]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: libsmb: Call cli_dfs_target_check() from cli_cifs_rename_send().
authorJeremy Allison <jra@samba.org>
Thu, 3 Feb 2022 23:56:51 +0000 (15:56 -0800)
committerNoel Power <npower@samba.org>
Fri, 4 Feb 2022 11:10:33 +0000 (11:10 +0000)
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 <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
source3/libsmb/clifile.c

index 9e15843f1203c599d238b1478e368eb6a47656a9..5c570c68eac8d937bcaaee7729111531b5fb230f 100644 (file)
@@ -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);