]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: libsmb: In cli_check_msdfs_proxy() replace cli_state_save_tcon()/cli_state_restor...
authorJeremy Allison <jra@samba.org>
Wed, 24 Aug 2022 00:28:21 +0000 (17:28 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 15 Sep 2022 18:43:32 +0000 (18:43 +0000)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
source3/libsmb/clidfs.c

index 4fa1fc4aa4571eb8d33187bf01f7a07c153a3372..d8355f8058b3aa57b03a07164e52994210247071 100644 (file)
@@ -1156,6 +1156,7 @@ bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
        char *fullpath = NULL;
        bool res;
        struct smbXcli_tcon *orig_tcon = NULL;
+       char *orig_share = NULL;
        char *newextrapath = NULL;
        NTSTATUS status;
        const char *remote_name;
@@ -1183,16 +1184,13 @@ bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
 
        /* Store tcon state. */
        if (cli_state_has_tcon(cli)) {
-               orig_tcon = cli_state_save_tcon(cli);
-               if (orig_tcon == NULL) {
-                       return false;
-               }
+               cli_state_save_tcon_share(cli, &orig_tcon, &orig_share);
        }
 
        /* check for the referral */
 
        if (!NT_STATUS_IS_OK(cli_tree_connect(cli, "IPC$", "IPC", NULL))) {
-               cli_state_restore_tcon(cli, orig_tcon);
+               cli_state_restore_tcon_share(cli, orig_tcon, orig_share);
                return false;
        }
 
@@ -1211,7 +1209,9 @@ bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
                                 * tcon so we don't leak it.
                                 */
                                cli_tdis(cli);
-                               cli_state_restore_tcon(cli, orig_tcon);
+                               cli_state_restore_tcon_share(cli,
+                                                            orig_tcon,
+                                                            orig_share);
                                return false;
                        }
                }
@@ -1223,7 +1223,7 @@ bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
 
        status = cli_tdis(cli);
 
-       cli_state_restore_tcon(cli, orig_tcon);
+       cli_state_restore_tcon_share(cli, orig_tcon, orig_share);
 
        if (!NT_STATUS_IS_OK(status)) {
                return false;