summaryrefslogtreecommitdiff
path: root/source3/auth
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2017-02-11 11:26:09 +0100
committerJeremy Allison <jra@samba.org>2017-03-08 22:01:15 +0100
commitb19868ce6ab823e447a6195d29291b9205422e67 (patch)
treeab5cf1ca29568c79131b69ea072b43d733b78796 /source3/auth
parentd31bf0e29d7982c24dadea1c9fb481ef26db72dd (diff)
downloadsamba-b19868ce6ab823e447a6195d29291b9205422e67.tar.gz
auth3: Simplify auth_check_ntlm_password talloc handling
Use talloc_stackframe and talloc_tos. Don't bother to talloc_free within the loop, we don't have many iterations. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/auth')
-rw-r--r--source3/auth/auth.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/source3/auth/auth.c b/source3/auth/auth.c
index c5392a5889e..2f84c70b56e 100644
--- a/source3/auth/auth.c
+++ b/source3/auth/auth.c
@@ -165,6 +165,7 @@ NTSTATUS auth_check_ntlm_password(TALLOC_CTX *mem_ctx,
const struct auth_usersupplied_info *user_info,
struct auth_serversupplied_info **pserver_info)
{
+ TALLOC_CTX *frame;
/* if all the modules say 'not for me' this is reasonable */
NTSTATUS nt_status = NT_STATUS_NO_SUCH_USER;
const char *unix_username;
@@ -174,6 +175,8 @@ NTSTATUS auth_check_ntlm_password(TALLOC_CTX *mem_ctx,
return NT_STATUS_LOGON_FAILURE;
}
+ frame = talloc_stackframe();
+
DEBUG(3, ("check_ntlm_password: Checking password for unmapped user [%s]\\[%s]@[%s] with the new password interface\n",
user_info->client.domain_name, user_info->client.account_name, user_info->workstation_name));
@@ -211,7 +214,6 @@ NTSTATUS auth_check_ntlm_password(TALLOC_CTX *mem_ctx,
for (auth_method = auth_context->auth_method_list;auth_method; auth_method = auth_method->next) {
struct auth_serversupplied_info *server_info;
- TALLOC_CTX *tmp_ctx;
NTSTATUS result;
if (user_info->flags & USER_INFO_LOCAL_SAM_ONLY
@@ -219,23 +221,15 @@ NTSTATUS auth_check_ntlm_password(TALLOC_CTX *mem_ctx,
continue;
}
- tmp_ctx = talloc_named(mem_ctx,
- 0,
- "%s authentication for user %s\\%s",
- auth_method->name,
- user_info->mapped.domain_name,
- user_info->client.account_name);
-
result = auth_method->auth(auth_context,
auth_method->private_data,
- tmp_ctx,
+ talloc_tos(),
user_info,
&server_info);
/* check if the module did anything */
if (NT_STATUS_EQUAL(result, NT_STATUS_NOT_IMPLEMENTED)) {
DEBUG(10,("check_ntlm_password: %s had nothing to say\n", auth_method->name));
- TALLOC_FREE(tmp_ctx);
if (user_info->flags & USER_INFO_LOCAL_SAM_ONLY) {
/* we don't expose the NT_STATUS_NOT_IMPLEMENTED
* internals, except when the caller is only probing
@@ -258,11 +252,8 @@ NTSTATUS auth_check_ntlm_password(TALLOC_CTX *mem_ctx,
if (NT_STATUS_IS_OK(nt_status)) {
*pserver_info = talloc_move(mem_ctx, &server_info);
- TALLOC_FREE(tmp_ctx);
break;
}
-
- TALLOC_FREE(tmp_ctx);
}
/* successful authentication */
@@ -310,6 +301,7 @@ NTSTATUS auth_check_ntlm_password(TALLOC_CTX *mem_ctx,
unix_username));
}
+ TALLOC_FREE(frame);
return nt_status;
}
@@ -322,6 +314,8 @@ fail:
nt_errstr(nt_status)));
ZERO_STRUCTP(pserver_info);
+ TALLOC_FREE(frame);
+
return nt_status;
}