[CalendarServer-changes] [2079]
CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py
source_changes at macosforge.org
source_changes at macosforge.org
Wed Dec 19 12:36:00 PST 2007
Revision: 2079
http://trac.macosforge.org/projects/calendarserver/changeset/2079
Author: wsanchez at apple.com
Date: 2007-12-19 12:35:59 -0800 (Wed, 19 Dec 2007)
Log Message:
-----------
Cache Basic auth password for the lifetime of each OD DirectoryRecord object. No need to time them out bcause they are all flushed with the record cache periodically.
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py
Modified: CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py 2007-12-15 00:19:09 UTC (rev 2078)
+++ CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py 2007-12-19 20:35:59 UTC (rev 2079)
@@ -762,12 +762,25 @@
def verifyCredentials(self, credentials):
if isinstance(credentials, UsernamePassword):
+ # Check cached password
try:
- return opendirectory.authenticateUserBasic(self.service.directory, self._nodename, self.shortName, credentials.password)
+ if credentials.password == self.password:
+ return True
+ except AttributeError:
+ pass
+
+ # Check with directory services
+ try:
+ if opendirectory.authenticateUserBasic(self.service.directory, self._nodename, self.shortName, credentials.password):
+ # Cache the password to avoid future DS queries
+ self.password = credentials.password
+ return True
except opendirectory.ODError, e:
logging.err("Open Directory (node=%s) error while performing basic authentication for user %s: %s"
- % (self.service.realmName, self.shortName, e), system="OpenDirectoryService")
- return False
+ % (self.service.realmName, self.shortName, e), system="OpenDirectoryService")
+
+ return False
+
elif isinstance(credentials, DigestedCredentials):
try:
# We need a special format for the "challenge" and "response" strings passed into open directory, as it is
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20071219/8f87e521/attachment.html
More information about the calendarserver-changes
mailing list