svn commit: samba r16537 - in branches/SAMBA_3_0/source/smbd: .

jra at samba.org jra at samba.org
Mon Jun 26 23:36:04 GMT 2006


Author: jra
Date: 2006-06-26 23:36:03 +0000 (Mon, 26 Jun 2006)
New Revision: 16537

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

Log:
Fix for bug #3858, all files in a directory not
being deleted when hide unreadable set to true.

Here's the scoop. 

This one is really interesting. The pattern of deleting a directory is to do a
findfirst to get the first part of the list, then for each name returned it
does a open/set delete on close/close -> thus deleting the file. Then it does a
findnext with the last file name THAT IT JUST DELETED ! Now we can handle this
in the findnext in the case where hide unreadable is set to false as we look
back in our cache of names and just seek to the right point. The bug is
actually fixed in the first hunk of this patch - the one that removes the
is_visible_file() check after SearchDir returns false. We don't actually need
it and in this case it's causing the delete to be aborted because it can't find
the name (doh ! it was just deleted). We don't need it as SearchDir is only
ever called from findnext, and findnext should only ever be returning names we
gave it.

The rest of the patch are the debugs I used to find
the problem but they're generically useful.

Phew - that one took a while to track down.....

Jerry, please merge for 3.0.23 final.

Jeremy.


Modified:
   branches/SAMBA_3_0/source/smbd/dir.c


Changeset:
Modified: branches/SAMBA_3_0/source/smbd/dir.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/dir.c	2006-06-26 23:35:58 UTC (rev 16536)
+++ branches/SAMBA_3_0/source/smbd/dir.c	2006-06-26 23:36:03 UTC (rev 16537)
@@ -636,12 +636,7 @@
 		return False;
 	}
 
-	if (SearchDir(dptr->dir_hnd, name, poffset)) {
-		if (is_visible_file(dptr->conn, dptr->path, name, pst, True)) {
-			return True;
-		}
-	}
-	return False;
+	return SearchDir(dptr->dir_hnd, name, poffset);
 }
 
 /****************************************************************************
@@ -854,6 +849,8 @@
 
 	/* If we can't stat it does not show it */
 	if (!VALID_STAT(*pst) && (SMB_VFS_STAT(conn, name, pst) != 0)) {
+		DEBUG(10,("user_can_read_file: SMB_VFS_STAT failed for file %s with error %s\n",
+			name, strerror(errno) ));
 		return False;
 	}
 
@@ -992,6 +989,7 @@
 
 	/* If it's a vetoed file, pretend it doesn't even exist */
 	if (use_veto && IS_VETO_PATH(conn, name)) {
+		DEBUG(10,("is_visible_file: file %s is vetoed.\n", name ));
 		return False;
 	}
 
@@ -1003,16 +1001,19 @@
 		}
 		/* Honour _hide unreadable_ option */
 		if (hide_unreadable && !user_can_read_file(conn, entry, pst)) {
+			DEBUG(10,("is_visible_file: file %s is unreadable.\n", entry ));
 			SAFE_FREE(entry);
 			return False;
 		}
 		/* Honour _hide unwriteable_ option */
 		if (hide_unwriteable && !user_can_write_file(conn, entry, pst)) {
+			DEBUG(10,("is_visible_file: file %s is unwritable.\n", entry ));
 			SAFE_FREE(entry);
 			return False;
 		}
 		/* Honour _hide_special_ option */
 		if (hide_special && file_is_special(conn, entry, pst)) {
+			DEBUG(10,("is_visible_file: file %s is special.\n", entry ));
 			SAFE_FREE(entry);
 			return False;
 		}



More information about the samba-cvs mailing list