[CalendarServer-changes] [3859] CalendarServer/trunk/twistedcaldav/config.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Mar 13 12:25:06 PDT 2009


Revision: 3859
          http://trac.macosforge.org/projects/calendarserver/changeset/3859
Author:   sagen at apple.com
Date:     2009-03-13 12:25:06 -0700 (Fri, 13 Mar 2009)
Log Message:
-----------
pop/imap/smtp passwords now looked up in keychain via account rather than label

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/config.py

Modified: CalendarServer/trunk/twistedcaldav/config.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/config.py	2009-03-13 18:29:21 UTC (rev 3858)
+++ CalendarServer/trunk/twistedcaldav/config.py	2009-03-13 19:25:06 UTC (rev 3859)
@@ -679,20 +679,25 @@
 
         if service["Enabled"]:
             for direction in ("Sending", "Receiving"):
-                # Get password from keychain.  If not there, fall back to what
-                # is in the plist. Keychain label names are icalserver.sending
-                # and icalserver.receiving.
-                try:
-                    label = "icalserver.%s" % (direction.lower(),)
-                    password = getPasswordFromKeychain(label)
-                    service[direction]["Password"] = password
-                    log.info("iMIP %s password successfully retreived from keychain" % (direction,))
-                except KeychainAccessError:
-                    # The system doesn't support keychain
-                    pass
-                except KeychainPasswordNotFound:
-                    # The password doesn't exist in the keychain.
-                    log.info("iMIP %s password not found in keychain" % (direction,))
+                if service[direction].Username:
+                    # Get password from keychain.  If not there, fall back to
+                    # what is in the plist.
+                    try:
+                        if direction == "Sending":
+                            account = service.Sending.Address
+                        else:
+                            account = "%s@%s" % (service.Receiving.Username,
+                                service.Receiving.Server)
+                        password = getPasswordFromKeychain(account)
+                        service[direction]["Password"] = password
+                        log.info("iMIP %s password successfully retreived from keychain" % (direction,))
+                    except KeychainAccessError:
+                        # The system doesn't support keychain
+                        pass
+                    except KeychainPasswordNotFound:
+                        # The password doesn't exist in the keychain.
+                        log.info("iMIP %s password not found in keychain" %
+                            (direction,))
 
 
 def _mergeData(oldData, newData):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20090313/6446f7ca/attachment-0001.html>


More information about the calendarserver-changes mailing list