From 66d1b4ce3a458151c6db846a3dafcdb4d36bc026 Mon Sep 17 00:00:00 2001 From: Peter Somogyi Date: Mon, 28 Aug 2017 15:24:39 +0200 Subject: [PATCH] s4/torture: make --unclist active with smb2 testcases BUG: https://bugzilla.samba.org/show_bug.cgi?id=12985 Signed-off-by: Peter Somogyi --- lib/torture/torture.h | 2 ++ source4/torture/smb2/util.c | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/lib/torture/torture.h b/lib/torture/torture.h index 6b373a9ca15..c0fbdb9081d 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 52a63dd962a..65090b0e8b7 100644 --- a/source4/torture/smb2/util.c +++ b/source4/torture/smb2/util.c @@ -33,6 +33,7 @@ #include "torture/torture.h" #include "torture/smb2/proto.h" +#include "source4/torture/util.h" /* @@ -385,6 +386,29 @@ 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); + TALLOC_CTX *mem_ctx = NULL; + bool ok; + + if (p != NULL) { + char *host2 = NULL; + char *share2 = NULL; + + mem_ctx = talloc_new(tctx); + if (mem_ctx == NULL) { + return false; + } + + ok = torture_get_conn_index(tctx->conn_index++, mem_ctx, tctx, + &host2, &share2); + if (!ok) { + TALLOC_FREE(mem_ctx); + return false; + } + + host = host2; + share = share2; + } status = smb2_connect_ext(tctx, host, @@ -402,8 +426,11 @@ 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)); + TALLOC_FREE(mem_ctx); return false; } + + TALLOC_FREE(mem_ctx); return true; } -- 2.14.1.342.g6490525c54-goog