Fix crash when default type is not a generated type, when password is unset and don't crash for fatals.
This commit is contained in:
parent
28bd162e05
commit
588ebe08cd
@ -66,6 +66,9 @@ void mpw_freeString(const char *string) {
|
|||||||
uint8_t const *mpw_scrypt(const size_t keySize, const char *secret, const uint8_t *salt, const size_t saltSize,
|
uint8_t const *mpw_scrypt(const size_t keySize, const char *secret, const uint8_t *salt, const size_t saltSize,
|
||||||
uint64_t N, uint32_t r, uint32_t p) {
|
uint64_t N, uint32_t r, uint32_t p) {
|
||||||
|
|
||||||
|
if (!secret || !salt)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
uint8_t *key = malloc( keySize );
|
uint8_t *key = malloc( keySize );
|
||||||
if (!key)
|
if (!key)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -532,23 +532,21 @@
|
|||||||
self.passwordField.attributedPlaceholder = stra(
|
self.passwordField.attributedPlaceholder = stra(
|
||||||
mainSite.type & MPSiteTypeClassStored? strl( @"No password" ):
|
mainSite.type & MPSiteTypeClassStored? strl( @"No password" ):
|
||||||
mainSite.type & MPSiteTypeClassGenerated? strl( @"..." ): @"", @{
|
mainSite.type & MPSiteTypeClassGenerated? strl( @"..." ): @"", @{
|
||||||
NSForegroundColorAttributeName : [UIColor whiteColor]
|
NSForegroundColorAttributeName : [UIColor whiteColor]
|
||||||
} );
|
} );
|
||||||
[MPiOSAppDelegate managedObjectContextPerformBlock:^(NSManagedObjectContext *context) {
|
[MPiOSAppDelegate managedObjectContextPerformBlock:^(NSManagedObjectContext *context) {
|
||||||
MPSiteEntity *site = [self siteInContext:context];
|
MPSiteEntity *site = [self siteInContext:context];
|
||||||
MPKey *key = [MPiOSAppDelegate get].key;
|
MPKey *key = [MPiOSAppDelegate get].key;
|
||||||
if (!key)
|
if (!key)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NSString *password, *loginName = [site resolveLoginUsingKey:key];
|
NSString *password = nil, *loginName = [site resolveLoginUsingKey:key];
|
||||||
if (self.transientSite)
|
MPSiteType transientType = [[MPiOSAppDelegate get] activeUserInContext:context].defaultType?: MPSiteTypeGeneratedLong;
|
||||||
password = [MPAlgorithmDefault generatePasswordForSiteNamed:self.transientSite ofType:
|
if (self.transientSite && transientType & MPSiteTypeClassGenerated)
|
||||||
[[MPiOSAppDelegate get] activeUserInContext:context].defaultType?: MPSiteTypeGeneratedLong
|
password = [MPAlgorithmDefault generatePasswordForSiteNamed:self.transientSite ofType:transientType
|
||||||
withCounter:1 usingKey:key];
|
withCounter:1 usingKey:key];
|
||||||
else if (site)
|
else if (site)
|
||||||
password = [site resolvePasswordUsingKey:key];
|
password = [site resolvePasswordUsingKey:key];
|
||||||
else
|
|
||||||
return;
|
|
||||||
|
|
||||||
TimeToCrack timeToCrack;
|
TimeToCrack timeToCrack;
|
||||||
NSString *timeToCrackString = nil;
|
NSString *timeToCrackString = nil;
|
||||||
|
@ -101,7 +101,6 @@
|
|||||||
CFStringCreateWithCString( NULL, basename( (char *)__FILE__ ), kCFStringEncodingUTF8 ), __LINE__, \
|
CFStringCreateWithCString( NULL, basename( (char *)__FILE__ ), kCFStringEncodingUTF8 ), __LINE__, \
|
||||||
CFStringCreateWithCString( NULL, __FUNCTION__, kCFStringEncodingUTF8 ), 5, \
|
CFStringCreateWithCString( NULL, __FUNCTION__, kCFStringEncodingUTF8 ), 5, \
|
||||||
CFStringCreateWithCString( NULL, _msg, kCFStringEncodingUTF8 ) ); \
|
CFStringCreateWithCString( NULL, _msg, kCFStringEncodingUTF8 ) ); \
|
||||||
abort(); \
|
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user