[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Mon Jul 19 00:41:35 MDT 2010


The branch, master has been updated
       via  c09dcb9... s3-auth: Use talloc hierarchies to properly free auth_ntlmssp_state contexts
       via  673fcfa... s3-auth: auth_make ntlmssp_state the parent context
       via  e60ed80... s3-auth: Simplify how we free the auth_context
       via  e4bd6eb... s3-auth: Cleanup and readability fixes
       via  cdcdaaa... s3-ntlmssp: Remove ntlmssp_end and let the talloc hierarchy handle it.
      from  27aece7... s3: Actually use the usecs in aio_fork_suspend

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit c09dcb903cdc1a68f71e892501a450df31367a54
Author: Simo Sorce <idra at samba.org>
Date:   Fri Jul 16 19:44:22 2010 -0400

    s3-auth: Use talloc hierarchies to properly free auth_ntlmssp_state contexts
    
    Turn auth_ntlmssp_end into a destructor and attach it to auth_ntlmssp_state.
    Remote auth_ntlmssp_end and use TALLOC_FREE in the callers.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>

commit 673fcfa3775ac6bdc467dde0bcf6670966cab50c
Author: Simo Sorce <idra at samba.org>
Date:   Sat Jul 17 10:22:04 2010 -0400

    s3-auth: auth_make ntlmssp_state the parent context
    
    There is no need for a separate mem_ctx member.
    Also make the ntlmssp_state a children of auth_ntlmssp_state
    Also cleanup auth_ntlmssp_end to free only what is not automatically freed
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>

commit e60ed80754f1f51c74bc338cc3a81d12f49d9687
Author: Simo Sorce <idra at samba.org>
Date:   Fri Jul 16 18:23:55 2010 -0400

    s3-auth: Simplify how we free the auth_context
    
    Turn the freeing function into a destructor and attach it to the
    auth_context.
    Make all callers TALLOC_FREE() the auth_context instead of calling
    the free function.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>

commit e4bd6eb72fba92c0b0a3e5e636e5312629758bc1
Author: Simo Sorce <idra at samba.org>
Date:   Fri Jul 16 17:47:21 2010 -0400

    s3-auth: Cleanup and readability fixes
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>

commit cdcdaaa6dd61475b8c0f37ce140a77271175cc9d
Author: Simo Sorce <idra at samba.org>
Date:   Fri Jul 16 17:30:14 2010 -0400

    s3-ntlmssp: Remove ntlmssp_end and let the talloc hierarchy handle it.
    
    All the members are children of ntlmssp_state anyway.
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source3/auth/auth.c                       |   34 ++++++++-------
 source3/auth/auth_compat.c                |    2 +-
 source3/auth/auth_ntlmssp.c               |   67 ++++++++++++----------------
 source3/include/auth.h                    |    1 -
 source3/include/proto.h                   |    2 -
 source3/libads/sasl.c                     |   14 +++---
 source3/libsmb/cliconnect.c               |    6 +-
 source3/libsmb/ntlmssp.c                  |   17 -------
 source3/libsmb/smb_seal.c                 |    2 +-
 source3/rpc_client/cli_pipe.c             |    2 +-
 source3/rpc_server/srv_netlog_nt.c        |    2 +-
 source3/rpc_server/srv_pipe.c             |    7 +---
 source3/smbd/negprot.c                    |    3 +-
 source3/smbd/password.c                   |    2 +-
 source3/smbd/seal.c                       |    2 +-
 source3/smbd/server_exit.c                |    3 +-
 source3/smbd/sesssetup.c                  |   11 ++---
 source3/smbd/smb2_sesssetup.c             |   18 ++++----
 source3/utils/ntlm_auth.c                 |   34 +++++++-------
 source3/winbindd/winbindd_ccache_access.c |    2 +-
 20 files changed, 98 insertions(+), 133 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/auth/auth.c b/source3/auth/auth.c
index a52dab9..5dc1d97 100644
--- a/source3/auth/auth.c
+++ b/source3/auth/auth.c
@@ -322,38 +322,40 @@ static NTSTATUS check_ntlm_password(const struct auth_context *auth_context,
  Clear out a auth_context, and destroy the attached TALLOC_CTX
 ***************************************************************************/
 
-static void free_auth_context(struct auth_context **auth_context)
+static int auth_context_destructor(void *ptr)
 {
-	auth_methods *auth_method;
+	struct auth_context *ctx = talloc_get_type(ptr, struct auth_context);
+	struct auth_methods *am;
 
-	if (*auth_context) {
-		/* Free private data of context's authentication methods */
-		for (auth_method = (*auth_context)->auth_method_list; auth_method; auth_method = auth_method->next) {
-			TALLOC_FREE(auth_method->private_data);
-		}
 
-		talloc_destroy(*auth_context);
-		*auth_context = NULL;
+	/* Free private data of context's authentication methods */
+	for (am = ctx->auth_method_list; am; am = am->next) {
+		TALLOC_FREE(am->private_data);
 	}
+
+	return 0;
 }
 
 /***************************************************************************
  Make a auth_info struct
 ***************************************************************************/
 
-static NTSTATUS make_auth_context(struct auth_context **auth_context) 
+static NTSTATUS make_auth_context(struct auth_context **auth_context)
 {
-	*auth_context = TALLOC_ZERO_P(talloc_autofree_context(),
-				      struct auth_context);
-	if (!*auth_context) {
+	struct auth_context *ctx;
+
+	ctx = talloc_zero(talloc_autofree_context(), struct auth_context);
+	if (!ctx) {
 		DEBUG(0,("make_auth_context: talloc failed!\n"));
 		return NT_STATUS_NO_MEMORY;
 	}
 
-	(*auth_context)->check_ntlm_password = check_ntlm_password;
-	(*auth_context)->get_ntlm_challenge = get_ntlm_challenge;
-	(*auth_context)->free = free_auth_context;
+	ctx->check_ntlm_password = check_ntlm_password;
+	ctx->get_ntlm_challenge = get_ntlm_challenge;
+
+	talloc_set_destructor((TALLOC_CTX *)ctx, auth_context_destructor);
 
+	*auth_context = ctx;
 	return NT_STATUS_OK;
 }
 
diff --git a/source3/auth/auth_compat.c b/source3/auth/auth_compat.c
index e90036f..cdd4096 100644
--- a/source3/auth/auth_compat.c
+++ b/source3/auth/auth_compat.c
@@ -59,7 +59,7 @@ NTSTATUS check_plaintext_password(const char *smb_name,
 	nt_status = plaintext_auth_context->check_ntlm_password(plaintext_auth_context, 
 								user_info, server_info); 
 
-	(plaintext_auth_context->free)(&plaintext_auth_context);
+	TALLOC_FREE(plaintext_auth_context);
 	free_user_info(&user_info);
 	return nt_status;
 }
diff --git a/source3/auth/auth_ntlmssp.c b/source3/auth/auth_ntlmssp.c
index ba7efbf..bebb86e 100644
--- a/source3/auth/auth_ntlmssp.c
+++ b/source3/auth/auth_ntlmssp.c
@@ -24,7 +24,6 @@
 #include "../libcli/auth/ntlmssp.h"
 
 struct auth_ntlmssp_state {
-	TALLOC_CTX *mem_ctx;
 	struct auth_context *auth_context;
 	struct auth_serversupplied_info *server_info;
 	struct ntlmssp_state *ntlmssp_state;
@@ -241,29 +240,33 @@ static NTSTATUS auth_ntlmssp_check_password(struct ntlmssp_state *ntlmssp_state,
 	if (auth_ntlmssp_state->server_info->user_session_key.length) {
 		DEBUG(10, ("Got NT session key of length %u\n",
 			(unsigned int)auth_ntlmssp_state->server_info->user_session_key.length));
-		*user_session_key = data_blob_talloc(auth_ntlmssp_state->mem_ctx, 
+		*user_session_key = data_blob_talloc(auth_ntlmssp_state,
 						   auth_ntlmssp_state->server_info->user_session_key.data,
 						   auth_ntlmssp_state->server_info->user_session_key.length);
 	}
 	if (auth_ntlmssp_state->server_info->lm_session_key.length) {
 		DEBUG(10, ("Got LM session key of length %u\n",
 			(unsigned int)auth_ntlmssp_state->server_info->lm_session_key.length));
-		*lm_session_key = data_blob_talloc(auth_ntlmssp_state->mem_ctx, 
+		*lm_session_key = data_blob_talloc(auth_ntlmssp_state,
 						   auth_ntlmssp_state->server_info->lm_session_key.data,
 						   auth_ntlmssp_state->server_info->lm_session_key.length);
 	}
 	return nt_status;
 }
 
+static int auth_ntlmssp_state_destructor(void *ptr);
+
 NTSTATUS auth_ntlmssp_start(struct auth_ntlmssp_state **auth_ntlmssp_state)
 {
 	NTSTATUS nt_status;
-	TALLOC_CTX *mem_ctx;
 	bool is_standalone;
 	const char *netbios_name;
 	const char *netbios_domain;
 	const char *dns_name;
 	char *dns_domain;
+	struct auth_ntlmssp_state *ans;
+	struct ntlmssp_state *ntlmssp_state;
+	struct auth_context *auth_context;
 
 	if ((enum server_types)lp_server_role() == ROLE_STANDALONE) {
 		is_standalone = true;
@@ -280,63 +283,51 @@ NTSTATUS auth_ntlmssp_start(struct auth_ntlmssp_state **auth_ntlmssp_state)
 	}
 	dns_name = get_mydnsfullname();
 
-	mem_ctx = talloc_init("AUTH NTLMSSP context");
-	
-	*auth_ntlmssp_state = TALLOC_ZERO_P(mem_ctx, struct auth_ntlmssp_state);
-	if (!*auth_ntlmssp_state) {
+	ans = talloc_zero(NULL, struct auth_ntlmssp_state);
+	if (!ans) {
 		DEBUG(0,("auth_ntlmssp_start: talloc failed!\n"));
-		talloc_destroy(mem_ctx);
+		TALLOC_FREE(ntlmssp_state);
 		return NT_STATUS_NO_MEMORY;
 	}
 
-	ZERO_STRUCTP(*auth_ntlmssp_state);
-
-	(*auth_ntlmssp_state)->mem_ctx = mem_ctx;
-
-	nt_status = ntlmssp_server_start(NULL,
+	nt_status = ntlmssp_server_start(ans,
 					 is_standalone,
 					 netbios_name,
 					 netbios_domain,
 					 dns_name,
 					 dns_domain,
-					 &(*auth_ntlmssp_state)->ntlmssp_state);
+					 &ans->ntlmssp_state);
 	if (!NT_STATUS_IS_OK(nt_status)) {
 		return nt_status;
 	}
 
-	if (!NT_STATUS_IS_OK(nt_status = make_auth_context_subsystem(&(*auth_ntlmssp_state)->auth_context))) {
+	nt_status = make_auth_context_subsystem(&auth_context);
+	if (!NT_STATUS_IS_OK(nt_status)) {
 		return nt_status;
 	}
+	ans->auth_context = talloc_steal(ans, auth_context);
 
-	(*auth_ntlmssp_state)->ntlmssp_state->callback_private = (*auth_ntlmssp_state);
-	(*auth_ntlmssp_state)->ntlmssp_state->get_challenge = auth_ntlmssp_get_challenge;
-	(*auth_ntlmssp_state)->ntlmssp_state->may_set_challenge = auth_ntlmssp_may_set_challenge;
-	(*auth_ntlmssp_state)->ntlmssp_state->set_challenge = auth_ntlmssp_set_challenge;
-	(*auth_ntlmssp_state)->ntlmssp_state->check_password = auth_ntlmssp_check_password;
+	ans->ntlmssp_state->callback_private = ans;
+	ans->ntlmssp_state->get_challenge = auth_ntlmssp_get_challenge;
+	ans->ntlmssp_state->may_set_challenge = auth_ntlmssp_may_set_challenge;
+	ans->ntlmssp_state->set_challenge = auth_ntlmssp_set_challenge;
+	ans->ntlmssp_state->check_password = auth_ntlmssp_check_password;
 
+	talloc_set_destructor((TALLOC_CTX *)ans, auth_ntlmssp_state_destructor);
+
+	*auth_ntlmssp_state = ans;
 	return NT_STATUS_OK;
 }
 
-void auth_ntlmssp_end(struct auth_ntlmssp_state **auth_ntlmssp_state)
+static int auth_ntlmssp_state_destructor(void *ptr)
 {
-	TALLOC_CTX *mem_ctx;
+	struct auth_ntlmssp_state *ans;
 
-	if (*auth_ntlmssp_state == NULL) {
-		return;
-	}
+	ans = talloc_get_type(ptr, struct auth_ntlmssp_state);
 
-	mem_ctx = (*auth_ntlmssp_state)->mem_ctx;
-	if ((*auth_ntlmssp_state)->ntlmssp_state) {
-		ntlmssp_end(&(*auth_ntlmssp_state)->ntlmssp_state);
-	}
-	if ((*auth_ntlmssp_state)->auth_context) {
-		((*auth_ntlmssp_state)->auth_context->free)(&(*auth_ntlmssp_state)->auth_context);
-	}
-	if ((*auth_ntlmssp_state)->server_info) {
-		TALLOC_FREE((*auth_ntlmssp_state)->server_info);
-	}
-	talloc_destroy(mem_ctx);
-	*auth_ntlmssp_state = NULL;
+	TALLOC_FREE(ans->server_info);
+	TALLOC_FREE(ans->ntlmssp_state);
+	return 0;
 }
 
 NTSTATUS auth_ntlmssp_update(struct auth_ntlmssp_state *auth_ntlmssp_state,
diff --git a/source3/include/auth.h b/source3/include/auth.h
index 17257b3..b7089b8 100644
--- a/source3/include/auth.h
+++ b/source3/include/auth.h
@@ -115,7 +115,6 @@ struct auth_context {
 					const struct auth_usersupplied_info *user_info, 
 					struct auth_serversupplied_info **server_info);
 	NTSTATUS (*nt_status_squash)(NTSTATUS nt_status);
-	void (*free)(struct auth_context **auth_context);
 };
 
 typedef struct auth_methods
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 9471f63..a5b98cd 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -66,7 +66,6 @@ bool auth_ntlmssp_negotiated_seal(struct auth_ntlmssp_state *auth_ntlmssp_state)
 void auth_ntlmssp_want_sign(struct auth_ntlmssp_state *auth_ntlmssp_state);
 void auth_ntlmssp_want_seal(struct auth_ntlmssp_state *auth_ntlmssp_state);
 NTSTATUS auth_ntlmssp_start(struct auth_ntlmssp_state **auth_ntlmssp_state);
-void auth_ntlmssp_end(struct auth_ntlmssp_state **auth_ntlmssp_state);
 NTSTATUS auth_ntlmssp_update(struct auth_ntlmssp_state *auth_ntlmssp_state,
 			     const DATA_BLOB request, DATA_BLOB *reply) ;
 NTSTATUS auth_ntlmssp_sign_packet(struct auth_ntlmssp_state *auth_ntlmssp_state,
@@ -3102,7 +3101,6 @@ void ntlmssp_want_feature_list(struct ntlmssp_state *ntlmssp_state, char *featur
 void ntlmssp_want_feature(struct ntlmssp_state *ntlmssp_state, uint32_t feature);
 NTSTATUS ntlmssp_update(struct ntlmssp_state *ntlmssp_state,
 			const DATA_BLOB in, DATA_BLOB *out) ;
-void ntlmssp_end(struct ntlmssp_state **ntlmssp_state);
 DATA_BLOB ntlmssp_weaken_keys(struct ntlmssp_state *ntlmssp_state, TALLOC_CTX *mem_ctx);
 NTSTATUS ntlmssp_server_start(TALLOC_CTX *mem_ctx,
 			      bool is_standalone,
diff --git a/source3/libads/sasl.c b/source3/libads/sasl.c
index 04b9a71..a37d1e8 100644
--- a/source3/libads/sasl.c
+++ b/source3/libads/sasl.c
@@ -106,7 +106,7 @@ static void ads_sasl_ntlmssp_disconnect(ADS_STRUCT *ads)
 	struct ntlmssp_state *ntlmssp_state =
 		(struct ntlmssp_state *)ads->ldap.wrap_private_data;
 
-	ntlmssp_end(&ntlmssp_state);
+	TALLOC_FREE(ntlmssp_state);
 
 	ads->ldap.wrap_ops = NULL;
 	ads->ldap.wrap_private_data = NULL;
@@ -209,7 +209,7 @@ static ADS_STATUS ads_sasl_spnego_ntlmssp_bind(ADS_STRUCT *ads)
 					ber_bvfree(scred);
 				}
 
-				ntlmssp_end(&ntlmssp_state);
+				TALLOC_FREE(ntlmssp_state);
 				return ADS_ERROR(rc);
 			}
 			if (scred) {
@@ -221,7 +221,7 @@ static ADS_STATUS ads_sasl_spnego_ntlmssp_bind(ADS_STRUCT *ads)
 
 		} else {
 
-			ntlmssp_end(&ntlmssp_state);
+			TALLOC_FREE(ntlmssp_state);
 			data_blob_free(&blob_out);
 			return ADS_ERROR_NT(nt_status);
 		}
@@ -233,7 +233,7 @@ static ADS_STATUS ads_sasl_spnego_ntlmssp_bind(ADS_STRUCT *ads)
 			if (!spnego_parse_challenge(blob, &blob_in, 
 						    &tmp_blob)) {
 
-				ntlmssp_end(&ntlmssp_state);
+				TALLOC_FREE(ntlmssp_state);
 				data_blob_free(&blob);
 				DEBUG(3,("Failed to parse challenges\n"));
 				return ADS_ERROR_NT(NT_STATUS_INVALID_PARAMETER);
@@ -243,7 +243,7 @@ static ADS_STATUS ads_sasl_spnego_ntlmssp_bind(ADS_STRUCT *ads)
 			if (!spnego_parse_auth_response(blob, nt_status, OID_NTLMSSP, 
 							&blob_in)) {
 
-				ntlmssp_end(&ntlmssp_state);
+				TALLOC_FREE(ntlmssp_state);
 				data_blob_free(&blob);
 				DEBUG(3,("Failed to parse auth response\n"));
 				return ADS_ERROR_NT(NT_STATUS_INVALID_PARAMETER);
@@ -266,11 +266,11 @@ static ADS_STATUS ads_sasl_spnego_ntlmssp_bind(ADS_STRUCT *ads)
 		if (!ADS_ERR_OK(status)) {
 			DEBUG(0, ("ads_setup_sasl_wrapping() failed: %s\n",
 				ads_errstr(status)));
-			ntlmssp_end(&ntlmssp_state);
+			TALLOC_FREE(ntlmssp_state);
 			return status;
 		}
 	} else {
-		ntlmssp_end(&ntlmssp_state);
+		TALLOC_FREE(ntlmssp_state);
 	}
 
 	return ADS_ERROR(rc);
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 06a6f7e..8d4c190 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -969,7 +969,7 @@ static int cli_session_setup_ntlmssp_state_destructor(
 	struct cli_session_setup_ntlmssp_state *state)
 {
 	if (state->ntlmssp_state != NULL) {
-		ntlmssp_end(&state->ntlmssp_state);
+		TALLOC_FREE(state->ntlmssp_state);
 	}
 	return 0;
 }
@@ -1079,7 +1079,7 @@ static void cli_session_setup_ntlmssp_done(struct tevent_req *subreq)
 			return;
 		}
 		TALLOC_FREE(subreq);
-		ntlmssp_end(&state->ntlmssp_state);
+		TALLOC_FREE(state->ntlmssp_state);
 		tevent_req_done(req);
 		return;
 	}
@@ -1122,7 +1122,7 @@ static void cli_session_setup_ntlmssp_done(struct tevent_req *subreq)
 	if (!NT_STATUS_IS_OK(status)
 	    && !NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
 		TALLOC_FREE(subreq);
-		ntlmssp_end(&state->ntlmssp_state);
+		TALLOC_FREE(state->ntlmssp_state);
 		tevent_req_nterror(req, status);
 		return;
 	}
diff --git a/source3/libsmb/ntlmssp.c b/source3/libsmb/ntlmssp.c
index 228d195..a0dc39b 100644
--- a/source3/libsmb/ntlmssp.c
+++ b/source3/libsmb/ntlmssp.c
@@ -275,23 +275,6 @@ NTSTATUS ntlmssp_update(struct ntlmssp_state *ntlmssp_state,
 }
 
 /**
- * End an NTLMSSP state machine
- *
- * @param ntlmssp_state NTLMSSP State, free()ed by this function
- */
-
-void ntlmssp_end(struct ntlmssp_state **ntlmssp_state)
-{
-	data_blob_free(&(*ntlmssp_state)->chal);
-	data_blob_free(&(*ntlmssp_state)->lm_resp);
-	data_blob_free(&(*ntlmssp_state)->nt_resp);
-	TALLOC_FREE(*ntlmssp_state);
-
-	*ntlmssp_state = NULL;
-	return;
-}
-
-/**
  * Determine correct target name flags for reply, given server role
  * and negotiated flags
  *
diff --git a/source3/libsmb/smb_seal.c b/source3/libsmb/smb_seal.c
index 92d7fef..4610850 100644
--- a/source3/libsmb/smb_seal.c
+++ b/source3/libsmb/smb_seal.c
@@ -371,7 +371,7 @@ void common_free_encryption_state(struct smb_trans_enc_state **pp_es)
 
 	if (es->smb_enc_type == SMB_TRANS_ENC_NTLM) {
 		if (es->s.ntlmssp_state) {
-			ntlmssp_end(&es->s.ntlmssp_state);
+			TALLOC_FREE(es->s.ntlmssp_state);
 		}
 	}
 #if defined(HAVE_GSSAPI) && defined(HAVE_KRB5)
diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index a61200a..8dd9386 100644
--- a/source3/rpc_client/cli_pipe.c
+++ b/source3/rpc_client/cli_pipe.c
@@ -2704,7 +2704,7 @@ NTSTATUS rpccli_anon_bind_data(TALLOC_CTX *mem_ctx,
 
 static int cli_auth_ntlmssp_data_destructor(struct cli_pipe_auth_data *auth)
 {
-	ntlmssp_end(&auth->a_u.ntlmssp_state);
+	TALLOC_FREE(auth->a_u.ntlmssp_state);
 	return 0;
 }
 
diff --git a/source3/rpc_server/srv_netlog_nt.c b/source3/rpc_server/srv_netlog_nt.c
index ebd3724..a57836a 100644
--- a/source3/rpc_server/srv_netlog_nt.c
+++ b/source3/rpc_server/srv_netlog_nt.c
@@ -1380,7 +1380,7 @@ static NTSTATUS _netr_LogonSamLogon_base(pipes_struct *p,
 			user_info, &server_info);
 	}
 
-	(auth_context->free)(&auth_context);
+	TALLOC_FREE(auth_context);
 	free_user_info(&user_info);
 
 	DEBUG(5,("%s: check_password returned status %s\n",
diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
index a7a5f4d..a56a634 100644
--- a/source3/rpc_server/srv_pipe.c
+++ b/source3/rpc_server/srv_pipe.c
@@ -85,12 +85,7 @@ static void dump_pdu_region(const char *name, int v,
 
 static void free_pipe_ntlmssp_auth_data(struct pipe_auth_data *auth)
 {
-	struct auth_ntlmssp_state *a = auth->a_u.auth_ntlmssp_state;
-
-	if (a) {
-		auth_ntlmssp_end(&a);
-	}
-	auth->a_u.auth_ntlmssp_state = NULL;
+	TALLOC_FREE(auth->a_u.auth_ntlmssp_state);
 }
 
 static DATA_BLOB generic_session_key(void)
diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c
index 755d3d9..4d73216 100644
--- a/source3/smbd/negprot.c
+++ b/source3/smbd/negprot.c
@@ -33,8 +33,7 @@ static void get_challenge(struct smbd_server_connection *sconn, uint8 buff[8])
 	if (sconn->smb1.negprot.auth_context) {
 		DEBUG(3, ("get challenge: is this a secondary negprot? "
 			  "sconn->negprot.auth_context is non-NULL!\n"));
-			sconn->smb1.negprot.auth_context->free(
-				&sconn->smb1.negprot.auth_context);
+			TALLOC_FREE(sconn->smb1.negprot.auth_context);
 	}
 
 	DEBUG(10, ("get challenge: creating negprot_global_auth_context\n"));
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index 2bd333a..996417b 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -120,7 +120,7 @@ void invalidate_vuid(struct smbd_server_connection *sconn, uint16 vuid)
 	session_yield(vuser);
 
 	if (vuser->auth_ntlmssp_state) {
-		auth_ntlmssp_end(&vuser->auth_ntlmssp_state);
+		TALLOC_FREE(vuser->auth_ntlmssp_state);
 	}
 
 	DLIST_REMOVE(sconn->smb1.sessions.validated_users, vuser);
diff --git a/source3/smbd/seal.c b/source3/smbd/seal.c
index 171e809..ad785a4 100644
--- a/source3/smbd/seal.c
+++ b/source3/smbd/seal.c
@@ -101,7 +101,7 @@ static void destroy_auth_ntlmssp(struct smb_srv_trans_enc_ctx *ec)
 	 */
 
 	if (ec->auth_ntlmssp_state) {
-		auth_ntlmssp_end(&ec->auth_ntlmssp_state);
+		TALLOC_FREE(ec->auth_ntlmssp_state);
 		/* The auth_ntlmssp_end killed this already. */
 		ec->es->s.ntlmssp_state = NULL;
 	}
diff --git a/source3/smbd/server_exit.c b/source3/smbd/server_exit.c
index 97394ae..1a33099 100644
--- a/source3/smbd/server_exit.c
+++ b/source3/smbd/server_exit.c
@@ -75,8 +75,7 @@ static void exit_server_common(enum server_exit_reason how,
 	change_to_root_user();
 
 	if (sconn && sconn->smb1.negprot.auth_context) {
-		struct auth_context *a = sconn->smb1.negprot.auth_context;
-		a->free(&sconn->smb1.negprot.auth_context);
+		TALLOC_FREE(sconn->smb1.negprot.auth_context);
 	}
 
 	if (lp_log_writeable_files_on_exit()) {
diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c
index 52fcd28..27eb4f6 100644
--- a/source3/smbd/sesssetup.c
+++ b/source3/smbd/sesssetup.c
@@ -150,14 +150,14 @@ static NTSTATUS check_guest_password(struct auth_serversupplied_info **server_in
 	}
 
 	if (!make_user_info_guest(&user_info)) {
-		(auth_context->free)(&auth_context);
+		TALLOC_FREE(auth_context);
 		return NT_STATUS_NO_MEMORY;
 	}
 
 	nt_status = auth_context->check_ntlm_password(auth_context,
 						user_info,
 						server_info);
-	(auth_context->free)(&auth_context);
+	TALLOC_FREE(auth_context);
 	free_user_info(&user_info);
 	return nt_status;
 }
@@ -708,7 +708,7 @@ static void reply_spnego_ntlmssp(struct smb_request *req,
 	if (!NT_STATUS_EQUAL(nt_status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
 		/* NB. This is *NOT* an error case. JRA */
 		if (do_invalidate) {
-			auth_ntlmssp_end(auth_ntlmssp_state);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list