s3: libsmb: In cli_rmdir_send() (SMBrmdir) check for DFS pathname.
authorJeremy Allison <jra@samba.org>
Wed, 7 Sep 2022 17:47:37 +0000 (10:47 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 15 Sep 2022 18:43:32 +0000 (18:43 +0000)
smbtorture3: SMB1-DFS-OPERATIONS: test_smb1_rmdir() shows
SMBrmdir uses DFS paths.

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

index e118de01e54fdd21d59a8275d0f3e9202e81389d..6ca0e3031a9147d7ab753f97a76a981229e44091 100644 (file)
@@ -2284,6 +2284,7 @@ struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
        uint8_t additional_flags = 0;
        uint16_t additional_flags2 = 0;
        uint8_t *bytes = NULL;
+       char *dname_cp = NULL;
 
        req = tevent_req_create(mem_ctx, &state, struct cli_rmdir_state);
        if (req == NULL) {
@@ -2303,9 +2304,19 @@ struct tevent_req *cli_rmdir_send(TALLOC_CTX *mem_ctx,
        if (tevent_req_nomem(bytes, req)) {
                return tevent_req_post(req, ev);
        }
+       /*
+        * SMBrmdir on a DFS share must use DFS names.
+        */
+       dname_cp = smb1_dfs_share_path(state, cli, dname);
+       if (tevent_req_nomem(dname_cp, req)) {
+               return tevent_req_post(req, ev);
+       }
        bytes[0] = 4;
-       bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn), dname,
-                                  strlen(dname)+1, NULL);
+       bytes = smb_bytes_push_str(bytes,
+                                  smbXcli_conn_use_unicode(cli->conn),
+                                  dname_cp,
+                                  strlen(dname_cp)+1,
+                                  NULL);
 
        if (tevent_req_nomem(bytes, req)) {
                return tevent_req_post(req, ev);