svn commit: samba r12289 - in branches/SAMBA_3_0_RELEASE: . source/auth source/lib source/libsmb source/modules source/rpc_client source/smbd

jerry at samba.org jerry at samba.org
Fri Dec 16 15:00:34 GMT 2005


Author: jerry
Date: 2005-12-16 15:00:31 +0000 (Fri, 16 Dec 2005)
New Revision: 12289

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=12289

Log:
grabbing clilist memory leak fixed and unix_mask_match() fixes
Modified:
   branches/SAMBA_3_0_RELEASE/WHATSNEW.txt
   branches/SAMBA_3_0_RELEASE/source/auth/pampass.c
   branches/SAMBA_3_0_RELEASE/source/lib/util.c
   branches/SAMBA_3_0_RELEASE/source/libsmb/clilist.c
   branches/SAMBA_3_0_RELEASE/source/modules/vfs_recycle.c
   branches/SAMBA_3_0_RELEASE/source/rpc_client/cli_pipe.c
   branches/SAMBA_3_0_RELEASE/source/smbd/chgpasswd.c


Changeset:
Modified: branches/SAMBA_3_0_RELEASE/WHATSNEW.txt
===================================================================
--- branches/SAMBA_3_0_RELEASE/WHATSNEW.txt	2005-12-16 14:48:14 UTC (rev 12288)
+++ branches/SAMBA_3_0_RELEASE/WHATSNEW.txt	2005-12-16 15:00:31 UTC (rev 12289)
@@ -62,6 +62,8 @@
     * Correctly handle the LDAP_UNWILLING_TO_PERFORM error from 
       eDirectory when accessing the universal password.
     * Fix deadlock condition in share mode locking code.
+    * Fix logic bug in unix_mask_match().
+    * Fix memory leak in SMB client code found by Mikhail Kshevetskiy.
 
 
 o   Gerald (Jerry) Carter <jerry at samba.org>

Modified: branches/SAMBA_3_0_RELEASE/source/auth/pampass.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/auth/pampass.c	2005-12-16 14:48:14 UTC (rev 12288)
+++ branches/SAMBA_3_0_RELEASE/source/auth/pampass.c	2005-12-16 15:00:31 UTC (rev 12289)
@@ -310,7 +310,7 @@
 				DEBUG(10,("smb_pam_passchange_conv: PAM_PROMPT_ECHO_ON: trying to match |%s| to |%s|\n",
 						t->prompt, current_prompt ));
 
-				if (unix_wild_match(t->prompt, current_prompt) == 0) {
+				if (unix_wild_match(t->prompt, current_prompt)) {
 					fstrcpy(current_reply, t->reply);
 					DEBUG(10,("smb_pam_passchange_conv: PAM_PROMPT_ECHO_ON: We sent: %s\n", current_reply));
 					pwd_sub(current_reply, udp->PAM_username, udp->PAM_password, udp->PAM_newpassword);
@@ -341,7 +341,7 @@
 				DEBUG(10,("smb_pam_passchange_conv: PAM_PROMPT_ECHO_OFF: trying to match |%s| to |%s|\n",
 						t->prompt, current_prompt ));
 
-				if (unix_wild_match(t->prompt, current_prompt) == 0) {
+				if (unix_wild_match(t->prompt, current_prompt)) {
 					fstrcpy(current_reply, t->reply);
 					DEBUG(10,("smb_pam_passchange_conv: PAM_PROMPT_ECHO_OFF: We sent: %s\n", current_reply));
 					pwd_sub(current_reply, udp->PAM_username, udp->PAM_password, udp->PAM_newpassword);

Modified: branches/SAMBA_3_0_RELEASE/source/lib/util.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/lib/util.c	2005-12-16 14:48:14 UTC (rev 12288)
+++ branches/SAMBA_3_0_RELEASE/source/lib/util.c	2005-12-16 15:00:31 UTC (rev 12289)
@@ -2640,6 +2640,7 @@
 
 /*******************************************************************
  Simple case insensitive interface to a UNIX wildcard matcher.
+ Returns True if match, False if not.
 *******************************************************************/
 
 BOOL unix_wild_match(const char *pattern, const char *string)
@@ -2660,7 +2661,7 @@
 	if (strequal(p2,"*"))
 		return True;
 
-	return unix_do_match(p2, s2) == 0;	
+	return unix_do_match(p2, s2);
 }
 
 /**********************************************************************

Modified: branches/SAMBA_3_0_RELEASE/source/libsmb/clilist.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/libsmb/clilist.c	2005-12-16 14:48:14 UTC (rev 12288)
+++ branches/SAMBA_3_0_RELEASE/source/libsmb/clilist.c	2005-12-16 15:00:31 UTC (rev 12289)
@@ -271,6 +271,10 @@
 			   it gives ERRSRV/ERRerror temprarily */
 			uint8 eclass;
 			uint32 ecode;
+
+			SAFE_FREE(rdata);
+			SAFE_FREE(rparam);
+
 			cli_dos_error(cli, &eclass, &ecode);
 			if (eclass != ERRSRV || ecode != ERRerror)
 				break;
@@ -278,8 +282,11 @@
 			continue;
 		}
 
-                if (cli_is_error(cli) || !rdata || !rparam) 
+                if (cli_is_error(cli) || !rdata || !rparam) {
+			SAFE_FREE(rdata);
+			SAFE_FREE(rparam);
 			break;
+		}
 
 		if (total_received == -1)
 			total_received = 0;
@@ -297,8 +304,11 @@
 			ff_lastname = SVAL(p,6);
 		}
 
-		if (ff_searchcount == 0) 
+		if (ff_searchcount == 0) {
+			SAFE_FREE(rdata);
+			SAFE_FREE(rparam);
 			break;
+		}
 
 		/* point to the data bytes */
 		p = rdata;
@@ -332,6 +342,8 @@
 
 		if (!tdl) {
 			DEBUG(0,("cli_list_new: Failed to expand dirlist\n"));
+			SAFE_FREE(rdata);
+			SAFE_FREE(rparam);
 			break;
 		} else {
 			dirlist = tdl;

Modified: branches/SAMBA_3_0_RELEASE/source/modules/vfs_recycle.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/modules/vfs_recycle.c	2005-12-16 14:48:14 UTC (rev 12288)
+++ branches/SAMBA_3_0_RELEASE/source/modules/vfs_recycle.c	2005-12-16 15:00:31 UTC (rev 12289)
@@ -319,7 +319,7 @@
 	}
 
 	for(i=0; haystack_list[i] ; i++) {
-		if(!unix_wild_match(haystack_list[i], needle)) {
+		if(unix_wild_match(haystack_list[i], needle)) {
 			return True;
 		}
 	}

Modified: branches/SAMBA_3_0_RELEASE/source/rpc_client/cli_pipe.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/rpc_client/cli_pipe.c	2005-12-16 14:48:14 UTC (rev 12288)
+++ branches/SAMBA_3_0_RELEASE/source/rpc_client/cli_pipe.c	2005-12-16 15:00:31 UTC (rev 12289)
@@ -789,6 +789,8 @@
 			(unsigned int)cli->fnum,
 			cli_errstr(cli->cli)));
 		ret = cli_get_nt_error(cli->cli);
+		SAFE_FREE(rparam);
+		SAFE_FREE(prdata);
 		goto err;
 	}
 

Modified: branches/SAMBA_3_0_RELEASE/source/smbd/chgpasswd.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/smbd/chgpasswd.c	2005-12-16 14:48:14 UTC (rev 12288)
+++ branches/SAMBA_3_0_RELEASE/source/smbd/chgpasswd.c	2005-12-16 15:00:31 UTC (rev 12289)
@@ -263,7 +263,7 @@
 				pstrcpy( str, buffer);
 				trim_char( str, ' ', ' ');
 
-				if ((match = (unix_wild_match(expected, str) == 0))) {
+				if ((match = unix_wild_match(expected, str)) == True) {
 					/* Now data has started to return, lower timeout. */
 					timeout = lp_passwd_chat_timeout() * 100;
 				}



More information about the samba-cvs mailing list