Thread: [Keychain-commit] SF.net SVN: keychain:[459] trunk/Frameworks/Keychain/Keychain
Status: Abandoned
Brought to you by:
wadetregaskis
From: <wad...@us...> - 2009-01-04 20:57:53
|
Revision: 459 http://keychain.svn.sourceforge.net/keychain/?rev=459&view=rev Author: wadetregaskis Date: 2009-01-04 20:57:50 +0000 (Sun, 04 Jan 2009) Log Message: ----------- * Removed -[Keychain version] and -[Keychain setVersion:], as they don't make sense. Part of bug #2473561. * Updated methods using SecKeychainSettings to properly set the struct version before calling SecKeychainCopySettings. Part of bug #2473561. Modified Paths: -------------- trunk/Frameworks/Keychain/Keychain/Keychain.h trunk/Frameworks/Keychain/Keychain/Keychain.m Modified: trunk/Frameworks/Keychain/Keychain/Keychain.h =================================================================== --- trunk/Frameworks/Keychain/Keychain/Keychain.h 2009-01-04 20:45:53 UTC (rev 458) +++ trunk/Frameworks/Keychain/Keychain/Keychain.h 2009-01-04 20:57:50 UTC (rev 459) @@ -216,20 +216,6 @@ - (BOOL)isWritable; -/*! @method setVersion: - @abstract Sets the version of the receiver. - @discussion You should be careful about setting this value, as it may relate intricately to the keychain file format on disk. See the description for the version method for more details. - @param version The major version number. */ - -- (void)setVersion:(uint32_t)version; - -/*! @method version - @abstract Returns the version of the receiver. - @discussion The version relates primarily to the format of the keychain file on disk, rather than how the receiver acts. At the time of writing, all keychain versions work the same. But MacOS 10.1 used a different format for storing keychains to 10.2. Indeed, 10.3 or another future release may change the format again. - @result The major version number. */ - -- (uint32_t)version; - /*! @method setLockOnSleep: @abstract Sets whether or not the receiver will lock itself automatically when the system goes to sleep. @discussion Some users like to have their keychain lock automatically when their computer is put to sleep. If they leave their computer alone overnight, for example, they might not want just anyone to be able to come along while they're sleeping and use their keychain. Modified: trunk/Frameworks/Keychain/Keychain/Keychain.m =================================================================== --- trunk/Frameworks/Keychain/Keychain/Keychain.m 2009-01-04 20:45:53 UTC (rev 458) +++ trunk/Frameworks/Keychain/Keychain/Keychain.m 2009-01-04 20:57:50 UTC (rev 459) @@ -465,43 +465,10 @@ } } -- (void)setVersion:(uint32_t)version { - SecKeychainSettings settings; - - _error = SecKeychainCopySettings(_keychain, &settings); - - if (noErr == _error) { - settings.version = version; - - _error = SecKeychainSetSettings(_keychain, &settings); - - if (CSSM_OK != _error) { - PSYSLOGND(LOG_ERR, @"Unable to set version for keychain %p, error %@.\n", self, OSStatusAsString(_error)); - PDEBUG(@"SecKeychainSetSettings(%p, %p) returned error %@.\n", _keychain, &settings, OSStatusAsString(_error)); - } - } else { - PSYSLOGND(LOG_ERR, @"Unable to set version for keychain %p, error %@.\n", self, OSStatusAsString(_error)); - PDEBUG(@"SecKeychainCopySettings(%p, %p) returned error %@.\n", _keychain, &settings, OSStatusAsString(_error)); - } -} - -- (uint32_t)version { - SecKeychainSettings settings; - - _error = SecKeychainCopySettings(_keychain, &settings); - - if (noErr == _error) { - return settings.version; - } else { - PSYSLOGND(LOG_ERR, @"Unable to determine version of keychain %p, error %@.\n", self, OSStatusAsString(_error)); - PDEBUG(@"SecKeychainCopySettings(%p, %p) returned error %@.\n", _keychain, &settings, OSStatusAsString(_error)); - - return -1; - } -} - - (void)setLockOnSleep:(BOOL)lockOnSleep { - SecKeychainSettings settings; + SecKeychainSettings settings = { + .version = SEC_KEYCHAIN_SETTINGS_VERS1 + }; _error = SecKeychainCopySettings(_keychain, &settings); @@ -521,7 +488,9 @@ } - (BOOL)willLockOnSleep { - SecKeychainSettings settings; + SecKeychainSettings settings = { + .version = SEC_KEYCHAIN_SETTINGS_VERS1 + }; _error = SecKeychainCopySettings(_keychain, &settings); @@ -536,7 +505,9 @@ } - (void)setLockAfterInterval:(BOOL)lockAfterInterval { - SecKeychainSettings settings; + SecKeychainSettings settings = { + .version = SEC_KEYCHAIN_SETTINGS_VERS1 + }; _error = SecKeychainCopySettings(_keychain, &settings); @@ -556,7 +527,9 @@ } - (BOOL)willLockAfterInterval { - SecKeychainSettings settings; + SecKeychainSettings settings = { + .version = SEC_KEYCHAIN_SETTINGS_VERS1 + }; _error = SecKeychainCopySettings(_keychain, &settings); @@ -571,7 +544,9 @@ } - (void)setInterval:(uint32_t)interval { - SecKeychainSettings settings; + SecKeychainSettings settings = { + .version = SEC_KEYCHAIN_SETTINGS_VERS1 + }; _error = SecKeychainCopySettings(_keychain, &settings); @@ -591,7 +566,9 @@ } - (uint32_t)interval { - SecKeychainSettings settings; + SecKeychainSettings settings = { + SEC_KEYCHAIN_SETTINGS_VERS1 + }; _error = SecKeychainCopySettings(_keychain, &settings); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wad...@us...> - 2009-01-04 21:13:27
|
Revision: 460 http://keychain.svn.sourceforge.net/keychain/?rev=460&view=rev Author: wadetregaskis Date: 2009-01-04 21:13:23 +0000 (Sun, 04 Jan 2009) Log Message: ----------- * Removed -[Keychain setLockAfterInterval:] and -[Keychain willLockAfterInterval] - these rely on functionality in the Security framework which isn't actually implemented (as of 10.5.6, at least). Renamed -[Keychain setInterval:] to -[Keychain setLockInterval:] and -[Keychain interval] to -[Keychain lockInterval]. Part of bug #2473561. Modified Paths: -------------- trunk/Frameworks/Keychain/Keychain/Keychain.h trunk/Frameworks/Keychain/Keychain/Keychain.m Modified: trunk/Frameworks/Keychain/Keychain/Keychain.h =================================================================== --- trunk/Frameworks/Keychain/Keychain/Keychain.h 2009-01-04 20:57:50 UTC (rev 459) +++ trunk/Frameworks/Keychain/Keychain/Keychain.h 2009-01-04 21:13:23 UTC (rev 460) @@ -229,34 +229,19 @@ - (BOOL)willLockOnSleep; -/*! @method setLockAfterInterval: - @abstract Sets whether or not the receiver will automatically lock itself after a certain period of inactivity. - @discussion Some users like to have their keychain lock automatically after a certain period of it being unused, for extra security, as locked keychains cannot be used at all - neither read nor added to. - - Note that you should set this only after setting the interval using setInterval:. If you set this first, and interval is 0, you will induce a race condition, the outcome of which may be that the receiver becomes locked. - @param lockAfterInterval YES if the receiver should lock itself automatically after a certain period of inactivity, NO otherwise. */ - -- (void)setLockAfterInterval:(BOOL)lockAfterInterval; - -/*! @method willLockAfterInterval - @abstract Returns whether or not the receiver will automatically lock itself after a certain period of inactivity. - @result Returns YES if the receiver is set to lock after some interval (which can be determined using the interval method), NO otherwise and in case of error. */ - -- (BOOL)willLockAfterInterval; - -/*! @method setInterval: +/*! @method setLockInterval: @abstract Sets the time in seconds after which a keychain automatically locks itself. @discussion This is an idle timeout - if the receiver is unused for the specified interval of time, it locks itself. Note that since keychains are system-wide, other applications may use the receiver without your knowledge. Also not that this interval does not need to be 'reset' every time you use the receiver - the receiver keeps track of time and usage itself. @param interval The number of seconds of idle time after which the receiver should lock itself. This may be 0, in which case the receiver will lock itself immediately after any operation. Since this setting is system-wide, you should be wary about setting this value to 0, or any other brief interval. */ -- (void)setInterval:(uint32_t)interval; +- (void)setLockInterval:(uint32_t)interval; -/*! @method interval +/*! @method lockInterval @abstract Returns the time in seconds after which a keychain automatically locks. @discussion This is an idle timeout - if the receiver is unused for this interval of time, it locks itself. Note that since keychains are system-wide, other applications may use the receiver without your knowledge. @result The time interval in seconds. This may be a non-zero number even if the receiver is not set to use it. */ -- (uint32_t)interval; +- (uint32_t)lockInterval; /*! @method lock @abstract Locks the receiver. Modified: trunk/Frameworks/Keychain/Keychain/Keychain.m =================================================================== --- trunk/Frameworks/Keychain/Keychain/Keychain.m 2009-01-04 20:57:50 UTC (rev 459) +++ trunk/Frameworks/Keychain/Keychain/Keychain.m 2009-01-04 21:13:23 UTC (rev 460) @@ -504,7 +504,7 @@ } } -- (void)setLockAfterInterval:(BOOL)lockAfterInterval { +- (void)setLockInterval:(uint32_t)interval { SecKeychainSettings settings = { .version = SEC_KEYCHAIN_SETTINGS_VERS1 }; @@ -512,45 +512,6 @@ _error = SecKeychainCopySettings(_keychain, &settings); if (noErr == _error) { - settings.useLockInterval = lockAfterInterval; - - _error = SecKeychainSetSettings(_keychain, &settings); - - if (CSSM_OK != _error) { - PSYSLOGND(LOG_ERR, @"Unable to set lock-after-interval for keychain %p, error %@.\n", self, OSStatusAsString(_error)); - PDEBUG(@"SecKeychainSetSettings(%p, %p) returned error %@.\n", _keychain, &settings, OSStatusAsString(_error)); - } - } else { - PSYSLOGND(LOG_ERR, @"Unable to set lock-after-interval for keychain %p, error %@.\n", self, OSStatusAsString(_error)); - PDEBUG(@"SecKeychainCopySettings(%p, %p) returned error %@.\n", _keychain, &settings, OSStatusAsString(_error)); - } -} - -- (BOOL)willLockAfterInterval { - SecKeychainSettings settings = { - .version = SEC_KEYCHAIN_SETTINGS_VERS1 - }; - - _error = SecKeychainCopySettings(_keychain, &settings); - - if (noErr == _error) { - return settings.useLockInterval; - } else { - PSYSLOGND(LOG_ERR, @"Unable to determine lock-after-interval setting of keychain %p, error %@.\n", self, OSStatusAsString(_error)); - PDEBUG(@"SecKeychainCopySettings(%p, %p) returned error %@.\n", _keychain, &settings, OSStatusAsString(_error)); - - return NO; - } -} - -- (void)setInterval:(uint32_t)interval { - SecKeychainSettings settings = { - .version = SEC_KEYCHAIN_SETTINGS_VERS1 - }; - - _error = SecKeychainCopySettings(_keychain, &settings); - - if (noErr == _error) { settings.lockInterval = interval; _error = SecKeychainSetSettings(_keychain, &settings); @@ -565,7 +526,7 @@ } } -- (uint32_t)interval { +- (uint32_t)lockInterval { SecKeychainSettings settings = { SEC_KEYCHAIN_SETTINGS_VERS1 }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |