]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: libsmb: In cli_lsa_lookup_name() replace cli_state_save_tcon()/cli_state_restore_...
authorJeremy Allison <jra@samba.org>
Wed, 24 Aug 2022 00:25:40 +0000 (17:25 -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/lib/util_sd.c

index 7439e261be1e2b72505e1c933e97aa7be1e55310..a4288a46f3d982f0f55ac99f9442ce3314cca21a 100644 (file)
@@ -173,6 +173,7 @@ static NTSTATUS cli_lsa_lookup_name(struct cli_state *cli,
                                    struct dom_sid *sid)
 {
        struct smbXcli_tcon *orig_tcon = NULL;
+       char *orig_share = NULL;
        struct rpc_pipe_client *p = NULL;
        struct policy_handle handle;
        NTSTATUS status;
@@ -181,11 +182,7 @@ static NTSTATUS cli_lsa_lookup_name(struct cli_state *cli,
        enum lsa_SidType *types;
 
        if (cli_state_has_tcon(cli)) {
-               orig_tcon = cli_state_save_tcon(cli);
-               if (orig_tcon == NULL) {
-                       status = NT_STATUS_NO_MEMORY;
-                       goto tcon_fail;
-               }
+               cli_state_save_tcon_share(cli, &orig_tcon, &orig_share);
        }
 
        status = cli_tree_connect(cli, "IPC$", "?????", NULL);
@@ -219,7 +216,7 @@ static NTSTATUS cli_lsa_lookup_name(struct cli_state *cli,
        TALLOC_FREE(p);
        cli_tdis(cli);
  tcon_fail:
-       cli_state_restore_tcon(cli, orig_tcon);
+       cli_state_restore_tcon_share(cli, orig_tcon, orig_share);
        TALLOC_FREE(frame);
        return status;
 }