[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-2933-g829b1ad

Volker Lendecke vlendec at samba.org
Sat Jun 21 09:11:26 GMT 2008


The branch, v3-3-test has been updated
       via  829b1ad4697f2f1ea008377d591456722dccd025 (commit)
       via  b39852f51313059899630ba63509fee904ba3613 (commit)
      from  20e0bb4800938863cb0aac1a19473748132043fc (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test


- Log -----------------------------------------------------------------
commit 829b1ad4697f2f1ea008377d591456722dccd025
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Jun 20 16:22:49 2008 +0200

    Make pipes_struct its own talloc ctx

commit b39852f51313059899630ba63509fee904ba3613
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Jun 20 16:22:32 2008 +0200

    Fix a SAFE_FREE/TALLOC_FREE mixup

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

Summary of changes:
 source/include/ntdomain.h         |    3 ---
 source/rpc_server/srv_netlog_nt.c |   29 ++++++++++-------------------
 source/rpc_server/srv_pipe.c      |    2 +-
 source/rpc_server/srv_pipe_hnd.c  |   27 ++++++---------------------
 4 files changed, 17 insertions(+), 44 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/include/ntdomain.h b/source/include/ntdomain.h
index dc63706..46842c8 100644
--- a/source/include/ntdomain.h
+++ b/source/include/ntdomain.h
@@ -225,9 +225,6 @@ typedef struct pipes_struct {
 	RPC_HDR hdr; /* Incoming RPC header. */
 	RPC_HDR_REQ hdr_req; /* Incoming request header. */
 
-	/* This context is used for pipe state storage and is freed when the pipe is closed. */
-	TALLOC_CTX *pipe_state_mem_ctx;
-
 	struct pipe_auth_data auth;
 
 	struct dcinfo *dc; /* Keeps the creds data from netlogon. */
diff --git a/source/rpc_server/srv_netlog_nt.c b/source/rpc_server/srv_netlog_nt.c
index 863c62a..a081228 100644
--- a/source/rpc_server/srv_netlog_nt.c
+++ b/source/rpc_server/srv_netlog_nt.c
@@ -377,7 +377,7 @@ NTSTATUS _netr_ServerReqChallenge(pipes_struct *p,
 				  struct netr_ServerReqChallenge *r)
 {
 	if (!p->dc) {
-		p->dc = TALLOC_ZERO_P(p->pipe_state_mem_ctx, struct dcinfo);
+		p->dc = TALLOC_ZERO_P(p, struct dcinfo);
 		if (!p->dc) {
 			return NT_STATUS_NO_MEMORY;
 		}
@@ -582,9 +582,8 @@ NTSTATUS _netr_ServerPasswordSet(pipes_struct *p,
 	if (!p->dc) {
 		/* Restore the saved state of the netlogon creds. */
 		become_root();
-		ret = secrets_restore_schannel_session_info(p->pipe_state_mem_ctx,
-							remote_machine,
-							&p->dc);
+		ret = secrets_restore_schannel_session_info(p, remote_machine,
+							    &p->dc);
 		unbecome_root();
 		if (!ret) {
 			return NT_STATUS_INVALID_HANDLE;
@@ -613,9 +612,7 @@ NTSTATUS _netr_ServerPasswordSet(pipes_struct *p,
 	}
 
 	become_root();
-	secrets_store_schannel_session_info(p->pipe_state_mem_ctx,
-						remote_machine,
-						p->dc);
+	secrets_store_schannel_session_info(p, remote_machine, p->dc);
 	ret = pdb_getsampwnam(sampass, p->dc->mach_acct);
 	unbecome_root();
 
@@ -716,9 +713,8 @@ NTSTATUS _netr_LogonSamLogoff(pipes_struct *p,
 		bool ret;
 
 		become_root();
-		ret = secrets_restore_schannel_session_info(p->pipe_state_mem_ctx,
-							    r->in.computer_name,
-							    &p->dc);
+		ret = secrets_restore_schannel_session_info(
+			p, r->in.computer_name, &p->dc);
 		unbecome_root();
 		if (!ret) {
 			return NT_STATUS_INVALID_HANDLE;
@@ -739,9 +735,7 @@ NTSTATUS _netr_LogonSamLogoff(pipes_struct *p,
 
 	/* We must store the creds state after an update. */
 	become_root();
-	secrets_store_schannel_session_info(p->pipe_state_mem_ctx,
-					    r->in.computer_name,
-					    p->dc);
+	secrets_store_schannel_session_info(p, r->in.computer_name, p->dc);
 	unbecome_root();
 
 	return NT_STATUS_OK;
@@ -814,9 +808,8 @@ NTSTATUS _netr_LogonSamLogon(pipes_struct *p,
 			bool ret;
 
 			become_root();
-			ret = secrets_restore_schannel_session_info(p->pipe_state_mem_ctx,
-					remote_machine,
-					&p->dc);
+			ret = secrets_restore_schannel_session_info(
+				p, remote_machine, &p->dc);
 			unbecome_root();
 			if (!ret) {
 				return NT_STATUS_INVALID_HANDLE;
@@ -837,9 +830,7 @@ NTSTATUS _netr_LogonSamLogon(pipes_struct *p,
 
 		/* We must store the creds state after an update. */
 		become_root();
-		secrets_store_schannel_session_info(p->pipe_state_mem_ctx,
-					remote_machine,
-					p->dc);
+		secrets_store_schannel_session_info(p, remote_machine, p->dc);
 		unbecome_root();
 	}
 
diff --git a/source/rpc_server/srv_pipe.c b/source/rpc_server/srv_pipe.c
index dcc4cd4..0987a42 100644
--- a/source/rpc_server/srv_pipe.c
+++ b/source/rpc_server/srv_pipe.c
@@ -1343,7 +1343,7 @@ static bool pipe_schannel_auth_bind(pipes_struct *p, prs_struct *rpc_in_p,
 		return False;
 	}
 
-	p->auth.a_u.schannel_auth = TALLOC_P(p->pipe_state_mem_ctx, struct schannel_auth_struct);
+	p->auth.a_u.schannel_auth = talloc(p, struct schannel_auth_struct);
 	if (!p->auth.a_u.schannel_auth) {
 		TALLOC_FREE(pdcinfo);
 		return False;
diff --git a/source/rpc_server/srv_pipe_hnd.c b/source/rpc_server/srv_pipe_hnd.c
index 1d62199..22903aa 100644
--- a/source/rpc_server/srv_pipe_hnd.c
+++ b/source/rpc_server/srv_pipe_hnd.c
@@ -221,7 +221,7 @@ smb_np_struct *open_rpc_pipe_p(const char *pipe_name,
 
 	if (p->np_state == NULL) {
 		DEBUG(0,("open_rpc_pipe_p: make_internal_rpc_pipe_p failed.\n"));
-		SAFE_FREE(p);
+		TALLOC_FREE(p);
 		return NULL;
 	}
 
@@ -279,33 +279,23 @@ static void *make_internal_rpc_pipe_p(const char *pipe_name,
 		return NULL;
 	}
 
-	p = SMB_MALLOC_P(pipes_struct);
+	p = TALLOC_ZERO_P(NULL, pipes_struct);
 
 	if (!p) {
 		DEBUG(0,("ERROR! no memory for pipes_struct!\n"));
 		return NULL;
 	}
 
-	ZERO_STRUCTP(p);
-
 	if ((p->mem_ctx = talloc_init("pipe %s %p", pipe_name, p)) == NULL) {
 		DEBUG(0,("open_rpc_pipe_p: talloc_init failed.\n"));
-		SAFE_FREE(p);
-		return NULL;
-	}
-
-	if ((p->pipe_state_mem_ctx = talloc_init("pipe_state %s %p", pipe_name, p)) == NULL) {
-		DEBUG(0,("open_rpc_pipe_p: talloc_init failed.\n"));
-		talloc_destroy(p->mem_ctx);
-		SAFE_FREE(p);
+		TALLOC_FREE(p);
 		return NULL;
 	}
 
 	if (!init_pipe_handle_list(p, pipe_name)) {
 		DEBUG(0,("open_rpc_pipe_p: init_pipe_handles failed.\n"));
 		talloc_destroy(p->mem_ctx);
-		talloc_destroy(p->pipe_state_mem_ctx);
-		SAFE_FREE(p);
+		TALLOC_FREE(p);
 		return NULL;
 	}
 
@@ -319,9 +309,8 @@ static void *make_internal_rpc_pipe_p(const char *pipe_name,
 	if(!prs_init(&p->in_data.data, RPC_MAX_PDU_FRAG_LEN, p->mem_ctx, MARSHALL)) {
 		DEBUG(0,("open_rpc_pipe_p: malloc fail for in_data struct.\n"));
 		talloc_destroy(p->mem_ctx);
-		talloc_destroy(p->pipe_state_mem_ctx);
 		close_policy_by_pipe(p);
-		SAFE_FREE(p);
+		TALLOC_FREE(p);
 		return NULL;
 	}
 
@@ -1214,10 +1203,6 @@ static bool close_internal_rpc_pipe_hnd(void *np_conn)
 		talloc_destroy(p->mem_ctx);
 	}
 
-	if (p->pipe_state_mem_ctx) {
-		talloc_destroy(p->pipe_state_mem_ctx);
-	}
-
 	free_pipe_rpc_context( p->contexts );
 
 	/* Free the handles database. */
@@ -1231,7 +1216,7 @@ static bool close_internal_rpc_pipe_hnd(void *np_conn)
 
 	ZERO_STRUCTP(p);
 
-	SAFE_FREE(p);
+	TALLOC_FREE(p);
 	
 	return True;
 }


-- 
Samba Shared Repository


More information about the samba-cvs mailing list