From: Volker Lendecke Date: Fri, 3 Jan 2020 11:51:04 +0000 (+0100) Subject: auth3: Simplify auth_get_ntlm_challenge() X-Git-Tag: ldb-2.1.0~128 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bcf944445837e7cdd611dc89fe931575fa771017;p=thirdparty%2Fsamba.git auth3: Simplify auth_get_ntlm_challenge() Use generate_random_buffer() directly on the talloc'ed buffer Signed-off-by: Volker Lendecke Reviewed-by: Gary Lockyer --- diff --git a/source3/auth/auth.c b/source3/auth/auth.c index ccda7118c7d..b4192d97412 100644 --- a/source3/auth/auth.c +++ b/source3/auth/auth.c @@ -84,9 +84,6 @@ static struct auth_init_function_entry *auth_find_backend_entry(const char *name NTSTATUS auth_get_ntlm_challenge(struct auth_context *auth_context, uint8_t chal[8]) { - uchar tmp[8]; - - if (auth_context->challenge.length) { DEBUG(5, ("get_ntlm_challenge (auth subsystem): returning previous challenge by module %s (normal)\n", auth_context->challenge_set_by)); @@ -94,13 +91,13 @@ NTSTATUS auth_get_ntlm_challenge(struct auth_context *auth_context, return NT_STATUS_OK; } - generate_random_buffer(tmp, sizeof(tmp)); - auth_context->challenge = data_blob_talloc(auth_context, - tmp, sizeof(tmp)); + auth_context->challenge = data_blob_talloc(auth_context, NULL, 8); if (auth_context->challenge.data == NULL) { DBG_WARNING("data_blob_talloc failed\n"); return NT_STATUS_NO_MEMORY; } + generate_random_buffer( + auth_context->challenge.data, auth_context->challenge.length); auth_context->challenge_set_by = "random";