s3: libsmb: In cli_set_ea_path() (SMBtrans2:TRANSACT2_SETPATHINFO) check for DFS...
authorJeremy Allison <jra@samba.org>
Thu, 8 Sep 2022 23:21:20 +0000 (16:21 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 15 Sep 2022 18:43:32 +0000 (18:43 +0000)
See smbtorture3: SMB1-DFS-PATHS: test_smb1_setpathinfo_XXXX()

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

index 62639156fe531b4a96bbec439c94b6e940a66df3..5bbff4d3c5860c81e7a849fb3fb086f93650a6dd 100644 (file)
@@ -5439,6 +5439,7 @@ NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
        uint8_t *param;
        NTSTATUS status;
        TALLOC_CTX *frame = NULL;
+       char *path_cp = NULL;
 
        if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
                return cli_smb2_set_ea_path(cli,
@@ -5459,8 +5460,18 @@ NTSTATUS cli_set_ea_path(struct cli_state *cli, const char *path,
        SSVAL(param,2,0);
        SSVAL(param,4,0);
 
-       param = trans2_bytes_push_str(param, smbXcli_conn_use_unicode(cli->conn),
-                                     path, strlen(path)+1,
+       /*
+        * TRANSACT2_SETPATHINFO on a DFS share must use DFS names.
+        */
+       path_cp = smb1_dfs_share_path(frame, cli, path);
+       if (path_cp == NULL) {
+               status = NT_STATUS_NO_MEMORY;
+               goto fail;
+       }
+       param = trans2_bytes_push_str(param,
+                                     smbXcli_conn_use_unicode(cli->conn),
+                                     path_cp,
+                                     strlen(path_cp)+1,
                                      NULL);
        param_len = talloc_get_size(param);