We support bundles, not applications, in the general sense

This commit is contained in:
Zorg committed 2016-04-10 19:41:58 -04:00
1 parent 1151d66337
commit 15c9ae65e7
4 files changed
+14 -14

No files matched your search

+2 -2
View File
@@ -215,7 +215,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
}
}
BOOL updateIsCodeSigned = [SUCodeSigningVerifier applicationAtPathIsCodeSigned:installSourcePath];
BOOL updateIsCodeSigned = [SUCodeSigningVerifier bundleAtPathIsCodeSigned:installSourcePath];
if (dsaKeysMatch) {
NSError *error = nil;
@@ -225,7 +225,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
}
} else {
NSString *hostBundlePath = host.bundlePath;
BOOL hostIsCodeSigned = [SUCodeSigningVerifier applicationAtPathIsCodeSigned:hostBundlePath];
BOOL hostIsCodeSigned = [SUCodeSigningVerifier bundleAtPathIsCodeSigned:hostBundlePath];
NSString *dsaStatus = newPublicDSAKey ? @"has a new DSA key that doesn't match the previous one" : (publicDSAKey ? @"removes the DSA key" : @"isn't signed with a DSA key");
if (!hostIsCodeSigned || !updateIsCodeSigned) {
+3 -3
View File
@@ -12,9 +12,9 @@
#import <Foundation/Foundation.h>
@interface SUCodeSigningVerifier : NSObject
+ (BOOL)codeSignatureAtPath:(NSString *)oldApplicationPath matchesSignatureAtPath:(NSString *)newApplicationPath error:(NSError **)error;
+ (BOOL)codeSignatureIsValidAtPath:(NSString *)applicationPath error:(NSError **)error;
+ (BOOL)applicationAtPathIsCodeSigned:(NSString *)applicationPath;
+ (BOOL)codeSignatureAtPath:(NSString *)oldBundlePath matchesSignatureAtPath:(NSString *)newBundlePath error:(NSError **)error;
+ (BOOL)codeSignatureIsValidAtPath:(NSString *)bundlePath error:(NSError **)error;
+ (BOOL)bundleAtPathIsCodeSigned:(NSString *)bundlePath;
@end
#endif
+8 -8
View File
@@ -17,7 +17,7 @@
@implementation SUCodeSigningVerifier
+ (BOOL)codeSignatureAtPath:(NSString *)oldApplicationPath matchesSignatureAtPath:(NSString *)newApplicationPath error:(NSError *__autoreleasing *)error
+ (BOOL)codeSignatureAtPath:(NSString *)oldBundlePath matchesSignatureAtPath:(NSString *)newBundlePath error:(NSError *__autoreleasing *)error
{
OSStatus result;
SecRequirementRef requirement = NULL;
@@ -30,7 +30,7 @@
*error = nil;
}
oldBundle = [NSBundle bundleWithPath:oldApplicationPath];
oldBundle = [NSBundle bundleWithPath:oldBundlePath];
if (!oldBundle) {
SULog(@"Failed to load NSBundle for original");
result = -1;
@@ -48,7 +48,7 @@
goto finally;
}
newBundle = [NSBundle bundleWithPath:newApplicationPath];
newBundle = [NSBundle bundleWithPath:newBundlePath];
if (!newBundle) {
SULog(@"Failed to load NSBundle for update");
result = -1;
@@ -94,7 +94,7 @@ finally:
return (result == noErr);
}
+ (BOOL)codeSignatureIsValidAtPath:(NSString *)applicationPath error:(NSError *__autoreleasing *)error
+ (BOOL)codeSignatureIsValidAtPath:(NSString *)bundlePath error:(NSError *__autoreleasing *)error
{
OSStatus result;
SecStaticCodeRef staticCode = NULL;
@@ -104,7 +104,7 @@ finally:
*error = nil;
}
newBundle = [NSBundle bundleWithPath:applicationPath];
newBundle = [NSBundle bundleWithPath:bundlePath];
if (!newBundle) {
SULog(@"Failed to load NSBundle");
result = -1;
@@ -129,7 +129,7 @@ finally:
if (result != noErr) {
if (result == errSecCSUnsigned) {
SULog(@"Error: The app is not signed using Apple Code Signing. %@", applicationPath);
SULog(@"Error: The app is not signed using Apple Code Signing. %@", bundlePath);
}
if (result == errSecCSReqFailed) {
[self logSigningInfoForCode:staticCode label:@"new info"];
@@ -161,13 +161,13 @@ static id valueOrNSNull(id value) {
}
}
+ (BOOL)applicationAtPathIsCodeSigned:(NSString *)applicationPath
+ (BOOL)bundleAtPathIsCodeSigned:(NSString *)bundlePath
{
OSStatus result;
SecStaticCodeRef staticCode = NULL;
NSBundle *newBundle;
newBundle = [NSBundle bundleWithPath:applicationPath];
newBundle = [NSBundle bundleWithPath:bundlePath];
if (!newBundle) {
SULog(@"Failed to load NSBundle");
return NO;
+1 -1
View File
@@ -106,7 +106,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
-(void)checkIfConfiguredProperly {
BOOL hasPublicDSAKey = [self.host publicDSAKey] != nil;
BOOL isMainBundle = [self.host.bundle isEqualTo:[NSBundle mainBundle]];
BOOL hostIsCodeSigned = [SUCodeSigningVerifier applicationAtPathIsCodeSigned:self.host.bundle.bundlePath];
BOOL hostIsCodeSigned = [SUCodeSigningVerifier bundleAtPathIsCodeSigned:self.host.bundle.bundlePath];
NSURL *feedURL = [self feedURL];
BOOL servingOverHttps = [[[feedURL scheme] lowercaseString] isEqualToString:@"https"];
if (!isMainBundle && !hasPublicDSAKey) {