]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: libsmb: In cli_ntcreate1_send() (SMBntcreateX) check for DFS pathname.
authorJeremy Allison <jra@samba.org>
Wed, 7 Sep 2022 18:26:46 +0000 (11:26 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 15 Sep 2022 18:43:32 +0000 (18:43 +0000)
smbtorture3: SMB1-DFS-OPERATIONS: test_smb1_ntcreatex() shows
SMBntcreateX uses DFS paths.

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

index 6ca0e3031a9147d7ab753f97a76a981229e44091..a657ed5e8580ed52d2c4dc65d998e60acd5acdd0 100644 (file)
@@ -2541,6 +2541,7 @@ static struct tevent_req *cli_ntcreate1_send(TALLOC_CTX *mem_ctx,
        uint8_t *bytes;
        size_t converted_len;
        uint16_t additional_flags2 = 0;
+       char *fname_cp = NULL;
 
        req = tevent_req_create(mem_ctx, &state, struct cli_ntcreate1_state);
        if (req == NULL) {
@@ -2574,8 +2575,17 @@ static struct tevent_req *cli_ntcreate1_send(TALLOC_CTX *mem_ctx,
        if (tevent_req_nomem(bytes, req)) {
                return tevent_req_post(req, ev);
        }
-       bytes = smb_bytes_push_str(bytes, smbXcli_conn_use_unicode(cli->conn),
-                                  fname, strlen(fname)+1,
+       /*
+        * SMBntcreateX on a DFS share must use DFS names.
+        */
+       fname_cp = smb1_dfs_share_path(state, cli, fname);
+       if (tevent_req_nomem(fname_cp, req)) {
+               return tevent_req_post(req, ev);
+       }
+       bytes = smb_bytes_push_str(bytes,
+                                  smbXcli_conn_use_unicode(cli->conn),
+                                  fname_cp,
+                                  strlen(fname_cp)+1,
                                   &converted_len);
        if (tevent_req_nomem(bytes, req)) {
                return tevent_req_post(req, ev);