]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: libsmb: In cli_lsa_lookup_sid() replace cli_state_save_tcon()/cli_state_restore_t...
authorJeremy Allison <jra@samba.org>
Wed, 24 Aug 2022 00:18:16 +0000 (17:18 -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 2141eaf49ac726855a69b94b99211582595ab957..7439e261be1e2b72505e1c933e97aa7be1e55310 100644 (file)
@@ -87,6 +87,7 @@ static NTSTATUS cli_lsa_lookup_sid(struct cli_state *cli,
                                   char **domain, char **name)
 {
        struct smbXcli_tcon *orig_tcon = NULL;
+       char *orig_share = NULL;
        struct rpc_pipe_client *p = NULL;
        struct policy_handle handle;
        NTSTATUS status;
@@ -96,11 +97,7 @@ static NTSTATUS cli_lsa_lookup_sid(struct cli_state *cli,
        char **names;
 
        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);
@@ -135,7 +132,7 @@ static NTSTATUS cli_lsa_lookup_sid(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;
 }