From: Jeremy Allison Date: Thu, 3 Feb 2022 22:54:26 +0000 (-0800) Subject: s3: libsmb: Call cli_dfs_target_check() from cli_ntrename_internal_send(). X-Git-Tag: tevent-0.12.0~780 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf3e5724422d8becd045542be196dfea6ac9ec2b;p=thirdparty%2Fsamba.git s3: libsmb: Call cli_dfs_target_check() from cli_ntrename_internal_send(). Currently we don't pass MSDFS names as targets here, but a caller may erroneously do this later, and for non-DFS names this is a no-op. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14169 Signed-off-by: Jeremy Allison Reviewed-by: Noel Power --- diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index a65b79365ad..032c11b5e75 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -1518,6 +1518,7 @@ static struct tevent_req *cli_ntrename_internal_send(TALLOC_CTX *mem_ctx, uint8_t additional_flags = 0; uint16_t additional_flags2 = 0; uint8_t *bytes = NULL; + NTSTATUS status; req = tevent_req_create(mem_ctx, &state, struct cli_ntrename_internal_state); @@ -1525,6 +1526,18 @@ static struct tevent_req *cli_ntrename_internal_send(TALLOC_CTX *mem_ctx, return NULL; } + /* + * Strip a MSDFS path from fname_dst if we were given one. + */ + status = cli_dfs_target_check(state, + cli, + fname_src, + fname_dst, + &fname_dst); + if (tevent_req_nterror(req, status)) { + return tevent_req_post(req, ev); + } + SSVAL(state->vwv+0, 0 ,FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY); SSVAL(state->vwv+1, 0, rename_flag);