From 3d626299ed596384f18759a66dcce0249db4dac1 Mon Sep 17 00:00:00 2001 From: Peter Somogyi Date: Mon, 21 Aug 2017 14:19:44 +0200 Subject: [PATCH] s4/torture: make --unclist active with smb2 testcases Signed-off-by: Peter Somogyi --- lib/torture/torture.h | 2 ++ source4/torture/smb2/util.c | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/torture/torture.h b/lib/torture/torture.h index 6b373a9..b4c53ad 100644 --- a/lib/torture/torture.h +++ b/lib/torture/torture.h @@ -101,6 +101,8 @@ struct torture_context /** Loadparm context (will go away in favor of torture_setting_ at some point) */ struct loadparm_context *lp_ctx; + + int conn_index; }; struct torture_results diff --git a/source4/torture/smb2/util.c b/source4/torture/smb2/util.c index 52a63dd..bfa642c 100644 --- a/source4/torture/smb2/util.c +++ b/source4/torture/smb2/util.c @@ -385,6 +385,14 @@ bool torture_smb2_connection_ext(struct torture_context *tctx, NTSTATUS status; const char *host = torture_setting_string(tctx, "host", NULL); const char *share = torture_setting_string(tctx, "share", NULL); + const char *p = torture_setting_string(tctx, "unclist", NULL); + bool ret = true; + + if (p != NULL) { + if (!torture_get_conn_index(tctx->conn_index++, tctx, tctx, + &host, &share)) + return false; + } status = smb2_connect_ext(tctx, host, @@ -402,9 +410,15 @@ bool torture_smb2_connection_ext(struct torture_context *tctx, if (!NT_STATUS_IS_OK(status)) { torture_comment(tctx, "Failed to connect to SMB2 share \\\\%s\\%s - %s\n", host, share, nt_errstr(status)); - return false; + ret = false; } - return true; + + if (p != NULL) { + talloc_free((void *)host); + talloc_free((void *)share); + } + + return ret; } bool torture_smb2_connection(struct torture_context *tctx, struct smb2_tree **tree) -- 1.7.1