summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/smbd/nttrans.c5
-rw-r--r--source3/smbd/reply.c15
-rw-r--r--source3/smbd/trans2.c3
3 files changed, 13 insertions, 10 deletions
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 5293ca5347..f67ddd3b31 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -1353,7 +1353,7 @@ void reply_ntrename(struct smb_request *req)
case RENAME_FLAG_RENAME:
status = rename_internals(ctx, conn, req, oldname,
newname, attrs, False, src_has_wcard,
- dest_has_wcard);
+ dest_has_wcard, DELETE_ACCESS);
break;
case RENAME_FLAG_HARD_LINK:
if (src_has_wcard || dest_has_wcard) {
@@ -1549,7 +1549,8 @@ static void call_nt_transact_rename(connection_struct *conn,
0,
replace_if_exists,
False,
- dest_has_wcard);
+ dest_has_wcard,
+ DELETE_ACCESS);
if (!NT_STATUS_IS_OK(status)) {
if (open_was_deferred(req->mid)) {
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 818ff319e4..d3b5dfac64 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -2184,7 +2184,7 @@ static NTSTATUS can_rename(connection_struct *conn, files_struct *fsp,
return NT_STATUS_OK;
}
- if (fsp->access_mask & DELETE_ACCESS) {
+ if (fsp->access_mask & (DELETE_ACCESS|FILE_WRITE_ATTRIBUTES)) {
return NT_STATUS_OK;
}
@@ -5585,7 +5585,8 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
uint32 attrs,
bool replace_if_exists,
bool src_has_wild,
- bool dest_has_wild)
+ bool dest_has_wild,
+ uint32_t access_mask)
{
char *directory = NULL;
char *mask = NULL;
@@ -5715,12 +5716,12 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
status = S_ISDIR(sbuf1.st_mode) ?
open_directory(conn, req, directory, &sbuf1,
- DELETE_ACCESS,
+ access_mask,
FILE_SHARE_READ|FILE_SHARE_WRITE,
FILE_OPEN, 0, 0, NULL,
&fsp)
: open_file_ntcreate(conn, req, directory, &sbuf1,
- DELETE_ACCESS,
+ access_mask,
FILE_SHARE_READ|FILE_SHARE_WRITE,
FILE_OPEN, 0, 0, 0, NULL,
&fsp);
@@ -5819,12 +5820,12 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
status = S_ISDIR(sbuf1.st_mode) ?
open_directory(conn, req, fname, &sbuf1,
- DELETE_ACCESS,
+ access_mask,
FILE_SHARE_READ|FILE_SHARE_WRITE,
FILE_OPEN, 0, 0, NULL,
&fsp)
: open_file_ntcreate(conn, req, fname, &sbuf1,
- DELETE_ACCESS,
+ access_mask,
FILE_SHARE_READ|FILE_SHARE_WRITE,
FILE_OPEN, 0, 0, 0, NULL,
&fsp);
@@ -5947,7 +5948,7 @@ void reply_mv(struct smb_request *req)
DEBUG(3,("reply_mv : %s -> %s\n",name,newname));
status = rename_internals(ctx, conn, req, name, newname, attrs, False,
- src_has_wcard, dest_has_wcard);
+ src_has_wcard, dest_has_wcard, DELETE_ACCESS);
if (!NT_STATUS_IS_OK(status)) {
if (open_was_deferred(req->mid)) {
/* We have re-scheduled this call. */
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 716f94f661..85a7cdb613 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -5322,7 +5322,8 @@ static NTSTATUS smb_file_rename_information(connection_struct *conn,
DEBUG(10,("smb_file_rename_information: SMB_FILE_RENAME_INFORMATION %s -> %s\n",
fname, base_name ));
status = rename_internals(ctx, conn, req, fname, base_name, 0,
- overwrite, False, dest_has_wcard);
+ overwrite, False, dest_has_wcard,
+ FILE_WRITE_ATTRIBUTES);
}
return status;