]> 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)
committerJule Anger <janger@samba.org>
Wed, 9 Feb 2022 10:23:20 +0000 (10:23 +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>
(cherry picked from commit 4473aea926fe4ddd23a6e0913009bb1a0a1eaa90)

source3/libsmb/clifile.c

index 3e441530e3224059ae2510eea9e2fa2a0499bad9..3204e120595431a1e4a3bdaede2b285692c44023 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);