summaryrefslogtreecommitdiff
path: root/source3/utils/smbcacls.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2017-06-13 16:56:48 -0700
committerJeremy Allison <jra@samba.org>2017-06-17 06:39:20 +0200
commitbd31d538a26bb21cbb53986a6105204da4392e2d (patch)
tree6f1b45bc00504c92b93168cefe05ed90970480a1 /source3/utils/smbcacls.c
parent50f50256aa8805921c42d0f9f2f8f89d06d9bd93 (diff)
downloadsamba-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/utils/smbcacls.c')
-rw-r--r--source3/utils/smbcacls.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index 11289e69e43..86b4591d365 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -51,12 +51,20 @@ static NTSTATUS cli_lsa_lookup_domain_sid(struct cli_state *cli,
struct dom_sid *sid)
{
union lsa_PolicyInformation *info = NULL;
- uint16_t orig_cnum = cli_state_get_tid(cli);
+ struct smbXcli_tcon *orig_tcon = NULL;
struct rpc_pipe_client *rpc_pipe = NULL;
struct policy_handle handle;
NTSTATUS status, result;
TALLOC_CTX *frame = talloc_stackframe();
+ if (cli_state_has_tcon(cli)) {
+ orig_tcon = cli_state_save_tcon(cli);
+ if (orig_tcon == NULL) {
+ status = NT_STATUS_NO_MEMORY;
+ goto done;
+ }
+ }
+
status = cli_tree_connect(cli, "IPC$", "?????", NULL);
if (!NT_STATUS_IS_OK(status)) {
goto done;
@@ -88,7 +96,7 @@ tdis:
TALLOC_FREE(rpc_pipe);
cli_tdis(cli);
done:
- cli_state_set_tid(cli, orig_cnum);
+ cli_state_restore_tcon(cli, orig_tcon);
TALLOC_FREE(frame);
return status;
}