diff options
author | Jamie McClymont <jamiemcclymont@catalyst.net.nz> | 2018-01-10 13:28:13 +1300 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2018-03-22 08:00:25 +0100 |
commit | ba805dcd6f95748d77e24d5de7c31af2ff5848b1 (patch) | |
tree | b0e6a8de07a91e3b00fcd2a9d4180d4526e8a76a /selftest/target | |
parent | 3966342a1817b84d78e0c6687b4e7dc6d71f3c41 (diff) | |
download | samba-ba805dcd6f95748d77e24d5de7c31af2ff5848b1.tar.gz |
s4:selftest: explicitly set NSS/RESOLV_WAPPER_* in wait_for_start
These variables were previously set directly on the selftest process
for the purpose of making this ldbsearch call, allowing them to leak
into other environments.
Signed-off-by: Jamie McClymont <jamiemcclymont@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'selftest/target')
-rwxr-xr-x | selftest/target/Samba4.pm | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm index 842cd1e1bb6..51a175b25e8 100755 --- a/selftest/target/Samba4.pm +++ b/selftest/target/Samba4.pm @@ -215,14 +215,6 @@ sub wait_for_start($$) # Ensure we have the first RID Set before we start tests. This makes the tests more reliable. if ($testenv_vars->{SERVER_ROLE} eq "domain controller") { - # Add hosts file for name lookups - $ENV{NSS_WRAPPER_HOSTS} = $testenv_vars->{NSS_WRAPPER_HOSTS}; - if (defined($testenv_vars->{RESOLV_WRAPPER_CONF})) { - $ENV{RESOLV_WRAPPER_CONF} = $testenv_vars->{RESOLV_WRAPPER_CONF}; - } else { - $ENV{RESOLV_WRAPPER_HOSTS} = $testenv_vars->{RESOLV_WRAPPER_HOSTS}; - } - print "waiting for working LDAP and a RID Set to be allocated\n"; my $ldbsearch = Samba::bindir_path($self, "ldbsearch"); my $count = 0; @@ -234,7 +226,21 @@ sub wait_for_start($$) $search_dn = "cn=RID Set,cn=$testenv_vars->{NETBIOSNAME},ou=domain controllers,$base_dn"; } my $max_wait = 60; - my $cmd = "$ldbsearch $testenv_vars->{CONFIGURATION} -H ldap://$testenv_vars->{SERVER} -U$testenv_vars->{USERNAME}%$testenv_vars->{PASSWORD} -s base -b \"$search_dn\""; + + # Add hosts file for name lookups + my $cmd = "NSS_WRAPPER_HOSTS='$testenv_vars->{NSS_WRAPPER_HOSTS}' "; + if (defined($testenv_vars->{RESOLV_WRAPPER_CONF})) { + $cmd .= "RESOLV_WRAPPER_CONF='$testenv_vars->{RESOLV_WRAPPER_CONF}' "; + } else { + $cmd .= "RESOLV_WRAPPER_HOSTS='$testenv_vars->{RESOLV_WRAPPER_HOSTS}' "; + } + + $cmd .= "$ldbsearch "; + $cmd .= "$testenv_vars->{CONFIGURATION} "; + $cmd .= "-H ldap://$testenv_vars->{SERVER} "; + $cmd .= "-U$testenv_vars->{USERNAME}%$testenv_vars->{PASSWORD} "; + $cmd .= "-s base "; + $cmd .= "-b '$search_dn' "; while (system("$cmd >/dev/null") != 0) { $count++; if ($count > $max_wait) { |