Modified: CalendarServer/trunk/twistedcaldav/directory/appleopendirectory.py (2078 => 2079)
--- 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