summaryrefslogtreecommitdiff
path: root/source3/torture
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/torture
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/torture')
-rw-r--r--source3/torture/torture.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index d7daffa20bc..6b6dbdf1f09 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -1302,6 +1302,7 @@ static bool run_tcon_test(int dummy)
const char *fname = "\\tcontest.tmp";
uint16_t fnum1;
uint32_t cnum1, cnum2, cnum3;
+ struct smbXcli_tcon *orig_tcon = NULL;
uint16_t vuid1, vuid2;
char buf[4];
bool ret = True;
@@ -1333,6 +1334,11 @@ static bool run_tcon_test(int dummy)
return False;
}
+ orig_tcon = cli_state_save_tcon(cli);
+ if (orig_tcon == NULL) {
+ return false;
+ }
+
status = cli_tree_connect_creds(cli, share, "?????", torture_creds);
if (!NT_STATUS_IS_OK(status)) {
printf("%s refused 2nd tree connect (%s)\n", host,
@@ -1400,6 +1406,8 @@ static bool run_tcon_test(int dummy)
return False;
}
+ cli_state_restore_tcon(cli, orig_tcon);
+
cli_state_set_tid(cli, cnum1);
if (!torture_close_connection(cli)) {
@@ -9017,6 +9025,7 @@ static bool run_uid_regression_test(int dummy)
int16_t old_vuid;
int32_t old_cnum;
bool correct = True;
+ struct smbXcli_tcon *orig_tcon = NULL;
NTSTATUS status;
printf("starting uid regression test\n");
@@ -9057,6 +9066,11 @@ static bool run_uid_regression_test(int dummy)
}
old_cnum = cli_state_get_tid(cli);
+ orig_tcon = cli_state_save_tcon(cli);
+ if (orig_tcon == NULL) {
+ correct = false;
+ goto out;
+ }
/* Now try a SMBtdis with the invald vuid set to zero. */
cli_state_set_uid(cli, 0);
@@ -9069,9 +9083,11 @@ static bool run_uid_regression_test(int dummy)
} else {
d_printf("First tdis failed (%s)\n", nt_errstr(status));
correct = false;
+ cli_state_restore_tcon(cli, orig_tcon);
goto out;
}
+ cli_state_restore_tcon(cli, orig_tcon);
cli_state_set_uid(cli, old_vuid);
cli_state_set_tid(cli, old_cnum);