svn commit: samba r24646 - in branches/SAMBA_4_0/source/ntvfs/posix: .

tridge at samba.org tridge at samba.org
Fri Aug 24 03:40:43 GMT 2007


Author: tridge
Date: 2007-08-24 03:40:40 +0000 (Fri, 24 Aug 2007)
New Revision: 24646

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

Log:

fixed the handling of case insensitive paths with wildcards

Modified:
   branches/SAMBA_4_0/source/ntvfs/posix/pvfs_resolve.c


Changeset:
Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_resolve.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_resolve.c	2007-08-24 02:38:51 UTC (rev 24645)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_resolve.c	2007-08-24 03:40:40 UTC (rev 24646)
@@ -480,8 +480,40 @@
 		return status;
 	}
 
-	/* if it has a wildcard then no point doing a stat() */
+	/* if it has a wildcard then no point doing a stat() of the
+	   full name. Instead We need check if the directory exists 
+	 */
 	if ((*name)->has_wildcard) {
+		const char *p;
+		char *dir_name, *saved_name;
+		p = strrchr((*name)->full_name, '/');
+		if (p == NULL) {
+			/* root directory wildcard is OK */
+			return NT_STATUS_OK;
+		}
+		dir_name = talloc_strndup(*name, (*name)->full_name, (p-(*name)->full_name));
+		if (stat(dir_name, &(*name)->st) == 0) {
+			talloc_free(dir_name);
+			return NT_STATUS_OK;
+		}
+		/* we need to search for a matching name */
+		saved_name = (*name)->full_name;
+		(*name)->full_name = dir_name;
+		status = pvfs_case_search(pvfs, *name);
+		if (!NT_STATUS_IS_OK(status)) {
+			/* the directory doesn't exist */
+			(*name)->full_name = saved_name;
+			return status;
+		}
+		/* it does exist, but might need a case change */
+		if (dir_name != (*name)->full_name) {
+			(*name)->full_name = talloc_asprintf(*name, "%s%s",
+							     (*name)->full_name, p);
+			NT_STATUS_HAVE_NO_MEMORY((*name)->full_name);
+		} else {
+			(*name)->full_name = saved_name;
+			talloc_free(dir_name);
+		}
 		return NT_STATUS_OK;
 	}
 



More information about the samba-cvs mailing list