From 4da3c724d5b3a60cd4af83b0a301b96a0d2ee945 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 2 Sep 2022 12:33:48 -0700 Subject: [PATCH] s3: libsmb: In cli_cifs_rename_send() (SMBmv) check for DFS source pathname. smbtorture3: SMB1-DFS-PATHS: test_smb1_mv() shows SMBmv uses DFS for src and dst. Signed-off-by: Jeremy Allison Reviewed-by: Noel Power --- source3/libsmb/clifile.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 25864332743..b07e9457a59 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -1332,6 +1332,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; + char *fname_src_cp = NULL; NTSTATUS status; req = tevent_req_create(mem_ctx, &state, struct cli_cifs_rename_state); @@ -1364,9 +1365,22 @@ static struct tevent_req *cli_cifs_rename_send(TALLOC_CTX *mem_ctx, if (tevent_req_nomem(bytes, req)) { return tevent_req_post(req, ev); } + + /* + * SMBmv on a DFS share uses DFS names for src and dst. + * See smbtorture3: SMB1-DFS-PATHS: test_smb1_mv(). + */ + + fname_src_cp = smb1_dfs_share_path(state, cli, fname_src); + if (tevent_req_nomem(fname_src_cp, req)) { + return tevent_req_post(req, ev); + } bytes[0] = 4; - bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), fname_src, - strlen(fname_src)+1, NULL); + bytes = smb_bytes_push_str(bytes, + smbXcli_conn_use_unicode(cli->conn), + fname_src_cp, + strlen(fname_src_cp)+1, + NULL); if (tevent_req_nomem(bytes, req)) { return tevent_req_post(req, ev); }