s4:selftest Confirm that there isn't a listener on the ldapi:// socket
authorAndrew Bartlett <abartlet@samba.org>
Fri, 14 Aug 2009 00:21:04 +0000 (10:21 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Sun, 16 Aug 2009 23:51:00 +0000 (09:51 +1000)
This should help debug problems with 'make test' of the LDAP backend,
if a stray listener is still around.

Andrew Bartlett

selftest/target/Samba4.pm

index ab421d586cc541d688ea2b54d7109bb5489e69ad..3c0c4f5152d636b8079b76aa48e494be9f7078c5 100644 (file)
@@ -37,9 +37,14 @@ sub slapd_start($$)
 {
        my $count = 0;
        my ($self, $env_vars) = @_;
+       my $ldbsearch = $self->bindir_path("ldbsearch");
 
        my $uri = $env_vars->{LDAP_URI};
 
+       if (system("$ldbsearch -H $uri -s base -b \"\" supportedLDAPVersion > /dev/null") == 0) {
+           print "A SLAPD is still listening to $uri before we started the LDAP backend.  Aborting!";
+           return 1;
+       }
        # running slapd in the background means it stays in the same process group, so it can be
        # killed by timelimit
        if ($self->{ldap} eq "fedora-ds") {
@@ -47,7 +52,6 @@ sub slapd_start($$)
        } elsif ($self->{ldap} eq "openldap") {
                system("$ENV{OPENLDAP_SLAPD} -d0 -F $env_vars->{SLAPD_CONF_D} -h $uri > $env_vars->{LDAPDIR}/logs 2>&1 &");
        }
-       my $ldbsearch = $self->bindir_path("ldbsearch");
        while (system("$ldbsearch -H $uri -s base -b \"\" supportedLDAPVersion > /dev/null") != 0) {
                $count++;
                if ($count > 40) {