summaryrefslogtreecommitdiff
path: root/source3/smbd/reply.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbd/reply.c')
-rw-r--r--source3/smbd/reply.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 02cada71aa..3a1514f1aa 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -1679,7 +1679,8 @@ static NTSTATUS can_rename(connection_struct *conn, char *fname, uint16 dirtype,
Check if a user is allowed to delete a file.
********************************************************************/
-static NTSTATUS can_delete(connection_struct *conn, char *fname, uint32 dirtype)
+static NTSTATUS can_delete(connection_struct *conn, char *fname,
+ uint32 dirtype, BOOL can_defer)
{
SMB_STRUCT_STAT sbuf;
uint32 fattr;
@@ -1777,7 +1778,7 @@ static NTSTATUS can_delete(connection_struct *conn, char *fname, uint32 dirtype)
FILE_OPEN,
0,
FILE_ATTRIBUTE_NORMAL,
- 0,
+ can_defer ? 0 : INTERNAL_OPEN_ONLY,
NULL, &fsp);
if (NT_STATUS_IS_OK(status)) {
@@ -1791,7 +1792,8 @@ static NTSTATUS can_delete(connection_struct *conn, char *fname, uint32 dirtype)
code.
****************************************************************************/
-NTSTATUS unlink_internals(connection_struct *conn, uint32 dirtype, char *name, BOOL has_wild)
+NTSTATUS unlink_internals(connection_struct *conn, uint32 dirtype,
+ char *name, BOOL has_wild, BOOL can_defer)
{
pstring directory;
pstring mask;
@@ -1835,7 +1837,7 @@ NTSTATUS unlink_internals(connection_struct *conn, uint32 dirtype, char *name, B
if (dirtype == 0) {
dirtype = FILE_ATTRIBUTE_NORMAL;
}
- status = can_delete(conn,directory,dirtype);
+ status = can_delete(conn,directory,dirtype,can_defer);
if (!NT_STATUS_IS_OK(status))
return status;
@@ -1885,7 +1887,8 @@ NTSTATUS unlink_internals(connection_struct *conn, uint32 dirtype, char *name, B
continue;
slprintf(fname,sizeof(fname)-1, "%s/%s",directory,dname);
- status = can_delete(conn, fname, dirtype);
+ status = can_delete(conn, fname, dirtype,
+ can_defer);
if (!NT_STATUS_IS_OK(status)) {
continue;
}
@@ -1931,7 +1934,8 @@ int reply_unlink(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
DEBUG(3,("reply_unlink : %s\n",name));
- status = unlink_internals(conn, dirtype, name, path_contains_wcard);
+ status = unlink_internals(conn, dirtype, name, path_contains_wcard,
+ True);
if (!NT_STATUS_IS_OK(status)) {
if (open_was_deferred(SVAL(inbuf,smb_mid))) {
/* We have re-scheduled this call. */