diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/auth/auth.c | 18 | ||||
-rw-r--r-- | source3/auth/auth_ntlmssp.c | 2 | ||||
-rw-r--r-- | source3/auth/auth_server.c | 2 | ||||
-rw-r--r-- | source3/auth/auth_util.c | 2 | ||||
-rw-r--r-- | source3/include/auth.h | 1 |
5 files changed, 9 insertions, 16 deletions
diff --git a/source3/auth/auth.c b/source3/auth/auth.c index ce8722a1b4..317fe307d4 100644 --- a/source3/auth/auth.c +++ b/source3/auth/auth.c @@ -106,7 +106,7 @@ static void get_ntlm_challenge(struct auth_context *auth_context, } challenge = auth_method->get_chal(auth_context, &auth_method->private_data, - auth_context->mem_ctx); + auth_context); if (!challenge.length) { DEBUG(3, ("auth_get_challenge: getting challenge from authentication method %s FAILED.\n", auth_method->name)); @@ -122,7 +122,7 @@ static void get_ntlm_challenge(struct auth_context *auth_context, uchar tmp[8]; generate_random_buffer(tmp, sizeof(tmp)); - auth_context->challenge = data_blob_talloc(auth_context->mem_ctx, + auth_context->challenge = data_blob_talloc(auth_context, tmp, sizeof(tmp)); challenge_set_by = "random"; @@ -331,7 +331,7 @@ static void free_auth_context(struct auth_context **auth_context) TALLOC_FREE(auth_method->private_data); } - talloc_destroy((*auth_context)->mem_ctx); + talloc_destroy(*auth_context); *auth_context = NULL; } } @@ -342,19 +342,13 @@ static void free_auth_context(struct auth_context **auth_context) static NTSTATUS make_auth_context(struct auth_context **auth_context) { - TALLOC_CTX *mem_ctx; - - mem_ctx = talloc_init("authentication context"); - - *auth_context = TALLOC_P(mem_ctx, struct auth_context); + *auth_context = TALLOC_ZERO_P(talloc_autofree_context(), + struct auth_context); if (!*auth_context) { DEBUG(0,("make_auth_context: talloc failed!\n")); - talloc_destroy(mem_ctx); return NT_STATUS_NO_MEMORY; } - ZERO_STRUCTP(*auth_context); - (*auth_context)->mem_ctx = mem_ctx; (*auth_context)->check_ntlm_password = check_ntlm_password; (*auth_context)->get_ntlm_challenge = get_ntlm_challenge; (*auth_context)->free = free_auth_context; @@ -538,7 +532,7 @@ NTSTATUS make_auth_context_fixed(struct auth_context **auth_context, uchar chal[ return nt_status; } - (*auth_context)->challenge = data_blob_talloc((*auth_context)->mem_ctx, chal, 8); + (*auth_context)->challenge = data_blob_talloc(*auth_context, chal, 8); (*auth_context)->challenge_set_by = "fixed"; return nt_status; } diff --git a/source3/auth/auth_ntlmssp.c b/source3/auth/auth_ntlmssp.c index a62d429008..762411702f 100644 --- a/source3/auth/auth_ntlmssp.c +++ b/source3/auth/auth_ntlmssp.c @@ -64,7 +64,7 @@ static NTSTATUS auth_ntlmssp_set_challenge(struct ntlmssp_state *ntlmssp_state, SMB_ASSERT(challenge->length == 8); - auth_context->challenge = data_blob_talloc(auth_context->mem_ctx, + auth_context->challenge = data_blob_talloc(auth_context, challenge->data, challenge->length); auth_context->challenge_set_by = "NTLMSSP callback (NTLM2)"; diff --git a/source3/auth/auth_server.c b/source3/auth/auth_server.c index 0109f625ed..f0f0267bdb 100644 --- a/source3/auth/auth_server.c +++ b/source3/auth/auth_server.c @@ -255,7 +255,7 @@ static DATA_BLOB auth_get_challenge_server(const struct auth_context *auth_conte /* The return must be allocated on the caller's mem_ctx, as our own will be destoyed just after the call. */ - return data_blob_talloc(auth_context->mem_ctx, cli->secblob.data,8); + return data_blob_talloc((TALLOC_CTX *)auth_context, cli->secblob.data,8); } else { return data_blob_null; } diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c index f149b19c0e..ab2ffc259e 100644 --- a/source3/auth/auth_util.c +++ b/source3/auth/auth_util.c @@ -2144,7 +2144,7 @@ bool make_auth_methods(struct auth_context *auth_context, auth_methods **auth_me "is NULL!\n"); } - *auth_method = TALLOC_P(auth_context->mem_ctx, auth_methods); + *auth_method = TALLOC_P(auth_context, auth_methods); if (!*auth_method) { DEBUG(0,("make_auth_method: malloc failed!\n")); return False; diff --git a/source3/include/auth.h b/source3/include/auth.h index 115143fb73..efae56ae52 100644 --- a/source3/include/auth.h +++ b/source3/include/auth.h @@ -91,7 +91,6 @@ struct auth_context { /* What order are the various methods in? Try to stop it changing under us */ struct auth_methods *auth_method_list; - TALLOC_CTX *mem_ctx; void (*get_ntlm_challenge)(struct auth_context *auth_context, uint8_t chal[8]); NTSTATUS (*check_ntlm_password)(const struct auth_context *auth_context, |