From 69d471aefb040cb2c96ede4d1b3f7fc24e1abbbc Mon Sep 17 00:00:00 2001 From: Andy Matuschak Date: Tue, 3 Jul 2012 18:49:53 -0700 Subject: [PATCH] Allow the user to try reentering his password if authentication fails. --- SUDiskImageUnarchiver.m | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/SUDiskImageUnarchiver.m b/SUDiskImageUnarchiver.m index e0099066..c8425aef 100644 --- a/SUDiskImageUnarchiver.m +++ b/SUDiskImageUnarchiver.m @@ -97,8 +97,13 @@ 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;