Revision: 3615 http://trac.macosforge.org/projects/calendarserver/changeset/3615 Author: sagen@apple.com Date: 2009-01-27 13:23:24 -0800 (Tue, 27 Jan 2009) Log Message: ----------- Update keychain lookup code to match new keychain item name. Modified Paths: -------------- CalendarServer/trunk/twistedcaldav/config.py CalendarServer/trunk/twistedcaldav/util.py Modified: CalendarServer/trunk/twistedcaldav/config.py =================================================================== --- CalendarServer/trunk/twistedcaldav/config.py 2009-01-27 00:32:48 UTC (rev 3614) +++ CalendarServer/trunk/twistedcaldav/config.py 2009-01-27 21:23:24 UTC (rev 3615) @@ -657,7 +657,7 @@ # Check for empty fields for key, value in service.iteritems(): - if not value and key not in ("AllowedJIDs", "HeartbeatMinutes"): + if not value and key not in ("AllowedJIDs", "HeartbeatMinutes", "Password"): raise ConfigurationError("Invalid %s for XMPPNotifierService: %r" % (key, value)) @@ -671,11 +671,11 @@ if service["Enabled"]: for direction in ("Sending", "Receiving"): # Get password from keychain. If not there, fall back to what - # is in the plist. Keychain account names are icalserver.sending + # is in the plist. Keychain label names are icalserver.sending # and icalserver.receiving. try: - account = "icalserver.%s" % (direction.lower(),) - password = getPasswordFromKeychain(account) + label = "icalserver.%s" % (direction.lower(),) + password = getPasswordFromKeychain(label) service[direction]["Password"] = password log.info("iMIP %s password successfully retreived from keychain" % (direction,)) except KeychainAccessError: Modified: CalendarServer/trunk/twistedcaldav/util.py =================================================================== --- CalendarServer/trunk/twistedcaldav/util.py 2009-01-27 00:32:48 UTC (rev 3614) +++ CalendarServer/trunk/twistedcaldav/util.py 2009-01-27 21:23:24 UTC (rev 3615) @@ -137,12 +137,12 @@ passwordRegExp = re.compile(r'password: "(.*)"') -def getPasswordFromKeychain(account): +def getPasswordFromKeychain(label): if os.path.isfile("/usr/bin/security"): child = Popen( args=[ "/usr/bin/security", "find-generic-password", - "-a", account, "-g", + "-l", label, "-g", ], stdout=PIPE, stderr=STDOUT, ) @@ -153,7 +153,7 @@ else: match = passwordRegExp.search(output) if not match: - error = "Password for %s not found in keychain" % (account,) + error = "Password for %s not found in keychain" % (label,) raise KeychainPasswordNotFound(error) else: return match.group(1)
participants (1)
-
source_changes@macosforge.org