selftest: fix samba3.rpc.samba3.netlogon running after an nt4_member test
authorJamie McClymont <jamiemcclymont@catalyst.net.nz>
Tue, 5 Dec 2017 23:49:48 +0000 (12:49 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 20 Dec 2017 03:22:10 +0000 (04:22 +0100)
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 <jamiemcclymont@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/selftest/tests.py
source4/torture/rpc/samba3rpc.c

index 4bb37077ff7147421ae97ce1a8d2bbfaeade6b53..d4e919de8f77515e1c621bad31f39269402d274c 100755 (executable)
@@ -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')
index 54239d4812e5d143b6c1fd4b8d3e88a9dddd35a2..9cd479c9baf310c3ff5d63d022dba648c642ef03 100644 (file)
@@ -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");