summaryrefslogtreecommitdiff
path: root/selftest
diff options
context:
space:
mode:
authorGarming Sam <garming@catalyst.net.nz>2017-03-27 15:26:48 +1300
committerAndrew Bartlett <abartlet@samba.org>2017-03-27 20:08:19 +0200
commit73bd0ebe5501dbbc3efef87209262f3a697b9115 (patch)
tree9a4c487cb124730e0e2bdc1f47b943c149557985 /selftest
parent6c23c94be38db043c395e103e37c637a66ae9b34 (diff)
downloadsamba-73bd0ebe5501dbbc3efef87209262f3a697b9115.tar.gz
selftest: Check that LDAP is available during RODC startup
Because the check was for RID Set, this was never done. However, this caused breakages that we've likely seen before. Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'selftest')
-rwxr-xr-xselftest/target/Samba4.pm37
1 files changed, 21 insertions, 16 deletions
diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm
index 8b5e699389b..1209893792f 100755
--- a/selftest/target/Samba4.pm
+++ b/selftest/target/Samba4.pm
@@ -211,7 +211,7 @@ 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" and not ($testenv_vars->{NETBIOSNAME} eq "RODC")) {
+ 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})) {
@@ -220,22 +220,27 @@ sub wait_for_start($$)
$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;
- my $base_dn = "DC=".join(",DC=", split(/\./, $testenv_vars->{REALM}));
- my $rid_set_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 \"$rid_set_dn\" rIDAllocationPool";
- while (system("$cmd >/dev/null") != 0) {
- $count++;
- if ($count > $max_wait) {
- warn("Timed out ($max_wait sec) waiting for working LDAP and a RID Set to be allocated by $testenv_vars->{NETBIOSNAME} PID $testenv_vars->{SAMBA_PID}");
- $ret = -1;
- last;
+ print "waiting for working LDAP and a RID Set to be allocated\n";
+ my $ldbsearch = Samba::bindir_path($self, "ldbsearch");
+ my $count = 0;
+ my $base_dn = "DC=".join(",DC=", split(/\./, $testenv_vars->{REALM}));
+
+ my $search_dn = $base_dn;
+ if ($testenv_vars->{NETBIOSNAME} ne "RODC") {
+ # TODO currently no check for actual rIDAllocationPool
+ $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\"";
+ while (system("$cmd >/dev/null") != 0) {
+ $count++;
+ if ($count > $max_wait) {
+ warn("Timed out ($max_wait sec) waiting for working LDAP and a RID Set to be allocated by $testenv_vars->{NETBIOSNAME} PID $testenv_vars->{SAMBA_PID}");
+ $ret = -1;
+ last;
+ }
+ sleep(1);
}
- sleep(1);
- }
}
print $self->getlog_env($testenv_vars);