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