steffen: server/kolab/kolab kolab_bootstrap,1.65,1.66

cvs at intevation.de cvs at intevation.de
Thu Oct 7 12:13:10 CEST 2004


Author: steffen

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

Modified Files:
	kolab_bootstrap 
Log Message:
new internal calendar user

Index: kolab_bootstrap
===================================================================
RCS file: /kolabrepository/server/kolab/kolab/kolab_bootstrap,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- kolab_bootstrap	22 Sep 2004 15:38:54 -0000	1.65
+++ kolab_bootstrap	7 Oct 2004 10:13:08 -0000	1.66
@@ -219,6 +219,8 @@
 my $base_dn = $kolab_config{'base_dn'} || die "could not read base_dn from $kolab_config";
 my $php_dn = $kolab_config{'php_dn'} || die "could not read php_dn from $kolab_config";
 my $php_pw = $kolab_config{'php_pw'} || die "could not read php_pw from $kolab_config";
+my $calendar_dn = $kolab_config{'calendar_dn'};
+my $calendar_pw = $kolab_config{'calendar_pw'};
 my @kolabhosts;
 
 if (!$bind_dn || !$bind_pw || !$ldap_uri || !$base_dn) {
@@ -286,6 +288,8 @@
       print " bind_pw : $bind_pw\n";
       $bind_pw_hash = hashPassword($bind_pw);
     }
+
+    # PENDING(steffen) Generate better passwords!
     if ($php_dn =~ /\@\@\@/) {
       $php_dn =~ s/\@\@\@kolab_basedn\@\@\@/$base_dn/g;
     }
@@ -293,6 +297,13 @@
       $php_pw = `$kolab_prefix/bin/openssl passwd nobody`;
       chomp $php_pw;
     }
+    if ($calendar_dn =~ /\@\@\@/) {
+      $calendar_dn =~ s/\@\@\@kolab_basedn\@\@\@/$base_dn/g;
+    }
+    if ($calendar_pw =~ /\@\@\@/) {
+      $calendar_pw = `$kolab_prefix/bin/openssl passwd calendar`;
+      chomp $php_pw;
+    }
 
     $fd = IO::File->new($kolab_config, "w+") || die "could not open $kolab_config";
     print $fd "fqdnhostname : $fqdn\n";
@@ -305,6 +316,8 @@
     print $fd "ldap_master_uri : $ldap_uri\n";
     print $fd "php_dn : $php_dn\n";
     print $fd "php_pw : $php_pw\n";
+    print $fd "calendar_dn : $calendar_dn\n";
+    print $fd "calendar_pw : $calendar_pw\n";
     undef $fd;
     print "done modifying $kolab_config\n\n";
     chmod 0600, $kolab_config;
@@ -478,6 +491,15 @@
       $mesg && $mesg->code && warn "failed to write entry: ", $mesg->error;
       undef $ldapobject;
 
+      # create calendar user
+      $ldapobject = newOrExistingLDAPEntry( $ldap, "cn=calendar,cn=internal,$base_dn" );
+      $ldapobject->replace('cn' => 'calendar', 'sn' => 'n/a n/a', 'uid' => 'calendar@'.$domain,
+                           'userPassword' => $calendar_pw, 'objectclass' => ['top','inetorgperson','kolabinetorgperson']);
+      $ldapobject->dn("cn=calendar,cn=internal,$base_dn");
+      $mesg = $ldapobject->update($ldap);
+      $mesg && $mesg->code && warn "failed to write entry: ", $mesg->error;
+      undef $ldapobject;
+
       # create mainainter group
       newkolabgroupofnames( $ldap, "cn=internal,$base_dn", 'maintainer', $bind_dn );
 
@@ -630,6 +652,15 @@
   my $entry = $mesg->entry(0);
   $php_pw = $entry->get_value( 'userPassword' );
 
+  $calendar_dn = "cn=calendar,cn=internal,$base_dn";
+  $mesg = $ldap->search(base=> $php_dn, scope=> 'exact', filter=> "(objectclass=*)");
+  if ($mesg && $mesg->count != 1) {
+    print "Calendar object not found, please check your input\n";
+    goto SLAVESTART;
+  }
+  my $entry = $mesg->entry(0);
+  $calendar_pw = $entry->get_value( 'userPassword' );
+
   $mesg = $ldap->search(base=> "k=kolab,$base_dn", scope=> 'exact',
 			filter=> "(objectClass=*)");
   if ($mesg && $mesg->count != 1) {
@@ -660,6 +691,8 @@
   print $fd "ldap_master_uri : $ldap_uri\n";
   print $fd "php_dn : $php_dn\n";
   print $fd "php_pw : $php_pw\n";
+  print $fd "calendar_dn : $calendar_dn\n";
+  print $fd "calendar_pw : $calendar_pw\n";
   undef $fd;
   print "done modifying $kolab_config\n\n";
   chmod 0600, $kolab_config;





More information about the commits mailing list