From 45be80844e9a3ce888bd6a67b224e14517c4d93d Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 7 Mar 2007 11:05:59 +0000 Subject: r21743: Always use the 'escaped' LDAPI path. Wait around for the server to start, so we don't try to contact it during it's starup phase. Andrew Bartlett (This used to be commit f484b0a924809dd8c9861ade8d184fb44b3b5e1f) --- source4/script/tests/Samba4.pm | 16 +++++++++++++--- source4/script/tests/mk-fedora-ds.sh | 2 -- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'source4/script') diff --git a/source4/script/tests/Samba4.pm b/source4/script/tests/Samba4.pm index 99e329e7b9..65b55fcee0 100644 --- a/source4/script/tests/Samba4.pm +++ b/source4/script/tests/Samba4.pm @@ -13,9 +13,10 @@ use strict; use FindBin qw($RealBin); use POSIX; -sub slapd_start($$) +sub slapd_start($$$) { - my ($conf, $uri, $loglevel) = @_; + my $count = 0; + my ($bindir, $conf, $uri) = @_; # running slapd in the background means it stays in the same process group, so it can be # killed by timelimit if (defined($ENV{FEDORA_DS_PREFIX})) { @@ -26,6 +27,14 @@ sub slapd_start($$) system("slapd -d$ENV{OPENLDAP_LOGLEVEL} -f $conf -h $uri > $ENV{LDAPDIR}/logs 2>&1 &"); $ENV{PATH} = $oldpath; } + while (system("$bindir/ldbsearch -H $uri -s base -b \"\" supportedLDAPVersion > /dev/null") != 0) { + $count++; + if ($count > 10) { + slapd_stop(); + return 0; + } + sleep(1); + } return 1; } @@ -103,7 +112,6 @@ sub wait_for_start() { # give time for nbt server to register its names print "delaying for nbt name registration\n"; - sleep(4); # This will return quickly when things are up, but be slow if we # need to wait for (eg) SSL init @@ -113,6 +121,8 @@ sub wait_for_start() system("bin/nmblookup $ENV{CONFIGURATION} -U $ENV{SERVER} $ENV{NETBIOSNAME}"); system("bin/nmblookup $ENV{CONFIGURATION} $ENV{NETBIOSNAME}"); system("bin/nmblookup $ENV{CONFIGURATION} -U $ENV{SERVER} $ENV{NETBIOSNAME}"); + system("bin/nmblookup $ENV{CONFIGURATION} $ENV{NETBIOSNAME}"); + system("bin/nmblookup $ENV{CONFIGURATION} -U $ENV{SERVER} $ENV{NETBIOSNAME}"); } sub provision($) diff --git a/source4/script/tests/mk-fedora-ds.sh b/source4/script/tests/mk-fedora-ds.sh index a36e7defee..7ea012d0cb 100755 --- a/source4/script/tests/mk-fedora-ds.sh +++ b/source4/script/tests/mk-fedora-ds.sh @@ -65,8 +65,6 @@ perl $FEDORA_DS_PREFIX/bin/ds_newinst.pl $FEDORA_DS_INF >&2 || exit 1; $srcdir/bin/ad2oLschema $CONFIGURATION -H $PRIVATEDIR/sam.ldb --option=convert:target=fedora-ds -I $srcdir/setup/schema-map-fedora-ds-1.0 -O $FEDORA_DS_DIR/schema/99_ad.ldif >&2 -LDAP_URI_ESCAPE="ldapi://"`echo $LDAPDIR/ldapi | sed 's|/|%2F|g'` - PROVISION_OPTIONS="$PROVISION_OPTIONS --ldap-module=nsuniqueid" #it is easier to base64 encode this than correctly escape it: # (targetattr = "*") (version 3.0;acl "full access to all by all";allow (all)(userdn = "ldap:///anyone");) -- cgit