mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-28 05:14:34 +00:00
We support bundles, not applications, in the general sense
This commit is contained in:
1 parent
1151d66337
commit
15c9ae65e7
4 files changed
+14
-14
No files matched your search
Vendored
+2
-2
@@ -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) {
|
||||
|
||||
Vendored
+3
-3
@@ -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
|
||||
Vendored
+8
-8
@@ -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;
|
||||
|
||||
Vendored
+1
-1
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user