diff options
author | Jeremy Allison <jra@samba.org> | 2017-06-13 16:56:48 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2017-06-17 06:39:20 +0200 |
commit | bd31d538a26bb21cbb53986a6105204da4392e2d (patch) | |
tree | 6f1b45bc00504c92b93168cefe05ed90970480a1 /source3/lib | |
parent | 50f50256aa8805921c42d0f9f2f8f89d06d9bd93 (diff) | |
download | samba-bd31d538a26bb21cbb53986a6105204da4392e2d.tar.gz |
s3: libsmb: Correctly save and restore connection tcon in smbclient, smbcacls and smbtorture3.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12831
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/util_sd.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/source3/lib/util_sd.c b/source3/lib/util_sd.c index a95cafd5f7a..aa6d4809fc8 100644 --- a/source3/lib/util_sd.c +++ b/source3/lib/util_sd.c @@ -84,7 +84,7 @@ static NTSTATUS cli_lsa_lookup_sid(struct cli_state *cli, enum lsa_SidType *type, char **domain, char **name) { - uint32_t orig_cnum = cli_state_get_tid(cli); + struct smbXcli_tcon *orig_tcon = NULL; struct rpc_pipe_client *p = NULL; struct policy_handle handle; NTSTATUS status; @@ -93,6 +93,14 @@ static NTSTATUS cli_lsa_lookup_sid(struct cli_state *cli, char **domains; 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; + } + } + status = cli_tree_connect(cli, "IPC$", "?????", NULL); if (!NT_STATUS_IS_OK(status)) { goto tcon_fail; @@ -125,7 +133,7 @@ static NTSTATUS cli_lsa_lookup_sid(struct cli_state *cli, TALLOC_FREE(p); cli_tdis(cli); tcon_fail: - cli_state_set_tid(cli, orig_cnum); + cli_state_restore_tcon(cli, orig_tcon); TALLOC_FREE(frame); return status; } @@ -165,7 +173,7 @@ static NTSTATUS cli_lsa_lookup_name(struct cli_state *cli, enum lsa_SidType *type, struct dom_sid *sid) { - uint32_t orig_cnum = cli_state_get_tid(cli); + struct smbXcli_tcon *orig_tcon = NULL; struct rpc_pipe_client *p; struct policy_handle handle; NTSTATUS status; @@ -173,6 +181,14 @@ static NTSTATUS cli_lsa_lookup_name(struct cli_state *cli, struct dom_sid *sids; 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; + } + } + status = cli_tree_connect(cli, "IPC$", "?????", NULL); if (!NT_STATUS_IS_OK(status)) { goto tcon_fail; @@ -204,7 +220,7 @@ static NTSTATUS cli_lsa_lookup_name(struct cli_state *cli, TALLOC_FREE(p); cli_tdis(cli); tcon_fail: - cli_state_set_tid(cli, orig_cnum); + cli_state_restore_tcon(cli, orig_tcon); TALLOC_FREE(frame); return status; } |