diff options
author | Tim Beale <timbeale@catalyst.net.nz> | 2017-08-01 17:18:45 +1200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2017-09-26 00:41:16 +0200 |
commit | 25b9e06f4a66a5269221fa7477eda0eab8344c79 (patch) | |
tree | 65467d0b717cdf3467835d8ab4db20cf64c35d82 /selftest/target | |
parent | 8c56aa2c91c7946ef17b1eba6ed70ba9b5d0c16c (diff) | |
download | samba-25b9e06f4a66a5269221fa7477eda0eab8344c79.tar.gz |
selftest: Use a unique hostname/IP for the no_nss testenv
The ad_dc_no_nss was re-using the ad_dc testenv but changing an
environment variable to disable the NSS wrapper module.
Presumably this would setup a second AD DC server with the same
hostname/IP as another DC (but with NSS disabled). This doesn't seem
like a good thing to be doing in the selftests. This patch changes
it so that the no_nss testenv uses a unique IP/hostname.
Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Diffstat (limited to 'selftest/target')
-rw-r--r-- | selftest/target/Samba.pm | 1 | ||||
-rwxr-xr-x | selftest/target/Samba4.pm | 38 |
2 files changed, 33 insertions, 6 deletions
diff --git a/selftest/target/Samba.pm b/selftest/target/Samba.pm index dc6b3d518bf..ba0cc7d0adb 100644 --- a/selftest/target/Samba.pm +++ b/selftest/target/Samba.pm @@ -346,6 +346,7 @@ sub get_interface($) # 11-16 used by selftest.pl for client interfaces + $interfaces{"addc_no_nss"} = 17; $interfaces{"addc_no_ntlm"} = 18; $interfaces{"idmapadmember"} = 19; $interfaces{"idmapridmember"} = 20; diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm index be43bae83cf..ea23c66c3dc 100755 --- a/selftest/target/Samba4.pm +++ b/selftest/target/Samba4.pm @@ -2127,7 +2127,7 @@ sub setup_env($$$) } elsif ($envname eq "ad_dc") { return $self->setup_ad_dc("$path/ad_dc"); } elsif ($envname eq "ad_dc_no_nss") { - return $self->setup_ad_dc("$path/ad_dc_no_nss", "no_nss"); + return $self->setup_ad_dc_no_nss("$path/ad_dc_no_nss"); } elsif ($envname eq "ad_dc_no_ntlm") { return $self->setup_ad_dc_no_ntlm("$path/ad_dc_no_ntlm"); } elsif ($envname eq "ad_member_rfc2307") { @@ -2502,7 +2502,7 @@ sub setup_rodc($$$) sub setup_ad_dc($$) { - my ($self, $path, $no_nss) = @_; + my ($self, $path) = @_; # If we didn't build with ADS, pretend this env was never available if (not $self->{target3}->have_ads()) { @@ -2515,11 +2515,37 @@ sub setup_ad_dc($$) return undef; } - if (defined($no_nss) and $no_nss) { - $env->{NSS_WRAPPER_MODULE_SO_PATH} = undef; - $env->{NSS_WRAPPER_MODULE_FN_PREFIX} = undef; + if (not defined($self->check_or_start($env, "single"))) { + return undef; + } + + my $upn_array = ["$env->{REALM}.upn"]; + my $spn_array = ["$env->{REALM}.spn"]; + + $self->setup_namespaces($env, $upn_array, $spn_array); + + $self->{vars}->{ad_dc} = $env; + return $env; +} + +sub setup_ad_dc_no_nss($$) +{ + my ($self, $path) = @_; + + # If we didn't build with ADS, pretend this env was never available + if (not $self->{target3}->have_ads()) { + return "UNKNOWN"; + } + + my $env = $self->provision_ad_dc($path, "addc_no_nss", "ADNONSSDOMAIN", + "adnonssdom.samba.example.com", ""); + unless ($env) { + return undef; } + $env->{NSS_WRAPPER_MODULE_SO_PATH} = undef; + $env->{NSS_WRAPPER_MODULE_FN_PREFIX} = undef; + if (not defined($self->check_or_start($env, "single"))) { return undef; } @@ -2529,7 +2555,7 @@ sub setup_ad_dc($$) $self->setup_namespaces($env, $upn_array, $spn_array); - $self->{vars}->{ad_dc} = $env; + $self->{vars}->{ad_dc_no_nss} = $env; return $env; } |