s3: utils: In show_userlist() replace cli_state_save_tcon()/cli_state_restore_tcon...
authorJeremy Allison <jra@samba.org>
Wed, 24 Aug 2022 00:34:43 +0000 (17:34 -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/utils/net_rpc.c

index 97c0158d612f26d53f48c006877d8729e165f1b5..1c89ffcd5e519c087e33afebf3810ed6b5a35328 100644 (file)
@@ -5129,6 +5129,7 @@ static void show_userlist(struct rpc_pipe_client *pipe_hnd,
        WERROR result;
        NTSTATUS status;
        struct smbXcli_tcon *orig_tcon = NULL;
+       char *orig_share = NULL;
        struct dcerpc_binding_handle *b = pipe_hnd->binding_handle;
 
        status = dcerpc_srvsvc_NetShareGetInfo(b, mem_ctx,
@@ -5151,14 +5152,11 @@ static void show_userlist(struct rpc_pipe_client *pipe_hnd,
        }
 
        if (cli_state_has_tcon(cli)) {
-               orig_tcon = cli_state_save_tcon(cli);
-               if (orig_tcon == NULL) {
-                       return;
-               }
+               cli_state_save_tcon_share(cli, &orig_tcon, &orig_share);
        }
 
        if (!NT_STATUS_IS_OK(cli_tree_connect(cli, netname, "A:", NULL))) {
-               cli_state_restore_tcon(cli, orig_tcon);
+               cli_state_restore_tcon_share(cli, orig_tcon, orig_share);
                return;
        }
 
@@ -5201,7 +5199,7 @@ static void show_userlist(struct rpc_pipe_client *pipe_hnd,
        if (fnum != (uint16_t)-1)
                cli_close(cli, fnum);
        cli_tdis(cli);
-       cli_state_restore_tcon(cli, orig_tcon);
+       cli_state_restore_tcon_share(cli, orig_tcon, orig_share);
 
        return;
 }