summaryrefslogtreecommitdiff
path: root/source3/auth
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2018-02-13 12:05:29 +0100
committerJeremy Allison <jra@samba.org>2018-02-20 21:55:13 +0100
commitb2aec11c76904bf6a8f67f0634cce5e443e77d8b (patch)
tree716e29e25f0f4ca24489103e8be8e03e27289166 /source3/auth
parent9abe97285b7e1de25bf1c1f4fde8fd481a31a6bb (diff)
downloadsamba-b2aec11c76904bf6a8f67f0634cce5e443e77d8b.tar.gz
s3:auth: Pass a mem_ctx to make_new_session_info_guest()
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/auth')
-rw-r--r--source3/auth/auth_util.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c
index f543b33eead..377d56d0488 100644
--- a/source3/auth/auth_util.c
+++ b/source3/auth/auth_util.c
@@ -798,8 +798,12 @@ static NTSTATUS get_guest_info3(TALLOC_CTX *mem_ctx,
left as-is for now.
***************************************************************************/
-static NTSTATUS make_new_session_info_guest(struct auth_session_info **session_info, struct auth_serversupplied_info **server_info)
+static NTSTATUS make_new_session_info_guest(TALLOC_CTX *mem_ctx,
+ struct auth_session_info **_session_info,
+ struct auth_serversupplied_info **_server_info)
{
+ struct auth_session_info *session_info = NULL;
+ struct auth_serversupplied_info *server_info = NULL;
const char *guest_account = lp_guest_account();
const char *domain = lp_netbios_name();
struct netr_SamInfo3 info3;
@@ -823,7 +827,7 @@ static NTSTATUS make_new_session_info_guest(struct auth_session_info **session_i
status = make_server_info_info3(tmp_ctx,
guest_account,
domain,
- server_info,
+ &server_info,
&info3);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("make_server_info_info3 failed with %s\n",
@@ -831,25 +835,26 @@ static NTSTATUS make_new_session_info_guest(struct auth_session_info **session_i
goto done;
}
- (*server_info)->guest = true;
+ server_info->guest = true;
/* This should not be done here (we should produce a server
* info, and later construct a session info from it), but for
* now this does not change the previous behavior */
- status = create_local_token(tmp_ctx, *server_info, NULL,
- (*server_info)->info3->base.account_name.string,
- session_info);
+ status = create_local_token(tmp_ctx, server_info, NULL,
+ server_info->info3->base.account_name.string,
+ &session_info);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("create_local_token failed: %s\n",
nt_errstr(status)));
goto done;
}
- talloc_steal(NULL, *session_info);
- talloc_steal(NULL, *server_info);
/* annoying, but the Guest really does have a session key, and it is
all zeros! */
- (*session_info)->session_key = data_blob_talloc_zero(NULL, 16);
+ session_info->session_key = data_blob_talloc_zero(session_info, 16);
+
+ *_session_info = talloc_move(mem_ctx, &session_info);
+ *_server_info = talloc_move(mem_ctx, &server_info);
status = NT_STATUS_OK;
done:
@@ -1136,7 +1141,7 @@ bool init_guest_info(void)
if (guest_info != NULL)
return true;
- return NT_STATUS_IS_OK(make_new_session_info_guest(&guest_info, &guest_server_info));
+ return NT_STATUS_IS_OK(make_new_session_info_guest(NULL, &guest_info, &guest_server_info));
}
NTSTATUS make_server_info_guest(TALLOC_CTX *mem_ctx,