Permalink
Browse files

Allow the user to try reentering his password if authentication fails.

  • Loading branch information...
1 parent d620dc0 commit 69d471aefb040cb2c96ede4d1b3f7fc24e1abbbc @andymatuschak andymatuschak committed Jul 4, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 SUDiskImageUnarchiver.m
View
@@ -97,8 +97,13 @@ - (void)extractDMGWithPassword:(NSString *)password
if (taskResult != 0)
{
NSString* resultStr = output ? [[[NSString alloc] initWithData: output encoding: NSUTF8StringEncoding] autorelease] : nil;
- SULog( @"hdiutil failed with code: %d data: <<%@>>", taskResult, resultStr );
- goto reportError;
+ if (password != nil && [resultStr rangeOfString:@"Authentication error"].location != NSNotFound && [delegate respondsToSelector:@selector(unarchiver:requiresPasswordReturnedViaInvocation:)]) {
+ [self performSelectorOnMainThread:@selector(requestPasswordFromDelegate) withObject:nil waitUntilDone:NO];
+ goto finally;
+ } else {
+ SULog( @"hdiutil failed with code: %d data: <<%@>>", taskResult, resultStr );
+ goto reportError;
+ }
}
mountedSuccessfully = YES;

0 comments on commit 69d471a

Please sign in to comment.