mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-22 04:30:47 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
57101a1c5b | ||
|
|
382b04fe4a | ||
|
|
07c773ace2 | ||
|
|
a85a48c59a | ||
|
|
cf17fff3fc | ||
|
|
4cc1702093 | ||
|
|
86fdb0c2ac | ||
|
|
3e7c7fe249 | ||
|
|
ce21e1b7e7 | ||
|
|
e9fa7c3d4a | ||
|
|
ceee82c4b1 | ||
|
|
7c39af9c99 | ||
|
|
e086125cb8 | ||
|
|
5e6acc824e | ||
|
|
ae27726b3b | ||
|
|
83f6dd3052 | ||
|
|
fb9b4a4f35 | ||
|
|
6d7f95d912 | ||
|
|
46249cc49f | ||
|
|
51712d2322 | ||
|
|
24898ad60d | ||
|
|
cf9edce775 | ||
|
|
2387feeb7c | ||
|
|
363a41234d | ||
|
|
06573e4b81 | ||
|
|
e702246bb5 | ||
|
|
78c14cc574 | ||
|
|
976e83159f | ||
|
|
d7e532d268 | ||
|
|
33ef8ca2b4 | ||
|
|
e5e560e751 | ||
|
|
4e33285068 | ||
|
|
313f4a497d | ||
|
|
ddb67d1c84 | ||
|
|
99dedafc67 | ||
|
|
0b7e343a56 | ||
|
|
cd4da94cb9 | ||
|
|
882fecea6b | ||
|
|
efdf9d4421 | ||
|
|
33c2eb89c9 | ||
|
|
dc1cd3a259 | ||
|
|
11eaa3e092 | ||
|
|
4adb53dc51 | ||
|
|
d0cc3b63b4 | ||
|
|
2aefacb7f2 | ||
|
|
3f433561d4 | ||
|
|
7bb0c69f76 | ||
|
|
2c7ad5bc29 | ||
|
|
7ebb603ab7 | ||
|
|
7b9e1fb431 | ||
|
|
9f23c4f11e | ||
|
|
ce2a721a73 | ||
|
|
eebadf5230 | ||
|
|
61d43f860a | ||
|
|
4dd4548be4 | ||
|
|
9c3ef30f4c | ||
|
|
585194908e | ||
|
|
330c733958 | ||
|
|
4c782a67ed | ||
|
|
65bfa1ccf2 |
No files matched your search
+1
-1
@@ -1,2 +1,2 @@
|
||||
language: objective-c
|
||||
script: make travis
|
||||
script: make ci
|
||||
@@ -1,3 +1,21 @@
|
||||
# 1.11.0
|
||||
|
||||
* Big improvements to code signing and DSA verification
|
||||
- Sparkle now checks not only whether an update is correctly signed, but also whether the updated version will be able to verify future updates. Updates now must either use DSA keys correctly, or not try to use them at all. Same goes for Apple Code Signing.
|
||||
- Rely on code signing and the DSA key in the new app instead of appcast. If the new app has a public DSA key, then the appcast item must have a DSA signature for the app, even if the app is code signed. (Zorg)
|
||||
* More verbose error message when DSA keys don't match (Kornel Lesiński)
|
||||
* Added delegate methods for pre-download and immediately post-failed-download (Isaac Greenspan)
|
||||
* Fix Lucida Grande is always used for release notes (LIU Dongyuan / 柳东原)
|
||||
* Only remove quarantine with setResourceValue: when it's present. Fixes "Unable to quarantine: 93" messages from showing up in the console. (Zorg)
|
||||
* Fixed const and nullability warnings (Jake Petroules, Kornel Lesiński)
|
||||
* Replaced deprecated NSRunAlertPanel/alertWithMessageText (Kevin Wojniak)
|
||||
* Imported the Foundation umbrella header in all the public headers (C.W. Betts)
|
||||
* pt-BR localization update (Victor Figueiredo)
|
||||
* Reject unsupported code-signing xattrs in binary delta (Zorg)
|
||||
* Fixed crash while applying delta update (antonc27)
|
||||
* Added logging of appcast/download URL on error (Kornel Lesiński)
|
||||
* More robust reading of Autoupdate.app path from Sparkle bundle
|
||||
|
||||
# 1.10.0
|
||||
|
||||
* Massive improvements to the BinaryDelta tool (Zorg)
|
||||
|
||||
@@ -15,12 +15,13 @@ SPARKLE_AUTOMATED_DOWNGRADES = 0
|
||||
SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME = 0
|
||||
|
||||
SPARKLE_VERSION_MAJOR = 1
|
||||
SPARKLE_VERSION_MINOR = 10
|
||||
SPARKLE_VERSION_MINOR = 11
|
||||
SPARKLE_VERSION_PATCH = 0
|
||||
SPARKLE_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)
|
||||
|
||||
CURRENT_PROJECT_VERSION = $(SPARKLE_VERSION)
|
||||
ALWAYS_SEARCH_USER_PATHS = NO
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES
|
||||
GCC_PREFIX_HEADER = Sparkle/Sparkle.pch
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = YES
|
||||
@@ -30,7 +31,8 @@ MACOSX_DEPLOYMENT_TARGET = 10.7
|
||||
PRODUCT_NAME = ${TARGET_NAME}
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.Sparkle.${PRODUCT_NAME:rfc1034identifier}
|
||||
|
||||
GCC_PREPROCESSOR_DEFINITIONS = SPARKLE_BUNDLE_IDENTIFIER=\"$(SPARKLE_BUNDLE_IDENTIFIER)\" SPARKLE_RELAUNCH_TOOL_NAME=\"$(SPARKLE_RELAUNCH_TOOL_NAME)\"
|
||||
GCC_PREPROCESSOR_DEFINITIONS = SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME=$(SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) SPARKLE_AUTOMATED_DOWNGRADES=$(SPARKLE_AUTOMATED_DOWNGRADES) SPARKLE_APPEND_VERSION_NUMBER=$(SPARKLE_APPEND_VERSION_NUMBER) SPARKLE_BUNDLE_IDENTIFIER=\"$(SPARKLE_BUNDLE_IDENTIFIER)\" SPARKLE_RELAUNCH_TOOL_NAME=\"$(SPARKLE_RELAUNCH_TOOL_NAME)\"
|
||||
|
||||
CLANG_ENABLE_OBJC_ARC = YES
|
||||
|
||||
// Enable warnings
|
||||
@@ -39,6 +41,7 @@ CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES
|
||||
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES
|
||||
CLANG_ENABLE_MODULES = YES
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
|
||||
CLANG_WARN_ASSIGN_ENUM = YES
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES
|
||||
CLANG_WARN_EMPTY_BODY = YES
|
||||
@@ -50,6 +53,9 @@ CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES
|
||||
CLANG_WARN_OBJC_RECEIVER_WEAK = YES
|
||||
CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
|
||||
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES
|
||||
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES
|
||||
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES
|
||||
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES
|
||||
GCC_WARN_ABOUT_MISSING_NEWLINE = YES
|
||||
@@ -76,4 +82,4 @@ GCC_WARN_UNUSED_VARIABLE = YES
|
||||
WARNING_CFLAGS_EXTRA = -Wno-custom-atomic-properties -Wno-implicit-atomic-properties
|
||||
|
||||
// Turn on all warnings, then disable a few which are almost impossible to avoid
|
||||
WARNING_CFLAGS = -Wall -Weverything -Wno-empty-translation-unit -Wno-unused-macros -Wno-gnu-statement-expression -Wno-receiver-is-weak -Wno-arc-repeated-use-of-weak -Wno-auto-import -Wno-cstring-format-directive $(WARNING_CFLAGS_EXTRA)
|
||||
WARNING_CFLAGS = -Wall -Weverything -Wno-unused-macros -Wno-gnu-statement-expression -Wno-receiver-is-weak -Wno-arc-repeated-use-of-weak -Wno-auto-import $(WARNING_CFLAGS_EXTRA)
|
||||
@@ -1,6 +1,8 @@
|
||||
.PHONY: all localizable-strings release build test travis
|
||||
.PHONY: all localizable-strings release build test ci
|
||||
|
||||
BUILDDIR := $(shell mktemp -d "$(TMPDIR)/Sparkle.XXXXXX")
|
||||
ifndef BUILDDIR
|
||||
BUILDDIR := $(shell mktemp -d "$(TMPDIR)/Sparkle.XXXXXX")
|
||||
endif
|
||||
|
||||
localizable-strings:
|
||||
rm -f Sparkle/en.lproj/Sparkle.strings
|
||||
@@ -18,4 +20,9 @@ build:
|
||||
test:
|
||||
xcodebuild -scheme Distribution -configuration Debug test
|
||||
|
||||
travis: test
|
||||
ci:
|
||||
for i in {7..11} ; do \
|
||||
if xcrun --sdk "macosx10.$$i" --show-sdk-path 2> /dev/null ; then \
|
||||
xcodebuild -sdk "macosx10.$$i" -scheme Distribution -configuration Debug test ; \
|
||||
fi ; \
|
||||
done
|
||||
+4
-3
@@ -1,4 +1,4 @@
|
||||
# Sparkle [](https://travis-ci.org/sparkle-project/Sparkle)
|
||||
# Sparkle [](https://travis-ci.org/sparkle-project/Sparkle) <a href='https://app.ship.io/dashboard#/jobs/8814/history' target='_blank'><img src='https://app.ship.io/jobs/V3PoCLcN5ft5Pnq0/build_status.png' height='20' /></a>
|
||||
|
||||
An easy-to-use software update framework for Cocoa developers.
|
||||
|
||||
@@ -6,20 +6,21 @@ An easy-to-use software update framework for Cocoa developers.
|
||||
|
||||
## Changes since 1.5b
|
||||
|
||||
* Up-to-date with 10.10 SDK and Xcode 6. Supports OS X 10.7+.
|
||||
* Up-to-date with 10.11 SDK and Xcode 7. Supports OS X 10.7+.
|
||||
* Cleaned up and modernized code, using ARC and Autolayout.
|
||||
* Merged bugfixes, security fixes and some features from multiple Sparkle forks.
|
||||
* Truly automatic background updates (no UI at all) when user agreed to "Automatically download and install updates in the future."
|
||||
* Ability to mark updates as critical.
|
||||
* Progress and status notifications for the host app.
|
||||
* Name of finish_installation.app can be configured to match your app's name.
|
||||
* Upgraded and more reliable binary delta and code signing verification.
|
||||
|
||||
## Features
|
||||
|
||||
* True self-updating—the user can choose to automatically download and install all updates.
|
||||
* Displays a detailed progress window to the user.
|
||||
* Supports authentication for installing in secure locations.
|
||||
* Supports Apple code signing and DSA signatures for ultra-secure updates.
|
||||
* Supports Apple Code Signing and DSA signatures for ultra-secure updates.
|
||||
* Easy to install. Sparkle requires no code in your app, so it's trivial to upgrade or remove the framework.
|
||||
* Uses appcasts for release information. Appcasts are supported by 3rd party update-tracking programs and websites.
|
||||
* Displays release notes to the user via WebKit.
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "Sparkle"
|
||||
s.version = "1.10.0"
|
||||
s.version = "1.11.0"
|
||||
s.summary = "A software update framework for OS X"
|
||||
s.description = "Sparkle is an easy-to-use software update framework for Cocoa developers."
|
||||
s.homepage = "http://sparkle-project.org"
|
||||
|
||||
Vendored
+4
-1
@@ -167,7 +167,10 @@ static const NSTimeInterval SUParentQuitCheckInterval = .25;
|
||||
completionHandler:^(NSError *error) {
|
||||
if (error) {
|
||||
if (self.shouldShowUI) {
|
||||
NSRunAlertPanel(@"", @"%@", @"OK", @"", @"", [error localizedDescription]);
|
||||
NSAlert *alert = [[NSAlert alloc] init];
|
||||
alert.messageText = @"";
|
||||
alert.informativeText = [NSString stringWithFormat:@"%@", [error localizedDescription]];
|
||||
[alert runModal];
|
||||
}
|
||||
exit(EXIT_FAILURE);
|
||||
} else {
|
||||
|
||||
Vendored
+14
-5
@@ -26,7 +26,11 @@
|
||||
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
|
||||
|
||||
for (NSXMLNode *attribute in attributeEnum) {
|
||||
dictionary[[attribute name]] = [attribute stringValue];
|
||||
NSString *attrName = [attribute name];
|
||||
if (!attrName) {
|
||||
continue;
|
||||
}
|
||||
dictionary[attrName] = [attribute stringValue];
|
||||
}
|
||||
return dictionary;
|
||||
}
|
||||
@@ -166,9 +170,12 @@
|
||||
else if ([name isEqualToString:SURSSElementPubDate])
|
||||
{
|
||||
// pubDate is expected to be an NSDate by SUAppcastItem, but the RSS class was returning an NSString
|
||||
NSDate *date = [NSDate dateWithNaturalLanguageString:[node stringValue]];
|
||||
if (date)
|
||||
dict[name] = date;
|
||||
NSString *string = node.stringValue;
|
||||
if (string) {
|
||||
NSDate *date = [NSDate dateWithNaturalLanguageString:string];
|
||||
if (date)
|
||||
dict[name] = date;
|
||||
}
|
||||
}
|
||||
else if ([name isEqualToString:SUAppcastElementDeltas])
|
||||
{
|
||||
@@ -184,7 +191,9 @@
|
||||
NSMutableArray *tags = [NSMutableArray array];
|
||||
NSEnumerator *childEnum = [[node children] objectEnumerator];
|
||||
for (NSXMLNode *child in childEnum) {
|
||||
[tags addObject:[child name]];
|
||||
NSString *childName = child.name;
|
||||
if (childName)
|
||||
[tags addObject:childName];
|
||||
}
|
||||
dict[name] = tags;
|
||||
}
|
||||
|
||||
Vendored
+7
-3
@@ -152,8 +152,9 @@
|
||||
}
|
||||
|
||||
// Find the appropriate release notes URL.
|
||||
if (dict[SUAppcastElementReleaseNotesLink]) {
|
||||
self.releaseNotesURL = [NSURL URLWithString:dict[SUAppcastElementReleaseNotesLink]];
|
||||
NSString *releaseNotesString = dict[SUAppcastElementReleaseNotesLink];
|
||||
if (releaseNotesString) {
|
||||
self.releaseNotesURL = [NSURL URLWithString:releaseNotesString];
|
||||
} else if ([self.itemDescription hasPrefix:@"http://"] || [self.itemDescription hasPrefix:@"https://"]) { // if the description starts with http:// or https:// use that.
|
||||
self.releaseNotesURL = [NSURL URLWithString:self.itemDescription];
|
||||
} else {
|
||||
@@ -164,12 +165,15 @@
|
||||
if (deltaDictionaries) {
|
||||
NSMutableDictionary *deltas = [NSMutableDictionary dictionary];
|
||||
for (NSDictionary *deltaDictionary in deltaDictionaries) {
|
||||
NSString *deltaFrom = deltaDictionary[SUAppcastAttributeDeltaFrom];
|
||||
if (!deltaFrom) continue;
|
||||
|
||||
NSMutableDictionary *fakeAppCastDict = [dict mutableCopy];
|
||||
[fakeAppCastDict removeObjectForKey:SUAppcastElementDeltas];
|
||||
fakeAppCastDict[SURSSElementEnclosure] = deltaDictionary;
|
||||
SUAppcastItem *deltaItem = [[SUAppcastItem alloc] initWithDictionary:fakeAppCastDict];
|
||||
|
||||
deltas[deltaDictionary[SUAppcastAttributeDeltaFrom]] = deltaItem;
|
||||
deltas[deltaFrom] = deltaItem;
|
||||
}
|
||||
self.deltaUpdates = deltas;
|
||||
}
|
||||
|
||||
Vendored
+3
-3
@@ -34,7 +34,7 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@, %@>", [self class], [self.host bundlePath], [self.host installationPath]]; }
|
||||
- (NSString *__nonnull)description { return [NSString stringWithFormat:@"%@ <%@, %@>", [self class], [self.host bundlePath], [self.host installationPath]]; }
|
||||
|
||||
- (IBAction)installNow:(id)__unused sender
|
||||
{
|
||||
@@ -57,12 +57,12 @@
|
||||
self.completionBlock = nil;
|
||||
}
|
||||
|
||||
- (NSImage *)applicationIcon
|
||||
- (NSImage *__nonnull)applicationIcon
|
||||
{
|
||||
return [self.host icon];
|
||||
}
|
||||
|
||||
- (NSString *)titleText
|
||||
- (NSString *__nonnull)titleText
|
||||
{
|
||||
if ([self.updateItem isCriticalUpdate])
|
||||
{
|
||||
|
||||
Vendored
+46
-16
@@ -191,6 +191,11 @@
|
||||
{
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[self.updateItem fileURL]];
|
||||
[request setValue:[self.updater userAgentString] forHTTPHeaderField:@"User-Agent"];
|
||||
if ([[self.updater delegate] respondsToSelector:@selector(updater:willDownloadUpdate:withRequest:)]) {
|
||||
[[self.updater delegate] updater:self.updater
|
||||
willDownloadUpdate:self.updateItem
|
||||
withRequest:request];
|
||||
}
|
||||
self.download = [[NSURLDownload alloc] initWithRequest:request delegate:self];
|
||||
}
|
||||
|
||||
@@ -219,6 +224,16 @@
|
||||
[self.download setDestination:self.downloadPath allowOverwrite:YES];
|
||||
}
|
||||
|
||||
/**
|
||||
* If the update is a package, then it must be signed using DSA. No other verification is done.
|
||||
*
|
||||
* If the update is a bundle, then it must meet any one of:
|
||||
*
|
||||
* * old and new DSA public keys are the same and valid (it allows change of Code Signing identity), or
|
||||
*
|
||||
* * old and new Code Signing identity are the same and valid
|
||||
*
|
||||
*/
|
||||
- (BOOL)validateUpdateDownloadedToPath:(NSString *)downloadedPath extractedToPath:(NSString *)extractedPath DSASignature:(NSString *)DSASignature publicDSAKey:(NSString *)publicDSAKey
|
||||
{
|
||||
BOOL isPackage = NO;
|
||||
@@ -233,7 +248,7 @@
|
||||
BOOL packageValidated = [SUDSAVerifier validatePath:downloadedPath withEncodedDSASignature:DSASignature withPublicDSAKey:publicDSAKey];
|
||||
|
||||
if (!packageValidated) {
|
||||
SULog(@"DSA signature validation failed. The update will be rejected.");
|
||||
SULog(@"DSA signature validation of the package failed. The update will be rejected.");
|
||||
}
|
||||
|
||||
return packageValidated;
|
||||
@@ -248,33 +263,41 @@
|
||||
SUHost *newHost = [[SUHost alloc] initWithBundle:newBundle];
|
||||
NSString *newPublicDSAKey = newHost.publicDSAKey;
|
||||
|
||||
BOOL dsaKeysMatch = (publicDSAKey == nil || newPublicDSAKey == nil) ? NO : [publicDSAKey isEqualToString:newPublicDSAKey];
|
||||
|
||||
if (newPublicDSAKey != nil) {
|
||||
if (![SUDSAVerifier validatePath:downloadedPath withEncodedDSASignature:DSASignature withPublicDSAKey:newPublicDSAKey]) {
|
||||
SULog(@"DSA signature validation failed. The update will be rejected.");
|
||||
SULog(@"DSA signature validation failed. The update has a public DSA key and is signed with a DSA key, but the %@ doesn't match the signature. The update will be rejected.",
|
||||
dsaKeysMatch ? @"public key" : @"new public key shipped with the update");
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL dsaKeysMatch = (publicDSAKey == nil || newPublicDSAKey == nil) ? NO : [publicDSAKey isEqualToString:newPublicDSAKey];
|
||||
BOOL updateIsCodeSigned = [SUCodeSigningVerifier applicationAtPathIsCodeSigned:installSourcePath];
|
||||
|
||||
if (dsaKeysMatch) {
|
||||
NSError *error = nil;
|
||||
if ([SUCodeSigningVerifier applicationAtPathIsCodeSigned:installSourcePath] && ![SUCodeSigningVerifier codeSignatureIsValidAtPath:installSourcePath error:&error]) {
|
||||
SULog(@"The application to update has an invalid code signature: %@. The update will be rejected.", error);
|
||||
if (updateIsCodeSigned && ![SUCodeSigningVerifier codeSignatureIsValidAtPath:installSourcePath error:&error]) {
|
||||
SULog(@"The update archive has a valid DSA signature, but the app is also signed with Code Signing, which is corrupted: %@. The update will be rejected.", error);
|
||||
return NO;
|
||||
}
|
||||
} else {
|
||||
if (![SUCodeSigningVerifier hostApplicationIsCodeSigned] || ![SUCodeSigningVerifier applicationAtPathIsCodeSigned:installSourcePath]) {
|
||||
SULog(@"Public DSA keys differ or are absent, and both apps are not code signed. The update will be rejected.");
|
||||
BOOL hostIsCodeSigned = [SUCodeSigningVerifier hostApplicationIsCodeSigned];
|
||||
|
||||
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) {
|
||||
NSString *acsStatus = !hostIsCodeSigned ? @"old app hasn't been signed with app Code Signing" : @"new app isn't signed with app Code Signing";
|
||||
SULog(@"The update archive %@, and the %@. At least one method of signature verification must be valid. The update will be rejected.", dsaStatus, acsStatus);
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
NSError *error = nil;
|
||||
if (![SUCodeSigningVerifier codeSignatureMatchesHostAndIsValidAtPath:installSourcePath error:&error]) {
|
||||
SULog(@"The update will be rejected because the code signature from the original and updated application failed to match: %@", error);
|
||||
SULog(@"The update archive %@, and the app is signed with a new Code Signing identity that doesn't match code signing of the original app: %@. At least one method of signature verification must be valid. The update will be rejected.", dsaStatus, error);
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@@ -291,6 +314,12 @@
|
||||
if (!failingUrl) {
|
||||
failingUrl = [self.updateItem fileURL];
|
||||
}
|
||||
|
||||
if ([[self.updater delegate] respondsToSelector:@selector(updater:failedToDownloadUpdate:error:)]) {
|
||||
[[self.updater delegate] updater:self.updater
|
||||
failedToDownloadUpdate:self.updateItem
|
||||
error:error];
|
||||
}
|
||||
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURelaunchError userInfo:@{
|
||||
NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred while downloading the update. Please try again later.", nil),
|
||||
@@ -390,18 +419,19 @@
|
||||
[updaterDelegate updater:self.updater willInstallUpdate:self.updateItem];
|
||||
}
|
||||
|
||||
NSBundle *sparkleBundle = [NSBundle bundleWithIdentifier:SUBundleIdentifier];
|
||||
NSBundle *sparkleBundle = self.updater.sparkleBundle;
|
||||
|
||||
// Copy the relauncher into a temporary directory so we can get to it after the new version's installed.
|
||||
// Only the paranoid survive: if there's already a stray copy of relaunch there, we would have problems.
|
||||
NSString *const relaunchPathToCopy = [sparkleBundle pathForResource:[[sparkleBundle infoDictionary] objectForKey:SURelaunchToolNameKey] ofType:@"app"];
|
||||
NSString *const relaunchToolName = @"" SPARKLE_RELAUNCH_TOOL_NAME;
|
||||
NSString *const relaunchPathToCopy = [sparkleBundle pathForResource:relaunchToolName ofType:@"app"];
|
||||
if (relaunchPathToCopy != nil) {
|
||||
NSString *targetPath = [self.host.appCachePath stringByAppendingPathComponent:[relaunchPathToCopy lastPathComponent]];
|
||||
// Only the paranoid survive: if there's already a stray copy of relaunch there, we would have problems.
|
||||
NSError *error = nil;
|
||||
[[NSFileManager defaultManager] createDirectoryAtPath:[targetPath stringByDeletingLastPathComponent] withIntermediateDirectories:YES attributes:@{} error:&error];
|
||||
|
||||
if ([SUPlainInstaller copyPathWithAuthentication:relaunchPathToCopy overPath:targetPath temporaryName:nil error:&error]) {
|
||||
|
||||
if ([SUPlainInstaller copyPathWithAuthentication:relaunchPathToCopy overPath:targetPath temporaryName:nil appendVersion:SPARKLE_APPEND_VERSION_NUMBER error:&error]) {
|
||||
self.relaunchPath = targetPath;
|
||||
} else {
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURelaunchError userInfo:@{
|
||||
@@ -415,7 +445,8 @@
|
||||
if ([updaterDelegate respondsToSelector:@selector(updaterWillRelaunchApplication:)])
|
||||
[updaterDelegate updaterWillRelaunchApplication:self.updater];
|
||||
|
||||
if (!self.relaunchPath || ![[NSFileManager defaultManager] fileExistsAtPath:self.relaunchPath]) {
|
||||
NSString *relaunchToolPath = [[NSBundle bundleWithPath:self.relaunchPath] executablePath];
|
||||
if (!relaunchToolPath || ![[NSFileManager defaultManager] fileExistsAtPath:self.relaunchPath]) {
|
||||
// Note that we explicitly use the host app's name here, since updating plugin for Mail relaunches Mail, not just the plugin.
|
||||
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURelaunchError userInfo:@{
|
||||
NSLocalizedDescriptionKey: [NSString stringWithFormat:SULocalizedString(@"An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@.", nil), [self.host name]],
|
||||
@@ -429,7 +460,6 @@
|
||||
if ([updaterDelegate respondsToSelector:@selector(pathToRelaunchForUpdater:)]) {
|
||||
pathToRelaunch = [updaterDelegate pathToRelaunchForUpdater:self.updater];
|
||||
}
|
||||
NSString *relaunchToolPath = [[NSBundle bundleWithPath:self.relaunchPath] executablePath];
|
||||
[NSTask launchedTaskWithLaunchPath:relaunchToolPath arguments:@[[self.host bundlePath],
|
||||
pathToRelaunch,
|
||||
[NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]],
|
||||
|
||||
Vendored
+1
-1
@@ -20,7 +20,7 @@ static BOOL applyBinaryDeltaToFile(xar_t x, xar_file_t file, NSString *sourceFil
|
||||
NSString *patchFile = temporaryFilename(@"apply-binary-delta");
|
||||
xar_extract_tofile(x, file, [patchFile fileSystemRepresentation]);
|
||||
const char *argv[] = {"/usr/bin/bspatch", [sourceFilePath fileSystemRepresentation], [destinationFilePath fileSystemRepresentation], [patchFile fileSystemRepresentation]};
|
||||
BOOL success = (bspatch(4, (char **)argv) == 0);
|
||||
BOOL success = (bspatch(4, argv) == 0);
|
||||
unlink([patchFile fileSystemRepresentation]);
|
||||
return success;
|
||||
}
|
||||
|
||||
Vendored
+6
-2
@@ -18,6 +18,10 @@
|
||||
#define IS_VALID_PERMISSIONS(mode) \
|
||||
(((mode & PERMISSION_FLAGS) == 0755) || ((mode & PERMISSION_FLAGS) == 0644))
|
||||
|
||||
#define APPLE_CODE_SIGN_XATTR_CODE_DIRECTORY_KEY "com.apple.cs.CodeDirectory"
|
||||
#define APPLE_CODE_SIGN_XATTR_CODE_REQUIREMENTS_KEY "com.apple.cs.CodeRequirements"
|
||||
#define APPLE_CODE_SIGN_XATTR_CODE_SIGNATURE_KEY "com.apple.cs.CodeSignature"
|
||||
|
||||
#define BINARY_DELTA_ATTRIBUTES_KEY "binary-delta-attributes"
|
||||
#define MAJOR_DIFF_VERSION_KEY "major-version"
|
||||
#define MINOR_DIFF_VERSION_KEY "minor-version"
|
||||
@@ -57,11 +61,11 @@ typedef NS_ENUM(uint16_t, SUBinaryDeltaMajorVersion)
|
||||
typedef NS_ENUM(uint16_t, SUBinaryDeltaMinorVersion)
|
||||
{
|
||||
SUAzureMinorVersion = 1,
|
||||
SUBeigeMinorVersion = 0,
|
||||
SUBeigeMinorVersion = 1,
|
||||
};
|
||||
|
||||
#define FIRST_DELTA_DIFF_MAJOR_VERSION SUAzureMajorVersion
|
||||
#define FIRST_DELTA_DIFF_MINOR_VERSION 0
|
||||
#define FIRST_DELTA_DIFF_MINOR_VERSION ((SUBinaryDeltaMinorVersion)0)
|
||||
|
||||
#define LATEST_DELTA_DIFF_MAJOR_VERSION SUBeigeMajorVersion
|
||||
|
||||
|
||||
Vendored
+6
-3
@@ -43,7 +43,7 @@ SUBinaryDeltaMinorVersion latestMinorVersionForMajorVersion(SUBinaryDeltaMajorVe
|
||||
case SUBeigeMajorVersion:
|
||||
return SUBeigeMinorVersion;
|
||||
}
|
||||
return 0;
|
||||
return (SUBinaryDeltaMinorVersion)0;
|
||||
}
|
||||
|
||||
NSString *temporaryFilename(NSString *base)
|
||||
@@ -144,8 +144,11 @@ NSData *hashOfFileContents(FTSENT *ent)
|
||||
|
||||
NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion)
|
||||
{
|
||||
const char *sourcePaths[] = {[path fileSystemRepresentation], 0};
|
||||
FTS *fts = fts_open((char* const*)sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles);
|
||||
char pathBuffer[PATH_MAX] = {0};
|
||||
[path getFileSystemRepresentation:pathBuffer maxLength:sizeof(pathBuffer)];
|
||||
|
||||
char * const sourcePaths[] = {pathBuffer, 0};
|
||||
FTS *fts = fts_open(sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles);
|
||||
if (!fts) {
|
||||
perror("fts_open");
|
||||
return nil;
|
||||
|
||||
Vendored
+57
-4
@@ -18,6 +18,7 @@
|
||||
#include <sys/param.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/xattr.h>
|
||||
#include <xar/xar.h>
|
||||
|
||||
extern int bsdiff(int argc, const char **argv);
|
||||
@@ -101,6 +102,39 @@ static bool aclExists(const FTSENT *ent)
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool codeSignatureExtendedAttributeExists(const FTSENT *ent)
|
||||
{
|
||||
const int options = XATTR_NOFOLLOW;
|
||||
ssize_t listSize = listxattr(ent->fts_path, NULL, 0, options);
|
||||
if (listSize == -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
char *buffer = malloc((size_t)listSize);
|
||||
assert(buffer != NULL);
|
||||
|
||||
ssize_t sizeBack = listxattr(ent->fts_path, buffer, (size_t)listSize, options);
|
||||
assert(sizeBack == listSize);
|
||||
|
||||
size_t startCharacterIndex = 0;
|
||||
for (size_t characterIndex = 0; characterIndex < (size_t)listSize; characterIndex++) {
|
||||
if (buffer[characterIndex] == '\0') {
|
||||
char *attribute = &buffer[startCharacterIndex];
|
||||
size_t length = characterIndex - startCharacterIndex;
|
||||
if (strncmp(APPLE_CODE_SIGN_XATTR_CODE_DIRECTORY_KEY, attribute, length) == 0 ||
|
||||
strncmp(APPLE_CODE_SIGN_XATTR_CODE_REQUIREMENTS_KEY, attribute, length) == 0 ||
|
||||
strncmp(APPLE_CODE_SIGN_XATTR_CODE_SIGNATURE_KEY, attribute, length) == 0) {
|
||||
free(buffer);
|
||||
return true;
|
||||
}
|
||||
startCharacterIndex = characterIndex + 1;
|
||||
}
|
||||
}
|
||||
|
||||
free(buffer);
|
||||
return false;
|
||||
}
|
||||
|
||||
static NSString *absolutePath(NSString *path)
|
||||
{
|
||||
NSURL *url = [[NSURL alloc] initFileURLWithPath:path];
|
||||
@@ -203,8 +237,11 @@ int createBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
||||
|
||||
NSMutableDictionary *originalTreeState = [NSMutableDictionary dictionary];
|
||||
|
||||
const char *sourcePaths[] = {[source fileSystemRepresentation], 0};
|
||||
FTS *fts = fts_open((char* const*)sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles);
|
||||
char pathBuffer[PATH_MAX] = {0};
|
||||
[source getFileSystemRepresentation:pathBuffer maxLength:sizeof(pathBuffer)];
|
||||
|
||||
char *sourcePaths[] = {pathBuffer, 0};
|
||||
FTS *fts = fts_open(sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles);
|
||||
if (!fts) {
|
||||
perror("fts_open");
|
||||
return 1;
|
||||
@@ -237,6 +274,11 @@ int createBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
||||
fprintf(stderr, "\nDiffing ACLs are not supported. Detected ACL in before-tree on file %s\n", ent->fts_path);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (codeSignatureExtendedAttributeExists(ent)) {
|
||||
fprintf(stderr, "\nDiffing code signed extended attributes are not supported. Detected extended attribute in before-tree on file %s\n", ent->fts_path);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
fts_close(fts);
|
||||
|
||||
@@ -256,9 +298,12 @@ int createBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\nProcessing %s...", [destination fileSystemRepresentation]);
|
||||
}
|
||||
|
||||
pathBuffer[0] = 0;
|
||||
[destination getFileSystemRepresentation:pathBuffer maxLength:sizeof(pathBuffer)];
|
||||
|
||||
sourcePaths[0] = [destination fileSystemRepresentation];
|
||||
fts = fts_open((char* const*)sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles);
|
||||
sourcePaths[0] = pathBuffer;
|
||||
fts = fts_open(sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles);
|
||||
if (!fts) {
|
||||
perror("fts_open");
|
||||
return 1;
|
||||
@@ -284,6 +329,9 @@ int createBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
||||
// We should validate permissions and ACLs even if we don't store the info in the diff in the case of ACLs,
|
||||
// or in the case of permissions if the patch version is 1
|
||||
|
||||
// We should also not allow files with code signed extended attributes since Apple doesn't recommend inserting these
|
||||
// inside an application, and since we don't preserve extended attribitutes anyway
|
||||
|
||||
mode_t permissions = [info[INFO_PERMISSIONS_KEY] unsignedShortValue];
|
||||
if (!IS_VALID_PERMISSIONS(permissions)) {
|
||||
fprintf(stderr, "\nInvalid file permissions after-tree on file %s\nOnly permissions with modes 0755 and 0644 are supported\n", ent->fts_path);
|
||||
@@ -295,6 +343,11 @@ int createBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (codeSignatureExtendedAttributeExists(ent)) {
|
||||
fprintf(stderr, "\nDiffing code signed extended attributes are not supported. Detected extended attribute in after-tree on file %s\n", ent->fts_path);
|
||||
return 1;
|
||||
}
|
||||
|
||||
NSDictionary *oldInfo = originalTreeState[key];
|
||||
|
||||
if ([info isEqual:oldInfo]) {
|
||||
|
||||
Vendored
+4
-5
@@ -51,11 +51,10 @@ extern NSString *const SUPromptUserOnFirstLaunchKey;
|
||||
extern NSString *const SUKeepDownloadOnFailedInstallKey;
|
||||
extern NSString *const SUDefaultsDomainKey;
|
||||
extern NSString *const SUFixedHTMLDisplaySizeKey __attribute__((deprecated("This key is obsolete and has no effect.")));
|
||||
|
||||
extern NSString *const SUAppendVersionNumberKey;
|
||||
extern NSString *const SUEnableAutomatedDowngradesKey;
|
||||
extern NSString *const SUNormalizeInstalledApplicationNameKey;
|
||||
extern NSString *const SURelaunchToolNameKey;
|
||||
extern NSString *const SUAppendVersionNumberKey __attribute__((deprecated("This key is obsolete. See SPARKLE_APPEND_VERSION_NUMBER.")));
|
||||
extern NSString *const SUEnableAutomatedDowngradesKey __attribute__((deprecated("This key is obsolete. See SPARKLE_AUTOMATED_DOWNGRADES.")));
|
||||
extern NSString *const SUNormalizeInstalledApplicationNameKey __attribute__((deprecated("This key is obsolete. SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME.")));
|
||||
extern NSString *const SURelaunchToolNameKey __attribute__((deprecated("This key is obsolete. SPARKLE_RELAUNCH_TOOL_NAME.")));
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Appcast keys::
|
||||
|
||||
Vendored
+16
-12
@@ -11,7 +11,7 @@
|
||||
|
||||
#import "SUGuidedPackageInstaller.h"
|
||||
|
||||
static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authorization, const char* executablePath, AuthorizationFlags options, const char* const* arguments)
|
||||
static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authorization, const char* executablePath, AuthorizationFlags options, char* const* arguments)
|
||||
{
|
||||
sig_t oldSigChildHandler = signal(SIGCHLD, SIG_DFL);
|
||||
BOOL returnValue = YES;
|
||||
@@ -19,7 +19,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
/* AuthorizationExecuteWithPrivileges used to support 10.4+; should be replaced with XPC or external process */
|
||||
if (AuthorizationExecuteWithPrivileges(authorization, executablePath, options, (char* const*)arguments, NULL) == errAuthorizationSuccess)
|
||||
if (AuthorizationExecuteWithPrivileges(authorization, executablePath, options, arguments, NULL) == errAuthorizationSuccess)
|
||||
#pragma clang diagnostic pop
|
||||
{
|
||||
int status = 0;
|
||||
@@ -38,7 +38,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
|
||||
+ (AuthorizationRef)authorizationForExecutable:(NSString*)executablePath
|
||||
{
|
||||
NSParameterAssert(executablePath);
|
||||
SUParameterAssert(executablePath);
|
||||
|
||||
// Get authorization using advice in Apple's Technical Q&A1172
|
||||
|
||||
@@ -52,14 +52,15 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
if ((validAuth == errAuthorizationSuccess) &&
|
||||
(auth != NULL))
|
||||
{
|
||||
const char* executableFileSystemRepresentation = [executablePath fileSystemRepresentation];
|
||||
char executableFileSystemRepresentation[PATH_MAX];
|
||||
[executablePath getFileSystemRepresentation:executableFileSystemRepresentation maxLength:sizeof(executableFileSystemRepresentation)];
|
||||
|
||||
// Prepare a right allowing script to execute with privileges
|
||||
AuthorizationItem right;
|
||||
memset(&right,0,sizeof(right));
|
||||
right.name = kAuthorizationRightExecute;
|
||||
right.value = (void*) executableFileSystemRepresentation;
|
||||
right.valueLength = strlen(executableFileSystemRepresentation);
|
||||
AuthorizationItem right = {
|
||||
.name = kAuthorizationRightExecute,
|
||||
.value = executableFileSystemRepresentation,
|
||||
.valueLength = strlen(executableFileSystemRepresentation),
|
||||
};
|
||||
|
||||
// Package up the single right
|
||||
AuthorizationRights rights;
|
||||
@@ -93,7 +94,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
|
||||
+ (void)performInstallationToPath:(NSString *)destinationPath fromPath:(NSString *)packagePath host:(SUHost *)__unused host versionComparator:(id<SUVersionComparison>)__unused comparator completionHandler:(void (^)(NSError *))completionHandler
|
||||
{
|
||||
NSParameterAssert(packagePath);
|
||||
SUParameterAssert(packagePath);
|
||||
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
|
||||
@@ -106,10 +107,13 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
AuthorizationRef auth = [self authorizationForExecutable:installerPath];
|
||||
if (auth != NULL)
|
||||
{
|
||||
char pathBuffer[PATH_MAX] = {0};
|
||||
[packagePath getFileSystemRepresentation:pathBuffer maxLength:sizeof(pathBuffer)];
|
||||
|
||||
// Permission was granted to execute the installer with privileges
|
||||
const char* const arguments[] = {
|
||||
char * const arguments[] = {
|
||||
"-pkg",
|
||||
[packagePath fileSystemRepresentation],
|
||||
pathBuffer,
|
||||
"-target",
|
||||
"/",
|
||||
NULL
|
||||
|
||||
Vendored
+21
-12
@@ -41,7 +41,7 @@ typedef struct {
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
if (aBundle == nil) aBundle = [NSBundle mainBundle];
|
||||
SUParameterAssert(aBundle);
|
||||
self.bundle = aBundle;
|
||||
if (![self.bundle bundleIdentifier]) {
|
||||
SULog(@"Error: the bundle being updated at %@ has no %@! This will cause preference read/write to not work properly.", self.bundle, kCFBundleIdentifierKey);
|
||||
@@ -53,7 +53,8 @@ typedef struct {
|
||||
}
|
||||
|
||||
// If we're using the main bundle's defaults we'll use the standard user defaults mechanism, otherwise we have to get CF-y.
|
||||
usesStandardUserDefaults = !self.defaultsDomain || [self.defaultsDomain isEqualToString:[[NSBundle mainBundle] bundleIdentifier]];
|
||||
NSString *mainBundleIdentifier = NSBundle.mainBundle.bundleIdentifier;
|
||||
usesStandardUserDefaults = !self.defaultsDomain || [self.defaultsDomain isEqualToString:mainBundleIdentifier];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -90,7 +91,7 @@ typedef struct {
|
||||
|
||||
- (NSString *)installationPath
|
||||
{
|
||||
if ([[[NSBundle bundleWithIdentifier:SUBundleIdentifier] infoDictionary][SUNormalizeInstalledApplicationNameKey] boolValue]) {
|
||||
if (SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) {
|
||||
// We'll install to "#{CFBundleName}.app", but only if that path doesn't already exist. If we're "Foo 4.2.app," and there's a "Foo.app" in this directory, we don't want to overwrite it! But if there's no "Foo.app," we'll take that name.
|
||||
NSString *normalizedAppPath = [[[self.bundle bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", [self.bundle objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleNameKey], [[self.bundle bundlePath] pathExtension]]];
|
||||
if (![[NSFileManager defaultManager] fileExistsAtPath:[[[self.bundle bundlePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@", [self.bundle objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleNameKey], [[self.bundle bundlePath] pathExtension]]]]) {
|
||||
@@ -100,7 +101,7 @@ typedef struct {
|
||||
return [self.bundle bundlePath];
|
||||
}
|
||||
|
||||
- (NSString *)name
|
||||
- (NSString *__nonnull)name
|
||||
{
|
||||
NSString *name;
|
||||
|
||||
@@ -117,7 +118,7 @@ typedef struct {
|
||||
return [[[NSFileManager defaultManager] displayNameAtPath:[self.bundle bundlePath]] stringByDeletingPathExtension];
|
||||
}
|
||||
|
||||
- (NSString *)version
|
||||
- (NSString *__nonnull)version
|
||||
{
|
||||
NSString *version = [self.bundle objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
|
||||
if (!version || [version isEqualToString:@""])
|
||||
@@ -125,7 +126,7 @@ typedef struct {
|
||||
return version;
|
||||
}
|
||||
|
||||
- (NSString *)displayVersion
|
||||
- (NSString *__nonnull)displayVersion
|
||||
{
|
||||
NSString *shortVersionString = [self.bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
|
||||
if (shortVersionString)
|
||||
@@ -134,7 +135,7 @@ typedef struct {
|
||||
return [self version]; // Fall back on the normal version string.
|
||||
}
|
||||
|
||||
- (NSImage *)icon
|
||||
- (NSImage *__nonnull)icon
|
||||
{
|
||||
// Cache the application icon.
|
||||
NSString *iconPath = [self.bundle pathForResource:[self.bundle objectForInfoDictionaryKey:@"CFBundleIconFile"] ofType:@"icns"];
|
||||
@@ -169,17 +170,25 @@ typedef struct {
|
||||
return ([[NSApplication sharedApplication] activationPolicy] == NSApplicationActivationPolicyAccessory);
|
||||
}
|
||||
|
||||
- (NSString *)publicDSAKey
|
||||
- (NSString *__nullable)publicDSAKey
|
||||
{
|
||||
// Maybe the key is just a string in the Info.plist.
|
||||
NSString *key = [self.bundle objectForInfoDictionaryKey:SUPublicDSAKeyKey];
|
||||
if (key) { return key; }
|
||||
if (key) {
|
||||
return key;
|
||||
}
|
||||
|
||||
// More likely, we've got a reference to a Resources file by filename:
|
||||
NSString *keyFilename = [self objectForInfoDictionaryKey:SUPublicDSAKeyFileKey];
|
||||
if (!keyFilename) { return nil; }
|
||||
NSError *ignoreErr = nil;
|
||||
return [NSString stringWithContentsOfFile:[self.bundle pathForResource:keyFilename ofType:nil] encoding:NSASCIIStringEncoding error:&ignoreErr];
|
||||
if (!keyFilename) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSString *keyPath = [self.bundle pathForResource:keyFilename ofType:nil];
|
||||
if (!keyPath) {
|
||||
return nil;
|
||||
}
|
||||
return [NSString stringWithContentsOfFile:keyPath encoding:NSASCIIStringEncoding error:nil];
|
||||
}
|
||||
|
||||
- (NSArray *)systemProfile
|
||||
|
||||
Vendored
+4
-3
@@ -44,8 +44,8 @@ static NSString *sUpdateFolder = nil;
|
||||
|
||||
+ (NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host isPackage:(BOOL *)isPackagePtr isGuided:(BOOL *)isGuidedPtr
|
||||
{
|
||||
NSParameterAssert(inUpdateFolder);
|
||||
NSParameterAssert(host);
|
||||
SUParameterAssert(inUpdateFolder);
|
||||
SUParameterAssert(host);
|
||||
|
||||
// Search subdirectories for the application
|
||||
NSString *currentFile,
|
||||
@@ -84,7 +84,8 @@ static NSString *sUpdateFolder = nil;
|
||||
} else {
|
||||
// Try matching on bundle identifiers in case the user has changed the name of the host app
|
||||
NSBundle *incomingBundle = [NSBundle bundleWithPath:currentPath];
|
||||
if (incomingBundle && [[incomingBundle bundleIdentifier] isEqualToString:[[host bundle] bundleIdentifier]]) {
|
||||
NSString *hostBundleIdentifier = host.bundle.bundleIdentifier;
|
||||
if (incomingBundle && [incomingBundle.bundleIdentifier isEqualToString:hostBundleIdentifier]) {
|
||||
isPackage = NO;
|
||||
newAppDownloadPath = currentPath;
|
||||
break;
|
||||
|
||||
Vendored
+6
-2
@@ -30,9 +30,13 @@
|
||||
NSString *lastPathComponent = [path lastPathComponent];
|
||||
for (NSString *currentType in typeSelectorDictionary)
|
||||
{
|
||||
NSString *value = typeSelectorDictionary[currentType];
|
||||
assert(value);
|
||||
|
||||
if ([currentType length] > [lastPathComponent length]) continue;
|
||||
if ([[lastPathComponent substringFromIndex:[lastPathComponent length] - [currentType length]] isEqualToString:currentType])
|
||||
return NSSelectorFromString(typeSelectorDictionary[currentType]);
|
||||
if ([[lastPathComponent substringFromIndex:[lastPathComponent length] - [currentType length]] isEqualToString:currentType]) {
|
||||
return NSSelectorFromString(value);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Vendored
+8
-9
@@ -16,10 +16,12 @@
|
||||
|
||||
+ (void)performInstallationToPath:(NSString *)installationPath fromPath:(NSString *)path host:(SUHost *)host versionComparator:(id<SUVersionComparison>)comparator completionHandler:(void (^)(NSError *))completionHandler
|
||||
{
|
||||
NSParameterAssert(host);
|
||||
SUParameterAssert(host);
|
||||
|
||||
BOOL allowDowngrades = SPARKLE_AUTOMATED_DOWNGRADES;
|
||||
|
||||
// Prevent malicious downgrades
|
||||
if (![[[NSBundle bundleWithIdentifier:SUBundleIdentifier] infoDictionary][SUEnableAutomatedDowngradesKey] boolValue]) {
|
||||
if (!allowDowngrades) {
|
||||
if ([comparator compareVersion:[host version] toVersion:[[NSBundle bundleWithPath:path] objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey]] == NSOrderedDescending) {
|
||||
NSString *errorMessage = [NSString stringWithFormat:@"Sparkle Updater: Possible attack in progress! Attempting to \"upgrade\" from %@ to %@. Aborting update.", [host version], [[NSBundle bundleWithPath:path] objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey]];
|
||||
NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUDowngradeError userInfo:@{ NSLocalizedDescriptionKey: errorMessage }];
|
||||
@@ -32,14 +34,11 @@
|
||||
NSError *error = nil;
|
||||
NSString *oldPath = [host bundlePath];
|
||||
NSString *tempName = [self temporaryNameForPath:[host installationPath]];
|
||||
BOOL hostIsCodeSigned = [SUCodeSigningVerifier applicationAtPathIsCodeSigned:oldPath];
|
||||
|
||||
BOOL result = [self copyPathWithAuthentication:path overPath:installationPath temporaryName:tempName error:&error];
|
||||
|
||||
BOOL result = [self copyPathWithAuthentication:path overPath:installationPath temporaryName:tempName appendVersion:SPARKLE_APPEND_VERSION_NUMBER error:&error];
|
||||
|
||||
if (result) {
|
||||
// If the host is code signed, then the replacement should be be too (and the signature should be valid).
|
||||
BOOL needToCheckCodeSignature = (hostIsCodeSigned || [SUCodeSigningVerifier applicationAtPathIsCodeSigned:installationPath]);
|
||||
if (needToCheckCodeSignature) {
|
||||
if ([SUCodeSigningVerifier applicationAtPathIsCodeSigned:installationPath]) {
|
||||
result = [SUCodeSigningVerifier codeSignatureIsValidAtPath:installationPath error:&error];
|
||||
}
|
||||
}
|
||||
@@ -48,7 +47,7 @@
|
||||
BOOL haveOld = [[NSFileManager defaultManager] fileExistsAtPath:oldPath];
|
||||
BOOL differentFromNew = ![oldPath isEqualToString:installationPath];
|
||||
if (haveOld && differentFromNew) {
|
||||
[self _movePathToTrash:oldPath]; // On success, trash old copy if there's still one due to renaming.
|
||||
[self _movePathToTrash:oldPath appendVersion:SPARKLE_APPEND_VERSION_NUMBER]; // On success, trash old copy if there's still one due to renaming.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -15,8 +15,8 @@
|
||||
|
||||
@interface SUPlainInstaller (Internals)
|
||||
+ (NSString *)temporaryNameForPath:(NSString *)path;
|
||||
+ (BOOL)copyPathWithAuthentication:(NSString *)src overPath:(NSString *)dst temporaryName:(NSString *)tmp error:(NSError **)error;
|
||||
+ (void)_movePathToTrash:(NSString *)path;
|
||||
+ (BOOL)copyPathWithAuthentication:(NSString *)src overPath:(NSString *)dst temporaryName:(NSString *)tmp appendVersion:(BOOL)a error:(NSError **)error;
|
||||
+ (void)_movePathToTrash:(NSString *)path appendVersion:(BOOL)a;
|
||||
+ (BOOL)_removeFileAtPath:(NSString *)path error:(NSError **)error;
|
||||
+ (BOOL)_removeFileAtPathWithForcedAuthentication:(NSString *)src error:(NSError **)error;
|
||||
@end
|
||||
|
||||
Vendored
+35
-24
@@ -61,14 +61,14 @@ static inline void PerformOnMainThreadSync(dispatch_block_t theBlock)
|
||||
// Authorization code based on generous contribution from Allan Odgaard. Thanks, Allan!
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations" // this is terrible; will fix later probably
|
||||
static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authorization, const char *executablePath, AuthorizationFlags options, const char *const *arguments)
|
||||
static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authorization, const char *executablePath, AuthorizationFlags options, char *const *arguments)
|
||||
{
|
||||
// *** MUST BE SAFE TO CALL ON NON-MAIN THREAD!
|
||||
|
||||
sig_t oldSigChildHandler = signal(SIGCHLD, SIG_DFL);
|
||||
BOOL returnValue = YES;
|
||||
|
||||
if (AuthorizationExecuteWithPrivileges(authorization, executablePath, options, (char* const*)arguments, NULL) == errAuthorizationSuccess)
|
||||
if (AuthorizationExecuteWithPrivileges(authorization, executablePath, options, arguments, NULL) == errAuthorizationSuccess)
|
||||
{
|
||||
int status;
|
||||
pid_t pid = wait(&status);
|
||||
@@ -107,7 +107,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
return [tempDir lastPathComponent];
|
||||
}
|
||||
|
||||
+ (NSString *)_temporaryCopyNameForPath:(NSString *)path didFindTrash:(BOOL *)outDidFindTrash
|
||||
+ (NSString *)_temporaryCopyNameForPath:(NSString *)path appendVersion:(BOOL)appendVersion didFindTrash:(BOOL *)outDidFindTrash
|
||||
{
|
||||
// *** MUST BE SAFE TO CALL ON NON-MAIN THREAD!
|
||||
NSString *tempDir = nil;
|
||||
@@ -140,7 +140,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
|
||||
// Let's try to read the version number so the filename will be more meaningful
|
||||
NSString *prefix;
|
||||
if ([[[NSBundle bundleWithIdentifier:SUBundleIdentifier] infoDictionary][SUAppendVersionNumberKey] boolValue]) {
|
||||
if (appendVersion) {
|
||||
NSString *postFix = nil;
|
||||
NSString *version = nil;
|
||||
if ((version = [[NSBundle bundleWithPath: path] objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey]) && ![version isEqualToString:@""])
|
||||
@@ -172,9 +172,14 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
{
|
||||
// *** MUST BE SAFE TO CALL ON NON-MAIN THREAD!
|
||||
|
||||
const char *srcPath = [src fileSystemRepresentation];
|
||||
const char *tmpPath = [tmp fileSystemRepresentation];
|
||||
const char *dstPath = [dst fileSystemRepresentation];
|
||||
char srcPath[PATH_MAX] = {0};
|
||||
[src getFileSystemRepresentation:srcPath maxLength:sizeof(srcPath)];
|
||||
|
||||
char tmpPath[PATH_MAX] = {0};
|
||||
[tmp getFileSystemRepresentation:tmpPath maxLength:sizeof(tmpPath)];
|
||||
|
||||
char dstPath[PATH_MAX] = {0};
|
||||
[dst getFileSystemRepresentation:dstPath maxLength:sizeof(dstPath)];
|
||||
|
||||
struct stat dstSB;
|
||||
if (stat(dstPath, &dstSB) != 0) // Doesn't exist yet, try containing folder.
|
||||
@@ -228,16 +233,16 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
|
||||
if (res) // Set permissions while it's still in source, so we have it with working and correct perms when it arrives at destination.
|
||||
{
|
||||
const char *coParams[] = { "-R", uidgid, srcPath, NULL };
|
||||
char *coParams[] = { "-R", uidgid, srcPath, NULL };
|
||||
res = AuthorizationExecuteWithPrivilegesAndWait(auth, "/usr/sbin/chown", kAuthorizationFlagDefaults, coParams);
|
||||
if (!res)
|
||||
SULog(@"chown -R %s %s failed.", uidgid, srcPath);
|
||||
SULog(@"chown -R %@ %@ failed.", @(uidgid), @(srcPath));
|
||||
}
|
||||
|
||||
BOOL haveDst = [[NSFileManager defaultManager] fileExistsAtPath:dst];
|
||||
if (res && haveDst) // If there's something at our tmp path (previous failed update or whatever) delete that first.
|
||||
{
|
||||
const char *rmParams[] = { "-rf", tmpPath, NULL };
|
||||
char *rmParams[] = { "-rf", tmpPath, NULL };
|
||||
res = AuthorizationExecuteWithPrivilegesAndWait(auth, "/bin/rm", kAuthorizationFlagDefaults, rmParams);
|
||||
if (!res)
|
||||
SULog(@"rm failed");
|
||||
@@ -245,7 +250,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
|
||||
if (res && haveDst) // Move old exe to tmp path.
|
||||
{
|
||||
const char *mvParams[] = { "-f", dstPath, tmpPath, NULL };
|
||||
char *mvParams[] = { "-f", dstPath, tmpPath, NULL };
|
||||
res = AuthorizationExecuteWithPrivilegesAndWait(auth, "/bin/mv", kAuthorizationFlagDefaults, mvParams);
|
||||
if (!res)
|
||||
SULog(@"mv 1 failed");
|
||||
@@ -253,7 +258,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
|
||||
if (res) // Move new exe to old exe's path.
|
||||
{
|
||||
const char *mvParams2[] = { "-f", srcPath, dstPath, NULL };
|
||||
char *mvParams2[] = { "-f", srcPath, dstPath, NULL };
|
||||
res = AuthorizationExecuteWithPrivilegesAndWait(auth, "/bin/mv", kAuthorizationFlagDefaults, mvParams2);
|
||||
if (!res)
|
||||
SULog(@"mv 2 failed");
|
||||
@@ -304,9 +309,14 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
{
|
||||
// *** MUST BE SAFE TO CALL ON NON-MAIN THREAD!
|
||||
|
||||
const char *srcPath = [src fileSystemRepresentation];
|
||||
const char *dstPath = [dst fileSystemRepresentation];
|
||||
const char *dstContainerPath = [[dst stringByDeletingLastPathComponent] fileSystemRepresentation];
|
||||
char srcPath[PATH_MAX] = {0};
|
||||
[src getFileSystemRepresentation:srcPath maxLength:sizeof(srcPath)];
|
||||
|
||||
char dstPath[PATH_MAX] = {0};
|
||||
[dst getFileSystemRepresentation:dstPath maxLength:sizeof(dstPath)];
|
||||
|
||||
char dstContainerPath[PATH_MAX] = {0};
|
||||
[dst.stringByDeletingLastPathComponent getFileSystemRepresentation:dstContainerPath maxLength:sizeof(dstContainerPath)];
|
||||
|
||||
struct stat dstSB;
|
||||
stat(dstContainerPath, &dstSB);
|
||||
@@ -332,7 +342,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
|
||||
if (res) // Set permissions while it's still in source, so we have it with working and correct perms when it arrives at destination.
|
||||
{
|
||||
const char *coParams[] = { "-R", uidgid, srcPath, NULL };
|
||||
char *coParams[] = { "-R", uidgid, srcPath, NULL };
|
||||
res = AuthorizationExecuteWithPrivilegesAndWait(auth, "/usr/sbin/chown", kAuthorizationFlagDefaults, coParams);
|
||||
if (!res)
|
||||
SULog(@"Can't set permissions");
|
||||
@@ -341,7 +351,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
BOOL haveDst = [[NSFileManager defaultManager] fileExistsAtPath:dst];
|
||||
if (res && haveDst) // If there's something at our tmp path (previous failed update or whatever) delete that first.
|
||||
{
|
||||
const char *rmParams[] = { "-rf", dstPath, NULL };
|
||||
char *rmParams[] = { "-rf", dstPath, NULL };
|
||||
res = AuthorizationExecuteWithPrivilegesAndWait(auth, "/bin/rm", kAuthorizationFlagDefaults, rmParams);
|
||||
if (!res)
|
||||
SULog(@"Can't remove destination file");
|
||||
@@ -349,7 +359,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
|
||||
if (res) // Move!.
|
||||
{
|
||||
const char *mvParams[] = { "-f", srcPath, dstPath, NULL };
|
||||
char *mvParams[] = { "-f", srcPath, dstPath, NULL };
|
||||
res = AuthorizationExecuteWithPrivilegesAndWait(auth, "/bin/mv", kAuthorizationFlagDefaults, mvParams);
|
||||
if (!res)
|
||||
SULog(@"Can't move source file");
|
||||
@@ -378,7 +388,8 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
{
|
||||
// *** MUST BE SAFE TO CALL ON NON-MAIN THREAD!
|
||||
|
||||
const char *srcPath = [src fileSystemRepresentation];
|
||||
char srcPath[PATH_MAX] = {0};
|
||||
[src getFileSystemRepresentation:srcPath maxLength:sizeof(srcPath)];
|
||||
|
||||
AuthorizationRef auth = NULL;
|
||||
OSStatus authStat = errAuthorizationDenied;
|
||||
@@ -397,7 +408,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
|
||||
if (res) // If there's something at our tmp path (previous failed update or whatever) delete that first.
|
||||
{
|
||||
const char *rmParams[] = { "-rf", srcPath, NULL };
|
||||
char *rmParams[] = { "-rf", srcPath, NULL };
|
||||
res = AuthorizationExecuteWithPrivilegesAndWait(auth, "/bin/rm", kAuthorizationFlagDefaults, rmParams);
|
||||
if (!res)
|
||||
SULog(@"Can't remove destination file");
|
||||
@@ -432,14 +443,14 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
return success;
|
||||
}
|
||||
|
||||
+ (void)_movePathToTrash:(NSString *)path
|
||||
+ (void)_movePathToTrash:(NSString *)path appendVersion:(BOOL)appendVersion
|
||||
{
|
||||
//SULog(@"Moving %@ to the trash.", path);
|
||||
NSInteger tag = 0;
|
||||
if (![[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceRecycleOperation source:[path stringByDeletingLastPathComponent] destination:@"" files:@[[path lastPathComponent]] tag:&tag])
|
||||
{
|
||||
BOOL didFindTrash = NO;
|
||||
NSString *trashPath = [self _temporaryCopyNameForPath:path didFindTrash:&didFindTrash];
|
||||
NSString *trashPath = [self _temporaryCopyNameForPath:path appendVersion:appendVersion didFindTrash:&didFindTrash];
|
||||
if( didFindTrash )
|
||||
{
|
||||
NSError *err = nil;
|
||||
@@ -453,12 +464,12 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
}
|
||||
}
|
||||
|
||||
+ (BOOL)copyPathWithAuthentication:(NSString *)src overPath:(NSString *)dst temporaryName:(NSString *)__unused tmp error:(NSError *__autoreleasing *)error
|
||||
+ (BOOL)copyPathWithAuthentication:(NSString *)src overPath:(NSString *)dst temporaryName:(NSString *)__unused tmp appendVersion:(BOOL)appendVersion error:(NSError *__autoreleasing *)error
|
||||
{
|
||||
FSRef srcRef, dstRef, dstDirRef, tmpDirRef;
|
||||
OSStatus err;
|
||||
BOOL hadFileAtDest = NO, didFindTrash = NO;
|
||||
NSString *tmpPath = [self _temporaryCopyNameForPath:dst didFindTrash:&didFindTrash];
|
||||
NSString *tmpPath = [self _temporaryCopyNameForPath:dst appendVersion:appendVersion didFindTrash:&didFindTrash];
|
||||
|
||||
// Make FSRef for destination:
|
||||
err = FSPathMakeRefWithOptions((const UInt8 *)[dst fileSystemRepresentation], kFSPathMakeRefDoNotFollowLeafSymlink, &dstRef, NULL);
|
||||
|
||||
Vendored
+8
-6
@@ -63,11 +63,10 @@
|
||||
[[self.updater delegate] updaterDidNotFindUpdate:self.updater];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidNotFindUpdateNotification object:self.updater];
|
||||
|
||||
NSAlert *alert = [NSAlert alertWithMessageText:SULocalizedString(@"You're up-to-date!", "Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates.")
|
||||
defaultButton:SULocalizedString(@"OK", nil)
|
||||
alternateButton:nil
|
||||
otherButton:nil
|
||||
informativeTextWithFormat:SULocalizedString(@"%@ %@ is currently the newest version available.", nil), [self.host name], [self.host displayVersion]];
|
||||
NSAlert *alert = [[NSAlert alloc] init];
|
||||
alert.messageText = SULocalizedString(@"You're up-to-date!", "Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates.");
|
||||
alert.informativeText = [NSString stringWithFormat:SULocalizedString(@"%@ %@ is currently the newest version available.", nil), [self.host name], [self.host displayVersion]];
|
||||
[alert addButtonWithTitle:SULocalizedString(@"OK", nil)];
|
||||
[self showModalAlert:alert];
|
||||
[self abortUpdate];
|
||||
}
|
||||
@@ -201,7 +200,10 @@
|
||||
|
||||
- (void)abortUpdateWithError:(NSError *)error
|
||||
{
|
||||
NSAlert *alert = [NSAlert alertWithMessageText:SULocalizedString(@"Update Error!", nil) defaultButton:SULocalizedString(@"Cancel Update", nil) alternateButton:nil otherButton:nil informativeTextWithFormat:@"%@", [error localizedDescription]];
|
||||
NSAlert *alert = [[NSAlert alloc] init];
|
||||
alert.messageText = SULocalizedString(@"Update Error!", nil);
|
||||
alert.informativeText = [NSString stringWithFormat:@"%@", [error localizedDescription]];
|
||||
[alert addButtonWithTitle:SULocalizedString(@"Cancel Update", nil)];
|
||||
[self showModalAlert:alert];
|
||||
[super abortUpdateWithError:error];
|
||||
}
|
||||
|
||||
Vendored
+13
-12
@@ -107,18 +107,16 @@
|
||||
|
||||
- (void)displayReleaseNotes
|
||||
{
|
||||
// Set the default font
|
||||
[self.releaseNotesView setPreferencesIdentifier:SUBundleIdentifier];
|
||||
self.releaseNotesView.preferencesIdentifier = SUBundleIdentifier;
|
||||
WebPreferences *prefs = [self.releaseNotesView preferences];
|
||||
NSString *familyName = [[NSFont systemFontOfSize:8] familyName];
|
||||
if ([familyName hasPrefix:@"."]) { // 10.9 returns ".Lucida Grande UI", which isn't a valid name for the WebView
|
||||
familyName = @"Lucida Grande";
|
||||
}
|
||||
[prefs setStandardFontFamily:familyName];
|
||||
[prefs setDefaultFontSize:(int)[NSFont systemFontSizeForControlSize:NSSmallControlSize]];
|
||||
[prefs setPlugInsEnabled:NO];
|
||||
[self.releaseNotesView setFrameLoadDelegate:self];
|
||||
[self.releaseNotesView setPolicyDelegate:self];
|
||||
prefs.plugInsEnabled = NO;
|
||||
self.releaseNotesView.frameLoadDelegate = self;
|
||||
self.releaseNotesView.policyDelegate = self;
|
||||
|
||||
// Set the default font
|
||||
// "-apple-system-font" is a reference to the system UI font on OS X. "-apple-system" is the new recommended token, but for backward compatibility we can't use it.
|
||||
prefs.standardFontFamily = @"-apple-system-font";
|
||||
prefs.defaultFontSize = (int)[NSFont systemFontSize];
|
||||
|
||||
// Stick a nice big spinner in the middle of the web view until the page is loaded.
|
||||
NSRect frame = [[self.releaseNotesView superview] frame];
|
||||
@@ -239,7 +237,10 @@
|
||||
- (void)webView:(WebView *)__unused sender decidePolicyForNavigationAction:(NSDictionary *)__unused actionInformation request:(NSURLRequest *)request frame:(WebFrame *)__unused frame decisionListener:(id<WebPolicyDecisionListener>)listener
|
||||
{
|
||||
if (self.webViewFinishedLoading) {
|
||||
[[NSWorkspace sharedWorkspace] openURL:[request URL]];
|
||||
NSURL *requestURL = request.URL;
|
||||
if (requestURL) {
|
||||
[[NSWorkspace sharedWorkspace] openURL:requestURL];
|
||||
}
|
||||
|
||||
[listener ignore];
|
||||
}
|
||||
|
||||
Vendored
+8
-4
@@ -63,12 +63,16 @@
|
||||
// If this is a background application we need to focus it in order to bring the prompt
|
||||
// to the user's attention. Otherwise the prompt would be hidden behind other applications and
|
||||
// the user would not know why the application was paused.
|
||||
if ([aHost isBackgroundApplication]) { [[NSApplication sharedApplication] activateIgnoringOtherApps:YES]; }
|
||||
if ([aHost isBackgroundApplication]) {
|
||||
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
|
||||
}
|
||||
|
||||
if( ![NSApp modalWindow]) // do not prompt if there is is another modal window on screen
|
||||
{
|
||||
if (![NSApp modalWindow]) { // do not prompt if there is is another modal window on screen
|
||||
SUUpdatePermissionPrompt *prompt = [[[self class] alloc] initWithHost:aHost systemProfile:profile delegate:d];
|
||||
[NSApp runModalForWindow:[prompt window]];
|
||||
NSWindow *window = [prompt window];
|
||||
if (window) {
|
||||
[NSApp runModalForWindow:window];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+19
@@ -33,6 +33,7 @@ SU_EXPORT @interface SUUpdater : NSObject
|
||||
- (instancetype)initForBundle:(NSBundle *)bundle;
|
||||
|
||||
@property (readonly, strong) NSBundle *hostBundle;
|
||||
@property (strong, readonly) NSBundle *sparkleBundle;
|
||||
|
||||
@property BOOL automaticallyChecksForUpdates;
|
||||
|
||||
@@ -209,6 +210,24 @@ SU_EXPORT extern NSString *const SUUpdaterAppcastNotificationKey;
|
||||
*/
|
||||
- (void)updaterDidNotFindUpdate:(SUUpdater *)updater;
|
||||
|
||||
/*!
|
||||
Called immediately before downloading the specified update.
|
||||
|
||||
\param updater The SUUpdater instance.
|
||||
\param item The appcast item corresponding to the update that is proposed to be downloaded.
|
||||
\param request The mutable URL request that will be used to download the update.
|
||||
*/
|
||||
- (void)updater:(SUUpdater *)updater willDownloadUpdate:(SUAppcastItem *)item withRequest:(NSMutableURLRequest *)request;
|
||||
|
||||
/*!
|
||||
Called after the specified update failed to download.
|
||||
|
||||
\param updater The SUUpdater instance.
|
||||
\param item The appcast item corresponding to the update that failed to download.
|
||||
\param error The error generated by the failed download.
|
||||
*/
|
||||
- (void)updater:(SUUpdater *)updater failedToDownloadUpdate:(SUAppcastItem *)item error:(NSError *)error;
|
||||
|
||||
/*!
|
||||
Called immediately before installing the specified update.
|
||||
|
||||
|
||||
Vendored
+18
-3
@@ -29,6 +29,8 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
|
||||
@interface SUUpdater () <SUUpdatePermissionPromptDelegate>
|
||||
@property (strong) NSTimer *checkTimer;
|
||||
@property (strong) NSBundle *sparkleBundle;
|
||||
|
||||
- (instancetype)initForBundle:(NSBundle *)bundle;
|
||||
- (void)startUpdateCycle;
|
||||
- (void)checkForUpdatesWithDriver:(SUUpdateDriver *)updateDriver;
|
||||
@@ -54,6 +56,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
@synthesize httpHeaders;
|
||||
@synthesize driver;
|
||||
@synthesize host;
|
||||
@synthesize sparkleBundle;
|
||||
|
||||
static NSMutableDictionary *sharedUpdaters = nil;
|
||||
static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObservationContext";
|
||||
@@ -80,6 +83,12 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
self = [super init];
|
||||
if (bundle == nil) bundle = [NSBundle mainBundle];
|
||||
|
||||
self.sparkleBundle = [NSBundle bundleForClass:[self class]];
|
||||
if (!self.sparkleBundle) {
|
||||
SULog(@"Error: SUUpdater can't find Sparkle.framework it belongs to");
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Register as observer straight away to avoid exceptions on -dealloc when -unregisterAsObserver is called:
|
||||
if (self) {
|
||||
[self registerAsObserver];
|
||||
@@ -104,11 +113,17 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
BOOL hostIsCodeSigned = [SUCodeSigningVerifier hostApplicationIsCodeSigned];
|
||||
if (!isMainBundle && !hasPublicDSAKey) {
|
||||
[self notifyWillShowModalAlert];
|
||||
NSRunAlertPanel(@"Insecure update error!", @"For security reasons, you need to sign your updates with a DSA key. See Sparkle's documentation for more information.", @"OK", nil, nil);
|
||||
NSAlert *alert = [[NSAlert alloc] init];
|
||||
alert.messageText = @"Insecure update error!";
|
||||
alert.informativeText = @"For security reasons, you need to sign your updates with a DSA key. See Sparkle's documentation for more information.";
|
||||
[alert runModal];
|
||||
[self notifyDidShowModalAlert];
|
||||
} else if (isMainBundle && !(hasPublicDSAKey || hostIsCodeSigned)) {
|
||||
[self notifyWillShowModalAlert];
|
||||
NSRunAlertPanel(@"Insecure update error!", @"For security reasons, you need to code sign your application or sign your updates with a DSA key. See Sparkle's documentation for more information.", @"OK", nil, nil);
|
||||
NSAlert *alert = [[NSAlert alloc] init];
|
||||
alert.messageText = @"Insecure update error!";
|
||||
alert.informativeText = @"For security reasons, you need to code sign your application or sign your updates with a DSA key. See Sparkle's documentation for more information.";
|
||||
[alert runModal];
|
||||
[self notifyDidShowModalAlert];
|
||||
}
|
||||
|
||||
@@ -459,7 +474,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
return customUserAgentString;
|
||||
}
|
||||
|
||||
NSString *version = [[NSBundle bundleWithIdentifier:SUBundleIdentifier] objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
|
||||
NSString *version = [self.sparkleBundle objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
|
||||
NSString *userAgent = [NSString stringWithFormat:@"%@/%@ Sparkle/%@", [self.host name], [self.host displayVersion], version ? version : @"?"];
|
||||
NSData *cleanedAgent = [userAgent dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
|
||||
return [[NSString alloc] initWithData:cleanedAgent encoding:NSASCIIStringEncoding];
|
||||
|
||||
Vendored
-8
@@ -24,13 +24,5 @@
|
||||
<string>${CURRENT_PROJECT_VERSION}</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
<key>SUAppendVersionNumber</key>
|
||||
<string>${SPARKLE_APPEND_VERSION_NUMBER}</string>
|
||||
<key>SUEnableAutomatedDowngrades</key>
|
||||
<string>${SPARKLE_AUTOMATED_DOWNGRADES}</string>
|
||||
<key>SUNormalizeInstalledApplicationName</key>
|
||||
<string>${SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME}</string>
|
||||
<key>SURelaunchToolName</key>
|
||||
<string>${SPARKLE_RELAUNCH_TOOL_NAME}</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Vendored
+11
-1
@@ -8,10 +8,20 @@
|
||||
|
||||
#ifdef __OBJC__
|
||||
|
||||
#if !defined(__clang_major__) || __clang_major__ < 7
|
||||
#define __nonnull
|
||||
#define __nullable
|
||||
#endif
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "SUConstants.h"
|
||||
#import "SUErrors.h"
|
||||
|
||||
#define SULocalizedString(key, comment) NSLocalizedStringFromTableInBundle(key, @"Sparkle", [NSBundle bundleWithIdentifier:SUBundleIdentifier] ? [NSBundle bundleWithIdentifier:SUBundleIdentifier] : [NSBundle mainBundle], comment)
|
||||
#define SULocalizedString(key, comment) NSLocalizedStringFromTableInBundle(key, @"Sparkle", (NSBundle *__nonnull)([NSBundle bundleWithIdentifier:SUBundleIdentifier] ? [NSBundle bundleWithIdentifier:SUBundleIdentifier] : [NSBundle mainBundle]), comment)
|
||||
|
||||
// Work around a warning generated by some versions of Xcode that we still support,
|
||||
// when using NSParameterAssert
|
||||
#define SUParameterAssert(condition) \
|
||||
NSAssert((condition), @"Invalid parameter not satisfying: %@", @(#condition))
|
||||
|
||||
#endif
|
||||
+2
-2
@@ -23,8 +23,8 @@
|
||||
<window identifier="SUUpdateAlert" title="Atualização de Software" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" hidesOnDeactivate="YES" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="SUUpdateAlert" animationBehavior="default" id="5" userLabel="Update Alert (release notes)">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="998" y="728" width="622" height="370"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1057"/>
|
||||
<rect key="contentRect" x="871" y="889" width="622" height="370"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
|
||||
<value key="minSize" type="size" width="550" height="150"/>
|
||||
<value key="maxSize" type="size" width="700" height="600"/>
|
||||
<view key="contentView" id="6">
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIIDOzCCAi0GByqGSM44BAEwggIgAoIBAQD2WbLx8Bd1b1vp8FdDpSzkHZ0tlX5x
|
||||
Hrzm0WWE9IokOmJw/UWk1GQYRJnA8UlufFTJV4dZVL3It4xwqqWWFyN36LWgQUpf
|
||||
ss9eTn7M7vjk7BVYch7QMs4jGEnSYkebuYfVhUZlg5VViQ+37Rj+ENtBUrkPJxIY
|
||||
CGAOIJn45uX5oNIPbElFkadU6m7zd1gn8KhRgIepa2k3iBbkFuCbxTPT/aqLI+MW
|
||||
8kR4jXITTgBkDew6DXLVL9SsJup4LeAEizTGyyTBY5bfMJaO8NaB8+uPrkC3SZV+
|
||||
r/LIaBcmU3vVfmw43FGzBlJtGflPaL8Ek9lRK1aSzk3Gr7tPdaado9tPAhUAmn4E
|
||||
HKjL3lXfHzBmDSrrp5G5+IkCggEAFvGRfoL0u3zN4O+8imTxfiSYcFUjBUly4gIl
|
||||
NXM4AgFmy8WE+diZRh6/3eg+CO0B1io+thmU2sTFAbV7sHVuGaBpPyFtcvrCHGGp
|
||||
EcqWwmxuhUc1CzeoBvGw4u8mfCBvcUPjFfhllJJFdIgaTrYXFxqgsb6ZKWKsYz9J
|
||||
jjJkOlRFIlRfowd1RlqodZYYvdvfWnPd32HpI9i/ofhPdlF5W2f51diH/jVJaRCo
|
||||
TKECwcYG+qkPC5gkIIgzC6/DPRT8pzCLJ0NoWj3TQwL1LffMSmT9hTGAD1iyJjn5
|
||||
S9ZLLkz/K+QoGS+Rv4gboMAxa0Cla7R8NwtXqMD0kpeZwDAAgQOCAQYAAoIBAQDw
|
||||
tDiRJy5DsFNRIaKe6NlyW1gyjYIhbeOCDt5fYMdX7tOR64ng28ACU5ESu6jRANMp
|
||||
NYjE9oTBx28C0TXXRLDiblHe6IsisKsJJgkNkNc2DwUdPcGoPTRK/MS0k0CQsPQq
|
||||
cU0Uh/vYXNQ3rsJMAJ0xJ+yYllm3MVQkbZrWlJTe/nU6M8ahiR6WBelrKhzHrhuy
|
||||
MZ8n+oXvBc/Jo8Z63O/5e94BS0PiGb1Eo84ds6ramno7XJpTXE/nxphBSsaXCwdy
|
||||
T97rvDzfDG0v0eo9fdX9aL7jPVODDt0bk+MSRdDpcMlgJzhIpNUtafrTUHIkPyKb
|
||||
/BX9wwwXLfWGTz5TRovi
|
||||
-----END PUBLIC KEY-----
|
||||
@@ -28,5 +28,18 @@
|
||||
<string>http://sparkle-project.org/files/sparkletestcast.xml</string>
|
||||
<key>SUPublicDSAKeyFile</key>
|
||||
<string>test_app_only_dsa_pub.pem</string>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSExceptionDomains</key>
|
||||
<dict>
|
||||
<key>sparkle-project.org</key>
|
||||
<dict>
|
||||
<key>NSIncludesSubdomains</key>
|
||||
<false/>
|
||||
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
return NSApplicationMain(argc, (const char **)argv);
|
||||
return NSApplicationMain(argc, argv);
|
||||
}
|
||||
@@ -12,6 +12,7 @@
|
||||
#import "SUBinaryDeltaCreate.h"
|
||||
#import "SUBinaryDeltaApply.h"
|
||||
#import <sys/stat.h>
|
||||
#include <sys/xattr.h>
|
||||
|
||||
@interface SUBinaryDeltaTest : XCTestCase
|
||||
|
||||
@@ -930,4 +931,42 @@ typedef void (^SUDeltaHandler)(NSFileManager *fileManager, NSString *sourceDirec
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)testInvalidCodeSignatureExtendedAttributeInBeforeTree
|
||||
{
|
||||
BOOL success = [self createAndApplyPatchWithBeforeDiffHandler:^(NSFileManager *__unused fileManager, NSString *sourceDirectory, NSString *destinationDirectory) {
|
||||
NSString *sourceFile = [sourceDirectory stringByAppendingPathComponent:@"A"];
|
||||
NSString *destinationFile = [destinationDirectory stringByAppendingPathComponent:@"A"];
|
||||
|
||||
XCTAssertTrue([[NSData data] writeToFile:sourceFile atomically:YES]);
|
||||
XCTAssertTrue([[NSData dataWithBytes:"loltest" length:7] writeToFile:destinationFile atomically:YES]);
|
||||
|
||||
// the actual data doesn't matter for testing purposes
|
||||
const char xattrValue[] = "hello";
|
||||
|
||||
XCTAssertEqual(0, setxattr([sourceFile fileSystemRepresentation], APPLE_CODE_SIGN_XATTR_CODE_DIRECTORY_KEY, xattrValue, sizeof(xattrValue), 0, XATTR_CREATE));
|
||||
XCTAssertEqual(0, setxattr([sourceFile fileSystemRepresentation], APPLE_CODE_SIGN_XATTR_CODE_REQUIREMENTS_KEY, xattrValue, sizeof(xattrValue), 0, XATTR_CREATE));
|
||||
XCTAssertEqual(0, setxattr([sourceFile fileSystemRepresentation], APPLE_CODE_SIGN_XATTR_CODE_SIGNATURE_KEY, xattrValue, sizeof(xattrValue), 0, XATTR_CREATE));
|
||||
} afterDiffHandler:nil];
|
||||
XCTAssertFalse(success);
|
||||
}
|
||||
|
||||
- (void)testInvalidCodeSignatureExtendedAttributeInAfterTree
|
||||
{
|
||||
BOOL success = [self createAndApplyPatchWithBeforeDiffHandler:^(NSFileManager *__unused fileManager, NSString *sourceDirectory, NSString *destinationDirectory) {
|
||||
NSString *sourceFile = [sourceDirectory stringByAppendingPathComponent:@"A"];
|
||||
NSString *destinationFile = [destinationDirectory stringByAppendingPathComponent:@"A"];
|
||||
|
||||
XCTAssertTrue([[NSData data] writeToFile:sourceFile atomically:YES]);
|
||||
XCTAssertTrue([[NSData dataWithBytes:"loltest" length:7] writeToFile:destinationFile atomically:YES]);
|
||||
|
||||
// the actual data doesn't matter for testing purposes
|
||||
const char xattrValue[] = "hello";
|
||||
|
||||
XCTAssertEqual(0, setxattr([destinationFile fileSystemRepresentation], APPLE_CODE_SIGN_XATTR_CODE_DIRECTORY_KEY, xattrValue, sizeof(xattrValue), 0, XATTR_CREATE));
|
||||
XCTAssertEqual(0, setxattr([destinationFile fileSystemRepresentation], APPLE_CODE_SIGN_XATTR_CODE_REQUIREMENTS_KEY, xattrValue, sizeof(xattrValue), 0, XATTR_CREATE));
|
||||
XCTAssertEqual(0, setxattr([destinationFile fileSystemRepresentation], APPLE_CODE_SIGN_XATTR_CODE_SIGNATURE_KEY, xattrValue, sizeof(xattrValue), 0, XATTR_CREATE));
|
||||
} afterDiffHandler:nil];
|
||||
XCTAssertFalse(success);
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -30,8 +30,9 @@
|
||||
[super setUp];
|
||||
|
||||
NSBundle *unitTestBundle = [NSBundle bundleForClass:[self class]];
|
||||
NSString *unitTestBundleIdentifier = unitTestBundle.bundleIdentifier;
|
||||
NSString *zippedAppPath = [unitTestBundle pathForResource:@"SparkleTestCodeSignApp" ofType:@"zip"];
|
||||
NSString *tempDir = [NSTemporaryDirectory() stringByAppendingPathComponent:[unitTestBundle bundleIdentifier]];
|
||||
NSString *tempDir = [NSTemporaryDirectory() stringByAppendingPathComponent:unitTestBundleIdentifier];
|
||||
NSError *error = nil;
|
||||
if ([[NSFileManager defaultManager] createDirectoryAtPath:tempDir withIntermediateDirectories:YES attributes:nil error:&error]) {
|
||||
if ([self unzip:zippedAppPath toPath:tempDir]) {
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
[super tearDown];
|
||||
}
|
||||
|
||||
#if __clang_major__ >= 6
|
||||
- (void)testInstallIfRoot
|
||||
{
|
||||
uid_t uid = getuid();
|
||||
@@ -61,5 +62,6 @@
|
||||
[self waitForExpectationsWithTimeout:40 handler:nil];
|
||||
[fm removeItemAtPath:expectedDestination error:nil];
|
||||
}
|
||||
#endif
|
||||
|
||||
@end
|
||||
@@ -11,6 +11,7 @@
|
||||
#import "SUUnarchiver.h"
|
||||
#import "SUPipedUnarchiver.h"
|
||||
|
||||
#if __clang_major__ >= 6
|
||||
@interface SUPipedUnarchiverTest : XCTestCase <SUUnarchiverDelegate>
|
||||
|
||||
@property (nonatomic, strong) XCTestExpectation *unarchived;
|
||||
@@ -78,3 +79,4 @@
|
||||
}
|
||||
|
||||
@end
|
||||
#endif
|
||||
Vendored
+1
-1
@@ -123,7 +123,7 @@ static off_t offtin(u_char *buf)
|
||||
return y;
|
||||
}
|
||||
|
||||
int bspatch(int argc,char * argv[])
|
||||
int bspatch(int argc,const char * const argv[])
|
||||
{
|
||||
FILE * f, * cpf, * dpf, * epf;
|
||||
stream_t cstream, dstream, estream;
|
||||
|
||||
Vendored
+1
-1
@@ -9,4 +9,4 @@
|
||||
|
||||
// So that we can use this method in SUBinaryDeltaApply.m.
|
||||
// Silences the GCC warning that the prototype doesn't exist.
|
||||
int bspatch(int argc, char * argv[]);
|
||||
int bspatch(int argc, const char * const argv[]);
|
||||
Vendored
+1
-1
@@ -40,7 +40,7 @@
|
||||
|
||||
#define SAIS_MYMALLOC(_num, _type) ((_type *)malloc((_num) * sizeof(_type)))
|
||||
#define SAIS_MYFREE(_ptr, _num, _type) free((_ptr))
|
||||
#define chr(_a) (cs == sizeof(sais_index_type) ? ((sais_index_type *)T)[(_a)] : ((unsigned char *)T)[(_a)])
|
||||
#define chr(_a) (cs == sizeof(sais_index_type) ? ((const sais_index_type *)T)[(_a)] : ((const unsigned char *)T)[(_a)])
|
||||
|
||||
/* find the start or end of each bucket */
|
||||
static
|
||||
|
||||
Vendored
+3
-3
@@ -24,8 +24,8 @@
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _SAIS_H
|
||||
#define _SAIS_H 1
|
||||
#ifndef SAIS_H
|
||||
#define SAIS_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -56,4 +56,4 @@ sais_int_bwt(const sais_index_type *T, sais_index_type *U, sais_index_type *A, i
|
||||
} /* extern "C" */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _SAIS_H */
|
||||
#endif /* SAIS_H */
|
||||
Reference in new issue
Block a user