[CalendarServer-changes] [7818] CalendarServer/trunk/twistedcaldav/directory/ldapdirectory.py

source_changes at macosforge.org source_changes at macosforge.org
Thu Jul 21 11:28:15 PDT 2011


Revision: 7818
          http://trac.macosforge.org/projects/calendarserver/changeset/7818
Author:   sagen at apple.com
Date:     2011-07-21 11:28:12 -0700 (Thu, 21 Jul 2011)
Log Message:
-----------
Retry after simple_bind_s indicates a lost connection

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/directory/ldapdirectory.py

Modified: CalendarServer/trunk/twistedcaldav/directory/ldapdirectory.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/ldapdirectory.py	2011-07-21 02:07:06 UTC (rev 7817)
+++ CalendarServer/trunk/twistedcaldav/directory/ldapdirectory.py	2011-07-21 18:28:12 UTC (rev 7818)
@@ -277,7 +277,7 @@
                         unrestricted = False
 
             record = self._ldapResultToRecord(dn, attrs, recordType)
-            self.log_debug("Got LDAP record %s" % (record,))
+            # self.log_debug("Got LDAP record %s" % (record,))
 
             if not unrestricted:
                 self.log_debug("%s is not enabled because it's not a member of group: %s" % (guid, self.restrictToGroup))
@@ -326,7 +326,13 @@
             self.log_debug("Creating authentication connection to LDAP")
             self.authLDAP = self.createLDAPConnection()
         self.log_debug("Authenticating %s" % (dn,))
-        self.authLDAP.bind_s(dn, password)
+        try:
+            self.authLDAP.simple_bind_s(dn, password)
+        except ldap.SERVER_DOWN, e:
+            self.log_debug("Lost connection to LDAP server. Retrying.")
+            self.authLDAP = self.createLDAPConnection()
+            self.authLDAP.simple_bind_s(dn, password)
+
         self.log_debug("Authentication succeeded for %s" % (dn,))
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110721/ad3348e5/attachment.html>


More information about the calendarserver-changes mailing list