selftest: don't hardcode '.python3' for extra-python tests
[bbaumbach/samba-autobuild/.git] / source4 / selftest / tests.py
1 #!/usr/bin/python
2 # This script generates a list of testsuites that should be run as part of
3 # the Samba 4 test suite.
4
5 # The output of this script is parsed by selftest.pl, which then decides
6 # which of the tests to actually run. It will, for example, skip all tests
7 # listed in selftest/skip or only run a subset during "make quicktest".
8
9 # The idea is that this script outputs all of the tests of Samba 4, not
10 # just those that are known to pass, and list those that should be skipped
11 # or are known to fail in selftest/skip or selftest/knownfail. This makes it
12 # very easy to see what functionality is still missing in Samba 4 and makes
13 # it possible to run the testsuite against other servers, such as Samba 3 or
14 # Windows that have a different set of features.
15
16 # The syntax for a testsuite is "-- TEST --" on a single line, followed
17 # by the name of the test, the environment it needs and the command to run, all
18 # three separated by newlines. All other lines in the output are considered
19 # comments.
20 from __future__ import print_function
21
22 import os
23 import sys
24 sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../../selftest"))
25 import selftesthelpers
26 from selftesthelpers import bindir, srcdir, binpath, python
27 from selftesthelpers import configuration, plantestsuite
28 from selftesthelpers import planpythontestsuite, planperltestsuite
29 from selftesthelpers import plantestsuite_loadlist, extra_python
30 from selftesthelpers import skiptestsuite, source4dir, valgrindify
31 from selftesthelpers import smbtorture4_options, smbtorture4_testsuites
32 from selftesthelpers import smbtorture4, ntlm_auth3, samba3srcdir
33
34
35 print("OPTIONS %s" % " ".join(smbtorture4_options), file=sys.stderr)
36
37
38 def plansmbtorture4testsuite(name, env, options, modname=None):
39     return selftesthelpers.plansmbtorture4testsuite(name, env, options,
40                                                     target='samba4', modname=modname)
41
42
43 samba4srcdir = source4dir()
44 samba4bindir = bindir()
45 validate = os.getenv("VALIDATE", "")
46 if validate:
47     validate_list = [validate]
48 else:
49     validate_list = []
50
51 nmblookup4 = binpath('nmblookup4')
52 smbclient4 = binpath('smbclient4')
53
54 bbdir = os.path.join(srcdir(), "testprogs/blackbox")
55
56 # alias to highlight what tests we want to run against a DC with SMBv1 disabled
57 smbv1_disabled_testenv = "restoredc"
58
59 # Simple tests for LDAP and CLDAP
60 for auth_type in ['', '-k no', '-k yes']:
61     for auth_level in ['--option=clientldapsaslwrapping=plain', '--sign', '--encrypt']:
62         creds = '-U"$USERNAME%$PASSWORD"'
63         options = creds + ' ' + auth_type + ' ' + auth_level
64         plantestsuite("samba4.ldb.ldap with options %r(ad_dc_ntvfs)" % options, "ad_dc_ntvfs", "%s/test_ldb.sh ldap $SERVER %s" % (bbdir, options))
65
66 # see if we support ADS on the Samba3 side
67 try:
68     config_h = os.environ["CONFIG_H"]
69 except KeyError:
70     config_h = os.path.join(samba4bindir, "default/include/config.h")
71
72 # check available features
73 config_hash = dict()
74 f = open(config_h, 'r')
75 try:
76     lines = f.readlines()
77     config_hash = dict((x[0], ' '.join(x[1:]))
78                        for x in map(lambda line: line.strip().split(' ')[1:],
79                                     list(filter(lambda line: (line[0:7] == '#define') and (len(line.split(' ')) > 2), lines))))
80 finally:
81     f.close()
82
83 have_heimdal_support = ("SAMBA4_USES_HEIMDAL" in config_hash)
84
85 for options in ['-U"$USERNAME%$PASSWORD"']:
86     plantestsuite("samba4.ldb.ldaps with options %s(ad_dc_ntvfs)" % options, "ad_dc_ntvfs",
87                   "%s/test_ldb.sh ldaps $SERVER_IP %s" % (bbdir, options))
88
89 creds_options = [
90     '--simple-bind-dn=$USERNAME@$REALM --password=$PASSWORD',
91 ]
92 peer_options = {
93     'SERVER_IP': '$SERVER_IP',
94     'SERVER_NAME': '$SERVER',
95     'SERVER.REALM': '$SERVER.$REALM',
96 }
97 tls_verify_options = [
98     '--option="tlsverifypeer=no_check"',
99     '--option="tlsverifypeer=ca_only"',
100     '--option="tlsverifypeer=ca_and_name_if_available"',
101     '--option="tlsverifypeer=ca_and_name"',
102     '--option="tlsverifypeer=as_strict_as_possible"',
103 ]
104
105 # we use :local for fl2008r2dc because of the self-signed certificate
106 for env in ["ad_dc_ntvfs", "fl2008r2dc:local"]:
107     for peer_key in peer_options.keys():
108         peer_val = peer_options[peer_key]
109         for creds in creds_options:
110             for tls_verify in tls_verify_options:
111                 options = creds + ' ' + tls_verify
112                 plantestsuite("samba4.ldb.simple.ldaps with options %s %s(%s)" % (
113                               peer_key, options, env), env,
114                               "%s/test_ldb_simple.sh ldaps %s %s" % (bbdir, peer_val, options))
115
116 # test all "ldap server require strong auth" combinations
117 for env in ["ad_dc_ntvfs", "fl2008r2dc", "fl2003dc"]:
118     options = '--simple-bind-dn="$USERNAME@$REALM" --password="$PASSWORD"'
119     plantestsuite("samba4.ldb.simple.ldap with SIMPLE-BIND %s(%s)" % (options, env),
120                   env, "%s/test_ldb_simple.sh ldap $SERVER %s" % (bbdir, options))
121     options += ' --option="tlsverifypeer=no_check"'
122     plantestsuite("samba4.ldb.simple.ldaps with SIMPLE-BIND %s(%s)" % (options, env),
123                   env, "%s/test_ldb_simple.sh ldaps $SERVER %s" % (bbdir, options))
124
125     auth_options = [
126         '--option=clientldapsaslwrapping=plain',
127         '--sign',
128         '--encrypt',
129         '-k yes --option=clientldapsaslwrapping=plain',
130         '-k yes --sign',
131         '-k yes --encrypt',
132         '-k no --option=clientldapsaslwrapping=plain',
133         '-k no --sign --option=ntlmssp_client:ldap_style_send_seal=no',
134         '-k no --sign',
135         '-k no --encrypt',
136     ]
137
138     for auth_option in auth_options:
139         options = '-U"$USERNAME%$PASSWORD"' + ' ' + auth_option
140         plantestsuite("samba4.ldb.simple.ldap with SASL-BIND %s(%s)" % (options, env),
141                       env, "%s/test_ldb_simple.sh ldap $SERVER %s" % (bbdir, options))
142     options = '-U"$USERNAME%$PASSWORD" --option="tlsverifypeer=no_check"'
143     plantestsuite("samba4.ldb.simple.ldaps with SASL-BIND %s(%s)" % (options, env),
144                   env, "%s/test_ldb_simple.sh ldaps $SERVER %s" % (bbdir, options))
145
146 for options in ['-U"$USERNAME%$PASSWORD"']:
147     plantestsuite("samba4.ldb.ldapi with options %s(ad_dc_ntvfs:local)" % options, "ad_dc_ntvfs:local",
148                   "%s/test_ldb.sh ldapi $PREFIX_ABS/ad_dc_ntvfs/private/ldapi %s" % (bbdir, options))
149
150 for t in smbtorture4_testsuites("ldap."):
151     plansmbtorture4testsuite(t, "ad_dc_ntvfs", '-U"$USERNAME%$PASSWORD" //$SERVER_IP/_none_')
152
153 ldbdir = os.path.join(srcdir(), "lib/ldb")
154 # Don't run LDB tests when using system ldb, as we won't have ldbtest installed
155 if os.path.exists(os.path.join(samba4bindir, "ldbtest")):
156     plantestsuite("ldb.base", "none", "%s/tests/test-tdb-subunit.sh %s" % (ldbdir, samba4bindir))
157 else:
158     skiptestsuite("ldb.base", "Using system LDB, ldbtest not available")
159
160 plantestsuite_loadlist("samba4.tests.attr_from_server.python(ad_dc_ntvfs)",
161                        "ad_dc_ntvfs:local",
162                        [python, os.path.join(samba4srcdir, "dsdb/tests/python/attr_from_server.py"),
163                         '$PREFIX_ABS/ad_dc_ntvfs/private/sam.ldb', '$LOADLIST', '$LISTOPT'])
164
165 # Tests for RPC
166
167 # add tests to this list as they start passing, so we test
168 # that they stay passing
169 ncacn_np_tests = ["rpc.schannel", "rpc.join", "rpc.lsa", "rpc.dssetup", "rpc.altercontext", "rpc.netlogon", "rpc.netlogon.admin", "rpc.handles", "rpc.samsync", "rpc.samba3-sessionkey", "rpc.samba3-getusername", "rpc.samba3-lsa", "rpc.samba3-bind", "rpc.samba3-netlogon", "rpc.asyncbind", "rpc.lsalookup", "rpc.lsa-getuser", "rpc.schannel2", "rpc.authcontext"]
170 ncalrpc_tests = ["rpc.schannel", "rpc.join", "rpc.lsa", "rpc.dssetup", "rpc.altercontext", "rpc.netlogon", "rpc.netlogon.admin", "rpc.asyncbind", "rpc.lsalookup", "rpc.lsa-getuser", "rpc.schannel2", "rpc.authcontext"]
171 drs_rpc_tests = smbtorture4_testsuites("drs.rpc")
172 ncacn_ip_tcp_tests = ["rpc.schannel", "rpc.join", "rpc.lsa", "rpc.dssetup", "rpc.drsuapi", "rpc.drsuapi_w2k8", "rpc.netlogon", "rpc.netlogon.admin", "rpc.asyncbind", "rpc.lsalookup", "rpc.lsa-getuser", "rpc.schannel2", "rpc.authcontext", "rpc.samr.passwords.validate"] + drs_rpc_tests
173 slow_ncacn_np_tests = ["rpc.samlogon", "rpc.samr", "rpc.samr.users", "rpc.samr.large-dc", "rpc.samr.users.privileges", "rpc.samr.passwords", "rpc.samr.passwords.pwdlastset", "rpc.samr.passwords.lockout", "rpc.samr.passwords.badpwdcount"]
174 slow_ncacn_ip_tcp_tests = ["rpc.cracknames"]
175
176 all_rpc_tests = ncalrpc_tests + ncacn_np_tests + ncacn_ip_tcp_tests + slow_ncacn_np_tests + slow_ncacn_ip_tcp_tests + ["rpc.lsa.secrets", "rpc.pac", "rpc.samba3-sharesec", "rpc.countcalls"]
177
178 # Make sure all tests get run
179 rpc_tests = smbtorture4_testsuites("rpc.")
180 auto_rpc_tests = list(filter(lambda t: t not in all_rpc_tests, rpc_tests))
181
182 for bindoptions in ["seal,padcheck"] + validate_list + ["bigendian"]:
183     for transport in ["ncalrpc", "ncacn_np", "ncacn_ip_tcp"]:
184         env = "ad_dc_ntvfs"
185         if transport == "ncalrpc":
186             tests = ncalrpc_tests
187             env = "ad_dc_ntvfs:local"
188         elif transport == "ncacn_np":
189             tests = ncacn_np_tests
190         elif transport == "ncacn_ip_tcp":
191             tests = ncacn_ip_tcp_tests
192         else:
193             raise AssertionError("invalid transport %r" % transport)
194         for t in tests:
195             plansmbtorture4testsuite(t, env, ["%s:$SERVER[%s]" % (transport, bindoptions), '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], "samba4.%s on %s with %s" % (t, transport, bindoptions))
196         plansmbtorture4testsuite('rpc.samba3-sharesec', env, ["%s:$SERVER[%s]" % (transport, bindoptions), '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN', '--option=torture:share=tmp'], "samba4.rpc.samba3.sharesec on %s with %s" % (transport, bindoptions))
197
198 # Plugin S4 DC tests (confirms named pipe auth forwarding).  This can be expanded once kerberos is supported in the plugin DC
199 #
200 for bindoptions in ["seal,padcheck"] + validate_list + ["bigendian"]:
201     for t in ncacn_np_tests:
202         env = "ad_dc"
203         transport = "ncacn_np"
204         plansmbtorture4testsuite(t, env, ["%s:$SERVER[%s]" % (transport, bindoptions), '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], "samba4.%s with %s" % (t, bindoptions))
205
206 for bindoptions in [""] + validate_list + ["bigendian"]:
207     for t in auto_rpc_tests:
208         plansmbtorture4testsuite(t, "ad_dc_ntvfs", ["$SERVER[%s]" % bindoptions, '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], "samba4.%s with %s" % (t, bindoptions))
209
210 t = "rpc.countcalls"
211 plansmbtorture4testsuite(t, "ad_dc_ntvfs:local", ["$SERVER[%s]" % bindoptions, '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], modname="samba4.%s" % t)
212
213 for transport in ["ncacn_np", "ncacn_ip_tcp"]:
214     env = "ad_dc_ntvfs"
215     if transport == "ncacn_np":
216         tests = slow_ncacn_np_tests
217     elif transport == "ncacn_ip_tcp":
218         tests = slow_ncacn_ip_tcp_tests
219     else:
220         raise AssertionError("Invalid transport %r" % transport)
221     for t in tests:
222         bindoptions = ''
223         if t == 'rpc.cracknames':
224             bindoptions = 'seal'
225         plansmbtorture4testsuite(t, env, ["%s:$SERVER[%s]" % (transport, bindoptions), '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], "samba4.%s on %s with %s" % (t, transport, bindoptions))
226
227 # Tests for the DFS referral calls implementation
228 for t in smbtorture4_testsuites("dfs."):
229     plansmbtorture4testsuite(t, "ad_dc_ntvfs", '//$SERVER/ipc\$ -U$USERNAME%$PASSWORD')
230     plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/ipc\$ -U$USERNAME%$PASSWORD')
231
232 # Tests for the NET API (net.api.become.dc tested below against all the roles)
233 net_tests = list(filter(lambda x: "net.api.become.dc" not in x, smbtorture4_testsuites("net.")))
234 for t in net_tests:
235     plansmbtorture4testsuite(t, "ad_dc_ntvfs", '$SERVER[%s] -U$USERNAME%%$PASSWORD -W$DOMAIN' % validate)
236
237 # Tests for session keys and encryption of RPC pipes
238 # FIXME: Integrate these into a single smbtorture test
239
240 transport = "ncacn_np"
241 for env in ["ad_dc_ntvfs", "nt4_dc"]:
242     for ntlmoptions in [
243         "-k no --option=clientusespnego=yes",
244         "-k no --option=clientusespnego=yes --option=ntlmssp_client:128bit=no",
245         "-k no --option=clientusespnego=yes --option=ntlmssp_client:56bit=yes",
246         "-k no --option=clientusespnego=yes --option=ntlmssp_client:56bit=no",
247         "-k no --option=clientusespnego=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:56bit=yes",
248         "-k no --option=clientusespnego=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:56bit=no",
249         "-k no --option=clientusespnego=yes --option=clientntlmv2auth=yes",
250         "-k no --option=clientusespnego=yes --option=clientntlmv2auth=yes --option=ntlmssp_client:128bit=no",
251         "-k no --option=clientusespnego=yes --option=clientntlmv2auth=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:56bit=yes",
252         "-k no --option=clientusespnego=no --option=clientntlmv2auth=yes",
253         "-k no --option=gensec:spnego=no --option=clientntlmv2auth=yes",
254         "-k no --option=clientusespnego=no"]:
255         name = "rpc.lsa.secrets on %s with with %s" % (transport, ntlmoptions)
256         plansmbtorture4testsuite('rpc.lsa.secrets', env, ["%s:$SERVER[]" % (transport), ntlmoptions, '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN', '--option=gensec:target_hostname=$NETBIOSNAME'], "samba4.%s" % name)
257     plantestsuite("samba.blackbox.pdbtest(%s)" % env, "%s:local" % env, [os.path.join(bbdir, "test_pdbtest.sh"), '$SERVER', "$PREFIX", "pdbtest", smbclient4, '$SMB_CONF_PATH', configuration])
258
259 gpo = smbtorture4_testsuites("gpo.")
260 for t in gpo:
261     plansmbtorture4testsuite(t, 'ad_dc:local', ['//$SERVER/sysvol', '-U$USERNAME%$PASSWORD'])
262
263 transports = ["ncacn_np", "ncacn_ip_tcp"]
264
265 # Kerberos varies between functional levels, so it is important to check this on all of them
266 for env in ["ad_dc_ntvfs", "fl2000dc", "fl2003dc", "fl2008r2dc", "ad_dc"]:
267     transport = "ncacn_np"
268     plansmbtorture4testsuite('rpc.pac', env, ["%s:$SERVER[]" % (transport, ), '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], "samba4.rpc.pac on %s" % (transport,))
269     plansmbtorture4testsuite('rpc.lsa.secrets', env, ["%s:$SERVER[]" % (transport, ), '-k', 'yes', '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN', '--option=gensec:target_hostname=$NETBIOSNAME', 'rpc.lsa.secrets'], "samba4.rpc.lsa.secrets on %s with Kerberos" % (transport,))
270     plansmbtorture4testsuite('rpc.lsa.secrets', env, ["%s:$SERVER[]" % (transport, ), '-k', 'yes', '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN', "--option=clientusespnegoprincipal=yes", '--option=gensec:target_hostname=$NETBIOSNAME'], "samba4.rpc.lsa.secrets on %s with Kerberos - use target principal" % (transport,))
271     plansmbtorture4testsuite('rpc.lsa.secrets', env, ["%s:$SERVER[target_principal=dcom/$NETBIOSNAME]" % (transport, ), '-k', 'yes', '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], "samba4.rpc.lsa.secrets on %s with Kerberos - netbios name principal dcom" % (transport,))
272     plansmbtorture4testsuite('rpc.lsa.secrets', env, ["%s:$SERVER[target_principal=$NETBIOSNAME\$]" % (transport, ), '-k', 'yes', '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], "samba4.rpc.lsa.secrets on %s with Kerberos - netbios name principal dollar" % (transport,))
273     plansmbtorture4testsuite('rpc.lsa.secrets', env, ["%s:$SERVER[target_principal=$NETBIOSNAME]" % (transport, ), '-k', 'yes', '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], "samba4.rpc.lsa.secrets on %s with Kerberos - netbios name principal" % (transport,))
274     plansmbtorture4testsuite('rpc.lsa.secrets.none*', env, ["%s:$SERVER" % transport, '-k', 'yes', '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN', "--option=gensec:fake_gssapi_krb5=yes", '--option=gensec:gssapi_krb5=no', '--option=gensec:target_hostname=$NETBIOSNAME'], "samba4.rpc.lsa.secrets on %s with Kerberos - use Samba3 style login" % transport)
275     plansmbtorture4testsuite('rpc.lsa.secrets.none*', env, ["%s:$SERVER" % transport, '-k', 'yes', '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN', "--option=gensec:fake_gssapi_krb5=yes", '--option=gensec:gssapi_krb5=no', '--option=gensec:target_hostname=$NETBIOSNAME', '--option=gensec_krb5:send_authenticator_checksum=false'], "samba4.rpc.lsa.secrets on %s with Kerberos - use raw-krb5-no-authenticator-checksum style login" % transport)
276     plansmbtorture4testsuite('rpc.lsa.secrets.none*', env, ["%s:$SERVER" % transport, '-k', 'yes', '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN', "--option=clientusespnegoprincipal=yes", '--option=gensec:fake_gssapi_krb5=yes', '--option=gensec:gssapi_krb5=no', '--option=gensec:target_hostname=$NETBIOSNAME'], "samba4.rpc.lsa.secrets on %s with Kerberos - use Samba3 style login, use target principal" % transport)
277
278     # Winreg tests test bulk Kerberos encryption of DCE/RPC
279     # We test rpc.winreg here too, because the winreg interface if
280     # handled by the source3/rpc_server code.
281     for bindoptions in ["connect", "packet", "krb5", "krb5,packet", "krb5,sign", "krb5,seal", "spnego", "spnego,packet", "spnego,sign", "spnego,seal"]:
282         plansmbtorture4testsuite('rpc.winreg', env, ["%s:$SERVER[%s]" % (transport, bindoptions), '-k', 'yes', '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], "samba4.rpc.winreg on %s with %s" % (transport, bindoptions))
283
284     for transport in transports:
285         plansmbtorture4testsuite('rpc.echo', env, ["%s:$SERVER[]" % (transport,), '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], "samba4.rpc.echo on %s" % (transport, ))
286
287         # Echo tests test bulk Kerberos encryption of DCE/RPC
288         for bindoptions in ["connect", "krb5", "krb5,sign", "krb5,seal", "spnego", "spnego,sign", "spnego,seal"] + validate_list + ["padcheck", "bigendian", "bigendian,seal"]:
289             echooptions = "--option=socket:testnonblock=True --option=torture:quick=yes -k yes"
290             plansmbtorture4testsuite('rpc.echo', env, ["%s:$SERVER[%s]" % (transport, bindoptions), echooptions, '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], "samba4.rpc.echo on %s with %s and %s" % (transport, bindoptions, echooptions))
291
292 for env in ["fl2000dc", "fl2008r2dc"]:
293     plansmbtorture4testsuite("net.api.become.dc", env, '$SERVER[%s] -U$USERNAME%%$PASSWORD -W$DOMAIN' % validate)
294
295 for bindoptions in ["sign", "seal"]:
296     plansmbtorture4testsuite('rpc.backupkey', "ad_dc_ntvfs", ["ncacn_np:$SERVER[%s]" % (bindoptions), '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], "samba4.rpc.backupkey with %s" % (bindoptions))
297
298 for transport in transports:
299     for bindoptions in ["sign", "seal"]:
300         for ntlmoptions in [
301             "--option=ntlmssp_client:ntlm2=yes --option=torture:quick=yes",
302             "--option=ntlmssp_client:ntlm2=no --option=torture:quick=yes",
303             "--option=ntlmssp_client:ntlm2=yes --option=ntlmssp_client:128bit=no --option=torture:quick=yes",
304             "--option=ntlmssp_client:ntlm2=no --option=ntlmssp_client:128bit=no --option=torture:quick=yes",
305             "--option=ntlmssp_client:ntlm2=yes --option=ntlmssp_client:keyexchange=no --option=torture:quick=yes",
306             "--option=ntlmssp_client:ntlm2=no --option=ntlmssp_client:keyexchange=no --option=torture:quick=yes",
307             "--option=clientntlmv2auth=yes --option=ntlmssp_client:keyexchange=no --option=torture:quick=yes",
308             "--option=clientntlmv2auth=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:keyexchange=yes --option=torture:quick=yes",
309             "--option=clientntlmv2auth=yes --option=ntlmssp_client:128bit=no --option=ntlmssp_client:keyexchange=no --option=torture:quick=yes"]:
310             if transport == "ncalrpc":
311                 env = "ad_dc_ntvfs:local"
312             else:
313                 env = "ad_dc_ntvfs"
314             plansmbtorture4testsuite('rpc.echo', env, ["%s:$SERVER[%s]" % (transport, bindoptions), ntlmoptions, '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], "samba4.rpc.echo on %s with %s and %s" % (transport, bindoptions, ntlmoptions))
315
316 plansmbtorture4testsuite('rpc.echo', "ad_dc_ntvfs", ['ncacn_np:$SERVER[smb2]', '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], "samba4.rpc.echo on ncacn_np over smb2")
317 for env in ["ad_dc", "nt4_dc"]:
318     plansmbtorture4testsuite('rpc.echo', env, ['60a15ec5-4de8-11d7-a637-005056a20182@ncacn_np:$SERVER[]', '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN', '--option=torture:quick=yes'], "samba4.rpc.echo on ncacn_np with object")
319     plansmbtorture4testsuite('rpc.echo', env, ['60a15ec5-4de8-11d7-a637-005056a20182@ncacn_ip_tcp:$SERVER[]', '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN', '--option=torture:quick=yes'], "samba4.rpc.echo on ncacn_ip_tcp with object")
320
321 plansmbtorture4testsuite('ntp.signd', "ad_dc_ntvfs:local", ['ncacn_np:$SERVER', '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], "samba4.ntp.signd")
322
323 nbt_tests = smbtorture4_testsuites("nbt.")
324 for t in nbt_tests:
325     plansmbtorture4testsuite(t, "ad_dc_ntvfs", "//$SERVER/_none_ -U\"$USERNAME%$PASSWORD\"")
326
327 # Tests against the NTVFS POSIX backend
328 ntvfsargs = ["--option=torture:sharedelay=100000", "--option=torture:oplocktimeout=3", "--option=torture:writetimeupdatedelay=500000"]
329
330 # Filter smb2 tests that should not run against ad_dc_ntvfs
331 smb2_s3only = [
332     "smb2.change_notify_disabled",
333     "smb2.dosmode",
334     "smb2.credits",
335     "smb2.kernel-oplocks",
336     "smb2.durable-v2-delay",
337     "smb2.aio_delay",
338 ]
339 smb2 = [x for x in smbtorture4_testsuites("smb2.") if x not in smb2_s3only]
340
341 # The QFILEINFO-IPC test needs to be on ipc$
342 raw = list(filter(lambda x: "raw.qfileinfo.ipc" not in x, smbtorture4_testsuites("raw.")))
343 base = smbtorture4_testsuites("base.")
344
345 netapi = smbtorture4_testsuites("netapi.")
346
347 for t in base + raw + smb2 + netapi:
348     plansmbtorture4testsuite(t, "ad_dc_ntvfs", ['//$SERVER/tmp', '-U$USERNAME%$PASSWORD'] + ntvfsargs)
349
350 libsmbclient = smbtorture4_testsuites("libsmbclient.")
351 protocols = [ 'NT1', 'SMB3' ]
352 for t in libsmbclient:
353     url = "smb://$USERNAME:$PASSWORD@$SERVER/tmp"
354     if t == "libsmbclient.list_shares":
355         url = "smb://$USERNAME:$PASSWORD@$SERVER"
356
357     for proto in protocols:
358         libsmbclient_testargs = ["--option=torture:smburl=" + url,
359                                  "--option=torture:replace_smbconf=%s/testdata/samba3/smb_new.conf" % srcdir(),
360                                  "--option=torture:clientprotocol=%s" % proto]
361         plansmbtorture4testsuite(t, "ad_dc", ['//$SERVER/tmp', '-U$USERNAME%$PASSWORD'] + libsmbclient_testargs, "samba4.%s.%s" % (t, proto))
362
363 plansmbtorture4testsuite("raw.qfileinfo.ipc", "ad_dc_ntvfs", '//$SERVER/ipc\$ -U$USERNAME%$PASSWORD')
364
365 for t in smbtorture4_testsuites("rap."):
366     plansmbtorture4testsuite(t, "ad_dc_ntvfs", '//$SERVER/IPC\$ -U$USERNAME%$PASSWORD')
367
368 # Tests against the NTVFS CIFS backend
369 for t in base + raw:
370     plansmbtorture4testsuite(t, "ad_dc_ntvfs", ['//$NETBIOSNAME/cifs', '-U$USERNAME%$PASSWORD', '--kerberos=yes'] + ntvfsargs, modname="samba4.ntvfs.cifs.krb5.%s" % t)
371
372 # Test NTVFS CIFS backend with S4U2Self and S4U2Proxy
373 t = "base.unlink"
374 plansmbtorture4testsuite(t, "ad_dc_ntvfs", ['//$NETBIOSNAME/cifs', '-U$USERNAME%$PASSWORD', '--kerberos=no'] + ntvfsargs, "samba4.ntvfs.cifs.ntlm.%s" % t)
375 plansmbtorture4testsuite(t, "rpc_proxy", ['//$NETBIOSNAME/cifs_to_dc', '-U$DC_USERNAME%$DC_PASSWORD', '--kerberos=yes'] + ntvfsargs, "samba4.ntvfs.cifs.krb5.%s" % t)
376 plansmbtorture4testsuite(t, "rpc_proxy", ['//$NETBIOSNAME/cifs_to_dc', '-U$DC_USERNAME%$DC_PASSWORD', '--kerberos=no'] + ntvfsargs, "samba4.ntvfs.cifs.ntlm.%s" % t)
377
378 plansmbtorture4testsuite('echo.udp', 'ad_dc_ntvfs:local', '//$SERVER/whatever')
379
380 # Local tests
381 for t in smbtorture4_testsuites("local."):
382     # The local.resolve test needs a name to look up using real system (not emulated) name routines
383     plansmbtorture4testsuite(t, "none", "ncalrpc:localhost")
384
385 # Confirm these tests with the system iconv too
386 for t in ["local.convert_string_handle", "local.convert_string", "local.ndr"]:
387     options = "ncalrpc: --option='iconv:use_builtin_handlers=false'"
388     plansmbtorture4testsuite(t, "none", options,
389                              modname="samba4.%s.system.iconv" % t)
390
391 tdbtorture4 = binpath("tdbtorture")
392 if os.path.exists(tdbtorture4):
393     plantestsuite("tdb.stress", "none", valgrindify(tdbtorture4))
394 else:
395     skiptestsuite("tdb.stress", "Using system TDB, tdbtorture not available")
396
397 plansmbtorture4testsuite("drs.unit", "none", "ncalrpc:")
398
399 # Pidl tests
400 for f in sorted(os.listdir(os.path.join(samba4srcdir, "../pidl/tests"))):
401     if f.endswith(".pl"):
402         planperltestsuite("pidl.%s" % f[:-3], os.path.normpath(os.path.join(samba4srcdir, "../pidl/tests", f)))
403
404 # DNS tests
405 plantestsuite_loadlist("samba.tests.dns", "fl2003dc:local", [python, os.path.join(srcdir(), "python/samba/tests/dns.py"), '$SERVER', '$SERVER_IP', '--machine-pass', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
406 plantestsuite_loadlist("samba.tests.dns", "rodc:local", [python, os.path.join(srcdir(), "python/samba/tests/dns.py"), '$SERVER', '$SERVER_IP', '--machine-pass', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
407 plantestsuite_loadlist("samba.tests.dns", "vampire_dc:local", [python, os.path.join(srcdir(), "python/samba/tests/dns.py"), '$SERVER', '$SERVER_IP', '--machine-pass', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
408
409 plantestsuite_loadlist("samba.tests.dns_forwarder", "fl2003dc:local", [python, os.path.join(srcdir(), "python/samba/tests/dns_forwarder.py"), '$SERVER', '$SERVER_IP', '$DNS_FORWARDER1', '$DNS_FORWARDER2', '--machine-pass', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
410
411 plantestsuite_loadlist("samba.tests.dns_tkey", "fl2008r2dc", [python, os.path.join(srcdir(), "python/samba/tests/dns_tkey.py"), '$SERVER', '$SERVER_IP', '--machine-pass', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
412 plantestsuite_loadlist("samba.tests.dns_wildcard", "ad_dc", [python, os.path.join(srcdir(), "python/samba/tests/dns_wildcard.py"), '$SERVER', '$SERVER_IP', '--machine-pass', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
413
414 plantestsuite_loadlist("samba.tests.dns_invalid", "ad_dc", [python, os.path.join(srcdir(), "python/samba/tests/dns_invalid.py"), '$SERVER_IP', '--machine-pass', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
415
416 for t in smbtorture4_testsuites("dns_internal."):
417     plansmbtorture4testsuite(t, "ad_dc_ntvfs:local", '//$SERVER/whavever')
418
419 # Local tests
420 for t in smbtorture4_testsuites("dlz_bind9."):
421     # The dlz_bind9 tests needs to look at the DNS database
422     plansmbtorture4testsuite(t, "chgdcpass:local", ["ncalrpc:$SERVER", '-U$USERNAME%$PASSWORD'])
423
424 planpythontestsuite("nt4_dc", "samba.tests.libsmb_samba_internal", py3_compatible=True)
425
426 # Blackbox Tests:
427 # tests that interact directly with the command-line tools rather than using
428 # the API. These mainly test that the various command-line options of commands
429 # work correctly.
430
431 for env in ["ad_member", "s4member", "ad_dc_ntvfs", "chgdcpass"]:
432     plantestsuite("samba4.blackbox.smbclient(%s:local)" % env, "%s:local" % env, [os.path.join(samba4srcdir, "utils/tests/test_smbclient.sh"), '$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD', '$DOMAIN', smbclient4])
433
434 plantestsuite("samba4.blackbox.samba_tool(ad_dc_ntvfs:local)", "ad_dc_ntvfs:local", [os.path.join(samba4srcdir, "utils/tests/test_samba_tool.sh"), '$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD', '$DOMAIN', smbclient4])
435 plantestsuite("samba4.blackbox.net_rpc_user(ad_dc)", "ad_dc", [os.path.join(bbdir, "test_net_rpc_user.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$DOMAIN'])
436
437 plantestsuite("samba4.blackbox.test_primary_group", "ad_dc:local", [os.path.join(bbdir, "test_primary_group.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$DOMAIN', '$PREFIX_ABS'])
438
439 if have_heimdal_support:
440     for env in ["ad_dc_ntvfs", "ad_dc"]:
441         plantestsuite("samba4.blackbox.pkinit(%s:local)" % env, "%s:local" % env, [os.path.join(bbdir, "test_pkinit_heimdal.sh"), '$SERVER', 'pkinit', '$PASSWORD', '$REALM', '$DOMAIN', '$PREFIX/%s' % env, "aes256-cts-hmac-sha1-96", smbclient4, configuration])
442         plantestsuite("samba4.blackbox.pkinit_pac(%s:local)" % env, "%s:local" % env, [os.path.join(bbdir, "test_pkinit_pac_heimdal.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', '$PREFIX/%s' % env, "aes256-cts-hmac-sha1-96", configuration])
443     plantestsuite("samba4.blackbox.kinit(ad_dc_ntvfs:local)", "ad_dc_ntvfs:local", [os.path.join(bbdir, "test_kinit_heimdal.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', '$PREFIX', "aes256-cts-hmac-sha1-96", smbclient4, configuration])
444     plantestsuite("samba4.blackbox.kinit(fl2000dc:local)", "fl2000dc:local", [os.path.join(bbdir, "test_kinit_heimdal.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', '$PREFIX', "arcfour-hmac-md5", smbclient4, configuration])
445     plantestsuite("samba4.blackbox.kinit(fl2008r2dc:local)", "fl2008r2dc:local", [os.path.join(bbdir, "test_kinit_heimdal.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', '$PREFIX', "aes256-cts-hmac-sha1-96", smbclient4, configuration])
446     plantestsuite("samba4.blackbox.kinit_trust(fl2008r2dc:local)", "fl2008r2dc:local", [os.path.join(bbdir, "test_kinit_trusts_heimdal.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', '$TRUST_SERVER', '$TRUST_USERNAME', '$TRUST_PASSWORD', '$TRUST_REALM', '$TRUST_DOMAIN', '$PREFIX', "forest", "aes256-cts-hmac-sha1-96"])
447     plantestsuite("samba4.blackbox.kinit_trust(fl2003dc:local)", "fl2003dc:local", [os.path.join(bbdir, "test_kinit_trusts_heimdal.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', '$TRUST_SERVER', '$TRUST_USERNAME', '$TRUST_PASSWORD', '$TRUST_REALM', '$TRUST_DOMAIN', '$PREFIX', "external", "arcfour-hmac-md5"])
448     plantestsuite("samba4.blackbox.export.keytab(ad_dc_ntvfs:local)", "ad_dc_ntvfs:local", [os.path.join(bbdir, "test_export_keytab_heimdal.sh"), '$SERVER', '$USERNAME', '$REALM', '$DOMAIN', "$PREFIX", smbclient4])
449     plantestsuite("samba4.blackbox.kpasswd(ad_dc_ntvfs:local)", "ad_dc_ntvfs:local", [os.path.join(bbdir, "test_kpasswd_heimdal.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', "$PREFIX/ad_dc_ntvfs"])
450 else:
451     plantestsuite("samba4.blackbox.kinit(ad_dc_ntvfs:local)", "ad_dc_ntvfs:local", [os.path.join(bbdir, "test_kinit_mit.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', '$PREFIX', smbclient4, configuration])
452     plantestsuite("samba4.blackbox.kinit(fl2000dc:local)", "fl2000dc:local", [os.path.join(bbdir, "test_kinit_mit.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', '$PREFIX', smbclient4, configuration])
453     plantestsuite("samba4.blackbox.kinit(fl2008r2dc:local)", "fl2008r2dc:local", [os.path.join(bbdir, "test_kinit_mit.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', '$PREFIX', smbclient4, configuration])
454     plantestsuite("samba4.blackbox.kinit_trust(fl2008r2dc:local)", "fl2008r2dc:local", [os.path.join(bbdir, "test_kinit_trusts_mit.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', '$TRUST_SERVER', '$TRUST_USERNAME', '$TRUST_PASSWORD', '$TRUST_REALM', '$TRUST_DOMAIN', '$PREFIX', "forest"])
455     plantestsuite("samba4.blackbox.kinit_trust(fl2003dc:local)", "fl2003dc:local", [os.path.join(bbdir, "test_kinit_trusts_mit.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', '$TRUST_SERVER', '$TRUST_USERNAME', '$TRUST_PASSWORD', '$TRUST_REALM', '$TRUST_DOMAIN', '$PREFIX', "external"])
456     plantestsuite("samba4.blackbox.export.keytab(ad_dc_ntvfs:local)", "ad_dc_ntvfs:local", [os.path.join(bbdir, "test_export_keytab_mit.sh"), '$SERVER', '$USERNAME', '$REALM', '$DOMAIN', "$PREFIX", smbclient4])
457     plantestsuite("samba4.blackbox.kpasswd(ad_dc_ntvfs:local)", "ad_dc_ntvfs:local", [os.path.join(bbdir, "test_kpasswd_mit.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', "$PREFIX/ad_dc_ntvfs"])
458
459 plantestsuite("samba4.blackbox.trust_ntlm", "fl2008r2dc:local", [os.path.join(bbdir, "test_trust_ntlm.sh"), '$SERVER_IP', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', '$TRUST_USERNAME', '$TRUST_PASSWORD', '$TRUST_REALM', '$TRUST_DOMAIN', 'forest', 'auto', 'NT_STATUS_LOGON_FAILURE'])
460 plantestsuite("samba4.blackbox.trust_ntlm", "fl2003dc:local", [os.path.join(bbdir, "test_trust_ntlm.sh"), '$SERVER_IP', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', '$TRUST_USERNAME', '$TRUST_PASSWORD', '$TRUST_REALM', '$TRUST_DOMAIN', 'external', 'auto', 'NT_STATUS_LOGON_FAILURE'])
461 plantestsuite("samba4.blackbox.trust_ntlm", "ad_member:local", [os.path.join(bbdir, "test_trust_ntlm.sh"), '$SERVER_IP', '$USERNAME', '$PASSWORD', '$SERVER', '$SERVER', '$DC_USERNAME', '$DC_PASSWORD', '$REALM', '$DOMAIN', 'member', 'auto', 'NT_STATUS_LOGON_FAILURE'])
462 plantestsuite("samba4.blackbox.trust_ntlm", "nt4_member:local", [os.path.join(bbdir, "test_trust_ntlm.sh"), '$SERVER_IP', '$USERNAME', '$PASSWORD', '$SERVER', '$SERVER', '$DC_USERNAME', '$DC_PASSWORD', '$DOMAIN', '$DOMAIN', 'member', 'auto', 'NT_STATUS_LOGON_FAILURE'])
463
464 plantestsuite("samba4.blackbox.trust_utils(fl2008r2dc:local)", "fl2008r2dc:local", [os.path.join(bbdir, "test_trust_utils.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', '$TRUST_SERVER', '$TRUST_USERNAME', '$TRUST_PASSWORD', '$TRUST_REALM', '$TRUST_DOMAIN', '$PREFIX', "forest"])
465 plantestsuite("samba4.blackbox.trust_utils(fl2003dc:local)", "fl2003dc:local", [os.path.join(bbdir, "test_trust_utils.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', '$TRUST_SERVER', '$TRUST_USERNAME', '$TRUST_PASSWORD', '$TRUST_REALM', '$TRUST_DOMAIN', '$PREFIX', "external"])
466 plantestsuite("samba4.blackbox.trust_token", "fl2008r2dc", [os.path.join(bbdir, "test_trust_token.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', '$DOMSID', '$TRUST_USERNAME', '$TRUST_PASSWORD', '$TRUST_REALM', '$TRUST_DOMAIN', '$TRUST_DOMSID', 'forest'])
467 plantestsuite("samba4.blackbox.trust_token", "fl2003dc", [os.path.join(bbdir, "test_trust_token.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', '$DOMSID', '$TRUST_USERNAME', '$TRUST_PASSWORD', '$TRUST_REALM', '$TRUST_DOMAIN', '$TRUST_DOMSID', 'external'])
468 plantestsuite("samba4.blackbox.ktpass(ad_dc_ntvfs)", "ad_dc_ntvfs", [os.path.join(bbdir, "test_ktpass.sh"), '$PREFIX/ad_dc_ntvfs'])
469 plantestsuite("samba4.blackbox.password_settings(ad_dc_ntvfs:local)", "ad_dc_ntvfs:local", [os.path.join(bbdir, "test_password_settings.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$REALM', '$DOMAIN', "$PREFIX/ad_dc_ntvfs"])
470 plantestsuite("samba4.blackbox.trust_user_account", "fl2008r2dc:local", [os.path.join(bbdir, "test_trust_user_account.sh"), '$PREFIX', '$REALM', '$DOMAIN', '$TRUST_REALM', '$TRUST_DOMAIN'])
471 plantestsuite("samba4.blackbox.cifsdd(ad_dc_ntvfs)", "ad_dc_ntvfs", [os.path.join(samba4srcdir, "client/tests/test_cifsdd.sh"), '$SERVER', '$USERNAME', '$PASSWORD', "$DOMAIN"])
472 plantestsuite("samba4.blackbox.nmblookup(ad_dc_ntvfs)", "ad_dc_ntvfs", [os.path.join(samba4srcdir, "utils/tests/test_nmblookup.sh"), '$NETBIOSNAME', '$NETBIOSALIAS', '$SERVER', '$SERVER_IP', nmblookup4])
473 plantestsuite("samba4.blackbox.locktest(ad_dc_ntvfs)", "ad_dc_ntvfs", [os.path.join(samba4srcdir, "torture/tests/test_locktest.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$DOMAIN', '$PREFIX'])
474 plantestsuite("samba4.blackbox.masktest", "ad_dc_ntvfs", [os.path.join(samba4srcdir, "torture/tests/test_masktest.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$DOMAIN', '$PREFIX'])
475 plantestsuite("samba4.blackbox.gentest(ad_dc_ntvfs)", "ad_dc_ntvfs", [os.path.join(samba4srcdir, "torture/tests/test_gentest.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$DOMAIN', "$PREFIX"])
476 plantestsuite("samba4.blackbox.rfc2307_mapping(ad_dc_ntvfs:local)", "ad_dc_ntvfs:local", [os.path.join(samba4srcdir, "../nsswitch/tests/test_rfc2307_mapping.sh"), '$DOMAIN', '$USERNAME', '$PASSWORD', "$SERVER", "$UID_RFC2307TEST", "$GID_RFC2307TEST", configuration])
477 plantestsuite("samba4.blackbox.chgdcpass", "chgdcpass", [os.path.join(bbdir, "test_chgdcpass.sh"), '$SERVER', "CHGDCPASS\$", '$REALM', '$DOMAIN', '$PREFIX', "aes256-cts-hmac-sha1-96", '$SELFTEST_PREFIX/chgdcpass', smbclient4])
478 plantestsuite("samba4.blackbox.samba_upgradedns(chgdcpass:local)", "chgdcpass:local", [os.path.join(bbdir, "test_samba_upgradedns.sh"), '$SERVER', '$REALM', '$PREFIX', '$SELFTEST_PREFIX/chgdcpass'])
479 plantestsuite("samba4.blackbox.net_ads(ad_dc:client)", "ad_dc:client", [os.path.join(bbdir, "test_net_ads.sh"), '$DC_SERVER', '$DC_USERNAME', '$DC_PASSWORD', '$PREFIX_ABS'])
480 plantestsuite("samba4.blackbox.client_etypes_all(ad_dc:client)", "ad_dc:client", [os.path.join(bbdir, "test_client_etypes.sh"), '$DC_SERVER', '$DC_USERNAME', '$DC_PASSWORD', '$PREFIX_ABS', 'all', '17_18_23'])
481 plantestsuite("samba4.blackbox.client_etypes_legacy(ad_dc:client)", "ad_dc:client", [os.path.join(bbdir, "test_client_etypes.sh"), '$DC_SERVER', '$DC_USERNAME', '$DC_PASSWORD', '$PREFIX_ABS', 'legacy', '23'])
482 plantestsuite("samba4.blackbox.client_etypes_strong(ad_dc:client)", "ad_dc:client", [os.path.join(bbdir, "test_client_etypes.sh"), '$DC_SERVER', '$DC_USERNAME', '$DC_PASSWORD', '$PREFIX_ABS', 'strong', '17_18'])
483 plantestsuite("samba4.blackbox.net_ads_dns(ad_member:local)", "ad_member:local", [os.path.join(bbdir, "test_net_ads_dns.sh"), '$DC_SERVER', '$DC_USERNAME', '$DC_PASSWORD', '$REALM', '$USERNAME', '$PASSWORD'])
484 plantestsuite("samba4.blackbox.samba-tool_ntacl(ad_member:local)", "ad_member:local", [os.path.join(bbdir, "test_samba-tool_ntacl.sh"), '$PREFIX'])
485 plantestsuite_loadlist("samba4.rpc.echo against NetBIOS alias", "ad_dc_ntvfs", [valgrindify(smbtorture4), "$LISTOPT", "$LOADLIST", 'ncacn_np:$NETBIOSALIAS', '-U$DOMAIN/$USERNAME%$PASSWORD', 'rpc.echo'])
486 # json tests hook into ``chgdcpass'' to make them run in contributor CI on
487 # gitlab
488 planpythontestsuite("chgdcpass", "samba.tests.blackbox.netads_json")
489
490 # Tests using the "Simple" NTVFS backend
491 for t in ["base.rw1"]:
492     plansmbtorture4testsuite(t, "ad_dc_ntvfs", ["//$SERVER/simple", '-U$USERNAME%$PASSWORD'], modname="samba4.ntvfs.simple.%s" % t)
493
494 # Domain S4member Tests
495 plansmbtorture4testsuite('rpc.echo', "s4member", ['ncacn_np:$NETBIOSNAME', '-U$NETBIOSNAME/$USERNAME%$PASSWORD'], "samba4.rpc.echo against s4member server with local creds")
496 plansmbtorture4testsuite('rpc.echo', "s4member", ['ncacn_np:$NETBIOSNAME', '-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'], "samba4.rpc.echo against s4member server with domain creds")
497 plansmbtorture4testsuite('rpc.samr', "s4member", ['ncacn_np:$NETBIOSNAME', '-U$NETBIOSNAME/$USERNAME%$PASSWORD'], "samba4.rpc.samr against s4member server with local creds")
498 plansmbtorture4testsuite('rpc.samr.users', "s4member", ['ncacn_np:$NETBIOSNAME', '-U$NETBIOSNAME/$USERNAME%$PASSWORD'], "samba4.rpc.samr.users against s4member server with local creds",)
499 plansmbtorture4testsuite('rpc.samr.passwords', "s4member", ['ncacn_np:$NETBIOSNAME', '-U$NETBIOSNAME/$USERNAME%$PASSWORD'], "samba4.rpc.samr.passwords against s4member server with local creds")
500 plantestsuite("samba4.blackbox.smbclient against s4member server with local creds", "s4member", [os.path.join(samba4srcdir, "client/tests/test_smbclient.sh"), '$NETBIOSNAME', '$USERNAME', '$PASSWORD', '$NETBIOSNAME', '$PREFIX', smbclient4])
501
502 # RPC Proxy
503 plansmbtorture4testsuite("rpc.echo", "rpc_proxy", ['ncacn_ip_tcp:$NETBIOSNAME', '-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'], modname="samba4.rpc.echo against rpc proxy with domain creds")
504
505 # Tests SMB signing
506 for mech in [
507     "-k no",
508     "-k no --option=clientusespnego=no",
509     "-k no --option=gensec:spengo=no",
510     "-k yes",
511     "-k yes --option=gensec:fake_gssapi_krb5=yes --option=gensec:gssapi_krb5=no"]:
512     for signing in ["--signing=on", "--signing=required"]:
513         signoptions = "%s %s" % (mech, signing)
514         name = "smb.signing on with %s" % signoptions
515         plansmbtorture4testsuite('base.xcopy', "ad_dc_ntvfs", ['//$NETBIOSNAME/xcopy_share', signoptions, '-U$USERNAME%$PASSWORD'], modname="samba4.%s" % name)
516
517 for mech in [
518     "-k no",
519     "-k no --option=clientusespnego=no",
520     "-k no --option=gensec:spengo=no",
521     "-k yes"]:
522     signoptions = "%s --signing=off" % mech
523     name = "smb.signing disabled on with %s" % signoptions
524     plansmbtorture4testsuite('base.xcopy', "s4member", ['//$NETBIOSNAME/xcopy_share', signoptions, '-U$DC_USERNAME%$DC_PASSWORD'], "samba4.%s domain-creds" % name)
525     plansmbtorture4testsuite('base.xcopy', "ad_member", ['//$NETBIOSNAME/xcopy_share', signoptions, '-U$DC_USERNAME%$DC_PASSWORD'], "samba4.%s domain-creds" % name)
526     plansmbtorture4testsuite('base.xcopy', "ad_dc", ['//$NETBIOSNAME/xcopy_share', signoptions, '-U$USERNAME%$PASSWORD'], "samba4.%s" % name)
527     plansmbtorture4testsuite('base.xcopy', "ad_dc",
528                              ['//$NETBIOSNAME/xcopy_share', signoptions, '-U$DC_USERNAME%$DC_PASSWORD'], "samba4.%s administrator" % name)
529
530 plantestsuite("samba4.blackbox.bogusdomain", "ad_member", ["testprogs/blackbox/bogus.sh", "$NETBIOSNAME", "xcopy_share", '$USERNAME', '$PASSWORD', '$DC_USERNAME', '$DC_PASSWORD', smbclient4])
531 for mech in [
532     "-k no",
533     "-k no --option=clientusespnego=no",
534     "-k no --option=gensec:spengo=no"]:
535     signoptions = "%s --signing=off" % mech
536     plansmbtorture4testsuite('base.xcopy', "s4member", ['//$NETBIOSNAME/xcopy_share', signoptions, '-U$NETBIOSNAME/$USERNAME%$PASSWORD'], modname="samba4.smb.signing on with %s local-creds" % signoptions)
537
538 plansmbtorture4testsuite('base.xcopy', "ad_dc_ntvfs", ['//$NETBIOSNAME/xcopy_share', '-k', 'no', '--signing=yes', '-U%'], modname="samba4.smb.signing --signing=yes anon")
539 plansmbtorture4testsuite('base.xcopy', "ad_dc_ntvfs", ['//$NETBIOSNAME/xcopy_share', '-k', 'no', '--signing=required', '-U%'], modname="samba4.smb.signing --signing=required anon")
540 plansmbtorture4testsuite('base.xcopy', "s4member", ['//$NETBIOSNAME/xcopy_share', '-k', 'no', '--signing=no', '-U%'], modname="samba4.smb.signing --signing=no anon")
541
542
543 wb_opts_default = ["--option=\"torture:strict mode=no\"", "--option=\"torture:timelimit=1\"", "--option=\"torture:winbindd_separator=/\"", "--option=\"torture:winbindd_netbios_name=$SERVER\"", "--option=\"torture:winbindd_netbios_domain=$DOMAIN\""]
544
545 winbind_ad_client_tests = smbtorture4_testsuites("winbind.struct") + smbtorture4_testsuites("winbind.pac")
546 winbind_wbclient_tests = smbtorture4_testsuites("winbind.wbclient")
547 for env in ["ad_dc", "s4member", "ad_member", "nt4_member"]:
548     wb_opts = wb_opts_default[:]
549     if env in ["ad_member"]:
550         wb_opts += ["--option=\"torture:winbindd_domain_without_prefix=$DOMAIN\""]
551     for t in winbind_ad_client_tests:
552         plansmbtorture4testsuite(t, "%s:local" % env, wb_opts + ['//$SERVER/tmp', '--realm=$REALM', '--machine-pass', '--option=torture:addc=$DC_SERVER'])
553
554 for env in ["nt4_dc", "fl2003dc"]:
555     for t in winbind_wbclient_tests:
556         plansmbtorture4testsuite(t, "%s:local" % env, '//$SERVER/tmp -U$DC_USERNAME%$DC_PASSWORD')
557
558 for env in ["nt4_dc", "nt4_member", "ad_dc", "ad_member", "s4member", "chgdcpass", "rodc"]:
559     tests = ["--ping", "--separator",
560              "--own-domain",
561              "--all-domains",
562              "--trusted-domains",
563              "--domain-info=BUILTIN",
564              "--domain-info=$DOMAIN",
565              "--online-status",
566              "--online-status --domain=BUILTIN",
567              "--online-status --domain=$DOMAIN",
568              "--check-secret --domain=$DOMAIN",
569              "--change-secret --domain=$DOMAIN",
570              "--check-secret --domain=$DOMAIN",
571              "--online-status --domain=$DOMAIN",
572              "--domain-users",
573              "--domain-groups",
574              "--name-to-sid=$DC_USERNAME",
575              "--name-to-sid=$DOMAIN/$DC_USERNAME",
576              "--user-info=$DOMAIN/$DC_USERNAME",
577              "--user-groups=$DOMAIN/$DC_USERNAME",
578              "--authenticate=$DOMAIN/$DC_USERNAME%$DC_PASSWORD",
579              "--allocate-uid",
580              "--allocate-gid"]
581
582     for t in tests:
583         plantestsuite("samba.wbinfo_simple.%s" % (t.replace(" --", ".").replace("--", "")), "%s:local" % env, [os.path.join(srcdir(), "nsswitch/tests/test_wbinfo_simple.sh"), t])
584
585     plantestsuite(
586         "samba.wbinfo_sids2xids.(%s:local)" % env, "%s:local" % env,
587         [os.path.join(samba3srcdir, "script/tests/test_wbinfo_sids2xids.sh")])
588
589     plantestsuite(
590         "samba.ntlm_auth.diagnostics(%s:local)" % env, "%s:local" % env,
591         [os.path.join(samba3srcdir, "script/tests/test_ntlm_auth_diagnostics.sh"), ntlm_auth3, '$DOMAIN', '$DC_USERNAME', '$DC_PASSWORD', configuration])
592
593     plantestsuite("samba.ntlm_auth.(%s:local)" % env, "%s:local" % env, [os.path.join(samba3srcdir, "script/tests/test_ntlm_auth_s3.sh"), valgrindify(python), samba3srcdir, ntlm_auth3, '$DOMAIN', '$DC_USERNAME', '$DC_PASSWORD', configuration])
594
595 for env in ["s4member_dflt_domain", "s4member"]:
596     for cmd in ["id", "getent"]:
597         users = ["$DC_USERNAME", "$DC_USERNAME@$REALM"]
598         if env == "s4member":
599             users = ["$DOMAIN/$DC_USERNAME", "$DC_USERNAME@$REALM"]
600         for usr in users:
601             plantestsuite("samba4.winbind.dom_name_parse.cmd", env, "%s/dom_parse.sh %s %s" % (bbdir, cmd, usr))
602
603 nsstest4 = binpath("nsstest")
604 for env in ["ad_dc:local", "s4member:local", "nt4_dc:local", "ad_member:local", "nt4_member:local"]:
605     if os.path.exists(nsstest4):
606         plantestsuite("samba.nss.test using winbind(%s)" % env, env, [os.path.join(bbdir, "nsstest.sh"), nsstest4, os.path.join(samba4bindir, "shared/libnss_wrapper_winbind.so.2")])
607     else:
608         skiptestsuite("samba.nss.test using winbind(%s)" % env, "nsstest not available")
609
610 subunitrun = valgrindify(python) + " " + os.path.join(samba4srcdir, "scripting/bin/subunitrun")
611 if extra_python is not None:
612     subunitrun3 = valgrindify(extra_python) + " " + os.path.join(samba4srcdir, "scripting/bin/subunitrun")
613
614
615 def planoldpythontestsuite(env, module, name=None, extra_path=[], environ={}, extra_args=[], py3_compatible=False):
616     environ = dict(environ)
617     py_path = list(extra_path)
618     if py_path:
619         environ["PYTHONPATH"] = ":".join(["$PYTHONPATH"] + py_path)
620     args = ["%s=%s" % item for item in environ.items()]
621     args += [subunitrun, "$LISTOPT", "$LOADLIST", module]
622     args += extra_args
623     if name is None:
624         name = module
625     plantestsuite_loadlist(name, env, args)
626     if py3_compatible and extra_python is not None:
627         args[args.index(subunitrun)] = subunitrun3
628         python_name = os.path.basename(extra_python)
629         plantestsuite_loadlist(name + "." + python_name, env, args)
630
631 # Run complex search expressions test once for each database backend.
632 # Right now ad_dc has mdb and ad_dc_ntvfs has tdb
633 mdb_testenv = "ad_dc"
634 tdb_testenv = "ad_dc_ntvfs"
635 for testenv in [mdb_testenv, tdb_testenv]:
636     planoldpythontestsuite(testenv, "samba.tests.complex_expressions", extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
637
638 planoldpythontestsuite("ad_dc_ntvfs:local", "samba.tests.gensec", extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
639 planoldpythontestsuite("none", "simple", extra_path=["%s/lib/tdb/python/tests" % srcdir()], name="tdb.python",  py3_compatible=True)
640 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.dcerpc.sam", py3_compatible=True)
641 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.dsdb", py3_compatible=True)
642 planpythontestsuite("none", "samba.tests.dsdb_lock", py3_compatible=True)
643 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.dcerpc.bare", py3_compatible=True)
644 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.dcerpc.unix", py3_compatible=True)
645 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.dcerpc.srvsvc")
646 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.samba_tool.timecmd", py3_compatible=True)
647 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.samba_tool.join", py3_compatible=True)
648
649 planpythontestsuite("none", "samba.tests.samba_tool.visualize", py3_compatible=True)
650
651
652 # test fsmo show
653 for env in ["ad_dc_ntvfs", "fl2000dc", "fl2003dc", "fl2008r2dc"]:
654     planpythontestsuite(env + ":local", "samba.tests.samba_tool.fsmo", py3_compatible=True)
655
656 # test user.edit
657 for env in ["ad_dc:local", "ad_dc_ntvfs:local", "fl2000dc:local", "fl2003dc:local", "fl2008r2dc:local"]:
658     plantestsuite("samba.tests.samba_tool.edit", env, [os.path.join(srcdir(), "python/samba/tests/samba_tool/edit.sh"), '$SERVER', '$USERNAME', '$PASSWORD'])
659
660 # We run this test against both AD DC implemetnations because it is
661 # the only test we have of GPO get/set behaviour, and this involves
662 # the file server as well as the LDAP server.
663 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.samba_tool.gpo",  py3_compatible=True)
664 planpythontestsuite("ad_dc:local", "samba.tests.samba_tool.gpo", py3_compatible=True)
665
666 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.samba_tool.processes", py3_compatible=True)
667 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.samba_tool.user", py3_compatible=True)
668 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.samba_tool.user_wdigest",  py3_compatible=True)
669 planpythontestsuite("ad_dc:local", "samba.tests.samba_tool.user", py3_compatible=True)
670 planpythontestsuite("ad_dc:local", "samba.tests.samba_tool.user_virtualCryptSHA", py3_compatible=True)
671 planpythontestsuite("chgdcpass:local", "samba.tests.samba_tool.user_check_password_script", py3_compatible=True)
672 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.samba_tool.group", py3_compatible=True)
673 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.samba_tool.ou", py3_compatible=True)
674 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.samba_tool.computer", py3_compatible=True)
675 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.samba_tool.forest", py3_compatible=True)
676 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.samba_tool.schema", py3_compatible=True)
677 planpythontestsuite("ad_dc:local", "samba.tests.samba_tool.ntacl", py3_compatible=True)
678 planpythontestsuite("none", "samba.tests.samba_tool.provision_password_check",  py3_compatible=True)
679 planpythontestsuite("none", "samba.tests.samba_tool.help", py3_compatible=True)
680 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.samba_tool.passwordsettings", py3_compatible=True)
681
682 # Run these against chgdcpass to share the runtime load
683 planpythontestsuite("chgdcpass:local", "samba.tests.samba_tool.sites", py3_compatible=True)
684 planpythontestsuite("chgdcpass:local", "samba.tests.samba_tool.dnscmd", py3_compatible=True)
685
686 # Run this against chgdcpass to ensure at least one python3 test
687 # against this autobuild target (samba-ad-dc-2)
688 planpythontestsuite("chgdcpass:local", "samba.tests.dcerpc.rpcecho", py3_compatible=True)
689
690 planoldpythontestsuite("nt4_dc", "samba.tests.netbios", extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
691 planoldpythontestsuite("ad_dc:local", "samba.tests.gpo", extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
692 planoldpythontestsuite("ad_dc:local", "samba.tests.dckeytab", extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
693 planoldpythontestsuite("ad_dc:local", "samba.tests.smb", extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
694
695 planoldpythontestsuite(
696     "ad_dc_ntvfs:local", "samba.tests.dcerpc.registry",
697     extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
698
699 planoldpythontestsuite(
700     "ad_dc:local", "samba.tests.ntacls_backup",
701     extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
702
703 planoldpythontestsuite("ad_dc_ntvfs", "samba.tests.dcerpc.dnsserver", extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
704 planoldpythontestsuite("ad_dc", "samba.tests.dcerpc.dnsserver", extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
705 planoldpythontestsuite("chgdcpass", "samba.tests.dcerpc.raw_protocol", extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
706 if have_heimdal_support:
707     planoldpythontestsuite("ad_dc:local", "samba.tests.auth_log", extra_args=['-U"$USERNAME%$PASSWORD"'],
708                            environ={'CLIENT_IP': '127.0.0.11',
709                                     'SOCKET_WRAPPER_DEFAULT_IFACE': 11})
710     planoldpythontestsuite("ad_dc_ntvfs:local", "samba.tests.auth_log", extra_args=['-U"$USERNAME%$PASSWORD"'],
711                            environ={'CLIENT_IP': '127.0.0.11',
712                                     'SOCKET_WRAPPER_DEFAULT_IFACE': 11})
713     planoldpythontestsuite("ad_dc:local", "samba.tests.auth_log_pass_change", extra_args=['-U"$USERNAME%$PASSWORD"'],
714                            environ={'CLIENT_IP': '127.0.0.11',
715                                     'SOCKET_WRAPPER_DEFAULT_IFACE': 11})
716     planoldpythontestsuite("ad_dc_ntvfs:local", "samba.tests.auth_log_pass_change", extra_args=['-U"$USERNAME%$PASSWORD"'],
717                            environ={'CLIENT_IP': '127.0.0.11',
718                                     'SOCKET_WRAPPER_DEFAULT_IFACE': 11})
719     planoldpythontestsuite("ad_dc_ntvfs:local", "samba.tests.auth_log_ncalrpc", extra_args=['-U"$USERNAME%$PASSWORD"'])
720     planoldpythontestsuite("ad_dc:local", "samba.tests.auth_log_ncalrpc", extra_args=['-U"$USERNAME%$PASSWORD"'])
721     planoldpythontestsuite("ad_dc:local", "samba.tests.auth_log_samlogon",
722                            extra_args=['-U"$USERNAME%$PASSWORD"'],
723                            environ={'CLIENT_IP': '127.0.0.11',
724                                     'SOCKET_WRAPPER_DEFAULT_IFACE': 11})
725     planoldpythontestsuite("ad_dc_ntvfs:local", "samba.tests.auth_log_samlogon",
726                            extra_args=['-U"$USERNAME%$PASSWORD"'],
727                            environ={'CLIENT_IP': '127.0.0.11',
728                                     'SOCKET_WRAPPER_DEFAULT_IFACE': 11})
729     planoldpythontestsuite("ad_dc:local", "samba.tests.auth_log_netlogon",
730                            extra_args=['-U"$USERNAME%$PASSWORD"'],
731                            environ={'CLIENT_IP': '127.0.0.11',
732                                     'SOCKET_WRAPPER_DEFAULT_IFACE': 11})
733     planoldpythontestsuite("ad_dc_ntvfs:local", "samba.tests.auth_log_netlogon",
734                            extra_args=['-U"$USERNAME%$PASSWORD"'],
735                            environ={'CLIENT_IP': '127.0.0.11',
736                                     'SOCKET_WRAPPER_DEFAULT_IFACE': 11})
737     planoldpythontestsuite("ad_dc:local",
738                            "samba.tests.auth_log_netlogon_bad_creds",
739                            extra_args=['-U"$USERNAME%$PASSWORD"'],
740                            environ={'CLIENT_IP': '127.0.0.11',
741                                     'SOCKET_WRAPPER_DEFAULT_IFACE': 11})
742     planoldpythontestsuite("ad_dc_ntvfs:local",
743                            "samba.tests.auth_log_netlogon_bad_creds",
744                            extra_args=['-U"$USERNAME%$PASSWORD"'],
745                            environ={'CLIENT_IP': '127.0.0.11',
746                                     'SOCKET_WRAPPER_DEFAULT_IFACE': 11})
747     planoldpythontestsuite("ad_dc:local", "samba.tests.audit_log_pass_change",
748                            extra_args=['-U"$USERNAME%$PASSWORD"'],
749                            environ={'CLIENT_IP': '127.0.0.11',
750                                     'SOCKET_WRAPPER_DEFAULT_IFACE': 11})
751     planoldpythontestsuite("ad_dc:local", "samba.tests.audit_log_dsdb",
752                            extra_args=['-U"$USERNAME%$PASSWORD"'],
753                            environ={'CLIENT_IP': '127.0.0.11',
754                                     'SOCKET_WRAPPER_DEFAULT_IFACE': 11})
755     planoldpythontestsuite("ad_dc:local", "samba.tests.group_audit",
756                            extra_args=['-U"$USERNAME%$PASSWORD"'],
757                            environ={'CLIENT_IP': '127.0.0.11',
758                                     'SOCKET_WRAPPER_DEFAULT_IFACE': 11})
759
760 planoldpythontestsuite("fl2008r2dc:local",
761                        "samba.tests.getdcname",
762                        extra_args=['-U"$USERNAME%$PASSWORD"'],
763                        py3_compatible=True)
764
765 planoldpythontestsuite("ad_dc",
766                        "samba.tests.net_join_no_spnego",
767                        extra_args=['-U"$USERNAME%$PASSWORD"'],
768                        py3_compatible=True)
769 planoldpythontestsuite("ad_dc",
770                        "samba.tests.net_join",
771                        extra_args=['-U"$USERNAME%$PASSWORD"'],
772                        py3_compatible=True)
773 # Need to test the password hashing in multiple environments to ensure that
774 # all the possible options are covered
775 #
776 # ad_dc:local functional_level >= 2008, gpg keys available
777 planoldpythontestsuite("ad_dc:local",
778                        "samba.tests.password_hash_gpgme",
779                        extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
780 # ad_dc_ntvfs:local functional level >= 2008, gpg keys not available
781 planoldpythontestsuite("ad_dc_ntvfs:local",
782                        "samba.tests.password_hash_fl2008",
783                        extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
784 # fl2003dc:local functional level < 2008, gpg keys not available
785 planoldpythontestsuite("fl2003dc:local",
786                        "samba.tests.password_hash_fl2003",
787                        extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
788 # ad_dc: wDigest values over ldap
789 planoldpythontestsuite("ad_dc",
790                        "samba.tests.password_hash_ldap",
791                        extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
792
793 for env in ["ad_dc", smbv1_disabled_testenv]:
794     planoldpythontestsuite(env + ":local", "samba.tests.domain_backup",
795                            extra_args=['-U"$USERNAME%$PASSWORD"'])
796
797 planoldpythontestsuite("none",
798                        "samba.tests.domain_backup_offline")
799 # Encrypted secrets
800 # ensure default provision (ad_dc) and join (vampire_dc)
801 # encrypt secret values on disk.
802 planoldpythontestsuite("ad_dc:local",
803                        "samba.tests.encrypted_secrets",
804                        extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
805 planoldpythontestsuite("vampire_dc:local",
806                        "samba.tests.encrypted_secrets",
807                        extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
808 # The fl2000dc environment is provisioned with the --plaintext_secrets option
809 # so this test will fail, which proves the secrets are not being encrypted.
810 # There is an entry in known_fail.d.
811 planoldpythontestsuite("fl2000dc:local",
812                        "samba.tests.encrypted_secrets",
813                        extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
814
815 planpythontestsuite("none",
816                     "samba.tests.lsa_string",
817                     py3_compatible=True)
818
819 planoldpythontestsuite("ad_dc_ntvfs",
820                        "samba.tests.krb5_credentials",
821                        py3_compatible=True,
822                        extra_args=['-U"$USERNAME%$PASSWORD"'])
823
824 for env in ["ad_dc_ntvfs", "vampire_dc", "promoted_dc"]:
825     planoldpythontestsuite(env,
826                            "samba.tests.py_credentials",
827                            extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
828 planoldpythontestsuite("ad_dc_ntvfs",
829                        "samba.tests.emulate.traffic",
830                        extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
831 planoldpythontestsuite("ad_dc_ntvfs",
832                        "samba.tests.emulate.traffic_packet",
833                        extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
834 planoldpythontestsuite("ad_dc_ntvfs",
835                        "samba.tests.blackbox.traffic_replay",
836                        extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
837 planoldpythontestsuite("ad_dc_ntvfs",
838                        "samba.tests.blackbox.traffic_learner",
839                        extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
840 planoldpythontestsuite("ad_dc_ntvfs",
841                        "samba.tests.blackbox.traffic_summary",
842                        extra_args=['-U"$USERNAME%$PASSWORD"'], py3_compatible=True)
843 planoldpythontestsuite("none", "samba.tests.loadparm")
844
845 #
846 # Want a selection of environments across the process models
847 #
848 for env in ["ad_dc_ntvfs:local", "ad_dc:local",
849             "fl2003dc:local", "fl2008r2dc:local",
850             "promoted_dc:local"]:
851     planoldpythontestsuite(env, "samba.tests.blackbox.smbcontrol", py3_compatible=True)
852
853 plantestsuite_loadlist("samba4.ldap.python(ad_dc_ntvfs)", "ad_dc_ntvfs", [python, os.path.join(samba4srcdir, "dsdb/tests/python/ldap.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
854 plantestsuite_loadlist("samba4.tokengroups.krb5.python(ad_dc_ntvfs)", "ad_dc_ntvfs:local", [python, os.path.join(samba4srcdir, "dsdb/tests/python/token_group.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '-k', 'yes', '$LOADLIST', '$LISTOPT'])
855 plantestsuite_loadlist("samba4.tokengroups.ntlm.python(ad_dc_ntvfs)", "ad_dc_ntvfs:local", [python, os.path.join(samba4srcdir, "dsdb/tests/python/token_group.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '-k', 'no', '$LOADLIST', '$LISTOPT'])
856 plantestsuite("samba4.sam.python(fl2008r2dc)", "fl2008r2dc", [python, os.path.join(samba4srcdir, "dsdb/tests/python/sam.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN'])
857 plantestsuite("samba4.sam.python(ad_dc_ntvfs)", "ad_dc_ntvfs", [python, os.path.join(samba4srcdir, "dsdb/tests/python/sam.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN'])
858 plantestsuite("samba4.user_account_control.python(ad_dc_ntvfs)", "ad_dc_ntvfs", [python, os.path.join(samba4srcdir, "dsdb/tests/python/user_account_control.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN'])
859 planoldpythontestsuite("ad_dc_ntvfs", "dsdb_schema_info",
860                        extra_path=[os.path.join(samba4srcdir, 'dsdb/tests/python')],
861                        name="samba4.schemaInfo.python(ad_dc_ntvfs)",
862         extra_args=['-U"$DOMAIN/$DC_USERNAME%$DC_PASSWORD"'], py3_compatible=True)
863
864 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.dsdb_schema_attributes", py3_compatible=True)
865
866 plantestsuite_loadlist("samba4.urgent_replication.python(ad_dc_ntvfs)", "ad_dc_ntvfs:local", [python, os.path.join(samba4srcdir, "dsdb/tests/python/urgent_replication.py"), '$PREFIX_ABS/ad_dc_ntvfs/private/sam.ldb', '$LOADLIST', '$LISTOPT'])
867 plantestsuite_loadlist("samba4.ldap.dirsync.python(ad_dc_ntvfs)", "ad_dc_ntvfs", [python, os.path.join(samba4srcdir, "dsdb/tests/python/dirsync.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
868 plantestsuite_loadlist("samba4.ldap.match_rules.python", "ad_dc_ntvfs", [python, os.path.join(srcdir(), "lib/ldb-samba/tests/match_rules.py"), '$PREFIX_ABS/ad_dc_ntvfs/private/sam.ldb', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
869 plantestsuite_loadlist("samba4.ldap.notification.python(ad_dc_ntvfs)", "ad_dc_ntvfs", [python, os.path.join(samba4srcdir, "dsdb/tests/python/notification.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
870 plantestsuite_loadlist("samba4.ldap.sites.python(ad_dc_ntvfs)", "ad_dc_ntvfs", [python, os.path.join(samba4srcdir, "dsdb/tests/python/sites.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
871
872 plantestsuite_loadlist("samba4.ldap.sort.python(ad_dc_ntvfs)", "ad_dc_ntvfs", [python, os.path.join(samba4srcdir, "dsdb/tests/python/sort.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
873 plantestsuite_loadlist("samba4.ldap.vlv.python(ad_dc_ntvfs)", "ad_dc_ntvfs", [python, os.path.join(samba4srcdir, "dsdb/tests/python/vlv.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
874 plantestsuite_loadlist("samba4.ldap.linked_attributes.python(ad_dc_ntvfs)", "ad_dc_ntvfs:local", [python, os.path.join(samba4srcdir, "dsdb/tests/python/linked_attributes.py"), '$PREFIX_ABS/ad_dc_ntvfs/private/sam.ldb', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
875
876 # These should be the first tests run against testenvs created by backup/restore
877 for env in ['offlinebackupdc', 'restoredc', 'renamedc', 'labdc']:
878     # check that a restored DC matches the original DC (backupfromdc)
879     plantestsuite("samba4.blackbox.ldapcmp_restore", env,
880                   ["PYTHON=%s" % python,
881                    os.path.join(bbdir, "ldapcmp_restoredc.sh"),
882                    '$PREFIX_ABS/backupfromdc', '$PREFIX_ABS/%s' % env])
883
884 # we also test joining backupfromdc here, as it's a bit special in that it
885 # doesn't have Default-First-Site-Name
886 for env in ['backupfromdc', 'offlinebackupdc', 'restoredc', 'renamedc',
887             'labdc']:
888     # basic test that we can join the testenv DC
889     plantestsuite("samba4.blackbox.join_ldapcmp", env,
890                   ["PYTHON=%s" % python, os.path.join(bbdir, "join_ldapcmp.sh")])
891
892 plantestsuite_loadlist("samba4.ldap.rodc.python(rodc)", "rodc",
893                        [python,
894                         os.path.join(samba4srcdir, "dsdb/tests/python/rodc.py"),
895                         '$SERVER', '-U"$USERNAME%$PASSWORD"',
896                         '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
897
898 plantestsuite_loadlist("samba4.ldap.rodc_rwdc.python(rodc)", "rodc:local",
899                        [python,
900                         os.path.join(samba4srcdir,
901                                      "dsdb/tests/python/rodc_rwdc.py"),
902                         '$SERVER', '$DC_SERVER', '-U"$USERNAME%$PASSWORD"',
903                         '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
904
905 planoldpythontestsuite("rodc:local", "replica_sync_rodc",
906                        extra_path=[os.path.join(samba4srcdir, 'torture/drs/python')],
907                        name="samba4.drs.replica_sync_rodc.python(rodc)",
908                        environ={'DC1': '$DC_SERVER', 'DC2': '$RODC_DC_SERVER'},
909                        extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'],
910                        py3_compatible=True)
911
912 planoldpythontestsuite("ad_dc_ntvfs", "password_settings",
913                        extra_path=[os.path.join(samba4srcdir, 'dsdb/tests/python')],
914                        name="samba4.ldap.passwordsettings.python",
915                        extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'],
916                        py3_compatible=True)
917
918 for env in ["ad_dc_ntvfs", "fl2000dc", "fl2003dc", "fl2008r2dc"]:
919     plantestsuite_loadlist("samba4.ldap_schema.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/ldap_schema.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
920     plantestsuite("samba4.ldap.possibleInferiors.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/samdb/ldb_modules/tests/possibleinferiors.py"), "ldap://$SERVER", '-U"$USERNAME%$PASSWORD"', "-W$DOMAIN"])
921     plantestsuite_loadlist("samba4.ldap.secdesc.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/sec_descriptor.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
922     plantestsuite_loadlist("samba4.ldap.acl.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/acl.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
923     if env != "fl2000dc":
924         # This test makes excessive use of the "userPassword" attribute which
925         # isn't available on DCs with Windows 2000 domain function level -
926         # therefore skip it in that configuration
927         plantestsuite_loadlist("samba4.ldap.passwords.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/passwords.py"), "$SERVER", '-U"$USERNAME%$PASSWORD"', "-W$DOMAIN", '$LOADLIST', '$LISTOPT'])
928
929 env = "ad_dc_ntvfs"
930 plantestsuite_loadlist("samba4.ldap.confidential_attr.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/confidential_attr.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
931
932 for env in ["ad_dc_ntvfs"]:
933     # This test takes a lot of time, so we run it against a minimum of
934     # environments, please only add new ones if there's really a
935     # difference we need to test
936     plantestsuite_loadlist("samba4.ldap.password_lockout.python(%s)" % env, env, [python, os.path.join(samba4srcdir, "dsdb/tests/python/password_lockout.py"), "$SERVER", '-U"$USERNAME%$PASSWORD"', "-W$DOMAIN", "--realm=$REALM", '$LOADLIST', '$LISTOPT'])
937     planoldpythontestsuite(env, "tombstone_reanimation",
938                            name="samba4.tombstone_reanimation.python",
939                            environ={'TEST_SERVER': '$SERVER', 'TEST_USERNAME': '$USERNAME', 'TEST_PASSWORD': '$PASSWORD'},
940                            extra_path=[os.path.join(samba4srcdir, 'dsdb/tests/python')], py3_compatible=True
941                            )
942
943 # this is a basic sanity-check of Kerberos/NTLM user login
944 for env in ["offlinebackupdc", "restoredc", "renamedc", "labdc"]:
945     plantestsuite_loadlist("samba4.ldap.login_basics.python(%s)" % env, env,
946                            [python, os.path.join(samba4srcdir, "dsdb/tests/python/login_basics.py"),
947                             "$SERVER", '-U"$USERNAME%$PASSWORD"', "-W$DOMAIN", "--realm=$REALM",
948                             '$LOADLIST', '$LISTOPT'])
949
950 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.upgradeprovisionneeddc", py3_compatible=True)
951 planpythontestsuite("ad_dc:local", "samba.tests.posixacl", py3_compatible=True)
952 planpythontestsuite("ad_dc_no_nss:local", "samba.tests.posixacl", py3_compatible=True)
953 plantestsuite_loadlist("samba4.deletetest.python(ad_dc_ntvfs)", "ad_dc_ntvfs", [python, os.path.join(samba4srcdir, "dsdb/tests/python/deletetest.py"),
954                                                                                 '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT'])
955 plantestsuite("samba4.blackbox.samba3dump", "none", [os.path.join(samba4srcdir, "selftest/test_samba3dump.sh")])
956 plantestsuite("samba4.blackbox.upgrade", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_s3upgrade.sh"), '$PREFIX/provision'])
957 plantestsuite("samba4.blackbox.provision.py", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_provision.sh"), '$PREFIX/provision'])
958 plantestsuite("samba4.blackbox.supported_features", "none",
959               ["PYTHON=%s" % python,
960                os.path.join(samba4srcdir,
961                             "setup/tests/blackbox_supported_features.sh"),
962                '$PREFIX/provision'])
963 plantestsuite("samba4.blackbox.start_backup", "none",
964               ["PYTHON=%s" % python,
965                os.path.join(samba4srcdir,
966                             "setup/tests/blackbox_start_backup.sh"),
967                '$PREFIX/provision'])
968 plantestsuite("samba4.blackbox.upgradeprovision.current", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_upgradeprovision.sh"), '$PREFIX/provision'])
969 plantestsuite("samba4.blackbox.setpassword.py", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_setpassword.sh"), '$PREFIX/provision'])
970 plantestsuite("samba4.blackbox.newuser.py", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_newuser.sh"), '$PREFIX/provision'])
971 plantestsuite("samba4.blackbox.group.py", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_group.sh"), '$PREFIX/provision'])
972 plantestsuite("samba4.blackbox.spn.py(ad_dc_ntvfs:local)", "ad_dc_ntvfs:local", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_spn.sh"), '$PREFIX/ad_dc_ntvfs'])
973 plantestsuite_loadlist("samba4.ldap.bind(fl2008r2dc)", "fl2008r2dc", [python, os.path.join(srcdir(), "auth/credentials/tests/bind.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '$LOADLIST', '$LISTOPT'])
974
975 # This makes sure we test the rid allocation code
976 t = "rpc.samr.large-dc"
977 plansmbtorture4testsuite(t, "vampire_dc", ['$SERVER', '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], modname=("samba4.%s.one" % t))
978 plansmbtorture4testsuite(t, "vampire_dc", ['$SERVER', '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], modname="samba4.%s.two" % t)
979
980 # RPC smoke-tests for testenvs of interest (RODC, etc)
981 for env in ['rodc', 'offlinebackupdc', 'restoredc', 'renamedc', 'labdc']:
982     plansmbtorture4testsuite('rpc.echo', env, ['ncacn_np:$SERVER', "-k", "yes", '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN'], modname="samba4.rpc.echo")
983     plansmbtorture4testsuite('rpc.echo', "%s:local" % env, ['ncacn_np:$SERVER', "-k", "yes", '-P', '--workgroup=$DOMAIN'], modname="samba4.rpc.echo")
984     plansmbtorture4testsuite('rpc.echo', "%s:local" % env, ['ncacn_np:$SERVER', "-k", "no", '-Utestallowed\ account%$DC_PASSWORD', '--workgroup=$DOMAIN'], modname="samba4.rpc.echo.testallowed")
985     plansmbtorture4testsuite('rpc.echo', "%s:local" % env, ['ncacn_np:$SERVER', "-k", "no", '-Utestdenied%$DC_PASSWORD', '--workgroup=$DOMAIN'], modname="samba4.rpc.echo.testdenied")
986     plantestsuite("samba4.blackbox.smbclient(%s:local)" % env, "%s:local" % env, [os.path.join(samba4srcdir, "utils/tests/test_smbclient.sh"), '$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD', '$DOMAIN', binpath('smbclient')])
987
988 planpythontestsuite("rodc:local", "samba.tests.samba_tool.rodc", py3_compatible=True)
989
990 plantestsuite("samba.blackbox.rpcclient_samlogon", "rodc:local", [os.path.join(samba3srcdir, "script/tests/test_rpcclient_samlogon.sh"),
991                                                                   "$DC_USERNAME", "$DC_PASSWORD", "ncacn_np:$SERVER", configuration])
992
993 plantestsuite("samba.blackbox.rpcclient_samlogon_testallowed", "rodc:local", [os.path.join(samba3srcdir, "script/tests/test_rpcclient_samlogon.sh"),
994                                                                               "testallowed\ account", "$DC_PASSWORD", "ncacn_np:$SERVER", configuration])
995
996 plantestsuite("samba.blackbox.rpcclient_samlogon_testdenied", "rodc:local", [os.path.join(samba3srcdir, "script/tests/test_rpcclient_samlogon.sh"),
997                                                                              "testdenied", "$DC_PASSWORD", "ncacn_np:$SERVER", configuration])
998
999
1000 plantestsuite("samba4.blackbox.provision-backend", "none", ["PYTHON=%s" % python, os.path.join(samba4srcdir, "setup/tests/blackbox_provision-backend.sh"), '$PREFIX/provision'])
1001
1002 # Test renaming the DC
1003 plantestsuite("samba4.blackbox.renamedc.sh", "none", ["PYTHON=%s" % python, os.path.join(bbdir, "renamedc.sh"), '$PREFIX/provision'])
1004
1005 # DRS python tests
1006
1007 env = 'vampire_dc'
1008 planoldpythontestsuite(env, "ridalloc_exop",
1009                        extra_path=[os.path.join(samba4srcdir, 'torture/drs/python')],
1010                        name="samba4.drs.ridalloc_exop.python(%s)" % env,
1011                        environ={'DC1': "$DC_SERVER", 'DC2': '$%s_SERVER' % env.upper()},
1012                        extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'],
1013                        py3_compatible=True)
1014
1015 for env in ['vampire_dc', 'promoted_dc']:
1016     planoldpythontestsuite("%s:local" % env, "samba_tool_drs",
1017                            extra_path=[os.path.join(samba4srcdir, 'torture/drs/python')],
1018                            name="samba4.drs.samba_tool_drs.python(%s)" % env,
1019                            environ={'DC1': '$DC_SERVER', 'DC2': '$%s_SERVER' % env.upper()},
1020                            extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'],
1021                            py3_compatible=True)
1022     planoldpythontestsuite("%s:local" % env, "samba_tool_drs_showrepl",
1023                            extra_path=[os.path.join(samba4srcdir, 'torture/drs/python')],
1024                            name="samba4.drs.samba_tool_drs_showrepl.python(%s)" % env,
1025                            environ={'DC1': '$DC_SERVER', 'DC2': '$%s_SERVER' % env.upper()},
1026                            extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'],
1027                            py3_compatible=True)
1028     planoldpythontestsuite("%s:local" % env, "replica_sync",
1029                            extra_path=[os.path.join(samba4srcdir, 'torture/drs/python')],
1030                            name="samba4.drs.replica_sync.python(%s)" % env,
1031                            environ={'DC1': '$DC_SERVER', 'DC2': '$%s_SERVER' % env.upper()},
1032                            extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'],
1033                            py3_compatible=True)
1034     planoldpythontestsuite(env, "delete_object",
1035                            extra_path=[os.path.join(samba4srcdir, 'torture/drs/python')],
1036                            name="samba4.drs.delete_object.python(%s)" % env,
1037                            environ={'DC1': '$DC_SERVER', 'DC2': '$%s_SERVER' % env.upper()},
1038                            extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'],
1039                            py3_compatible=True)
1040     planoldpythontestsuite(env, "fsmo",
1041                            name="samba4.drs.fsmo.python(%s)" % env,
1042                            extra_path=[os.path.join(samba4srcdir, 'torture/drs/python')],
1043                            environ={'DC1': "$DC_SERVER", 'DC2': '$%s_SERVER' % env.upper()},
1044                            extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'],
1045                            py3_compatible=True)
1046     planoldpythontestsuite(env, "repl_move",
1047                            extra_path=[os.path.join(samba4srcdir, 'torture/drs/python')],
1048                            name="samba4.drs.repl_move.python(%s)" % env,
1049                            environ={'DC1': "$DC_SERVER", 'DC2': '$%s_SERVER' % env.upper()},
1050                            extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'],
1051                            py3_compatible=True)
1052     planoldpythontestsuite(env, "getnc_exop",
1053                            extra_path=[os.path.join(samba4srcdir, 'torture/drs/python')],
1054                            name="samba4.drs.getnc_exop.python(%s)" % env,
1055                            environ={'DC1': "$DC_SERVER", 'DC2': '$%s_SERVER' % env.upper()},
1056                            extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'],
1057                            py3_compatible=True)
1058     planoldpythontestsuite(env, "getnc_unpriv",
1059                            extra_path=[os.path.join(samba4srcdir, 'torture/drs/python')],
1060                            name="samba4.drs.getnc_unpriv.python(%s)" % env,
1061                            environ={'DC1': "$DC_SERVER", 'DC2': '$%s_SERVER' % env.upper()},
1062                            extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'],
1063                            py3_compatible=True)
1064     planoldpythontestsuite(env, "linked_attributes_drs",
1065                            extra_path=[os.path.join(samba4srcdir, 'torture/drs/python')],
1066                            name="samba4.drs.linked_attributes_drs.python(%s)" % env,
1067                            environ={'DC1': "$DC_SERVER", 'DC2': '$%s_SERVER' % env.upper()},
1068                            extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'])
1069     planoldpythontestsuite(env, "link_conflicts",
1070                            extra_path=[os.path.join(samba4srcdir, 'torture/drs/python')],
1071                            name="samba4.drs.link_conflicts.python(%s)" % env,
1072                            environ={'DC1': "$DC_SERVER", 'DC2': '$%s_SERVER' % env.upper()},
1073                            extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'],
1074                            py3_compatible=True)
1075
1076 for env in ['vampire_dc', 'promoted_dc', 'vampire_2000_dc']:
1077     planoldpythontestsuite(env, "repl_schema",
1078                            extra_path=[os.path.join(samba4srcdir, 'torture/drs/python')],
1079                            name="samba4.drs.repl_schema.python(%s)" % env,
1080                            environ={'DC1': "$DC_SERVER", 'DC2': '$%s_SERVER' % env.upper()},
1081                            extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'],
1082                            py3_compatible=True)
1083
1084 # A side-effect of the getncchanges tests is that they will create hundreds of
1085 # tombstone objects, so run them last to avoid interferring with (and slowing
1086 # down) the other DRS tests
1087 for env in ['vampire_dc', 'promoted_dc']:
1088     planoldpythontestsuite(env, "getncchanges",
1089                            extra_path=[os.path.join(samba4srcdir, 'torture/drs/python')],
1090                            name="samba4.drs.getncchanges.python(%s)" % env,
1091                            environ={'DC1': "$DC_SERVER", 'DC2': '$%s_SERVER' % env.upper()},
1092                            extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'],
1093                            py3_compatible=True)
1094
1095 for env in ['ad_dc_ntvfs']:
1096     planoldpythontestsuite(env, "repl_rodc",
1097                            extra_path=[os.path.join(samba4srcdir, 'torture/drs/python')],
1098                            name="samba4.drs.repl_rodc.python(%s)" % env,
1099                            environ={'DC1': "$DC_SERVER", 'DC2': '$DC_SERVER'},
1100                            extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'],
1101                            py3_compatible=True)
1102     planoldpythontestsuite(env, "samba.tests.join",
1103                            name="samba.tests.join.python(%s)" % env,
1104                            extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'],
1105                            py3_compatible=True)
1106     planoldpythontestsuite(env, "cracknames",
1107                            extra_path=[os.path.join(samba4srcdir, 'torture/drs/python')],
1108                            name="samba4.drs.cracknames.python(%s)" % env,
1109                            environ={'DC1': "$DC_SERVER", 'DC2': '$DC_SERVER'},
1110                            extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'],
1111                            py3_compatible=True)
1112
1113 planoldpythontestsuite("chgdcpass:local", "samba.tests.blackbox.samba_dnsupdate",
1114                        environ={'DNS_SERVER_IP': '$SERVER_IP'})
1115
1116 for env in ["ad_dc_ntvfs", "s4member", "rodc", "promoted_dc", "ad_dc", "ad_member"]:
1117     plantestsuite("samba.blackbox.wbinfo(%s:local)" % env, "%s:local" % env, [os.path.join(samba4srcdir, "../nsswitch/tests/test_wbinfo.sh"), '$DOMAIN', '$DC_USERNAME', '$DC_PASSWORD', env])
1118
1119 #
1120 # KDC Tests
1121 #
1122
1123 # This test is for users cached at the RODC
1124 plansmbtorture4testsuite('krb5.kdc', "rodc", ['ncacn_np:$SERVER_IP', "-k", "yes", '-Utestdenied%$PASSWORD',
1125                                               '--workgroup=$DOMAIN', '--realm=$REALM',
1126                                               '--option=torture:krb5-upn=testdenied_upn@$REALM.upn',
1127                                               '--option=torture:expect_rodc=true'],
1128                          "samba4.krb5.kdc with account DENIED permission to replicate to an RODC")
1129 plansmbtorture4testsuite('krb5.kdc', "rodc", ['ncacn_np:$SERVER_IP', "-k", "yes", '-Utestallowed\ account%$PASSWORD',
1130                                               '--workgroup=$DOMAIN', '--realm=$REALM',
1131                                               '--option=torture:expect_machine_account=true',
1132                                               '--option=torture:krb5-upn=testallowed\ upn@$REALM',
1133                                               '--option=torture:krb5-hostname=testallowed',
1134                                               '--option=torture:expect_rodc=true',
1135                                               '--option=torture:expect_cached_at_rodc=true'],
1136                          "samba4.krb5.kdc with account ALLOWED permission to replicate to an RODC")
1137
1138 # This ensures we have correct behaviour on a server that is not not the PDC emulator
1139 env = "promoted_dc"
1140 plansmbtorture4testsuite('krb5.kdc', env, ['ncacn_np:$SERVER_IP', "-k", "yes", '-U$USERNAME%$PASSWORD', '--workgroup=$DOMAIN', '--realm=$REALM'],
1141                          "samba4.krb5.kdc with specified account")
1142 plansmbtorture4testsuite('krb5.kdc', env, ['ncacn_np:$SERVER_IP', "-k", "yes", '-Utestupnspn%$PASSWORD', '--workgroup=$DOMAIN', '--realm=$REALM',
1143                                            '--option=torture:expect_machine_account=true',
1144                                            '--option=torture:krb5-upn=http/testupnspn.$DNSNAME@$REALM',
1145                                            '--option=torture:krb5-hostname=testupnspn.$DNSNAME',
1146                                            '--option=torture:krb5-service=http'],
1147                          "samba4.krb5.kdc with account having identical UPN and SPN")
1148
1149
1150 for env in ["rodc", "promoted_dc", "fl2000dc", "fl2008r2dc"]:
1151     if env == "rodc":
1152         # The machine account is cached at the RODC, as it is the local account
1153         extra_options = ['--option=torture:expect_rodc=true', '--option=torture:expect_cached_at_rodc=true']
1154     else:
1155         extra_options = []
1156
1157     plansmbtorture4testsuite('krb5.kdc', "%s:local" % env, ['ncacn_np:$SERVER_IP', "-k", "yes", '-P',
1158                                                             '--workgroup=$DOMAIN', '--realm=$REALM',
1159                                                             '--option=torture:krb5-hostname=$SERVER',
1160                                                             '--option=torture:run_removedollar_test=true',
1161                                                             '--option=torture:expect_machine_account=true'] + extra_options,
1162                              "samba4.krb5.kdc with machine account")
1163
1164
1165 for env in [
1166         'vampire_dc',
1167         'promoted_dc']:
1168     planoldpythontestsuite(env, "samba.tests.kcc",
1169                            name="samba.tests.kcc",
1170                            environ={'TEST_SERVER': '$SERVER', 'TEST_USERNAME': '$USERNAME',
1171                                     'TEST_PASSWORD': '$PASSWORD',
1172                                     'TEST_ENV': env
1173                                     },
1174                            extra_path=[os.path.join(srcdir(), "samba/python"), ],
1175                            py3_compatible=True)
1176     planpythontestsuite(env, "samba.tests.samba_tool.visualize_drs", py3_compatible=True)
1177
1178 planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.kcc.kcc_utils", py3_compatible=True)
1179
1180 for env in ["simpleserver", "fileserver", "nt4_dc", "ad_dc", "ad_dc_ntvfs",
1181             "ad_member", "offlinebackupdc", "restoredc", "renamedc", "labdc"]:
1182     planoldpythontestsuite(env, "netlogonsvc",
1183                            extra_path=[os.path.join(srcdir(), 'python/samba/tests')],
1184                            name="samba.tests.netlogonsvc.python(%s)" % env,
1185                            py3_compatible=True)
1186
1187 for env in ["ktest", "ad_member", "ad_dc_no_ntlm"]:
1188     planoldpythontestsuite(env, "ntlmdisabled",
1189                            extra_path=[os.path.join(srcdir(), 'python/samba/tests')],
1190                            name="samba.tests.ntlmdisabled.python(%s)" % env,
1191                            py3_compatible=True)
1192
1193 # Demote the vampire DC, it must be the last test each DC, before the dbcheck
1194 for env in ['vampire_dc', 'promoted_dc', 'rodc']:
1195     planoldpythontestsuite(env, "samba.tests.samba_tool.demote",
1196                            name="samba.tests.samba_tool.demote",
1197                            environ={
1198                                'CONFIGFILE': '$PREFIX/%s/etc/smb.conf' % env
1199                            },
1200                            extra_args=['-U"$USERNAME%$PASSWORD"'],
1201                            extra_path=[os.path.join(srcdir(), "samba/python")]
1202                            )
1203 # TODO: Verifying the databases really should be a part of the
1204 # environment teardown.
1205 # check the databases are all OK. PLEASE LEAVE THIS AS THE LAST TEST
1206 for env in ["ad_dc_ntvfs", "ad_dc", "fl2000dc", "fl2003dc", "fl2008r2dc",
1207             'vampire_dc', 'promoted_dc', 'backupfromdc', 'restoredc',
1208             'renamedc', 'offlinebackupdc', 'labdc']:
1209     plantestsuite("samba4.blackbox.dbcheck(%s)" % env, env + ":local", ["PYTHON=%s" % python, os.path.join(bbdir, "dbcheck.sh"), '$PREFIX/provision', configuration])
1210
1211 #
1212 # Tests to verify bug 13653 https://bugzilla.samba.org/show_bug.cgi?id=13653
1213 # ad_dc has an lmdb backend, ad_dc_ntvfs has a tdb backend.
1214 #
1215 planoldpythontestsuite("ad_dc_ntvfs:local",
1216                        "samba.tests.blackbox.bug13653",
1217                        extra_args=['-U"$USERNAME%$PASSWORD"'],
1218                        environ={'TEST_ENV': 'ad_dc_ntvfs'},
1219                        py3_compatible=True)
1220 planoldpythontestsuite("ad_dc:local",
1221                        "samba.tests.blackbox.bug13653",
1222                        extra_args=['-U"$USERNAME%$PASSWORD"'],
1223                        environ={'TEST_ENV': 'ad_dc'},
1224                        py3_compatible=True)
1225 # cmocka tests not requiring a specific environment
1226 #
1227 plantestsuite("samba4.dsdb.samdb.ldb_modules.unique_object_sids", "none",
1228               [os.path.join(bindir(), "test_unique_object_sids")])
1229 plantestsuite("samba4.dsdb.samdb.ldb_modules.encrypted_secrets.tdb", "none",
1230               [os.path.join(bindir(), "test_encrypted_secrets_tdb")])
1231 plantestsuite("samba4.dsdb.samdb.ldb_modules.encrypted_secrets.mdb", "none",
1232               [os.path.join(bindir(), "test_encrypted_secrets_mdb")])
1233 plantestsuite("lib.audit_logging.audit_logging", "none",
1234               [os.path.join(bindir(), "audit_logging_test")])
1235 plantestsuite("lib.audit_logging.audit_logging.errors", "none",
1236               [os.path.join(bindir(), "audit_logging_error_test")])
1237 plantestsuite("samba4.dsdb.samdb.ldb_modules.audit_util", "none",
1238               [os.path.join(bindir(), "test_audit_util")])
1239 plantestsuite("samba4.dsdb.samdb.ldb_modules.audit_log", "none",
1240               [os.path.join(bindir(), "test_audit_log")])
1241 plantestsuite("samba4.dsdb.samdb.ldb_modules.audit_log.errors", "none",
1242               [os.path.join(bindir(), "test_audit_log_errors")])
1243 plantestsuite("samba4.dsdb.samdb.ldb_modules.group_audit", "none",
1244               [os.path.join(bindir(), "test_group_audit")])
1245 plantestsuite("samba4.dsdb.samdb.ldb_modules.group_audit.errors", "none",
1246               [os.path.join(bindir(), "test_group_audit_errors")])
1247 plantestsuite("samba4.dcerpc.dnsserver.dnsutils", "none",
1248               [os.path.join(bindir(), "test_rpc_dns_server_dnsutils")])
1249
1250 # process restart and limit tests, these break the environment so need to run
1251 # in their own specific environment
1252 planoldpythontestsuite("preforkrestartdc:local",
1253                        "samba.tests.prefork_restart",
1254                        extra_path=[
1255                            os.path.join(srcdir(), 'python/samba/tests')],
1256                        extra_args=['-U"$USERNAME%$PASSWORD"'],
1257                        name="samba.tests.prefork_restart",
1258                        py3_compatible=True)
1259 planoldpythontestsuite("proclimitdc:local",
1260                        "samba.tests.process_limits",
1261                        extra_path=[
1262                            os.path.join(srcdir(), 'python/samba/tests')],
1263                        extra_args=['-U"$USERNAME%$PASSWORD"'],
1264                        environ={'CLIENT_IP': '127.0.0.11',
1265                                 'SOCKET_WRAPPER_DEFAULT_IFACE': 11},
1266                        name="samba.tests.process_limits",
1267                        py3_compatible=True)