1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
Commit Graph

968 Commits

Author SHA1 Message Date
Noel Power
3dced6a436 selftest: Add basic smbcacls test(s)
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-07-07 21:40:33 +00:00
Stefan Metzmacher
b7832c2c80 selftest/Samba4: split out _setup_ad_dc()
setup_ad_dc() was used for more than 'ad_dc'.
Setting up 'ad_dc' means not all missing arguments are
passed as undef.

The following had no effect

        if (!defined($conf_opts)) {
                $conf_opts = "";
        }

and $conf_opts results in a string of 'HASH(....)'

So we better pass explicit undef arguments from setup_ad_dc() to
_setup_ad_dc() now.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2020-07-07 10:30:39 +00:00
Stefan Metzmacher
f1ecaa75a2 selftest/Samba3: support durable handles on the 'aio' share
This means we can test the lock sequence checking via the
'samba3.smb2.lock aio(nt4_dc)' test.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-06-27 04:20:39 +00:00
Andreas Schneider
984dd6416c selftest: Add ad_member_fips target
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
2020-05-18 14:43:40 +00:00
Andreas Schneider
5dc1c312b6 selftest: Add force_fips_mode support to provision_ad_member()
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
2020-05-18 14:43:40 +00:00
Andreas Schneider
c94f6ddcca selftest: Split out a provision_ad_member() function
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
2020-05-18 14:43:40 +00:00
Andreas Schneider
17a7618a23 selftest: Use Kerberos to join an ad_member
Reviewed-by: Alexander Bokovoy <ab@samba.org>
2020-05-18 14:43:40 +00:00
Isaac Boukris
8b5e764413 selftest: add python S4U2Self tests including unkeyed checksums
To test the CRC32 I reverted the unkeyed-checksum fix (43958af1)
and the weak-crypto fix (389d1b97). Note that the unkeyed-md5
still worked even with weak-crypto disabled, and that the
unkeyed-sha1 never worked but I left it anyway.

Signed-off-by: Isaac Boukris <iboukris@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri May 15 12:25:40 UTC 2020 on sn-devel-184
2020-05-15 12:25:40 +00:00
Jeremy Allison
a9651d6bc2 s3: selftest: Add share definition [bad_iconv] in fileserver.
Creates a utf8 valid filename within that is invalid in CP850.
Useful to test smbclient list directory character set conversions.

https://bugzilla.samba.org/show_bug.cgi?id=14374

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2020-05-12 19:53:46 +00:00
Andreas Schneider
5ae07ac3ea selftest: Force fips mode for openssl in ad_dc_fips
This allows us to test MIT KRB5 and OpenLDAP in FIPS mode.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2020-04-08 13:02:40 +00:00
Andreas Schneider
a78f481984 selftest: Start ad_dc_fips with forced fips mode
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2020-04-08 13:02:40 +00:00
Andreas Schneider
df8831b9d2 selftest: Pass force_fips_mode to provision_raw_prepare()
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2020-04-08 13:02:40 +00:00
Andreas Schneider
dcd99c8d9f selftest: Pass force_fips to provision()
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2020-04-08 13:02:40 +00:00
Andreas Schneider
aa480d4b45 selftest: Pass force_fips_mode to provision_ad_dc()
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2020-04-08 13:02:39 +00:00
Andreas Schneider
8c5da549f6 selftest: Pass extra_provision_options to provision_raw_prepare()
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2020-04-08 13:02:39 +00:00
Andreas Schneider
865670616b selftest: Add an ad_dc_fips environment
This is not FIPS ready yet.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2020-04-08 13:02:39 +00:00
Noel Power
58623e5348 selftest: Modify fileserver_smb1 with vfs_aio params
To support running tests samba3.smbtorture_s3.vfs_aio* in
test env fileserver_smb1 we need to add some params to
fileserver_smb1 config files.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-03 15:08:32 +00:00
Noel Power
f7456c8be9 selftest: Add 'hide new files timeout' related data to fileserver_smb1
In order to support samba3.smbtorture_s3.hidenewfiles (and moving
the test to fileserver_smb1) we need to ensure we have some supporting
config

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-03 15:08:32 +00:00
Noel Power
02a16b3171 selftest/target: Add test environment ad_dc_default_smb1_done
Adding test env ad_dc_default_smb1_done an alias for
test environment ad_dc_default_smb1

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-03 15:08:27 +00:00
Noel Power
ba3fe03b51 selftest/target: Create nt4_dc_smb1_done env (alias for nt4_dc_smb1)
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-03 15:08:27 +00:00
Noel Power
4948dfc63d selftest/target: Add new alias environment fileserver_smb1_done
setup_fileserver_smb1_done is an alias for setup_fileserver_smb1

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-03 15:08:27 +00:00
Noel Power
7dbfdd8121 selftest/target: Add new alias environment ad_dc_smb1_done
Adding ad_dc_smb1_done, and alias for test env ad_dc_smb1

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-03 15:08:27 +00:00
Noel Power
f1139ac5c6 selftest/target: create return_alias_env function for Samba3.pm
This will allow us easily create lightweight alias environments
like ad_dc_smb1_done etc.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-03 15:08:27 +00:00
Noel Power
34b14c4fd2 selftest/target: Add new alias env ad_dc_default_smb1
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-03 15:08:27 +00:00
Noel Power
3e5131e06d selftest/target: Create new nt4_dc_smb1 environment
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-03 15:08:26 +00:00
Noel Power
b0ea347c50 selftest: Create new test env ad_dc_smb1
ad_dc_smb1 is a copy of the ad_dc test environment but
with the difference that it still supports SMB1, this will allow
use to still run SMB1 tests for that env.

Signed-off-by: Noel Power <npower@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-03 15:08:26 +00:00
Noel Power
fcae89684e selftest: Add new test environment fileserver_smb1
fileserver_smb1 is a copy of the fileserver test environment but
with the difference that it still supports SMB1, this will allow
use to still run SMB1 tests.

Signed-off-by: Noel Power <npower@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-03 15:08:26 +00:00
Noel Power
f64e032a35 selftest: Allow rpc_proxy & s4member also negotiate SMB1
Test environments rpc_proxy & s4member depend on ad_dc_ntvfs
so these environments additionally need to also be able to
still support SMB1.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-03 15:08:26 +00:00
Noel Power
49ba8f2155 selftest: disable SMB1 from testenv(s) make >=SMB2 the default
Change the values of 'min protocol' set for the various test
environments to be SMB2_02.

Servers will only offer protocols starting with the min specified in the
conf files. We don't change the client value here yet (until SMB1 is
truely gone) as we still want to be able to run SMB1 tests.

Signed-off-by: Noel Power <npower@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-03 15:08:26 +00:00
Noel Power
5898c72318 selftest: Allow ad_dc_ntvfs negotiate smb1 still
The default for most test envs will be changed in a future
commit(s) to be >= SMB2 then we need to still allow  ad_dc_ntvfs to
support SMB1. This will make the number of tests to port easier to
deal with. In addition to test env ad_dc_ntvfs still supporting SMB1
we need to do the same with test other environments that depend on
ad_dc_ntvfs (this will be handled in followup commits).

In addition to the above this change will ensure we don't trigger
failures for ntvfs tests when we switch to default >= SMB2 which will
make the associated skip file (added in a future commit) smaller.

Signed-off-by: Noel Power <npower@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2020-04-03 15:08:26 +00:00
Ralph Boehme
a45e637025 selftest: allow SMB1 in clusteredmember env
This is a relatively new test environment that only uses very few tests
yet. Skip the env name rename dance for this env, but someone has to convert the
tests later on.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-04-03 15:08:25 +00:00
Stefan Metzmacher
05d3a909d5 selftest: use 10.53.57.0/8 instead of 127.0.0.1/8
This makes our testing much more realistic and allows
the removal of some knowfail entries.

It also means the testing with network namespaces on Linux
can use the same addresses as our socket wrapper testing.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2020-03-27 09:02:38 +00:00
Stefan Metzmacher
83f6ff9006 selftest: pass ipv4 and ipv6 listener addresses to dns_hub.py
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2020-03-27 09:02:38 +00:00
Stefan Metzmacher
6b249437bd selftest: let realm_to_ip_mappings() return stable (sorted) results
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2020-03-27 09:02:38 +00:00
Stefan Metzmacher
0bc9987049 selftest: {offlinebackupdc,restoredc,customdc} are disconnected from other environments
These restore copies of others and better use their own resolv.conf
and use '--use-samba-tool --no-credentials' for samba_dnsupdate in order
to avoid talking to the real environments.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2020-03-27 09:02:38 +00:00
Stefan Metzmacher
c5e478216f selftest: correctly use RESOLV_CONF from the DC environment or "no_resolv.conf"
It's important to have the correct $resolv_conf variable within
provision(), because it also sets "RESOLV_WRAPPER_CONF" if needed,
instead of just setting "RESOLV_CONF".

There's also no point in creating an resolv.conf with the ip addresses
for other roles than "active directory domain controller".

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2020-03-27 09:02:38 +00:00
Stefan Metzmacher
678651a73b selftest: always explicitly use RESOLV_CONF
By default point RESOLV_CONF to a non-existing file and
use the per environment RESOLV_CONF explicitly where needed.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2020-03-27 09:02:38 +00:00
Stefan Metzmacher
8133c5787b selftest: split out Samba::mk_resolv_conf() helper
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2020-03-27 09:02:38 +00:00
Stefan Metzmacher
1e9697c4d2 selftest: we have a global $ENV{UID_WRAPPER} = 1, don't set it again
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2020-03-27 09:02:38 +00:00
Stefan Metzmacher
b6af0a268c selftest: let get_env_for_process() include RESOLV_CONF
This is needed for all environments not just "samba".

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2020-03-27 09:02:38 +00:00
Stefan Metzmacher
f1f43f1331 selftest: handle proc{killdom,limit}.samba.example.com in dns_hub
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2020-03-27 09:02:38 +00:00
Stefan Metzmacher
ffa40fa90f selftest: allow dns_hub.py to do forwarding to ipv6 servers
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2020-03-27 09:02:38 +00:00
Stefan Metzmacher
25ba290d18 selftest: allow dns_hub.py to listen on more than one address
This makes it possible to serve ipv4 and ipv6 at the same time.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2020-03-27 09:02:37 +00:00
Stefan Metzmacher
2d1d67ed72 selftest: make sure dns_hub.py exits on SIGINT
Otherwise we have a deadlock in the python threading
that prevents out EOF detection on stdin to work
if someone aborts 'make test' with strg+c.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2020-03-27 09:02:37 +00:00
Andreas Schneider
d61a33acda selftest: Fix string compare in DnsHandler() of dns_hub.py
dns_hub.py:115: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if forwarder is 'ignore':
dns_hub.py:117: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif forwarder is 'fail':

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Mar 24 14:31:25 UTC 2020 on sn-devel-184
2020-03-24 14:31:25 +00:00
Samuel Cabrero
d809da3ace selftest: Run python.samba.tests.dcerpc.raw_protocol against S3 ad_member
The goal is to pass the raw protocol testsuite against s3 RPC server.
To do so we need to enable epmd and lsasd daemons, as the testsuite
connects to the endpoint mapper and lsa endpoints using NCACN_IP_TCP
and NCACN_NP transports.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-03-20 15:36:31 +00:00
Martin Schwenke
dc0150801c selftest:clusteredmember: Build a unclist for every share
This is fairly cheap and it is simple to do.  This allows the Python
code to be able to specify a unclist quite simply.  The level of
coupling doesn't seem worse than anything else in the
selftest/autobuild code.

There may be cleverer ways of doing this (e.g. a wrapper in
testprogs/blackbox/clusteredmember_smbtorture or similar) but cleverer
code isn't necessarily better code... and they'll probably involve
code duplication.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>
2020-02-19 09:38:40 +00:00
Michael Adam
5ff7e2f213 selftest:Samba3: add a clusteredmember environment
Allow running tests against a CTDB setup, thereby covering the
dbrwap_ctdb->ctdb stack in real SMB tests.

Sets up a 3 node cluster.

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Martin Schwenke <martin@meltin.net>
2020-02-19 09:38:40 +00:00
Volker Lendecke
bb85a710e2 selftest: Split up a long line
We'll add another argument soon

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2020-02-19 09:38:40 +00:00
Martin Schwenke
822604a112 selftest: net command needs to think it is root in clustered case
So just run it "as root" all the time.

Something similar is already done for other things in
Samba3::provision(), such as running smbpasswd in
Samba3::createuser().

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>
2020-02-19 09:38:40 +00:00
Volker Lendecke
c779dfe70f selftest: Allow passing fork_and_exec()'s child_cleanup
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2020-02-19 09:38:40 +00:00
Volker Lendecke
154d7c8eaf selftest: Convert Samba3::check_or_start() to named parameters
Another parameter will be added soon.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2020-02-19 09:38:40 +00:00
Volker Lendecke
ff5dd4bb4f selftest: Parameterize clean up in the child process
Default to closing the write end of the parent->child pipe.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2020-02-19 09:38:40 +00:00
Martin Schwenke
586189ab69 selftest: Fix an uninitialised variable warning.
If $nmbd is not "yes" then this can result in a warning.

Introduced in commit 676261fa08.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>
2020-02-19 09:38:40 +00:00
Volker Lendecke
4cd28d736a selftest: Fix a warning message
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2020-02-19 09:38:39 +00:00
Volker Lendecke
2a54c03af7 selftest: Add "share_dir" as an argument to Samba3::provision()
Default to the previous value

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2020-02-19 09:38:39 +00:00
Volker Lendecke
7598b9069d selftest: Allow "netbios name" to be overriden in Samba3::provision()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2020-02-19 09:38:39 +00:00
Andreas Schneider
e2ea059e67 s3:tests: Add test for a dropbox with dir mode 0733
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Feb 18 21:07:44 UTC 2020 on sn-devel-184
2020-02-18 21:07:44 +00:00
Andreas Schneider
b9ab8bf7a9 s3:tests: Add smbclient test for 'force create mode = 0664'
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Feb 14 20:16:04 UTC 2020 on sn-devel-184
2020-02-14 20:16:04 +00:00
Stefan Metzmacher
7d1b560804 selftest: create a pcap file for the environment setup
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2020-02-06 14:57:42 +00:00
Stefan Metzmacher
f182c9a36b selftest: create pcap files for invidual env services
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2020-02-06 14:57:42 +00:00
Stefan Metzmacher
4effc5585e selftest: move {setup,cleanup}_pcap() to selftest/target/Samba.pm
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2020-02-06 14:57:42 +00:00
Douglas Bagnall
131bfc8ce2 selftest: avoid comparison against undefined value
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-02-04 05:13:40 +00:00
Douglas Bagnall
7334d575a9 selftest/target/samba: do not look for undef environment
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-02-04 05:13:40 +00:00
Douglas Bagnall
d087f74d45 selftest/target/samba: add missing methods
These methods are being called but have not been provided.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-02-04 05:13:40 +00:00
Douglas Bagnall
213e237e39 selftest/s3: prefer empty string over undef to add nothing to config
To fix a warning.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-02-04 05:13:40 +00:00
Douglas Bagnall
e50c5b80bf selftest/s3: actually close parent copy of smbd's STDIN
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-02-04 05:13:40 +00:00
Douglas Bagnall
314b59fbef selftest/s4: remove illegal function signature
The character ':' has no meaning in function signatures. Perhaps ';' was
intended, which would have marked the later arguments as optional --
which is the default with no signature. All callers always provide all
the arguments anyway.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-02-04 05:13:40 +00:00
Douglas Bagnall
18efb47a8f selftest/s4: don't put pcap file in / by default
If the SOCKET_WRAPPER_PCAP_DIR is not defined, let's assume it wasn't
wanted rather than choosing /.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-02-04 05:13:40 +00:00
Douglas Bagnall
7a65a26a2f selftest/s4: properly initialise an empty hash
The '%ret = {}' construction was bad because '{}' is a hash-ref, which
counts as a single scalar value, but a true hash like '%ret' must be
initialised with an even number of scalar values (usually in pairs, like
'($a => $b, $c => $d)').

I think this meant %ret was initialised as something harmless like
'(<HASH(0x55ce39781278)> => undef)'.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-02-04 05:13:39 +00:00
Douglas Bagnall
6c4ee5282e selftest: avoid redeclaring perl variables
None of these ones are doing any harm, we just want to silence these
warnings.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-02-04 05:13:39 +00:00
Douglas Bagnall
467abee4ee selftest/target/samba: avoid overwriting $pkinitdir
We were declaring the same variable twice with two different paths,
"$cadir/Users/$pkinitprincipalname" here and
"$ctx->{prefix_abs}/pkinit" about 5 lines down.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-02-04 05:13:39 +00:00
Douglas Bagnall
8f17d48163 selftest: enable perl warnings
After this we will see more noise with each test run, and these
warnings will be addressed in following commits.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-02-04 05:13:39 +00:00
Volker Lendecke
3f0e0ee274 selftest: Exit skipped daemons on close(STDIN)
Without this, teardown_env() will take ages for environments with
skipped daemons

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Jan 29 11:06:53 UTC 2020 on sn-devel-184
2020-01-29 11:06:53 +00:00
Volker Lendecke
5bc5b681c0 selftest: Close STDIN_PIPE's write end for skipped daemons
Without this, any environment that skips any daemon will not shut down
properly. If a copy of a pipe's write end remains, closing one of them
won't cause the read end to be readable, i.e. the daemons waiting for
that won't exit properly.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-01-29 09:36:27 +00:00
Volker Lendecke
f9173c18a6 selftest: Convert Samba3::provision() to named parameters
9 positional parameters is a bit too much for easy overview

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2020-01-27 14:27:33 +00:00
Volker Lendecke
26da6f562b selftest: Factor out create_file_chmod()
24 lines less perl :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2020-01-27 14:27:33 +00:00
Andreas Schneider
6a10ab3f10 selftest: Make 'Samba Users' the primary group of joe
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
2020-01-24 15:46:42 +00:00
Andreas Schneider
227a8a1131 selftest: Add a group 'Samba Users'
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
2020-01-24 15:46:42 +00:00
Andreas Schneider
b4a4adebd9 selftest: Add user joe
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
2020-01-24 15:46:42 +00:00
Ralph Boehme
1cf2397226 selftest: don't use NTVFS fileserver in chgdcpass
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Fri Dec 20 07:34:42 UTC 2019 on sn-devel-184
2019-12-20 07:34:42 +00:00
Ralph Boehme
2e5188f520 selftest: don't use NTVFS fileserver in rodc
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-12-20 06:08:41 +00:00
Ralph Boehme
629254ec5b selftest: don't use NTVFS fileserver in fl2008r2dc
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-12-20 06:08:41 +00:00
Ralph Boehme
3518151cb2 selftest: don't use NTVFS fileserver in fl2003dc
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-12-20 06:08:41 +00:00
Ralph Boehme
bd141ead0d selftest: don't use NTVFS fileserver in fl2000dc
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-12-20 06:08:41 +00:00
Ralph Boehme
fbcf1ab708 selftest: don't use NTVFS fileserver in vampire_dc
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-12-20 06:08:40 +00:00
Ralph Boehme
db24892d0e selftest: don't use NTVFS fileserver in promoted_dc
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-12-20 06:08:40 +00:00
Ralph Boehme
01141d06af selftest: make fl2008dc an alias for ad_dc, not ad_dc_ntvfs
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-12-20 06:08:40 +00:00
Ralph Boehme
bba0cafa95 selftest: make ad_dc_slowtests an alias for ad_dc, not ad_dc_ntvfs
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-12-20 06:08:40 +00:00
Ralph Boehme
8d1206c920 selftest: make ad_dc_default an alias for ad_dc, not ad_dc_ntvfs
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-12-20 06:08:40 +00:00
Douglas Bagnall
e737988641 dcerpc: developer option to save ndr_fuzz_X seeds
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Pair-programmed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-12-10 07:50:28 +00:00
Andreas Schneider
6201b30421 s3:smbspool_krb5_wrapper: Map AUTH_INFO_REQUIRED=none to anonymous
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2019-12-09 12:48:45 +00:00
Isaac Boukris
609a1d1d6b Revert "selftest: system-heimdal: workaround upstream "host" canon bug"
This reverts commit 15ddd95d94.

Signed-off-by: Isaac Boukris <iboukris@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-11-27 10:25:38 +00:00
Stefan Metzmacher
564049fbc9 s3:mdssvc: make use of lp_parm_const_string()
We don't need any substitution for elasticsearch options.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-11-27 10:25:31 +00:00
Isaac Boukris
389d1b979b heimdal: do not compile weak crypto
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14202

Signed-off-by: Isaac Boukris <iboukris@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-11-19 14:48:41 +00:00
Isaac Boukris
15ddd95d94 selftest: system-heimdal: workaround upstream "host" canon bug
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14179

Signed-off-by: Isaac Boukris <iboukris@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-11-13 17:49:38 +00:00
Andrew Bartlett
d524c7ddee CVE-2019-14833: Use utf8 characters in the unacceptable password
This shows that the "check password script" handling has a bug.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12438
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2019-10-29 10:04:45 +00:00
Isaac Boukris
90f557f3a1 selftest: s3: add a test for spnego downgrade from krb5 to ntlm
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14106

Signed-off-by: Isaac Boukris <iboukris@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-10-12 14:33:32 +00:00
Ralph Boehme
da7dec0a50 selftest: add end-to-end tests for mdssvc with a fake HTTP server
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
2019-10-09 14:35:29 +00:00
Stefan Metzmacher
0ee085b594 selftest/Samba3.pm: use "winbind use krb5 enterprise principals = yes" for ad_member
This demonstrates that can do krb5_auth in winbindd without knowning about trusted domains.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14124

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>

Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Tue Sep 24 19:51:29 UTC 2019 on sn-devel-184
2019-09-24 19:51:29 +00:00
Stefan Metzmacher
e2737a74d4 selftest/Samba3.pm: use "winbind scan trusted domains = no" for ad_member
This demonstrates that we rely on knowning about trusted domains before
we can do krb5_auth in winbindd.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14124

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2019-09-24 18:30:38 +00:00
Andreas Schneider
13e3811c95 selftest: Export TRUST information in the ad_member target environment
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14124

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2019-09-24 18:30:38 +00:00
Stefan Metzmacher
2b43ce6704 s3:selftest: add delay_inject:brl_lock_windows testing
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14113

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Mon Sep  9 15:42:45 UTC 2019 on sn-devel-184
2019-09-09 15:42:45 +00:00
Stefan Metzmacher
9ab5a51a6e CVE-2019-10197: test_smbclient_s3.sh: add regression test for the no permission on share root problem
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14035

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2019-09-03 08:07:38 +00:00
Stefan Metzmacher
d7ed819d9f CVE-2019-10197: selftest: make fsrvp_share its own independent subdirectory
The next patch will otherwise break the fsrvp related tests.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14035

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2019-09-03 08:07:38 +00:00
Andrew Bartlett
5f70f972a5 selftest: Remove obsolete LDAP backend hooks from selftest.pl et al
This removes some quite complex logic that has not been used since the LDAP
backend project was shelved prior to 2011.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Nadezhda Ivanova <nivanova@symas.com>
2019-08-30 08:32:30 +00:00
Andrew Bartlett
b4816861f2 s4-dns: Deprecate BIND9_FLATFILE and remove "rndc command"
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Aug 22 21:24:00 UTC 2019 on sn-devel-184
2019-08-22 21:24:00 +00:00
Ralph Boehme
017af5d583 torture: beginning of a mdssvc RPC service test-suite
Yikes! Most tests fail atm.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-08-08 20:24:33 +00:00
Ralph Boehme
5806affefd selftest: explicitly set "mangled names = yes"
This is the current default and what 'make test' assumes currently.

The next commit will change the default to "illegal".

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-07-08 16:22:38 +00:00
Stefan Metzmacher
d216db5cd5 selftest: explicitly set "client min protocol = CORE"
This is the current default and what 'make test' assumes currently.

The next commit will change the default to disable SMB1.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-07-08 16:22:38 +00:00
Stefan Metzmacher
c163ef20f8 selftest: explicitly set "server min protocol = LANMAN1"
This is the current default and what 'make test' assumes currently.

The next commit will change the default to disable SMB1.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-07-08 16:22:37 +00:00
Douglas Bagnall
77d69ab820 dns_hub: print usage with too few args
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-07-05 01:05:20 +00:00
Gary Lockyer
5583208aed samba-tool domain join: remove the subdomain option
Remove the sub domain option from join, as it currently does not work.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-07-02 02:23:10 +00:00
Ralph Boehme
6e65c28312 selftest: add a test that itime is not set when setting DOS attrs
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Jul  1 23:21:07 UTC 2019 on sn-devel-184
2019-07-01 23:21:07 +00:00
Ralph Boehme
eb98678656 vfs_fruit: make "fruit:zero_file_id" a per share option
Now that File-ID calculation goes through the VFS, we can nicely make a
per-share option out of it.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-07-01 21:43:24 +00:00
Aaron Haslett
fc9845da69 selftest: specifying 2008_R2 base schema for tests that need it
We're going to change the default base schema so this patch changes all
tests and testenvs requiring the current default (2008_R2) to specify it
in all provision commands using --base-schema.

Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-06-26 04:12:33 +00:00
Ralph Boehme
ac2167eb23 selftest: allow guest login in the ad_member_idmap_rid env
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13944

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-06-05 15:40:24 +00:00
Tim Beale
b23d005cdc selftest: Don't use global dirs when parsing customdc realm
When creating the customdc, testparm would default to using
/usr/local/samba sub-directories for creating sockets and lock files.
Instead, pass in the tmpdir we just created as an option to the command.

Normally this didn't cause a noticeable problem, however, if we run the
command with UID-wrapper but without socket-wrapper (i.e.
USE_NAMESPACES=1), then it fails completely.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri May 31 06:34:36 UTC 2019 on sn-devel-184
2019-05-31 06:34:36 +00:00
Tim Beale
6defc1f183 selftest: Add check customdc has valid realm/domain
If we couldn't determine the realm/domain from the backup file, it's a
lot nicer to fail early with a clear error message (rather than failing
later on with a really obscure message).

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-05-31 05:18:21 +00:00
Tim Beale
067b4fc03f selftest: Add linux namespace support (USE_NAMESPACES=1)
This hooks up the selftest/ns/* scripts added earlier with the selftest
system, so developers can optionally run a testenv or test using linux
namespaces instead of socket-wrapper.

The idea is this is experimental functionality that we can extend
further in future, in order to make testing Samba more versatile.

+ The top-level WAF script now does an 'unshare' to create a new
top-level 'selftest' namespace in which to create the testenv(s).
+ selftest.pl creates a common 'selftest0' bridge to connect together
the individual DCs.
+ Update Samba.pm so it can use real IPs instead of loopback addresses.
In fork_and_exec(), we add a couple of hooks so that the binary gets
started in a different namespace (using unshare/start_in_ns.sh), and
the parent process connects the new child namespace up to the common
selftest0 bridge (using add_bridge_iface.sh).

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-05-31 05:18:20 +00:00
Tim Beale
c9e6251382 selftest: Add TESTENV_DIR "env" variable
We store the testenv directory path for the 'ctx' hashmap, but not for
the testenv-vars hashmap (and that can be really annoying sometimes).
Add it into the second hashmap that selftest actually keeps track of.
Currently it's only stored in the hashmap, not actually exported as an
environment variable (but we could easily do that if a test-case need
this info).

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-05-31 05:18:20 +00:00
Tim Beale
163897f125 selftest: Use scalar variable for new daemon_ctx hashmap
The selftest code typically stores hashmaps as scalar variables (i.e.
it only ever uses references to hashmaps). So much so that using a regular
hashmap (and passing it by reference via \%daemon_ctx) looks out of
place.

Using the hashmap directly made more sense when it was only being used
locally, but now the hashmap is being passed by reference into a function
anyway, so storing it as a scalar doesn't make much difference.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-05-24 03:19:18 +00:00
Tim Beale
b976502d49 selftest: Add common fork_and_exec() function
Now the code has been refactored, we can move it into a common function.
This reduces code duplication and means we have a common place where we
start samba daemons from.

Note that some daemons behave slightly different, but the $daemon_ctx
allows us to customize their behaviour a bit.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-05-24 03:19:17 +00:00
Tim Beale
746e137777 selftest: Rework setting env variables for other forked binaries
Final refactor to merge the fork-and-exec code into a common function.

We can now use $daemon_ctx{ENV_VARS} to customize differences between
the forked binaries:
- samba: add in extra env variables on top of the defaults.
- dns_hub: there are no ENV variables we need to export.
- winbindd/smbd: these use the defaults, so they pass through an
undefined $daemon_ctx{ENV_VARS} (purely to make the code common across
all 5 places).

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-05-24 03:19:17 +00:00
Tim Beale
ae3e33d492 selftest: Rework setting env variables for nmbd
Instead of having a special $skip_resolv_conf parameter just for nmbd,
use the get_env_for_process() API and customize the hashmap returned.
Pass the customized hashmap in as an optional part of the daemon_ctx.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-05-24 03:19:17 +00:00
Tim Beale
c79f0c1975 selftest: Store fork-and-exec daemon info in a hashmap
This intermediary refactor adds a hashmap that stores the values needed
to run each samba daemon. This adds a bit more code in the short term,
but it basically means the code in 5 different places now becomes
identical, and we can extract it out to a common function.

The converting FULL_CMD from an array reference back to an array is a
bit ugly, but we can clean this up a bit once the code is all in one
place.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-05-24 03:19:17 +00:00
Tim Beale
ad30fdc6ba selftest: Add helper function to build up s3 daemon cmd
The s3 daemons all basically use the same command logic, it's just they
use slightly different environment variables.

This adds a common helper function, which we can pass the specific
environment variables into.

(Note the slight parameter difference for winbind with --stdout vs
--log-stdout).

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-05-24 03:19:17 +00:00
Tim Beale
ba9323abde selftest: Move fork cmd args up a level
This is a fairly simple move of code and is the first step in a larger
refactor.

It doesn't matter if we build up the command args prior to the fork (we
only use them in the forked child). But moving the code means the code
to handle the fork-and-exec becomes common code that is repeated in
several places throughout Samba3.pm and Samba4.pm.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-05-24 03:19:17 +00:00
Tim Beale
0fd3685cfd selftest: remove unused variable (@optargs)
Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-05-24 03:19:17 +00:00
Tim Beale
a60e59735c selftest: Refactor duplicated code to set ENV vars
Whenever we started a process, we basically used the same code to setup
the ENV variables.

The s4 ENVNAME may now be slightly different in the child process that
runs samba (i.e. '$testenv.samba'), but that ENV var did not appeared to
be used much.

I'm not sure if the current difference in $skip_resolv_wrapper logic for
nmbd was deliberate or accidental, but I've preserved the logic for now.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-05-24 03:19:17 +00:00
Joe Guo
b78048524d selftest/target/Samba4.pm: increase max_wait from 60s to 120s to avoid timeout failure in samba-ad-dc-backup
Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-05-10 08:19:16 +00:00
Christof Schmitt
65e1d783cb selftest: Add idmap configuration for trusted domain for idmap_ad
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13903

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-04-24 01:02:17 +00:00
Christof Schmitt
281fb81ab1 selftest: Make trusted domain information available for idmap_ad environment
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13903

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-04-24 01:02:17 +00:00
Christof Schmitt
8266bd1f45 selftest: Use fl2008r2dc for ad_member_idmap_ad
fl2008r2dc already has a trusted domain. That will be used to use
idmap_ad for querying idmap attributes from the trusted domain.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13903

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-04-24 01:02:17 +00:00
Garming Sam
bfd762b53a selftest: rename schemaupgrade_dc (+pair) to schema_dc
This is needed because the name of the autobuild job and
the name of the selftest env end up in the socket path
for ncalrpc sockets.

The challenge is that (for example)
/memdisk/autobuild/fl/b2424063/samba-schemaupgrade/bin/ab/schemaupgrade_pair_dc/ncalrpc/np/protected_storage
does not fit in a struct sockaddr_un.

Signed-off-by: Garming Sam <garming@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Apr 12 05:41:36 UTC 2019 on sn-devel-144
2019-04-12 05:41:36 +00:00
Tim Beale
4336c058ca selftest: Add new 2-DC testenv for live schema upgrade
This adds a new 2-DC testenv that:
1. Provisions an AD DC with 2008R2 schema
2. Joins another AD DC with 2008R2 schema
3. Starts Samba
4. Performs a live schema upgrade on the PDC
Testenv targetting in tests.py files for this testenv required that we
extend the environment dependencies system to include optional post-startup
dependencies specified in ENV_DEPS_POST maps.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2019-04-11 04:17:10 +00:00
Douglas Bagnall
ed0060d3f2 selftest: use test smb.conf in provision
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Tim Beale <timbeale@catalyst.net.nz>
2019-03-30 22:21:26 +00:00
Tim Beale
a4d433aede selftest: Restore IPs 12-16 for selftest client
The assumption that tests only used the .11 IP was wrong. The
winsreplication test tries to use multiple different IPs - CI doesn't
fail when we remove the additional IPs, but it starts to skip test
cases.

+ Update get_interfaces_config() and get_ipv4_addr() so we can add
multiple different IPs for the same host.
+ Update selftest.pl so the client gets 6 IP addresses.
+ Update comments to better reflect this dependency.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-27 13:31:27 +00:00
Samuel Cabrero
5826b31f41 selftest: Do not include system krb5.conf in s4 test environments
If built with system MIT krb5 and dns_lookup_kdc is set to false in
system krb5.conf tests fail because KDC is not found.

Pair-Programmed-With: Andreas Schneider <asn@samba.org>
Signed-off-by: Samuel Cabrero <scabrero@suse.de>
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-03-22 14:03:19 +00:00
Ralph Boehme
6a1e5fbfcd selftest: test vfs_nfs4acl_xattr in nfs mode
The same tests as for the other modes xdr and ndr are marked as
knownfail.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-03-18 19:21:25 +00:00
Tim Beale
3075b85c1a selftest: Remove unnecessary dns_hub hashmap entries
These are only used within the function, and there's already a local
variable that stores the same info.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-14 02:12:19 +00:00
Tim Beale
50abab31f8 selftest: Use consistent env variables for dns_hub
Setting up a testenv involves populating 2 different hashmaps - an
intermediary one (usually called 'ctx') and one that is used to populate
the testenv environment variables (usually called 'env_vars' or
'dcvars').
Because the dns_hub setup is very simple, it doesn't need two different
hashmaps. However, the variable names are still a mix of the two
hashmaps.

This patch updates dns_hub to use the second, more finalized hashmap
variable-names.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-14 02:12:19 +00:00
Tim Beale
e9c01fdbb8 selftest: Add helper function to get interfaces config
Add a helper function to return the IPv4/IPv6 addresses for the
smb.conf. This keeps the netmask assumptions in the same places as
the IP subnet assumptions.

This refactor means we no longer need to store $ctx->{interfaces}, as it
was only used in one place.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-14 02:12:18 +00:00
Tim Beale
a3da2f63be selftest: Remove secondary client interfaces
I can't see anything in the tests that ever tries to use these other IP
addresses. While it makes sense that we might want the tests to simulate
multiple different clients (with different IPs), we don't appear to do
this currently.

Removing the spare client addresses minimizes the number of hard-coded
IP addresses in selftest.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-14 02:12:18 +00:00
Tim Beale
d192ba4e0b selftest: Add helper function to create exports file for a testenv
This writes out the environment variables that are normally setup in the
testenv xterm to a file. This allows them to be sourced later.

This function is currently unused. However, it provides an alternative
replacement for the selftest-vars.sh script (which is really out of
date). I do plan to make use of this function in a subsequent patch-set.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-12 01:53:26 +00:00
Tim Beale
0dbb923881 selftest: Move @exported_envvars into Samba.pm
This brings it closer to the code that actually sets these variables
(i.e. Samba3/4.pm).

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-12 01:53:26 +00:00
Tim Beale
1d5583c913 dns_hub: Add some debug as to what DNS proxying is happening
This should make it clear at run-time how dns_hub is actually proxying
DNS requests, which will hopefully aid in debugging problems (i.e.
forgetting to add a mapping when adding a new DNS realm).

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Mar  6 00:48:43 UTC 2019 on sn-devel-144
2019-03-06 00:48:43 +00:00
Tim Beale
2cd65a7a4e dns_hub: Minor variable rename
We've dropped the iface logic now - this dictionary maps from
realm-to-IP.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-05 23:27:31 +00:00
Tim Beale
327ed9758a selftest: Map realm to IP address (instead of iface)
The code is more readable if the hashmap translates between realm and
DC-name, rather than realm-to-iface. We already have a function to map
between DC-name and iface (and since we're doing this, we might as well
map straight to IP address).

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-05 23:27:31 +00:00
Tim Beale
cbcd4f8f00 selftest: Pass realm-to-IP mapping to dns_hub as an argument
Instead of storing hashmaps in 2 different files, we can just convert a
perl hashmap into a string, pass it to dns_hub, and convert it back into
a python dictionary.

The main reason for doing this is the IP-to-testenv mapping now all
lives in a single file (Samba.pm). All this logic is right next to each
other rather than being split across multiple files. Hopefully this will
make it easier to keep it up to date as we add new testenvs.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-05 23:27:31 +00:00