Rev 5337: merge from upstream in http://samba.sernet.de/ma/bzr/SAMBA_3_0-registry.bzr/

Michael Adam ma at sernet.de
Thu Apr 5 10:03:01 GMT 2007


At http://samba.sernet.de/ma/bzr/SAMBA_3_0-registry.bzr/

------------------------------------------------------------
revno: 5337
revision-id: ma at sernet.de-20070405100257-a0b764bc9201685f
parent: ma at sernet.de-20070404231329-24fad8c3805602b0
parent: jra at samba.org-20070405050043-e5k93h9v5nsdq3ov
committer: Michael Adam <ma at sernet.de>
branch nick: SAMBA_3_0-registry.bzr
timestamp: Thu 2007-04-05 12:02:57 +0200
message:
  merge from upstream
modified:
  REVISION                       REVISION-20060530022625-68239662668b41c3
  source/modules/vfs_recycle.c   vfs_recycle.c-20060530022627-d07dfe793c4da075
    ------------------------------------------------------------
    merged: jra at samba.org-20070405050043-e5k93h9v5nsdq3ov
    parent: jra at samba.org-20070404230042-yjnnzy9q2k1v747c
    committer: jra at samba.org
    branch nick: SAMBA_3_0.bzr
    timestamp: Thu 2007-04-05 00:00:43 -0500
    message:
      jra at samba.org (r22080)  2007-04-04 18:33:07 -0500 (Wed, 04 Apr 2007)
          
          Fix directory recycle module bug #4486.
          Jeremy.
          
=== modified file 'REVISION'
--- a/REVISION	2007-04-04 23:00:42 +0000
+++ b/REVISION	2007-04-05 05:00:43 +0000
@@ -2,9 +2,9 @@
 URL: svn+ssh://svn.samba.org/home/svn/samba/branches/SAMBA_3_0
 Repository Root: svn+ssh://svn.samba.org/home/svn/samba
 Repository UUID: 0c0555d6-39d7-0310-84fc-f1cc0bd64818
-Revision: 22079
+Revision: 22080
 Node Kind: directory
 Last Changed Author: jra
-Last Changed Rev: 22079
-Last Changed Date: 2007-04-04 12:38:12 -0500 (Wed, 04 Apr 2007)
+Last Changed Rev: 22080
+Last Changed Date: 2007-04-04 18:33:07 -0500 (Wed, 04 Apr 2007)
 

=== modified file 'source/modules/vfs_recycle.c'
--- a/source/modules/vfs_recycle.c	2007-03-09 00:05:11 +0000
+++ b/source/modules/vfs_recycle.c	2007-04-05 05:00:43 +0000
@@ -311,23 +311,48 @@
 }
 
 /**
- * Check if needle is contained exactly in haystack
- * @param haystack list of parameters separated by delimimiter character
- * @param needle string to be matched exactly to haystack
- * @return True if found
+ * Check if any of the components of "exclude_list" are contained in path.
+ * Return True if found
  **/
-static BOOL checkparam(const char **haystack_list, const char *needle)
+
+static BOOL matchdirparam(const char **dir_exclude_list, char *path)
 {
-	int i;
+	char *startp = NULL, *endp = NULL;
 
-	if (haystack_list == NULL || haystack_list[0] == NULL ||
-		*haystack_list[0] == '\0' || needle == NULL || *needle == '\0') {
+	if (dir_exclude_list == NULL || dir_exclude_list[0] == NULL ||
+		*dir_exclude_list[0] == '\0' || path == NULL || *path == '\0') {
 		return False;
 	}
 
-	for(i=0; haystack_list[i] ; i++) {
-		if(strequal(haystack_list[i], needle)) {
-			return True;
+	/* 
+	 * Walk the components of path, looking for matches with the
+	 * exclude list on each component. 
+	 */
+
+	for (startp = path; startp; startp = endp) {
+		int i;
+
+		while (*startp == '/') {
+			startp++;
+		}
+		endp = strchr(startp, '/');
+		if (endp) {
+			*endp = '\0';
+		}
+
+		for(i=0; dir_exclude_list[i] ; i++) {
+			if(unix_wild_match(dir_exclude_list[i], startp)) {
+				/* Repair path. */
+				if (endp) {
+					*endp = '/';
+				}
+				return True;
+			}
+		}
+
+		/* Repair path. */
+		if (endp) {
+			*endp = '/';
 		}
 	}
 
@@ -485,11 +510,7 @@
 		goto done;
 	}
 
-	/* FIXME: this check will fail if we have more than one level of directories,
-	 * we shoud check for every level 1, 1/2, 1/2/3, 1/2/3/4 .... 
-	 * 	---simo
-	 */
-	if (checkparam(recycle_exclude_dir(handle), path_name)) {
+	if (matchdirparam(recycle_exclude_dir(handle), path_name)) {
 		DEBUG(3, ("recycle: directory %s is excluded \n", path_name));
 		rc = SMB_VFS_NEXT_UNLINK(handle, file_name);
 		goto done;



More information about the samba-cvs mailing list