summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/proto.h3
-rw-r--r--source3/smbd/dir.c14
-rw-r--r--source3/smbd/file_access.c3
3 files changed, 11 insertions, 9 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index bcecde955d..6856dd7730 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1626,8 +1626,7 @@ void cancel_pending_lock_requests_by_fid(files_struct *fsp,
enum file_close_type close_type);
void send_stat_cache_delete_message(struct messaging_context *msg_ctx,
const char *name);
-NTSTATUS can_delete_directory(struct connection_struct *conn,
- const char *dirname);
+NTSTATUS can_delete_directory_fsp(files_struct *fsp);
bool change_to_root_user(void);
void contend_level2_oplocks_begin(files_struct *fsp,
enum level2_contention_type type);
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;
diff --git a/source3/smbd/file_access.c b/source3/smbd/file_access.c
index 0e74207b84..f4a7bb3d45 100644
--- a/source3/smbd/file_access.c
+++ b/source3/smbd/file_access.c
@@ -228,8 +228,7 @@ NTSTATUS can_set_delete_on_close(files_struct *fsp, uint32 dosmode)
return NT_STATUS_ACCESS_DENIED;
}
- return can_delete_directory(fsp->conn,
- fsp->fsp_name->base_name);
+ return can_delete_directory_fsp(fsp);
}
return NT_STATUS_OK;