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