]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
auth3: Simplify auth_get_ntlm_challenge()
authorVolker Lendecke <vl@samba.org>
Fri, 3 Jan 2020 11:51:04 +0000 (12:51 +0100)
committerGary Lockyer <gary@samba.org>
Mon, 6 Jan 2020 01:47:30 +0000 (01:47 +0000)
Use generate_random_buffer() directly on the talloc'ed buffer

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
source3/auth/auth.c

index ccda7118c7d269f8e481a70eb179693fe2a816b7..b4192d974122f9bdc63bf022e13c466e0539998e 100644 (file)
@@ -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";