From: Volodymyr Khomenko Date: Wed, 12 Oct 2011 16:57:57 +0000 (-0700) Subject: Fix bug #8515 - Empty CIFS share can be blocked for other clients by deleting it... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c6e2256e2ef024ecdbebb9cb04d919342daeb780;p=thirdparty%2Fsamba.git Fix bug #8515 - Empty CIFS share can be blocked for other clients by deleting it via empty path (DELETE_PENDING until the last client) Disallow "." in can_set_delete_on_close(). Autobuild-User: Jeremy Allison Autobuild-Date: Wed Oct 12 21:07:27 CEST 2011 on sn-devel-104 (cherry picked from commit bd260f03ab492d03c2890db47dc6fb4f1b824a1a) --- diff --git a/source3/locking/locking.c b/source3/locking/locking.c index 095d0b17b9d..8f192a6ef89 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -1350,6 +1350,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); }