From: Jeremy Allison Date: Thu, 3 Feb 2022 23:56:51 +0000 (-0800) Subject: s3: libsmb: Call cli_dfs_target_check() from cli_cifs_rename_send(). X-Git-Tag: tevent-0.12.0~778 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4473aea926fe4ddd23a6e0913009bb1a0a1eaa90;p=thirdparty%2Fsamba.git s3: libsmb: Call cli_dfs_target_check() from cli_cifs_rename_send(). Strips off any DFS prefix from the target if passed in. 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 9e15843f120..5c570c68eac 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -1323,6 +1323,7 @@ static struct tevent_req *cli_cifs_rename_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_cifs_rename_state); if (req == NULL) { @@ -1337,6 +1338,18 @@ static struct tevent_req *cli_cifs_rename_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } + /* + * 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); bytes = talloc_array(state, uint8_t, 1);