From: Andreas Schneider Date: Tue, 13 Feb 2018 11:05:29 +0000 (+0100) Subject: s3:auth: Pass a mem_ctx to make_new_session_info_guest() X-Git-Tag: tevent-0.9.36~61 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b2aec11c76904bf6a8f67f0634cce5e443e77d8b;p=thirdparty%2Fsamba.git s3:auth: Pass a mem_ctx to make_new_session_info_guest() Signed-off-by: Andreas Schneider Reviewed-by: Jeremy Allison --- 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,