[CalendarServer-changes] [8306] CalendarServer/trunk/twistedcaldav/directory/ldapdirectory.py
source_changes at macosforge.org
source_changes at macosforge.org
Wed Nov 16 15:00:32 PST 2011
Revision: 8306
http://trac.macosforge.org/projects/calendarserver/changeset/8306
Author: sagen at apple.com
Date: 2011-11-16 15:00:32 -0800 (Wed, 16 Nov 2011)
Log Message:
-----------
Return HTTP 503 is LDAP server is down.
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/directory/ldapdirectory.py
Modified: CalendarServer/trunk/twistedcaldav/directory/ldapdirectory.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/ldapdirectory.py 2011-11-16 21:52:13 UTC (rev 8305)
+++ CalendarServer/trunk/twistedcaldav/directory/ldapdirectory.py 2011-11-16 23:00:32 UTC (rev 8306)
@@ -270,6 +270,10 @@
(repr(self.credentials.get("dn")),))
self.ldap.simple_bind_s(self.credentials.get("dn"),
self.credentials.get("password"))
+ except ldap.SERVER_DOWN:
+ msg = "Can't connect to LDAP %s: server down" % (self.uri,)
+ self.log_error(msg)
+ raise DirectoryConfigurationError(msg)
except ldap.INVALID_CREDENTIALS:
msg = "Can't bind to LDAP %s: check credentials" % (self.uri,)
self.log_error(msg)
@@ -472,6 +476,9 @@
try:
result = self.ldap.search_s(base, scope, filterstr=filterstr,
attrlist=attrlist)
+ except ldap.SERVER_DOWN:
+ self.log_error("LDAP server unavailable")
+ raise HTTPError(StatusResponse(responsecode.SERVICE_UNAVAILABLE, "LDAP server unavailable"))
except ldap.NO_SUCH_OBJECT:
result = []
except ldap.FILTER_ERROR, e:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20111116/276f8ab4/attachment.html>
More information about the calendarserver-changes
mailing list