From: Jeremy Allison Date: Thu, 28 Jan 2021 18:56:18 +0000 (-0800) Subject: s3: smbtorture3: Ensure run_tcon_test() always replaces any saved tcon and shuts... X-Git-Tag: tevent-0.11.0~1842 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f9ca91bd293e9f2710c4449c5d4f5d016a066049;p=thirdparty%2Fsamba.git s3: smbtorture3: Ensure run_tcon_test() always replaces any saved tcon and shuts down correctly even in error paths. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13992 Signed-off-by: Jeremy Allison Reviewed-by: Andreas Schneider --- diff --git a/source3/torture/torture.c b/source3/torture/torture.c index cdf5d5ca3aa..4f572902494 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -1347,6 +1347,7 @@ static bool run_tcon_test(int dummy) if (!NT_STATUS_IS_OK(status)) { printf("%s refused 2nd tree connect (%s)\n", host, nt_errstr(status)); + cli_state_restore_tcon(cli, orig_tcon); cli_shutdown(cli); return False; } @@ -1399,6 +1400,8 @@ static bool run_tcon_test(int dummy) status = cli_close(cli, fnum1); if (!NT_STATUS_IS_OK(status)) { printf("close failed (%s)\n", nt_errstr(status)); + cli_state_restore_tcon(cli, orig_tcon); + cli_shutdown(cli); return False; } @@ -1407,6 +1410,8 @@ static bool run_tcon_test(int dummy) status = cli_tdis(cli); if (!NT_STATUS_IS_OK(status)) { printf("secondary tdis failed (%s)\n", nt_errstr(status)); + cli_state_restore_tcon(cli, orig_tcon); + cli_shutdown(cli); return False; }