summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2017-06-13 16:56:48 -0700
committerKarolin Seeger <kseeger@samba.org>2017-06-28 11:20:13 +0200
commitfad0c0da857b140932327962128e071eba965b9a (patch)
tree392d8c01168ad521b082904328f0f25917d6c37b /source3/libsmb
parentd2a309b90e50d7d15175031dc5881ea722ed1317 (diff)
downloadsamba-fad0c0da857b140932327962128e071eba965b9a.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> (cherry picked from commit bd31d538a26bb21cbb53986a6105204da4392e2d)
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/clidfs.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c
index 1010e1b5c28..75012b28e87 100644
--- a/source3/libsmb/clidfs.c
+++ b/source3/libsmb/clidfs.c
@@ -1205,7 +1205,7 @@ bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
size_t consumed = 0;
char *fullpath = NULL;
bool res;
- uint32_t cnum;
+ struct smbXcli_tcon *orig_tcon = NULL;
char *newextrapath = NULL;
NTSTATUS status;
const char *remote_name;
@@ -1215,7 +1215,6 @@ bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
}
remote_name = smbXcli_conn_remote_name(cli->conn);
- cnum = cli_state_get_tid(cli);
/* special case. never check for a referral on the IPC$ share */
@@ -1230,15 +1229,25 @@ bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
return false;
}
+ /* Store tcon state. */
+ if (cli_state_has_tcon(cli)) {
+ orig_tcon = cli_state_save_tcon(cli);
+ if (orig_tcon == NULL) {
+ return false;
+ }
+ }
+
/* check for the referral */
if (!NT_STATUS_IS_OK(cli_tree_connect(cli, "IPC$", "IPC", NULL))) {
+ cli_state_restore_tcon(cli, orig_tcon);
return false;
}
if (force_encrypt) {
status = cli_cm_force_encryption_creds(cli, creds, "IPC$");
if (!NT_STATUS_IS_OK(status)) {
+ cli_state_restore_tcon(cli, orig_tcon);
return false;
}
}
@@ -1248,12 +1257,13 @@ bool cli_check_msdfs_proxy(TALLOC_CTX *ctx,
res = NT_STATUS_IS_OK(status);
status = cli_tdis(cli);
+
+ cli_state_restore_tcon(cli, orig_tcon);
+
if (!NT_STATUS_IS_OK(status)) {
return false;
}
- cli_state_set_tid(cli, cnum);
-
if (!res || !num_refs) {
return false;
}