svn commit: samba r2654 - in branches/SAMBA_4_0/source: auth libcli libcli/raw ntvfs/posix smbd

tridge at samba.org tridge at samba.org
Sun Sep 26 06:44:11 GMT 2004


Author: tridge
Date: 2004-09-26 06:44:08 +0000 (Sun, 26 Sep 2004)
New Revision: 2654

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source&rev=2654&nolog=1

Log:
fixed some more server memory leaks. We are now down to a single leak
of 16 bytes, caused by the 16 byte data_blob in the smb_signing
code.

Modified:
   branches/SAMBA_4_0/source/auth/auth_sam.c
   branches/SAMBA_4_0/source/libcli/cliconnect.c
   branches/SAMBA_4_0/source/libcli/raw/clisession.c
   branches/SAMBA_4_0/source/libcli/raw/clisocket.c
   branches/SAMBA_4_0/source/libcli/raw/clitransport.c
   branches/SAMBA_4_0/source/libcli/raw/clitree.c
   branches/SAMBA_4_0/source/libcli/raw/rawrequest.c
   branches/SAMBA_4_0/source/ntvfs/posix/vfs_posix.c
   branches/SAMBA_4_0/source/smbd/process_standard.c


Changeset:
Modified: branches/SAMBA_4_0/source/auth/auth_sam.c
===================================================================
--- branches/SAMBA_4_0/source/auth/auth_sam.c	2004-09-26 06:41:59 UTC (rev 2653)
+++ branches/SAMBA_4_0/source/auth/auth_sam.c	2004-09-26 06:44:08 UTC (rev 2654)
@@ -39,6 +39,8 @@
 				DATA_BLOB *user_sess_key, 
 				DATA_BLOB *lm_sess_key)
 {
+	NTSTATUS status;
+
 	if (acct_flags & ACB_PWNOTREQ) {
 		if (lp_null_passwords()) {
 			DEBUG(3,("Account for user '%s' has no password and null passwords are allowed.\n", 
@@ -51,7 +53,7 @@
 		}		
 	}
 
-	return ntlm_password_check(mem_ctx, &auth_context->challenge, 
+	status = ntlm_password_check(mem_ctx, &auth_context->challenge, 
 				   &user_info->lm_resp, &user_info->nt_resp, 
 				   &user_info->lm_interactive_password, 
 				   &user_info->nt_interactive_password,
@@ -59,6 +61,17 @@
 				   user_info->smb_name.str, 
 				   user_info->client_domain.str, 
 				   lm_pwd->hash, nt_pwd->hash, user_sess_key, lm_sess_key);
+
+	if (NT_STATUS_IS_OK(status)) {
+		if (user_sess_key && user_sess_key->data) {
+			talloc_steal(auth_context, user_sess_key->data);
+		}
+		if (lm_sess_key && lm_sess_key->data) {
+			talloc_steal(auth_context, lm_sess_key->data);
+		}
+	}
+
+	return status;
 }
 
 
@@ -330,8 +343,7 @@
 		}
 		
 		if (group_ret > 0 && 
-		    !(groupSIDs = talloc_realloc_p(groupSIDs, 
-						   struct dom_sid *, group_ret))) {
+		    !(groupSIDs = talloc_array_p(*server_info, struct dom_sid *, group_ret))) {
 			talloc_free(*server_info);
 			return NT_STATUS_NO_MEMORY;
 		}

Modified: branches/SAMBA_4_0/source/libcli/cliconnect.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/cliconnect.c	2004-09-26 06:41:59 UTC (rev 2653)
+++ branches/SAMBA_4_0/source/libcli/cliconnect.c	2004-09-26 06:44:08 UTC (rev 2654)
@@ -211,7 +211,7 @@
 {
 	struct smbcli_state *cli;
 
-	cli = talloc_named(NULL, sizeof(*cli), "smbcli_state");
+	cli = talloc_p(NULL, struct smbcli_state);
 	if (cli) {
 		ZERO_STRUCTP(cli);
 	}

Modified: branches/SAMBA_4_0/source/libcli/raw/clisession.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/raw/clisession.c	2004-09-26 06:41:59 UTC (rev 2653)
+++ branches/SAMBA_4_0/source/libcli/raw/clisession.c	2004-09-26 06:44:08 UTC (rev 2654)
@@ -33,7 +33,7 @@
 {
 	struct smbcli_session *session;
 
-	session = talloc_named(NULL, sizeof(*session), "smbcli_session");
+	session = talloc_p(transport, struct smbcli_session);
 	if (!session) {
 		return NULL;
 	}

Modified: branches/SAMBA_4_0/source/libcli/raw/clisocket.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/raw/clisocket.c	2004-09-26 06:41:59 UTC (rev 2653)
+++ branches/SAMBA_4_0/source/libcli/raw/clisocket.c	2004-09-26 06:44:08 UTC (rev 2654)
@@ -29,7 +29,7 @@
 {
 	struct smbcli_socket *sock;
 
-	sock = talloc_named(NULL, sizeof(*sock), "smbcli_socket");
+	sock = talloc_p(NULL, struct smbcli_socket);
 	if (!sock) {
 		return NULL;
 	}

Modified: branches/SAMBA_4_0/source/libcli/raw/clitransport.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/raw/clitransport.c	2004-09-26 06:41:59 UTC (rev 2653)
+++ branches/SAMBA_4_0/source/libcli/raw/clitransport.c	2004-09-26 06:44:08 UTC (rev 2654)
@@ -49,7 +49,7 @@
 	struct smbcli_transport *transport;
 	struct fd_event fde;
 
-	transport = talloc_named(NULL, sizeof(*transport), "smbcli_transport");
+	transport = talloc_p(sock, struct smbcli_transport);
 	if (!transport) return NULL;
 
 	ZERO_STRUCTP(transport);

Modified: branches/SAMBA_4_0/source/libcli/raw/clitree.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/raw/clitree.c	2004-09-26 06:41:59 UTC (rev 2653)
+++ branches/SAMBA_4_0/source/libcli/raw/clitree.c	2004-09-26 06:44:08 UTC (rev 2654)
@@ -34,7 +34,7 @@
 {
 	struct smbcli_tree *tree;
 
-	tree = talloc_named(NULL, sizeof(*tree), "smbcli_tree");
+	tree = talloc_p(session, struct smbcli_tree);
 	if (!tree) {
 		return NULL;
 	}

Modified: branches/SAMBA_4_0/source/libcli/raw/rawrequest.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/raw/rawrequest.c	2004-09-26 06:41:59 UTC (rev 2653)
+++ branches/SAMBA_4_0/source/libcli/raw/rawrequest.c	2004-09-26 06:44:08 UTC (rev 2654)
@@ -62,7 +62,7 @@
 {
 	struct smbcli_request *req;
 
-	req = talloc_named(NULL, sizeof(struct smbcli_request), "smcli_request");
+	req = talloc_p(transport, struct smbcli_request);
 	if (!req) {
 		return NULL;
 	}

Modified: branches/SAMBA_4_0/source/ntvfs/posix/vfs_posix.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/vfs_posix.c	2004-09-26 06:41:59 UTC (rev 2653)
+++ branches/SAMBA_4_0/source/ntvfs/posix/vfs_posix.c	2004-09-26 06:44:08 UTC (rev 2654)
@@ -59,7 +59,7 @@
 
 	DEBUG(0,("WARNING: the posix vfs handler is incomplete - you probably want \"ntvfs handler = simple\"\n"));
 
-	pvfs = talloc_named(tcon, sizeof(struct pvfs_state), "pvfs_connect(%s)", sharename);
+	pvfs = talloc_p(tcon, struct pvfs_state);
 	if (pvfs == NULL) {
 		return NT_STATUS_NO_MEMORY;
 	}

Modified: branches/SAMBA_4_0/source/smbd/process_standard.c
===================================================================
--- branches/SAMBA_4_0/source/smbd/process_standard.c	2004-09-26 06:41:59 UTC (rev 2653)
+++ branches/SAMBA_4_0/source/smbd/process_standard.c	2004-09-26 06:44:08 UTC (rev 2654)
@@ -97,6 +97,10 @@
 		talloc_free(conn->service->srv_ctx);
 	}
 
+	/* this init_iconv() has the effect of freeing the iconv context memory,
+	   which makes leak checking easier */
+	init_iconv();
+
 	/* terminate this process */
 	exit(0);
 }



More information about the samba-cvs mailing list