From 94cf480096be8d5210e16bd26418de4d7d82a6db Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 2 Dec 2009 18:06:40 -0800 Subject: Remove unneeded argument from can_set_delete_on_close(). Ensure can_set_delete_on_close() is correctly called before any setting of the disposition bit (clean up the do_unlink() call). Jeremy. (cherry picked from commit dfcc4115ddc7c3bf7a69d7eb747c096cd217b8a6) (cherry picked from commit baa4727b243ff2dfb78d3dd5fd29c8e9a3667c56) --- source3/smbd/reply.c | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) (limited to 'source3/smbd/reply.c') diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 682f56ff33e..101635fb504 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -2454,24 +2454,6 @@ static NTSTATUS do_unlink(connection_struct *conn, return NT_STATUS_OBJECT_NAME_INVALID; #endif /* JRATEST */ - /* Fix for bug #3035 from SATOH Fumiyasu - - On a Windows share, a file with read-only dosmode can be opened with - DELETE_ACCESS. But on a Samba share (delete readonly = no), it - fails with NT_STATUS_CANNOT_DELETE error. - - This semantic causes a problem that a user can not - rename a file with read-only dosmode on a Samba share - from a Windows command prompt (i.e. cmd.exe, but can rename - from Windows Explorer). - */ - - if (!lp_delete_readonly(SNUM(conn))) { - if (fattr & aRONLY) { - return NT_STATUS_CANNOT_DELETE; - } - } - /* On open checks the open itself will check the share mode, so don't do it here as we'll get it wrong. */ @@ -2500,6 +2482,16 @@ static NTSTATUS do_unlink(connection_struct *conn, return status; } + status = can_set_delete_on_close(fsp, fattr); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(10, ("do_unlink can_set_delete_on_close for file %s - " + "(%s)\n", + smb_fname_str_dbg(smb_fname), + nt_errstr(status))); + close_file(req, fsp, NORMAL_CLOSE); + return status; + } + /* The set is across all open files on this dev/inode pair. */ if (!set_delete_on_close(fsp, True, &conn->server_info->utok)) { close_file(req, fsp, NORMAL_CLOSE); @@ -6084,7 +6076,7 @@ NTSTATUS rename_internals_fsp(connection_struct *conn, */ if (create_options & FILE_DELETE_ON_CLOSE) { - status = can_set_delete_on_close(fsp, True, 0); + status = can_set_delete_on_close(fsp, 0); if (NT_STATUS_IS_OK(status)) { /* Note that here we set the *inital* delete on close flag, -- cgit