summaryrefslogtreecommitdiff
path: root/source3/smbd/dir.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2012-11-14 14:40:51 -0800
committerMichael Adam <obnox@samba.org>2012-11-20 01:46:27 +0100
commitc5ad5029fd87b36426927d57425d5debbb26394c (patch)
tree3a94d4a969406f95cf64ce29e65beadd3ca900fb /source3/smbd/dir.c
parent4985332b951d8cd46c9c0cd877875ab7839b4edb (diff)
downloadsamba-c5ad5029fd87b36426927d57425d5debbb26394c.tar.gz
samba-c5ad5029fd87b36426927d57425d5debbb26394c.tar.bz2
samba-c5ad5029fd87b36426927d57425d5debbb26394c.zip
More for #9374 - Allow smb2.acls torture test to pass against smbd with a POSIX ACLs backend.
Change can_delete_directory() to can_delete_directory_fsp(), as we only ever call this from an open directory file handle. This allows us to use OpenDir_fsp() instead of OpenDir(). OpenDir() re-checks the ACL on the directory, which may refuse DIR_LIST permissions. OpenDir_fsp() does not. As this is a file-server internal check to see if the directory actually contains any files before setting delete on close, we can ignore the ACL here (Windows does). Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Tue Nov 20 01:46:28 CET 2012 on sn-devel-104
Diffstat (limited to 'source3/smbd/dir.c')
-rw-r--r--source3/smbd/dir.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index e12812e8da..525f20ec7f 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -1743,16 +1743,20 @@ bool SearchDir(struct smb_Dir *dirp, const char *name, long *poffset)
Is this directory empty ?
*****************************************************************/
-NTSTATUS can_delete_directory(struct connection_struct *conn,
- const char *dirname)
+NTSTATUS can_delete_directory_fsp(files_struct *fsp)
{
NTSTATUS status = NT_STATUS_OK;
long dirpos = 0;
const char *dname = NULL;
+ const char *dirname = fsp->fsp_name->base_name;
char *talloced = NULL;
SMB_STRUCT_STAT st;
- struct smb_Dir *dir_hnd = OpenDir(talloc_tos(), conn,
- dirname, NULL, 0);
+ struct connection_struct *conn = fsp->conn;
+ struct smb_Dir *dir_hnd = OpenDir_fsp(talloc_tos(),
+ conn,
+ fsp,
+ NULL,
+ 0);
if (!dir_hnd) {
return map_nt_error_from_unix(errno);
@@ -1772,7 +1776,7 @@ NTSTATUS can_delete_directory(struct connection_struct *conn,
continue;
}
- DEBUG(10,("can_delete_directory: got name %s - can't delete\n",
+ DEBUG(10,("got name %s - can't delete\n",
dname ));
status = NT_STATUS_DIRECTORY_NOT_EMPTY;
break;