svn commit: samba r6043 - in trunk/source: lib smbd

jra at samba.org jra at samba.org
Thu Mar 24 19:32:53 GMT 2005


Author: jra
Date: 2005-03-24 19:32:53 +0000 (Thu, 24 Mar 2005)
New Revision: 6043

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

Log:
Ensure the old search calls always ask mask_match to translate
patterns like ????????.??? - even if using an NT1 protocol.
Matches W2K3 behavior.
Jeremy.

Modified:
   trunk/source/lib/ms_fnmatch.c
   trunk/source/lib/util.c
   trunk/source/smbd/dir.c


Changeset:
Modified: trunk/source/lib/ms_fnmatch.c
===================================================================
--- trunk/source/lib/ms_fnmatch.c	2005-03-24 18:26:17 UTC (rev 6042)
+++ trunk/source/lib/ms_fnmatch.c	2005-03-24 19:32:53 UTC (rev 6043)
@@ -146,7 +146,7 @@
 	return -1;
 }
 
-int ms_fnmatch(const char *pattern, const char *string, enum protocol_types protocol, 
+int ms_fnmatch(const char *pattern, const char *string, BOOL translate_pattern,
 	       BOOL is_case_sensitive)
 {
 	wpstring p, s;
@@ -179,7 +179,7 @@
 		return -1;
 	}
 
-	if (protocol <= PROTOCOL_LANMAN2) {
+	if (translate_pattern) {
 		/*
 		  for older negotiated protocols it is possible to
 		  translate the pattern to produce a "new style"

Modified: trunk/source/lib/util.c
===================================================================
--- trunk/source/lib/util.c	2005-03-24 18:26:17 UTC (rev 6042)
+++ trunk/source/lib/util.c	2005-03-24 19:32:53 UTC (rev 6043)
@@ -2475,10 +2475,26 @@
 	if (strcmp(pattern,".") == 0)
 		return False;
 	
-	return ms_fnmatch(pattern, string, Protocol, is_case_sensitive) == 0;
+	return ms_fnmatch(pattern, string, Protocol <= PROTOCOL_LANMAN2, is_case_sensitive) == 0;
 }
 
 /*******************************************************************
+ A wrapper that handles case sensitivity and the special handling
+ of the ".." name. Varient that is only called by old search code which requires
+ pattern translation.
+*******************************************************************/
+
+BOOL mask_match_search(const char *string, char *pattern, BOOL is_case_sensitive)
+{
+	if (strcmp(string,"..") == 0)
+		string = ".";
+	if (strcmp(pattern,".") == 0)
+		return False;
+	
+	return ms_fnmatch(pattern, string, True, is_case_sensitive) == 0;
+}
+
+/*******************************************************************
  A wrapper that handles a list of patters and calls mask_match()
  on each.  Returns True if any of the patterns match.
 *******************************************************************/

Modified: trunk/source/smbd/dir.c
===================================================================
--- trunk/source/smbd/dir.c	2005-03-24 18:26:17 UTC (rev 6042)
+++ trunk/source/smbd/dir.c	2005-03-24 19:32:53 UTC (rev 6043)
@@ -698,7 +698,7 @@
 static BOOL mangle_mask_match(connection_struct *conn, fstring filename, char *mask)
 {
 	mangle_map(filename,True,False,SNUM(conn));
-	return mask_match(filename,mask,False);
+	return mask_match_search(filename,mask,False);
 }
 
 /****************************************************************************
@@ -740,7 +740,7 @@
 			see masktest for a demo
 		*/
 		if ((strcmp(mask,"*.*") == 0) ||
-		    mask_match(filename,mask,False) ||
+		    mask_match_search(filename,mask,False) ||
 		    mangle_mask_match(conn,filename,mask)) {
 
 			if (!mangle_is_8_3(filename, False))



More information about the samba-cvs mailing list