summaryrefslogtreecommitdiff
path: root/source3/auth
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-04-11 12:20:24 +0200
committerVolker Lendecke <vl@samba.org>2010-04-11 13:53:19 +0200
commitc5c40f26482696aca9ee67d170e827f450d59a8b (patch)
tree7f63421a3f2520c75a7000cde8045c70a8b6cd4f /source3/auth
parente35a2f89b27b49f57d73c2461e0cecd2bbd46fa8 (diff)
downloadsamba-c5c40f26482696aca9ee67d170e827f450d59a8b.tar.gz
samba-c5c40f26482696aca9ee67d170e827f450d59a8b.tar.bz2
samba-c5c40f26482696aca9ee67d170e827f450d59a8b.zip
s3: Make "auth_context" its own talloc parent
Remove "mem_ctx" from "struct auth_context"
Diffstat (limited to 'source3/auth')
-rw-r--r--source3/auth/auth.c18
-rw-r--r--source3/auth/auth_ntlmssp.c2
-rw-r--r--source3/auth/auth_server.c2
-rw-r--r--source3/auth/auth_util.c2
4 files changed, 9 insertions, 15 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;