thomas: server/perl-kolab/lib/Kolab LDAP.pm,1.9,1.10

cvs at kolab.org cvs at kolab.org
Mon Feb 9 16:39:39 CET 2009


Author: thomas

Update of /kolabrepository/server/perl-kolab/lib/Kolab
In directory doto:/tmp/cvs-serv1855/perl-kolab/lib/Kolab

Modified Files:
	LDAP.pm 
Log Message:
Continue LDAP sync if connecting the IMAP server fails, just skip actions that would need it.


Index: LDAP.pm
===================================================================
RCS file: /kolabrepository/server/perl-kolab/lib/Kolab/LDAP.pm,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- LDAP.pm	9 Feb 2009 15:32:37 -0000	1.9
+++ LDAP.pm	9 Feb 2009 15:39:37 -0000	1.10
@@ -480,6 +480,11 @@
         $islocal = 0;
     }
 
+    if (!$cyrus) {
+        Kolab::log('L', 'object wants mailbox, but not connected to imap, returning', KOLAB_DEBUG);
+        return;
+    }
+
     # Intermediate multidomain support:
     # We accept domain encoded in CN...
     if( $p eq 'sf' && index( $uid, '@' ) < 0 ) {
@@ -616,6 +621,13 @@
     my $remfromldap = shift || 0;
     my $p = shift || 'user';
 
+    my $guid = $object->get_value($Kolab::config{$p . '_field_guid'});
+    my $uid = uidcacheFetch($guid);
+    if ($uid && !$cyrus) {
+        Kolab::log('L', 'object found in mboxcache, but not connected to imap, returning', KOLAB_DEBUG);
+        return;
+    }
+
     if ($remfromldap) {
         my $dn = $object->dn;
 	my $del = $object->get_value($Kolab::config{$p . '_field_deleted'}, asref => 1);
@@ -697,8 +709,6 @@
 	}
     }
 
-    my $guid = $object->get_value($Kolab::config{$p . '_field_guid'});
-    my $uid = uidcacheFetch($guid);
     if (!$uid) {
         Kolab::log('L', 'Deleted object not found in mboxcache, returning', KOLAB_DEBUG);
         return;
@@ -715,16 +725,16 @@
     Kolab::log('L', 'Synchronising');
 
     my $cyrus = Kolab::Cyrus::create;
-    if( !$cyrus ) {
-      # We could not connect, bail out for now
-      return 0;
-    }
     %newuid_db = ();
 
     $user_timestamp  = syncBasic($cyrus, 'user', '', $user_timestamp, 0);
     $sf_timestamp    = syncBasic($cyrus, 'sf', '', $sf_timestamp, 1);
     $group_timestamp = syncBasic($cyrus, 'group', '', $group_timestamp, 0);
 
+    if( !$cyrus ) {
+      # We could not connect, bail out for now
+      return 0;
+    }
     # Check that all mailboxes correspond to LDAP objects
     Kolab::log('L', 'Synchronising mailboxes');
 





More information about the commits mailing list