Rev 11882: Fix running against openldap. in file:///home/jelmer/bzr.samba/SAMBA_4_0/

Jelmer Vernooij jelmer at samba.org
Tue Apr 17 00:35:51 GMT 2007


At file:///home/jelmer/bzr.samba/SAMBA_4_0/

------------------------------------------------------------
revno: 11882
revision-id: jelmer at samba.org-20070417003537-smfal94m26ngylh8
parent: jelmer at samba.org-20070417001333-mff8mosr6a5i3sb3
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: SAMBA_4_0
timestamp: Tue 2007-04-17 02:35:37 +0200
message:
  Fix running against openldap.
modified:
  source/script/tests/Samba4.pm  svn-v2:21707 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2fscript%2ftests%2fSamba4.pm
=== modified file 'source/script/tests/Samba4.pm'
--- a/source/script/tests/Samba4.pm	2007-04-17 00:13:33 +0000
+++ b/source/script/tests/Samba4.pm	2007-04-17 00:35:37 +0000
@@ -26,7 +26,6 @@
 	my $count = 0;
 	my ($self, $env_vars) = @_;
 
-	my $conf = $env_vars->{SLAPD_CONF};
 	my $uri = $env_vars->{LDAP_URI};
 
 	# running slapd in the background means it stays in the same process group, so it can be
@@ -36,7 +35,7 @@
 	} elsif ($self->{ldap} eq "openldap") {
 		my $oldpath = $ENV{PATH};
 		$ENV{PATH} = "/usr/local/sbin:/usr/sbin:/sbin:$ENV{PATH}";
-		system("slapd -d0 -f $conf -h $uri > $env_vars->{LDAPDIR}/logs 2>&1 &");
+		system("slapd -d0 -f $env_vars->{SLAPD_CONF} -h $uri > $env_vars->{LDAPDIR}/logs 2>&1 &");
 		$ENV{PATH} = $oldpath;
 	}
 	while (system("$self->{bindir}/ldbsearch -H $uri -s base -b \"\" supportedLDAPVersion > /dev/null") != 0) {
@@ -229,7 +228,7 @@
 
 	system("perl $ENV{FEDORA_DS_PREFIX}/bin/ds_newinst.pl $fedora_ds_inf >&2") == 0 or return 0;
 
-	unlink(<$fedora_ds_dir/schema/00core.*>);
+	system(<$fedora_ds_dir/schema/00core.*>);
 
 	open(LDIF, ">$fedora_ds_dir/dse.ldif");
 	print LDIF "
@@ -295,7 +294,7 @@
 suffix		\"$basedn\"
 rootdn          \"cn=Manager,$basedn\"
 rootpw          $password
-directory	\$ldapdir/db
+directory	$ldapdir/db
 index           objectClass eq
 index           samAccountName eq
 index name eq
@@ -363,9 +362,9 @@
 	open(CONF, ">$modconf"); close(CONF);
 
 	if (system("slaptest -u -f $slapd_conf >&2") != 0) {
-		open(CONF, ">modconf"); 
+		open(CONF, ">$modconf"); 
 		# enable slapd modules
-		print "
+		print CONF "
 modulepath	/usr/lib/ldap
 moduleload	back_bdb
 moduleload	syncprov
@@ -373,16 +372,15 @@
 		close(CONF);
 	}
 
-	if (system("slaptest -u -f $slapd_conf") == 0) {
-    	system("slapadd -f $slapd_conf < $privatedir/$dnsname.ldif >/dev/null") == 0 or die("slapadd failed");
-    }
+	system("slaptest -u -f $slapd_conf") == 0 or die("slaptest still fails after adding modules");
+	system("slapadd -f $slapd_conf < $privatedir/$dnsname.ldif >/dev/null") == 0 or die("slapadd failed");
 
     system("slaptest -f $slapd_conf >/dev/null") == 0 or 
 		die ("slaptest after database load failed");
     
 	$ENV{PATH} = $oldpath;
 
-	return $pidfile;
+	return ($slapd_conf, $pidfile);
 }
 
 sub provision($$$$$)
@@ -564,7 +562,7 @@
 
 	if (not defined($self->{ldap})) {
 	} elsif ($self->{ldap} eq "openldap") {
-		$ret->{OPENLDAP_PIDFILE} = $self->mk_openldap($ldapdir, $basedn, $password, $privatedir, $dnsname, $configuration, join(' ', @provision_options)) or die("Unable to create openldap directories");
+		($ret->{SLAPD_CONF}, $ret->{OPENLDAP_PIDFILE}) = $self->mk_openldap($ldapdir, $basedn, $password, $privatedir, $dnsname, $configuration, join(' ', @provision_options)) or die("Unable to create openldap directories");
 	} elsif ($self->{ldap} eq "fedora") {
 		($ret->{FEDORA_DS_DIR}, $ret->{FEDORA_DS_PIDFILE}) = $self->mk_fedora($ldapdir, $basedn, $root, $password, $privatedir, $configuration) or die("Unable to create fedora ds directories");
 		push (@provision_options, "--ldap-module=nsuniqueid");



More information about the samba-cvs mailing list