From 0cfc6a8e11bf1d2dd80861cf5331f4cde78dd674 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 15 Jan 2007 09:17:11 +0000 Subject: r20796: Fix the same problem Jeremy has fixed (improper handling of deferred opens) for delete_driver_files. Proper fix pending... :-) Jeremy, please check. Volker (This used to be commit 21b8f15dd5ad567efeacf5ba22dc4d8c64b09b76) --- source3/smbd/reply.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'source3/smbd') 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. */ -- cgit