steffen: server/kolab/kolab kolab_bootstrap, 1.27, 1.28 kolabd, 1.3, 1.4 slapd.conf.template, 1.18, 1.19

cvs at intevation.de cvs at intevation.de
Wed May 26 04:10:36 CEST 2004


Author: steffen

Update of /kolabrepository/server/kolab/kolab
In directory doto:/tmp/cvs-serv32597/kolab/kolab

Modified Files:
	kolab_bootstrap kolabd slapd.conf.template 
Log Message:
multilocation bugfixes

Index: kolab_bootstrap
===================================================================
RCS file: /kolabrepository/server/kolab/kolab/kolab_bootstrap,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- kolab_bootstrap	25 May 2004 23:14:47 -0000	1.27
+++ kolab_bootstrap	26 May 2004 02:10:34 -0000	1.28
@@ -1,4 +1,4 @@
-#!@l_prefix@/bin/perl
+#!@l_prefix@/bin/perl 
 
 # (c) 2004 Steffen Hansen <steffen at klaralvdalens-datakonsult.se>
 # (c) 2003 Tassilo Erlewein <tassilo.erlewein at erfrakon.de>
@@ -100,7 +100,6 @@
 if ($tmp) { $fqdn = $tmp; }
 print "Proceeding with Hostname $fqdn\n";
 
-my $tmp;
 if( $is_master eq "false" ) {
   $tmp = "2";
 } else {
@@ -212,7 +211,38 @@
       tryConnect( '127.0.0.1', 9999 ) && die "A process is already listening to port 9999 (kolabd)\n"
 	."Please stop any running kolabd and bootstrap again\n";
 
+      # Set up slapd to replicate to slave server's kolabds
       my $tmpl = IO::File->new("$kolab_prefix/etc/kolab/slapd.conf.template", "r") || die "could not read $kolab_prefix/etc/kolab/slapd.conf.template";
+      my $cfg = "";
+      while( <$tmpl> ) {
+	my $line = $_;
+	last if $line =~ /##### Replication setup (dont delete this line, kolab_bootstrap depends on it) #####/;
+	$cfg .= $line;
+      }
+      close($tmpl);
+      undef $tmpl;
+
+      while(1) {
+	print "name or IP of slave kolab server (host:port) [empty for none]: ";
+	my $tmp = ReadLine;
+	chomp $tmp;
+	if( $tmp ) {
+	  $cfg .= "replica host=$tmp\n";
+	  $cfg .= "  binddn=\"cn=replicator\"\n";
+	  $cfg .= "  bindmethod=simple credentials=secret\n\n";
+	} else {
+	  last;
+	}
+      };
+
+      $tmpl = IO::File->new("$kolab_prefix/etc/kolab/slapd.conf.template", "w") || die "could not write $kolab_prefix/etc/kolab/slapd.conf.template";
+      print $tmpl $cfg;
+      close( $tmpl );
+      undef $cfg;	
+      undef $tmpl;
+
+      # Creating slapd.conf from template
+      $tmpl = IO::File->new("$kolab_prefix/etc/kolab/slapd.conf.template", "r") || die "could not read $kolab_prefix/etc/kolab/slapd.conf.template";
       my $slpd = IO::File->new("$kolab_prefix/etc/openldap/slapd.conf","w+") || die "could not write to $kolab_prefix/etc/openldap/slapd.conf";
       chmod (0640,"$kolab_prefix/etc/openldap/slapd.conf");
       foreach (<$tmpl>) {
@@ -227,7 +257,7 @@
       # now we must startup slapd
       print "temporarily starting slapd\n";
       $ldap_uri = "ldap://127.0.0.1:389/";
-      system("$kolab_prefix/libexec/openldap/slapd -h ldap://127.0.0.1:389/ -f $kolab_prefix/etc/openldap/slapd.conf");
+      (system("$kolab_prefix/libexec/openldap/slapd -h ldap://127.0.0.1:389/ -f $kolab_prefix/etc/openldap/slapd.conf") == 0 ) || die( "Could not start temporary slapd" );
       sleep 3;
     }
 
@@ -360,7 +390,7 @@
    $cfg .= $_ while (<FH>);
    close(FH);
 
-   $cfg =~ s/\n((openldap_url|sasl_authmech)\S*=[^\n]*)/#\1\n/sg;
+   $cfg =~ s/\n((openldap_url|sasl_authmech)\S*=[^\n]*)/#$1\n/sg;
    $cfg .= "openldap_url=\"\"\nsasl_authmech=\"ldap\"\n";
 
    open(FH, ">$kolab_prefix/etc/rc.conf") || die;
@@ -408,7 +438,7 @@
       goto SLAVESTART;
     }
     $php_dn = "cn=nobody,$base_dn";
-    my $mesg = $ldap->search(base=> $php_dn, scope=> 'exact', filter=> "(objectclass=*)");
+    $mesg = $ldap->search(base=> $php_dn, scope=> 'exact', filter=> "(objectclass=*)");
     if ($mesg && $mesg->count != 1) {
       print "Nobody object found, please check your input\n";
       goto SLAVESTART;
@@ -435,7 +465,7 @@
     $cfg .= $_ while (<FH>);
     close(FH);
     
-    $cfg =~ s/\n((openldap_url|sasl_authmech)\S*=[^\n]*)/#\1\n/sg;
+    $cfg =~ s/\n((openldap_url|sasl_authmech)\S*=[^\n]*)/#$1\n/sg;
     $cfg .= "openldap_url=\"\"\nsasl_authmech=\"ldap\"\n";
     
     open(FH, ">$kolab_prefix/etc/rc.conf") || die;

Index: kolabd
===================================================================
RCS file: /kolabrepository/server/kolab/kolab/kolabd,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- kolabd	25 May 2004 03:22:53 -0000	1.3
+++ kolabd	26 May 2004 02:10:34 -0000	1.4
@@ -110,6 +110,7 @@
         }
         Kolab::LDAP::Backend::run($backend);
 
+        Kolab::log('K', "`$backend' returned");
 	# exit with 0 status to avoid killing daemon
 	exit(0);
     }

Index: slapd.conf.template
===================================================================
RCS file: /kolabrepository/server/kolab/kolab/slapd.conf.template,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- slapd.conf.template	19 May 2004 16:36:20 -0000	1.18
+++ slapd.conf.template	26 May 2004 02:10:34 -0000	1.19
@@ -17,6 +17,7 @@
 replica-pidfile	@l_prefix@/var/openldap/run/slurpd.pid
 argsfile	@l_prefix@/var/openldap/slapd.args
 replogfile      @l_prefix@/var/openldap/replog
+replicationinterval 5
 
 schemacheck 	on
 lastmod		on
@@ -126,3 +127,5 @@
 	by group="cn=admin,@@@base_dn@@@" write
  	by group="cn=maintainer,@@@base_dn@@@" write
 	by * read stop
+
+##### Replication setup (dont delete this line, kolab_bootstrap depends on it) #####





More information about the commits mailing list