From 242e3296108f513b286787ac12ea768b9c4ed954 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 25 Sep 2010 15:31:29 -0700 Subject: [PATCH] s3: Lift talloc_autofree_context() from make_auth_context_subsystem() --- source3/auth/auth.c | 10 ++++++---- source3/auth/auth_compat.c | 5 ++++- source3/auth/auth_ntlmssp.c | 2 +- source3/include/proto.h | 3 ++- source3/rpc_server/srv_netlog_nt.c | 4 +++- source3/smbd/negprot.c | 2 +- source3/smbd/sesssetup.c | 2 +- 7 files changed, 18 insertions(+), 10 deletions(-) diff --git a/source3/auth/auth.c b/source3/auth/auth.c index 8a3e3497be1..4eb0845ba01 100644 --- a/source3/auth/auth.c +++ b/source3/auth/auth.c @@ -455,7 +455,8 @@ static NTSTATUS make_auth_context_text_list(TALLOC_CTX *mem_ctx, Make a auth_context struct for the auth subsystem ***************************************************************************/ -NTSTATUS make_auth_context_subsystem(struct auth_context **auth_context) +NTSTATUS make_auth_context_subsystem(TALLOC_CTX *mem_ctx, + struct auth_context **auth_context) { char **auth_method_list = NULL; NTSTATUS nt_status; @@ -526,8 +527,7 @@ NTSTATUS make_auth_context_subsystem(struct auth_context **auth_context) DEBUG(5,("Using specified auth order\n")); } - nt_status = make_auth_context_text_list(talloc_autofree_context(), - auth_context, + nt_status = make_auth_context_text_list(mem_ctx, auth_context, auth_method_list); TALLOC_FREE(auth_method_list); @@ -541,7 +541,9 @@ NTSTATUS make_auth_context_subsystem(struct auth_context **auth_context) NTSTATUS make_auth_context_fixed(struct auth_context **auth_context, uchar chal[8]) { NTSTATUS nt_status; - if (!NT_STATUS_IS_OK(nt_status = make_auth_context_subsystem(auth_context))) { + nt_status = make_auth_context_subsystem(talloc_autofree_context(), + auth_context); + if (!NT_STATUS_IS_OK(nt_status)) { return nt_status; } diff --git a/source3/auth/auth_compat.c b/source3/auth/auth_compat.c index bd4c433ab99..ffad36e9f2e 100644 --- a/source3/auth/auth_compat.c +++ b/source3/auth/auth_compat.c @@ -42,7 +42,10 @@ NTSTATUS check_plaintext_password(const char *smb_name, struct auth_usersupplied_info *user_info = NULL; uint8_t chal[8]; NTSTATUS nt_status; - if (!NT_STATUS_IS_OK(nt_status = make_auth_context_subsystem(&plaintext_auth_context))) { + + nt_status = make_auth_context_subsystem(talloc_tos(), + &plaintext_auth_context); + if (!NT_STATUS_IS_OK(nt_status)) { return nt_status; } diff --git a/source3/auth/auth_ntlmssp.c b/source3/auth/auth_ntlmssp.c index af3a6f38278..3905914884c 100644 --- a/source3/auth/auth_ntlmssp.c +++ b/source3/auth/auth_ntlmssp.c @@ -229,7 +229,7 @@ NTSTATUS auth_ntlmssp_start(struct auth_ntlmssp_state **auth_ntlmssp_state) return nt_status; } - nt_status = make_auth_context_subsystem(&auth_context); + nt_status = make_auth_context_subsystem(talloc_tos(), &auth_context); if (!NT_STATUS_IS_OK(nt_status)) { return nt_status; } diff --git a/source3/include/proto.h b/source3/include/proto.h index 849a0622306..38ee2818ad7 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -29,7 +29,8 @@ NTSTATUS smb_register_auth(int version, const char *name, auth_init_function init); bool load_auth_module(struct auth_context *auth_context, const char *module, auth_methods **ret) ; -NTSTATUS make_auth_context_subsystem(struct auth_context **auth_context) ; +NTSTATUS make_auth_context_subsystem(TALLOC_CTX *mem_ctx, + struct auth_context **auth_context); NTSTATUS make_auth_context_fixed(struct auth_context **auth_context, uchar chal[8]) ; /* The following definitions come from auth/auth_builtin.c */ diff --git a/source3/rpc_server/srv_netlog_nt.c b/source3/rpc_server/srv_netlog_nt.c index d821b04cdc5..963737f8970 100644 --- a/source3/rpc_server/srv_netlog_nt.c +++ b/source3/rpc_server/srv_netlog_nt.c @@ -1360,7 +1360,9 @@ static NTSTATUS _netr_LogonSamLogon_base(struct pipes_struct *p, { uint8_t chal[8]; - if (!NT_STATUS_IS_OK(status = make_auth_context_subsystem(&auth_context))) { + status = make_auth_context_subsystem(talloc_tos(), + &auth_context); + if (!NT_STATUS_IS_OK(status)) { return status; } diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c index 463e1c80836..51f2d0c1deb 100644 --- a/source3/smbd/negprot.c +++ b/source3/smbd/negprot.c @@ -38,7 +38,7 @@ static void get_challenge(struct smbd_server_connection *sconn, uint8 buff[8]) DEBUG(10, ("get challenge: creating negprot_global_auth_context\n")); nt_status = make_auth_context_subsystem( - &sconn->smb1.negprot.auth_context); + sconn, &sconn->smb1.negprot.auth_context); if (!NT_STATUS_IS_OK(nt_status)) { DEBUG(0, ("make_auth_context_subsystem returned %s", nt_errstr(nt_status))); diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c index b227d2bc9e4..68b91b7f1b2 100644 --- a/source3/smbd/sesssetup.c +++ b/source3/smbd/sesssetup.c @@ -1589,7 +1589,7 @@ void reply_sesssetup_and_X(struct smb_request *req) struct auth_context *plaintext_auth_context = NULL; nt_status = make_auth_context_subsystem( - &plaintext_auth_context); + talloc_tos(), &plaintext_auth_context); if (NT_STATUS_IS_OK(nt_status)) { uint8_t chal[8]; -- 2.34.1