Bugzilla day wiki page is up
Jeremy Allison
jra at samba.org
Fri Feb 9 01:58:07 GMT 2007
On Thu, Feb 08, 2007 at 08:32:05AM -0600, Gerald (Jerry) Carter wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> FYI....
>
> See http://wiki.samba.org/index.php/Bugzilla_Day for links to the
> current Vista patch set and open bugs. Thanks.
Here's the patch for bug #4188 (Windows Vista RC1 and RC2 can't delete
directory on Samba share) for 3.0.24. Based on work by Joe Meadows
which was nicer than what I did for 3.0.25 (so I'm going to update
the SAMBA_3_0_25 svn tree :-).
Cheers,
Jeremy.
-------------- next part --------------
Index: source/lib/dummysmbd.c
===================================================================
--- source/lib/dummysmbd.c (revision 21254)
+++ source/lib/dummysmbd.c (working copy)
@@ -38,3 +38,9 @@
{
return False;
}
+
+NTSTATUS can_delete_directory(struct connection_struct *conn,
+ const char *dirname)
+{
+ return NT_STATUS_OK;
+}
Index: source/smbd/dir.c
===================================================================
--- source/smbd/dir.c (revision 21254)
+++ source/smbd/dir.c (working copy)
@@ -1255,3 +1255,42 @@
}
return False;
}
+
+/*****************************************************************
+ Is this directory empty ?
+*****************************************************************/
+
+NTSTATUS can_delete_directory(struct connection_struct *conn,
+ const char *dirname)
+{
+ NTSTATUS status = NT_STATUS_OK;
+ long dirpos = 0;
+ const char *dname;
+ struct smb_Dir *dir_hnd = OpenDir(conn, dirname, NULL, 0);
+
+ if (!dir_hnd) {
+ return map_nt_error_from_unix(errno);
+ }
+
+ while ((dname = ReadDirName(dir_hnd,&dirpos))) {
+ SMB_STRUCT_STAT st;
+
+ /* Quick check for "." and ".." */
+ if (dname[0] == '.') {
+ if (!dname[1] || (dname[1] == '.' && !dname[2])) {
+ continue;
+ }
+ }
+
+ if (!is_visible_file(conn, dirname, dname, &st, True)) {
+ continue;
+ }
+
+ DEBUG(10,("can_delete_directory: got name %s - can't delete\n", dname ));
+ status = NT_STATUS_DIRECTORY_NOT_EMPTY;
+ break;
+ }
+ CloseDir(dir_hnd);
+
+ return status;
+}
Index: source/locking/locking.c
===================================================================
--- source/locking/locking.c (revision 21254)
+++ source/locking/locking.c (working copy)
@@ -1166,6 +1166,11 @@
return NT_STATUS_ACCESS_DENIED;
}
+ /* Don't allow delete on close for non-empty directories. */
+ if (fsp->is_directory) {
+ return can_delete_directory(fsp->conn, fsp->fsp_name);
+ }
+
return NT_STATUS_OK;
}
More information about the samba-technical
mailing list