*
* If 'unix charset' is not utf8, the password consist of random ascii
* values!
+ *
+ * The return value is a talloc string with destructor talloc_keep_secret() set.
+ * The content will be overwritten by zeros when the mem_ctx is destroyed.
*/
_PUBLIC_ char *generate_random_machine_password(TALLOC_CTX *mem_ctx, size_t min, size_t max)
frame = talloc_stackframe_pool(2048);
state = talloc_zero(frame, struct generate_random_machine_password_state);
+ talloc_keep_secret(state);
diff = max - min;
TALLOC_FREE(frame);
return NULL;
}
+ talloc_keep_secret(utf8_pw);
ok = convert_string_talloc(frame,
CH_UTF16MUNGED, CH_UNIX,
if (!ok) {
goto ascii_fallback;
}
+ talloc_keep_secret(unix_pw);
if (utf8_len != unix_len) {
goto ascii_fallback;
TALLOC_FREE(frame);
return NULL;
}
+ talloc_keep_secret(new_pw);
talloc_set_name_const(new_pw, __func__);
TALLOC_FREE(frame);
return new_pw;
TALLOC_FREE(frame);
return NULL;
}
+ talloc_keep_secret(new_pw);
talloc_set_name_const(new_pw, __func__);
TALLOC_FREE(frame);
return new_pw;