Keychain fix + signout fix.
[FIXED] GenericPassword class keychain items should have both an Account and a Service attribute. [FIXED] OS X: Logout when key is saved.
This commit is contained in:
parent
b0875beb36
commit
ada6d6b36a
@ -17,8 +17,10 @@ static NSDictionary *keyQuery() {
|
||||
static NSDictionary *MPKeyQuery = nil;
|
||||
if (!MPKeyQuery)
|
||||
MPKeyQuery = [PearlKeyChain createQueryForClass:kSecClassGenericPassword
|
||||
attributes:[NSDictionary dictionaryWithObject:@"Saved Master Password"
|
||||
forKey:(__bridge id)kSecAttrService]
|
||||
attributes:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"Saved Master Password", (__bridge id)kSecAttrService,
|
||||
@"default", (__bridge id)kSecAttrAccount,
|
||||
nil]
|
||||
matches:nil];
|
||||
|
||||
return MPKeyQuery;
|
||||
@ -29,8 +31,10 @@ static NSDictionary *keyIDQuery() {
|
||||
static NSDictionary *MPKeyIDQuery = nil;
|
||||
if (!MPKeyIDQuery)
|
||||
MPKeyIDQuery = [PearlKeyChain createQueryForClass:kSecClassGenericPassword
|
||||
attributes:[NSDictionary dictionaryWithObject:@"Master Password Verification"
|
||||
forKey:(__bridge id)kSecAttrService]
|
||||
attributes:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"Master Password Check", (__bridge id)kSecAttrService,
|
||||
@"default", (__bridge id)kSecAttrAccount,
|
||||
nil]
|
||||
matches:nil];
|
||||
|
||||
return MPKeyIDQuery;
|
||||
@ -39,8 +43,10 @@ static NSDictionary *keyIDQuery() {
|
||||
- (void)forgetKey {
|
||||
|
||||
inf(@"Deleting key and ID from keychain.");
|
||||
[PearlKeyChain deleteItemForQuery:keyQuery()];
|
||||
[PearlKeyChain deleteItemForQuery:keyIDQuery()];
|
||||
if ([PearlKeyChain deleteItemForQuery:keyQuery()] != errSecItemNotFound)
|
||||
inf(@"Removed key from keychain.");
|
||||
if ([PearlKeyChain deleteItemForQuery:keyIDQuery()] != errSecItemNotFound)
|
||||
inf(@"Removed key ID from keychain.");
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPNotificationKeyForgotten object:self];
|
||||
#ifdef TESTFLIGHT_SDK_VERSION
|
||||
@ -49,7 +55,8 @@ static NSDictionary *keyIDQuery() {
|
||||
}
|
||||
|
||||
- (IBAction)signOut:(id)sender {
|
||||
|
||||
|
||||
[MPConfig get].saveKey = [NSNumber numberWithBool:NO];
|
||||
[self updateKey:nil];
|
||||
}
|
||||
|
||||
|
@ -212,9 +212,10 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
|
||||
|
||||
#pragma mark - UbiquityStoreManagerDelegate
|
||||
|
||||
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didSwitchToiCloud:(BOOL)didSwitch {
|
||||
- (void)ubiquityStoreManager:(UbiquityStoreManager *)manager didSwitchToiCloud:(BOOL)iCloudEnabled {
|
||||
|
||||
self.useICloudItem.state = didSwitch? NSOnState: NSOffState;
|
||||
self.useICloudItem.state = iCloudEnabled? NSOnState: NSOffState;
|
||||
self.useICloudItem.enabled = !iCloudEnabled;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -105,8 +105,6 @@
|
||||
// "Unlock" button.
|
||||
[[MPAppDelegate get] tryMasterPassword:[(NSSecureTextField *)alert.accessoryView stringValue]];
|
||||
}
|
||||
|
||||
[self unlock];
|
||||
}
|
||||
|
||||
- (NSArray *)control:(NSControl *)control textView:(NSTextView *)textView completions:(NSArray *)words forPartialWordRange:(NSRange)charRange indexOfSelectedItem:(NSInteger *)index {
|
||||
|
@ -425,7 +425,6 @@
|
||||
case 5:
|
||||
#endif
|
||||
{
|
||||
[MPConfig get].saveKey = [NSNumber numberWithBool:NO];
|
||||
[[MPAppDelegate get] signOut:self];
|
||||
[[MPAppDelegate get] loadKey:YES];
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user