From e644370b022cabe837fec7958eb189ae372bb12a Mon Sep 17 00:00:00 2001 From: michael starke Date: Tue, 25 Jun 2013 13:28:13 +0200 Subject: [PATCH] Fixed error when setting an empty password. Fixed error that ignored the keyfile --- MacPass/MPDocument.m | 7 ++++--- MacPass/MPPasswordEditViewController.m | 8 +++++++- MacPass/MacPass-Info.plist | 2 +- MiniKeePassLib | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/MacPass/MPDocument.m b/MacPass/MPDocument.m index 408f3e44..2f0c3e49 100644 --- a/MacPass/MPDocument.m +++ b/MacPass/MPDocument.m @@ -103,7 +103,8 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey"; #pragma mark Protection - (BOOL)decryptWithPassword:(NSString *)password keyFileURL:(NSURL *)keyFileURL { - self.password = password; + self.key = keyFileURL; + self.password = [password length] > 0 ? password : nil; @try { self.tree = [KdbReaderFactory load:[[self fileURL] path] withPassword:self.passwordHash]; } @@ -139,8 +140,8 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey"; } - (KdbPassword *)passwordHash { - // TODO: Use defaults to determine Encoding? - return [[[KdbPassword alloc] initWithPassword:self.password passwordEncoding:NSUTF8StringEncoding keyFile:[self.key path]] autorelease]; + + return [[[KdbPassword alloc] initWithPassword:self.password passwordEncoding:NSUTF8StringEncoding keyFileURL:self.key] autorelease]; } + (BOOL)autosavesInPlace diff --git a/MacPass/MPPasswordEditViewController.m b/MacPass/MPPasswordEditViewController.m index 05476469..57950674 100644 --- a/MacPass/MPPasswordEditViewController.m +++ b/MacPass/MPPasswordEditViewController.m @@ -52,7 +52,13 @@ MPDocument *document = [[NSDocumentController sharedDocumentController] documentForWindow:[[self view] window]]; if(document) { document.key = [self.keyfilePathControl URL]; - document.password = [self.passwordTextField stringValue]; + NSString *password = [self.passwordTextField stringValue]; + if([password length] > 0) { + document.password = password; + } + else { + document.password = nil; + } } id mainWindowController = [[[self view] window] windowController]; [mainWindowController showEntries]; diff --git a/MacPass/MacPass-Info.plist b/MacPass/MacPass-Info.plist index 36a4a928..91259c78 100644 --- a/MacPass/MacPass-Info.plist +++ b/MacPass/MacPass-Info.plist @@ -48,7 +48,7 @@ CFBundleSignature ???? CFBundleVersion - 1065 + 1090 LSMinimumSystemVersion ${MACOSX_DEPLOYMENT_TARGET} NSHumanReadableCopyright diff --git a/MiniKeePassLib b/MiniKeePassLib index 8c5d2b62..5bda74e6 160000 --- a/MiniKeePassLib +++ b/MiniKeePassLib @@ -1 +1 @@ -Subproject commit 8c5d2b62097451a61298ce28d215e223763d679f +Subproject commit 5bda74e60865f0f556e9991b671a83eed6cc9ad2