s3: libsmb: In cli_cifs_rename_send() (SMBmv) check for DFS source pathname.
authorJeremy Allison <jra@samba.org>
Fri, 2 Sep 2022 19:33:48 +0000 (12:33 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 15 Sep 2022 18:43:32 +0000 (18:43 +0000)
smbtorture3: SMB1-DFS-PATHS: test_smb1_mv() shows
SMBmv uses DFS for src and dst.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
source3/libsmb/clifile.c

index 25864332743413e4cd73bfcebfa4bf60e30e0d88..b07e9457a5934cfbb7da4a2dc26b5397ab42acdb 100644 (file)
@@ -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);
        }