svn commit: samba r21769 - in branches: SAMBA_3_0/source/smbd SAMBA_3_0_25/source/smbd

jra at samba.org jra at samba.org
Fri Mar 9 02:16:05 GMT 2007


Author: jra
Date: 2007-03-09 02:16:03 +0000 (Fri, 09 Mar 2007)
New Revision: 21769

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

Log:
Attempt to fix bug #4384 in old search code.
We were accessing a pathname that hadn't gone
through unix_convert ! That's a big no-no...
Jeremy.

Modified:
   branches/SAMBA_3_0/source/smbd/reply.c
   branches/SAMBA_3_0_25/source/smbd/reply.c


Changeset:
Modified: branches/SAMBA_3_0/source/smbd/reply.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/reply.c	2007-03-08 23:54:57 UTC (rev 21768)
+++ branches/SAMBA_3_0/source/smbd/reply.c	2007-03-09 02:16:03 UTC (rev 21769)
@@ -967,16 +967,13 @@
 
 	if (status_len == 0) {
 		SMB_STRUCT_STAT sbuf;
-		pstring dir2;
 
 		pstrcpy(directory,path);
-		pstrcpy(dir2,path);
 		nt_status = unix_convert(conn, directory, True, NULL, &sbuf);
 		if (!NT_STATUS_IS_OK(nt_status)) {
 			END_PROFILE(SMBsearch);
 			return ERROR_NT(nt_status);
 		}
-		unix_format(dir2);
 
 		nt_status = check_name(conn, directory);
 		if (!NT_STATUS_IS_OK(nt_status)) {
@@ -984,23 +981,16 @@
 			return ERROR_NT(nt_status);
 		}
 
-		p = strrchr_m(dir2,'/');
-		if (p == NULL) {
-			pstrcpy(mask,dir2);
-			*dir2 = 0;
-		} else {
-			*p = 0;
-			pstrcpy(mask,p+1);
-		}
-
 		p = strrchr_m(directory,'/');
 		if (!p) {
-			*directory = 0;
+			pstrcpy(mask,directory);
+			pstrcpy(directory,".");
 		} else {
 			*p = 0;
+			pstrcpy(mask,p+1);
 		}
 
-		if (strlen(directory) == 0) {
+		if (*directory == '\0') {
 			pstrcpy(directory,".");
 		}
 		memset((char *)status,'\0',21);

Modified: branches/SAMBA_3_0_25/source/smbd/reply.c
===================================================================
--- branches/SAMBA_3_0_25/source/smbd/reply.c	2007-03-08 23:54:57 UTC (rev 21768)
+++ branches/SAMBA_3_0_25/source/smbd/reply.c	2007-03-09 02:16:03 UTC (rev 21769)
@@ -966,16 +966,13 @@
 
 	if (status_len == 0) {
 		SMB_STRUCT_STAT sbuf;
-		pstring dir2;
 
 		pstrcpy(directory,path);
-		pstrcpy(dir2,path);
 		nt_status = unix_convert(conn, directory, True, NULL, &sbuf);
 		if (!NT_STATUS_IS_OK(nt_status)) {
 			END_PROFILE(SMBsearch);
 			return ERROR_NT(nt_status);
 		}
-		unix_format(dir2);
 
 		nt_status = check_name(conn, directory);
 		if (!NT_STATUS_IS_OK(nt_status)) {
@@ -983,23 +980,16 @@
 			return ERROR_NT(nt_status);
 		}
 
-		p = strrchr_m(dir2,'/');
-		if (p == NULL) {
-			pstrcpy(mask,dir2);
-			*dir2 = 0;
-		} else {
-			*p = 0;
-			pstrcpy(mask,p+1);
-		}
-
 		p = strrchr_m(directory,'/');
 		if (!p) {
-			*directory = 0;
+			pstrcpy(mask,directory);
+			pstrcpy(directory,".");
 		} else {
 			*p = 0;
+			pstrcpy(mask,p+1);
 		}
 
-		if (strlen(directory) == 0) {
+		if (*directory == '\0') {
 			pstrcpy(directory,".");
 		}
 		memset((char *)status,'\0',21);



More information about the samba-cvs mailing list