From bfcbc9be612bf947f4238208b5a35a715ec36007 Mon Sep 17 00:00:00 2001 From: Jamie McClymont Date: Wed, 6 Dec 2017 12:49:48 +1300 Subject: [PATCH] selftest: fix samba3.rpc.samba3.netlogon running after an nt4_member test samba3.rpc.samba3.netlogon is using get_myname to find a username with which to perform a join. This means that the test tries to join with the existing localnt4dc2 user, which happens to work if get_myname is working correctly (which it isn't -- see next commit about NSS_WRAPPER_HOSTNAME!) This commit fixes a test run with, for example: TESTS="samba3.blackbox.smbclient_ntlm.plain samba3.rpc.samba3.netlogon" (given samba3.blackbox.smbclient_ntlm.plain is in the nt4_member env) ...which previously failed due to the combination of this and the NSS_WRAPPER_HOSTNAME bug. Signed-off-by: Jamie McClymont Reviewed-by: Garming Sam Reviewed-by: Andrew Bartlett --- source3/selftest/tests.py | 3 +++ source4/torture/rpc/samba3rpc.c | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py index 4bb37077ff7..d4e919de8f7 100755 --- a/source3/selftest/tests.py +++ b/source3/selftest/tests.py @@ -534,6 +534,9 @@ for t in tests: plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD') plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/aio -U$USERNAME%$PASSWORD', 'aio') plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD') + elif t == "rpc.samba3.netlogon" or t == "rpc.samba3.sessionkey": + plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD --option=torture:wksname=samba3rpctest') + plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD --option=torture:wksname=samba3rpctest') else: plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD') plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD') diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c index 54239d4812e..9cd479c9baf 100644 --- a/source4/torture/rpc/samba3rpc.c +++ b/source4/torture/rpc/samba3rpc.c @@ -1373,9 +1373,7 @@ static bool torture_netlogon_samba3(struct torture_context *torture) struct smbcli_session_options session_options; wks_name = torture_setting_string(torture, "wksname", NULL); - if (wks_name == NULL) { - wks_name = get_myname(torture); - } + torture_assert(torture, wks_name != NULL, "wksname not set"); lpcfg_smbcli_options(torture->lp_ctx, &options); lpcfg_smbcli_session_options(torture->lp_ctx, &session_options); @@ -1513,7 +1511,9 @@ static bool torture_samba3_sessionkey(struct torture_context *torture) struct cli_credentials *anon_creds; const char *wks_name; - wks_name = torture_setting_string(torture, "wksname", get_myname(torture)); + + wks_name = torture_setting_string(torture, "wksname", NULL); + torture_assert(torture, wks_name != NULL, "wksname not set"); if (!(anon_creds = cli_credentials_init_anon(torture))) { torture_fail(torture, "create_anon_creds failed\n"); -- 2.47.3