diff --git a/MasterPassword/MPAppDelegate_Key.m b/MasterPassword/MPAppDelegate_Key.m index d5be3bc0..c2286114 100644 --- a/MasterPassword/MPAppDelegate_Key.m +++ b/MasterPassword/MPAppDelegate_Key.m @@ -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]; } diff --git a/MasterPassword/Mac/MPAppDelegate.m b/MasterPassword/Mac/MPAppDelegate.m index 6f85c215..37156f2d 100644 --- a/MasterPassword/Mac/MPAppDelegate.m +++ b/MasterPassword/Mac/MPAppDelegate.m @@ -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 diff --git a/MasterPassword/Mac/MPPasswordWindowController.m b/MasterPassword/Mac/MPPasswordWindowController.m index 63c719b2..f037274c 100644 --- a/MasterPassword/Mac/MPPasswordWindowController.m +++ b/MasterPassword/Mac/MPPasswordWindowController.m @@ -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 { diff --git a/MasterPassword/iOS/MPMainViewController.m b/MasterPassword/iOS/MPMainViewController.m index 604ea362..2dd97e18 100644 --- a/MasterPassword/iOS/MPMainViewController.m +++ b/MasterPassword/iOS/MPMainViewController.m @@ -425,7 +425,6 @@ case 5: #endif { - [MPConfig get].saveKey = [NSNumber numberWithBool:NO]; [[MPAppDelegate get] signOut:self]; [[MPAppDelegate get] loadKey:YES]; break;