Fix bug #8515 - Empty CIFS share can be blocked for other clients by deleting it...
authorVolodymyr Khomenko <Volodymyr_Khomenko@dell.com>
Wed, 12 Oct 2011 16:57:57 +0000 (09:57 -0700)
committerJeremy Allison <jra@samba.org>
Wed, 12 Oct 2011 19:07:27 +0000 (21:07 +0200)
Disallow "." in can_set_delete_on_close().

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Wed Oct 12 21:07:27 CEST 2011 on sn-devel-104

source3/locking/locking.c

index 90417309fe728e2db8efcaa2330fca82648fb9d2..38d8c090a68b7af01b630a8939f0bdd5c3d35668 100644 (file)
@@ -1473,6 +1473,14 @@ NTSTATUS can_set_delete_on_close(files_struct *fsp, uint32 dosmode)
        /* Don't allow delete on close for non-empty directories. */
        if (fsp->is_directory) {
                SMB_ASSERT(!is_ntfs_stream_smb_fname(fsp->fsp_name));
+
+               /* Or the root of a share. */
+               if (ISDOT(fsp->fsp_name->base_name)) {
+                       DEBUG(10,("can_set_delete_on_close: can't set delete on "
+                                 "close for the root of a share.\n"));
+                       return NT_STATUS_ACCESS_DENIED;
+               }
+
                return can_delete_directory(fsp->conn,
                                            fsp->fsp_name->base_name);
        }