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 | ||
|
|
51b62de4cb | ||
|
|
4643becaff | ||
|
|
4bbfac11aa | ||
|
|
0f4f7c3509 | ||
|
|
91af4db0c0 | ||
|
|
21a894cd63 | ||
|
|
e8035cc912 | ||
|
|
342aec164d | ||
|
|
517f7862ab | ||
|
|
6ca90a8c11 | ||
|
|
a7e8e2aad5 | ||
|
|
e9e5791e51 | ||
|
|
7c705e5fff | ||
|
|
b1d887264f | ||
|
|
da06dc80d6 | ||
|
|
2ed2f3def3 | ||
|
|
3292c4ea10 | ||
|
|
fbc7a7fbf7 | ||
|
|
4733fe7785 | ||
|
|
8585d06bb5 | ||
|
|
4d111b96e4 | ||
|
|
0557a5ba5c | ||
|
|
61d43f860a | ||
|
|
4dd4548be4 | ||
|
|
9c3ef30f4c | ||
|
|
585194908e | ||
|
|
330c733958 | ||
|
|
4c782a67ed | ||
|
|
3a304123d9 | ||
|
|
87da4cc0f2 | ||
|
|
12f29384ea | ||
|
|
253f7c1023 | ||
|
|
65bfa1ccf2 | ||
|
|
f19038e5fe | ||
|
|
619e4a60a2 | ||
|
|
6e92311aaa | ||
|
|
7d7aeb9f65 | ||
|
|
ae3d04660e | ||
|
|
2068da1cf9 | ||
|
|
19fdb9276d | ||
|
|
f55d2a4439 | ||
|
|
28ea47f796 |
No files matched your search
+1
-1
@@ -21,7 +21,7 @@ ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: false
|
||||
#DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ForEachMacros: foreach,Q_FOREACH
|
||||
#ForEachMacros: foreach,Q_FOREACH
|
||||
IndentCaseLabels: true
|
||||
IndentFunctionDeclarationAfterType: true
|
||||
IndentWidth: 4
|
||||
|
||||
+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)
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
// BinaryDelta tool only
|
||||
|
||||
PRODUCT_NAME = BinaryDelta
|
||||
@@ -15,20 +15,24 @@ 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
|
||||
GCC_INLINES_ARE_PRIVATE_EXTERN = YES
|
||||
ARCHS = $(ARCHS_STANDARD)
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7
|
||||
PRODUCT_NAME = ${TARGET_NAME}
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.Sparkle.${PRODUCT_NAME:rfc1034identifier}
|
||||
|
||||
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)\"
|
||||
|
||||
GCC_PREPROCESSOR_DEFINITIONS = SPARKLE_BUNDLE_IDENTIFIER=\"$(SPARKLE_BUNDLE_IDENTIFIER)\" SPARKLE_RELAUNCH_TOOL_NAME=\"$(SPARKLE_RELAUNCH_TOOL_NAME)\"
|
||||
CLANG_ENABLE_OBJC_ARC = YES
|
||||
|
||||
// Enable warnings
|
||||
@@ -37,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
|
||||
@@ -48,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
|
||||
@@ -74,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)
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
GCC_OPTIMIZATION_LEVEL = 0
|
||||
DEBUG_INFORMATION_FORMAT = dwarf
|
||||
ENABLE_TESTABILITY = YES
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES
|
||||
SPARKLE_EXTRA_DEBUG = -DDEBUG
|
||||
OTHER_CFLAGS = $(SPARKLE_EXTRA_DEBUG)
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
DYLIB_INSTALL_NAME_BASE = @rpath
|
||||
DYLIB_COMPATIBILITY_VERSION = 1.6
|
||||
DYLIB_CURRENT_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)
|
||||
PRODUCT_NAME = Sparkle
|
||||
WRAPPER_EXTENSION = framework
|
||||
FRAMEWORK_VERSION = A
|
||||
INFOPLIST_FILE = Sparkle/Sparkle-Info.plist
|
||||
@@ -11,3 +10,4 @@ GCC_PREPROCESSOR_DEFINITIONS = $(inherited) BUILDING_SPARKLE=1
|
||||
OTHER_LDFLAGS = -Wl,-U,_NSURLQuarantinePropertiesKey
|
||||
SKIP_INSTALL = YES
|
||||
DEFINES_MODULE = YES
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ${SPARKLE_BUNDLE_IDENTIFIER}
|
||||
@@ -1,8 +1,8 @@
|
||||
// Test Application only
|
||||
|
||||
INFOPLIST_FILE = TestApplication/TestApplication-Info.plist
|
||||
PRODUCT_NAME = Sparkle Test App
|
||||
WRAPPER_EXTENSION = app
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon
|
||||
CLANG_ENABLE_OBJC_ARC = NO
|
||||
LD_RUNPATH_SEARCH_PATHS = @executable_path/../Frameworks
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.SparkleTestApp
|
||||
@@ -1,7 +1,6 @@
|
||||
// Unit Test only
|
||||
|
||||
INFOPLIST_FILE = Tests/SparkleTests-Info.plist
|
||||
PRODUCT_NAME = Sparkle Unit Tests
|
||||
WRAPPER_EXTENSION = xctest
|
||||
OTHER_CFLAGS = $(inherited) -iframework"$(DEVELOPER_FRAMEWORKS_DIR)" -iframework"$(PLATFORM_DIR)/Developer/Library/Frameworks"
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO
|
||||
|
||||
@@ -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.
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "Sparkle"
|
||||
s.version = "1.9.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"
|
||||
@@ -18,7 +18,7 @@ Pod::Spec.new do |s|
|
||||
s.platform = :osx, '10.7'
|
||||
s.source = { :http => "https://github.com/sparkle-project/Sparkle/releases/download/#{s.version}/Sparkle-#{s.version}.tar.bz2" }
|
||||
|
||||
s.public_header_files = 'Sparkle.framework/Headers/*.h'
|
||||
s.public_header_files = 'Sparkle.framework/Versions/A/Headers/*.h'
|
||||
s.vendored_framework = 'Sparkle.framework'
|
||||
s.resources = 'Sparkle.framework'
|
||||
s.xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => '"${PODS_ROOT}/Sparkle"' }
|
||||
|
||||
@@ -167,9 +167,9 @@
|
||||
61F83F720DBFE140006FDD30 /* SUBasicUpdateDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 61F83F700DBFE137006FDD30 /* SUBasicUpdateDriver.m */; };
|
||||
61F83F740DBFE141006FDD30 /* SUBasicUpdateDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 61F83F6F0DBFE137006FDD30 /* SUBasicUpdateDriver.h */; settings = {ATTRIBUTES = (); }; };
|
||||
61FA52880E2D9EA400EF58AD /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* Sparkle.framework */; settings = {ATTRIBUTES = (Required, ); }; };
|
||||
721CF1A71AD7643600D9AC09 /* bsdiff.c in Sources */ = {isa = PBXBuildFile; fileRef = 5D06E8DB0FD68CB9005AE3F6 /* bsdiff.c */; };
|
||||
721CF1A81AD7644100D9AC09 /* bspatch.c in Sources */ = {isa = PBXBuildFile; fileRef = 5D06E8DC0FD68CB9005AE3F6 /* bspatch.c */; };
|
||||
721CF1A91AD7644C00D9AC09 /* sais.c in Sources */ = {isa = PBXBuildFile; fileRef = 7223E7611AD1AEFF008E3161 /* sais.c */; };
|
||||
721CF1A71AD7643600D9AC09 /* bsdiff.c in Sources */ = {isa = PBXBuildFile; fileRef = 5D06E8DB0FD68CB9005AE3F6 /* bsdiff.c */; settings = {COMPILER_FLAGS = "-w"; }; };
|
||||
721CF1A81AD7644100D9AC09 /* bspatch.c in Sources */ = {isa = PBXBuildFile; fileRef = 5D06E8DC0FD68CB9005AE3F6 /* bspatch.c */; settings = {COMPILER_FLAGS = "-w"; }; };
|
||||
721CF1A91AD7644C00D9AC09 /* sais.c in Sources */ = {isa = PBXBuildFile; fileRef = 7223E7611AD1AEFF008E3161 /* sais.c */; settings = {COMPILER_FLAGS = "-w"; }; };
|
||||
721CF1AA1AD7647000D9AC09 /* libxar.1.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D1AF5890FD7678C0065DB48 /* libxar.1.dylib */; };
|
||||
721CF1AB1AD764EB00D9AC09 /* libbz2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D06E8FB0FD68D61005AE3F6 /* libbz2.dylib */; };
|
||||
7223E7631AD1AEFF008E3161 /* sais.c in Sources */ = {isa = PBXBuildFile; fileRef = 7223E7611AD1AEFF008E3161 /* sais.c */; };
|
||||
@@ -1201,7 +1201,7 @@
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
CLASSPREFIX = SU;
|
||||
LastUpgradeCheck = 0630;
|
||||
LastUpgradeCheck = 0700;
|
||||
ORGANIZATIONNAME = "Sparkle Project";
|
||||
TargetAttributes = {
|
||||
612279D80DB5470200AB99EA = {
|
||||
@@ -1759,14 +1759,12 @@
|
||||
14950061195FB89500BC5B5B /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
14950062195FB89500BC5B5B /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0630"
|
||||
LastUpgradeVersion = "0700"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -48,6 +48,8 @@
|
||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
selectedDebuggerIdentifier = ""
|
||||
@@ -57,6 +59,7 @@
|
||||
buildConfiguration = "Debug"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0630"
|
||||
LastUpgradeVersion = "0700"
|
||||
version = "2.0">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -48,6 +48,8 @@
|
||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
selectedDebuggerIdentifier = ""
|
||||
@@ -58,6 +60,7 @@
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugXPCServices = "NO"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.sparkle-project.Sparkle.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
|
||||
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
+1
-1
@@ -9,7 +9,7 @@
|
||||
#ifndef SUAPPCAST_H
|
||||
#define SUAPPCAST_H
|
||||
|
||||
#import <Foundation/NSURLDownload.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SUExport.h"
|
||||
|
||||
@class SUAppcastItem;
|
||||
|
||||
Vendored
+17
-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;
|
||||
}
|
||||
@@ -244,10 +253,13 @@
|
||||
|
||||
- (void)reportError:(NSError *)error
|
||||
{
|
||||
NSURL *failingUrl = error.userInfo[NSURLErrorFailingURLErrorKey];
|
||||
|
||||
self.completionBlock([NSError errorWithDomain:SUSparkleErrorDomain code:SUAppcastError userInfo:@{
|
||||
NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred in retrieving update information. Please try again later.", nil),
|
||||
NSLocalizedFailureReasonErrorKey: [error localizedDescription],
|
||||
NSUnderlyingErrorKey: error,
|
||||
NSURLErrorFailingURLErrorKey: failingUrl ? failingUrl : [NSNull null],
|
||||
}]);
|
||||
self.completionBlock = nil;
|
||||
}
|
||||
|
||||
Vendored
+2
-1
@@ -9,7 +9,8 @@
|
||||
#ifndef SUAPPCASTITEM_H
|
||||
#define SUAPPCASTITEM_H
|
||||
|
||||
#include "SUExport.h"
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SUExport.h"
|
||||
|
||||
SU_EXPORT @interface SUAppcastItem : NSObject
|
||||
@property (copy, readonly) NSString *title;
|
||||
|
||||
Vendored
+8
-4
@@ -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 = [[[self class] alloc] initWithDictionary:fakeAppCastDict];
|
||||
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
+1
@@ -27,6 +27,7 @@
|
||||
- (BOOL)hostSupportsItem:(SUAppcastItem *)ui;
|
||||
- (BOOL)itemContainsSkippedVersion:(SUAppcastItem *)ui;
|
||||
- (BOOL)itemContainsValidUpdate:(SUAppcastItem *)ui;
|
||||
- (void)appcastDidFinishLoading:(SUAppcast *)ac;
|
||||
- (void)didFindValidUpdate;
|
||||
- (void)didNotFindUpdate;
|
||||
|
||||
|
||||
Vendored
+94
-24
@@ -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,29 +224,81 @@
|
||||
[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
|
||||
{
|
||||
NSString *newBundlePath = [SUInstaller appPathInUpdateFolder:extractedPath forHost:self.host];
|
||||
BOOL isPackage = NO;
|
||||
NSString *installSourcePath = [SUInstaller installSourcePathInUpdateFolder:extractedPath forHost:self.host isPackage:&isPackage isGuided:NULL];
|
||||
if (installSourcePath == nil) {
|
||||
SULog(@"No suitable install is found in the update. The update will be rejected.");
|
||||
return NO;
|
||||
}
|
||||
|
||||
// Modern packages are not distributed as bundles and are code signed differently than regular applications
|
||||
if (isPackage) {
|
||||
BOOL packageValidated = [SUDSAVerifier validatePath:downloadedPath withEncodedDSASignature:DSASignature withPublicDSAKey:publicDSAKey];
|
||||
|
||||
if (newBundlePath) {
|
||||
if ([SUCodeSigningVerifier hostApplicationIsCodeSigned]) {
|
||||
NSError *error = nil;
|
||||
if ([SUCodeSigningVerifier codeSignatureMatchesHostAndIsValidAtPath:newBundlePath error:&error]) {
|
||||
return YES;
|
||||
} else {
|
||||
SULog(@"Code signature check on update failed: %@. Sparkle will use DSA signature instead.", error);
|
||||
}
|
||||
} else {
|
||||
SULog(@"The host app is not signed using Apple Code Signing, and therefore cannot verify updates this way. Sparkle will use DSA signature instead.");
|
||||
if (!packageValidated) {
|
||||
SULog(@"DSA signature validation of the package failed. The update will be rejected.");
|
||||
}
|
||||
|
||||
return packageValidated;
|
||||
}
|
||||
|
||||
NSBundle *newBundle = [NSBundle bundleWithPath:installSourcePath];
|
||||
if (newBundle == nil) {
|
||||
SULog(@"No suitable bundle is found in the update. The update will be rejected.");
|
||||
return NO;
|
||||
}
|
||||
|
||||
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 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 updateIsCodeSigned = [SUCodeSigningVerifier applicationAtPathIsCodeSigned:installSourcePath];
|
||||
|
||||
if (dsaKeysMatch) {
|
||||
NSError *error = nil;
|
||||
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 {
|
||||
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 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;
|
||||
}
|
||||
}
|
||||
|
||||
if (DSASignature) {
|
||||
return [SUDSAVerifier validatePath:downloadedPath withEncodedDSASignature:DSASignature withPublicDSAKey:publicDSAKey];
|
||||
} else {
|
||||
SULog(@"The appcast item for the update has no DSA signature. The update will be rejected, because both DSA and Apple Code Signing verification failed.");
|
||||
return NO;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)downloadDidFinish:(NSURLDownload *)__unused d
|
||||
@@ -253,9 +310,21 @@
|
||||
|
||||
- (void)download:(NSURLDownload *)__unused download didFailWithError:(NSError *)error
|
||||
{
|
||||
NSURL *failingUrl = error.userInfo[NSURLErrorFailingURLErrorKey];
|
||||
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),
|
||||
NSUnderlyingErrorKey: error,
|
||||
NSURLErrorFailingURLErrorKey: failingUrl ? failingUrl : [NSNull null],
|
||||
}]];
|
||||
}
|
||||
|
||||
@@ -350,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:@{
|
||||
@@ -375,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]],
|
||||
@@ -389,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]],
|
||||
@@ -441,7 +511,7 @@
|
||||
- (void)abortUpdateWithError:(NSError *)error
|
||||
{
|
||||
if ([error code] != SUNoUpdateError) { // Let's not bother logging this.
|
||||
SULog(@"Error: %@ %@", [error localizedDescription], [error localizedFailureReason]);
|
||||
SULog(@"Error: %@ %@ (URL %@)", error.localizedDescription, error.localizedFailureReason, error.userInfo[NSURLErrorFailingURLErrorKey]);
|
||||
}
|
||||
if (self.download) {
|
||||
[self.download cancel];
|
||||
|
||||
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
+8
-5
@@ -9,6 +9,8 @@
|
||||
#ifndef SUBINARYDELTACOMMON_H
|
||||
#define SUBINARYDELTACOMMON_H
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#include <fts.h>
|
||||
|
||||
#define PERMISSION_FLAGS (S_IRWXU | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID | S_ISVTX)
|
||||
@@ -16,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"
|
||||
@@ -55,17 +61,14 @@ 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
|
||||
|
||||
@class NSString;
|
||||
@class NSData;
|
||||
|
||||
extern int compareFiles(const FTSENT **a, const FTSENT **b);
|
||||
extern NSData *hashOfFileContents(FTSENT *ent);
|
||||
extern NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion);
|
||||
|
||||
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
+6
-5
@@ -10,6 +10,8 @@
|
||||
#ifndef SUCONSTANTS_H
|
||||
#define SUCONSTANTS_H
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Misc:
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -49,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
+8
@@ -15,6 +15,14 @@
|
||||
#ifndef SUDSAVERIFIER_H
|
||||
#define SUDSAVERIFIER_H
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED < 1090
|
||||
@interface NSData (SUDSAVerifier)
|
||||
- (id)initWithBase64Encoding:(NSString *)base64String;
|
||||
@end
|
||||
#endif
|
||||
|
||||
@interface SUDSAVerifier : NSObject
|
||||
|
||||
+ (BOOL)validatePath:(NSString *)path withEncodedDSASignature:(NSString *)encodedSignature withPublicDSAKey:(NSString *)pkeyString;
|
||||
|
||||
Vendored
+1
-1
@@ -65,7 +65,7 @@
|
||||
CFRelease(uuid);
|
||||
}
|
||||
}
|
||||
while (noErr == FSPathMakeRefWithOptions((UInt8 *)[mountPoint fileSystemRepresentation], kFSPathMakeRefDoNotFollowLeafSymlink, &tmpRef, NULL));
|
||||
while (noErr == FSPathMakeRefWithOptions((const UInt8 *)[mountPoint fileSystemRepresentation], kFSPathMakeRefDoNotFollowLeafSymlink, &tmpRef, NULL));
|
||||
|
||||
NSData *promptData = nil;
|
||||
promptData = [NSData dataWithBytes:"yes\n" length:4];
|
||||
|
||||
Vendored
+2
-2
@@ -22,11 +22,11 @@ A guided installation can be started by applications other than the application
|
||||
#ifndef SUGUIDEDPACKAGEINSTALLER_H
|
||||
#define SUGUIDEDPACKAGEINSTALLER_H
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "Sparkle.h"
|
||||
#import "SUInstaller.h"
|
||||
|
||||
@interface SUGuidedPackageInstaller : SUInstaller {
|
||||
}
|
||||
@interface SUGuidedPackageInstaller : SUInstaller
|
||||
|
||||
/*! Perform the guided installation */
|
||||
+ (void)performInstallationToPath:(NSString *)path fromPath:(NSString *)installerGuide host:(SUHost *)host versionComparator:(id<SUVersionComparison>)comparator completionHandler:(void (^)(NSError *))completionHandler;
|
||||
|
||||
Vendored
+19
-14
@@ -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;
|
||||
@@ -71,9 +72,10 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
validAuth = AuthorizationCopyRights(auth,
|
||||
&rights,
|
||||
kAuthorizationEmptyEnvironment,
|
||||
kAuthorizationFlagPreAuthorize |
|
||||
(AuthorizationFlags)
|
||||
(kAuthorizationFlagPreAuthorize |
|
||||
kAuthorizationFlagExtendRights |
|
||||
kAuthorizationFlagInteractionAllowed,
|
||||
kAuthorizationFlagInteractionAllowed),
|
||||
NULL);
|
||||
if (validAuth != errAuthorizationSuccess)
|
||||
{
|
||||
@@ -92,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), ^{
|
||||
|
||||
@@ -105,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
+1
@@ -5,6 +5,7 @@
|
||||
// Copyright 2008 Andy Matuschak. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SUUpdater.h"
|
||||
#import "SUAppcast.h"
|
||||
#import "SUAppcastItem.h"
|
||||
|
||||
Vendored
+22
-13
@@ -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"];
|
||||
@@ -151,7 +152,7 @@ typedef struct {
|
||||
if (!icon) {
|
||||
BOOL isMainBundle = (self.bundle == [NSBundle mainBundle]);
|
||||
|
||||
NSString *fileType = isMainBundle ? (NSString *)kUTTypeApplication : (NSString *)kUTTypeBundle;
|
||||
NSString *fileType = isMainBundle ? (__bridge NSString *)kUTTypeApplication : (__bridge NSString *)kUTTypeBundle;
|
||||
icon = [[NSWorkspace sharedWorkspace] iconForFileType:fileType];
|
||||
}
|
||||
return icon;
|
||||
@@ -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
+1
-1
@@ -15,7 +15,7 @@
|
||||
@class SUHost;
|
||||
@interface SUInstaller : NSObject
|
||||
|
||||
+ (NSString *)appPathInUpdateFolder:(NSString *)updateFolder forHost:(SUHost *)host;
|
||||
+ (NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host isPackage:(BOOL *)isPackagePtr isGuided:(BOOL *)isGuidedPtr;
|
||||
+ (void)installFromUpdateFolder:(NSString *)updateFolder overHost:(SUHost *)host installationPath:(NSString *)installationPath versionComparator:(id<SUVersionComparison>)comparator completionHandler:(void (^)(NSError *))completionHandler;
|
||||
+ (void)finishInstallationToPath:(NSString *)installationPath withResult:(BOOL)result error:(NSError *)error completionHandler:(void (^)(NSError *))completionHandler;
|
||||
+ (NSString *)updateFolder;
|
||||
|
||||
Vendored
+4
-10
@@ -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;
|
||||
@@ -121,13 +122,6 @@ static NSString *sUpdateFolder = nil;
|
||||
return newAppDownloadPath;
|
||||
}
|
||||
|
||||
+ (NSString *)appPathInUpdateFolder:(NSString *)updateFolder forHost:(SUHost *)host
|
||||
{
|
||||
BOOL isPackage = NO;
|
||||
NSString *path = [self installSourcePathInUpdateFolder:updateFolder forHost:host isPackage:&isPackage isGuided:nil];
|
||||
return isPackage ? nil : path;
|
||||
}
|
||||
|
||||
+ (void)installFromUpdateFolder:(NSString *)inUpdateFolder overHost:(SUHost *)host installationPath:(NSString *)installationPath versionComparator:(id<SUVersionComparison>)comparator completionHandler:(void (^)(NSError *))completionHandler
|
||||
{
|
||||
BOOL isPackage = NO;
|
||||
|
||||
Vendored
+2
@@ -9,6 +9,8 @@
|
||||
#ifndef SUPACKAGEINSTALLER_H
|
||||
#define SUPACKAGEINSTALLER_H
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "SUUpdater.h"
|
||||
|
||||
#import "SUAppcast.h"
|
||||
|
||||
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
+2
@@ -9,6 +9,8 @@
|
||||
#ifndef SUPLAININSTALLER_H
|
||||
#define SUPLAININSTALLER_H
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "SUUpdater.h"
|
||||
|
||||
#import "SUAppcast.h"
|
||||
|
||||
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
+4
-2
@@ -9,12 +9,14 @@
|
||||
#ifndef SUPLAININSTALLERINTERNALS_H
|
||||
#define SUPLAININSTALLERINTERNALS_H
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "SUPlainInstaller.h"
|
||||
|
||||
@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
+52
-33
@@ -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;
|
||||
@@ -117,7 +117,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
FSVolumeRefNum vSrcRefNum = kFSInvalidVolumeRefNum;
|
||||
FSCatalogInfo catInfo;
|
||||
memset(&catInfo, 0, sizeof(catInfo));
|
||||
OSStatus err = FSPathMakeRef((UInt8 *)[path fileSystemRepresentation], &pathRef, NULL);
|
||||
OSStatus err = FSPathMakeRef((const UInt8 *)[path fileSystemRepresentation], &pathRef, NULL);
|
||||
if( err == noErr )
|
||||
{
|
||||
err = FSGetCatalogInfo(&pathRef, kFSCatInfoVolume, &catInfo, NULL, NULL, NULL);
|
||||
@@ -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,15 +464,15 @@ 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((UInt8 *)[dst fileSystemRepresentation], kFSPathMakeRefDoNotFollowLeafSymlink, &dstRef, NULL);
|
||||
err = FSPathMakeRefWithOptions((const UInt8 *)[dst fileSystemRepresentation], kFSPathMakeRefDoNotFollowLeafSymlink, &dstRef, NULL);
|
||||
hadFileAtDest = (err == noErr); // There is a file at the destination, move it aside. If we normalized the name, we might not get here, so don't error.
|
||||
if( hadFileAtDest )
|
||||
{
|
||||
@@ -481,12 +492,12 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
|
||||
if( hadFileAtDest )
|
||||
{
|
||||
err = FSPathMakeRef((UInt8 *)[[tmpPath stringByDeletingLastPathComponent] fileSystemRepresentation], &tmpDirRef, NULL);
|
||||
err = FSPathMakeRef((const UInt8 *)[[tmpPath stringByDeletingLastPathComponent] fileSystemRepresentation], &tmpDirRef, NULL);
|
||||
if (err != noErr)
|
||||
FSPathMakeRef((UInt8 *)[[dst stringByDeletingLastPathComponent] fileSystemRepresentation], &tmpDirRef, NULL);
|
||||
FSPathMakeRef((const UInt8 *)[[dst stringByDeletingLastPathComponent] fileSystemRepresentation], &tmpDirRef, NULL);
|
||||
}
|
||||
|
||||
err = FSPathMakeRef((UInt8 *)[[dst stringByDeletingLastPathComponent] fileSystemRepresentation], &dstDirRef, NULL);
|
||||
err = FSPathMakeRef((const UInt8 *)[[dst stringByDeletingLastPathComponent] fileSystemRepresentation], &dstDirRef, NULL);
|
||||
|
||||
if (err == noErr && hadFileAtDest)
|
||||
{
|
||||
@@ -500,7 +511,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
}
|
||||
}
|
||||
|
||||
err = FSPathMakeRef((UInt8 *)[src fileSystemRepresentation], &srcRef, NULL);
|
||||
err = FSPathMakeRef((const UInt8 *)[src fileSystemRepresentation], &srcRef, NULL);
|
||||
if (err == noErr)
|
||||
{
|
||||
NSFileManager *manager = [[NSFileManager alloc] init];
|
||||
@@ -572,7 +583,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
NSFileManager *manager = [NSFileManager defaultManager];
|
||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED < 101000
|
||||
if (!&NSURLQuarantinePropertiesKey) {
|
||||
NSString *const quarantineAttribute = (NSString*)kLSItemQuarantineProperties;
|
||||
NSString *const quarantineAttribute = (__bridge NSString *)kLSItemQuarantineProperties;
|
||||
const int removeXAttrOptions = XATTR_NOFOLLOW;
|
||||
|
||||
[self removeXAttr:quarantineAttribute
|
||||
@@ -599,7 +610,11 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
}
|
||||
#endif
|
||||
NSURL *rootURL = [NSURL fileURLWithPath:root];
|
||||
[rootURL setResourceValue:[NSNull null] forKey:NSURLQuarantinePropertiesKey error:NULL];
|
||||
id rootResourceValue = nil;
|
||||
[rootURL getResourceValue:&rootResourceValue forKey:NSURLQuarantinePropertiesKey error:NULL];
|
||||
if (rootResourceValue) {
|
||||
[rootURL setResourceValue:[NSNull null] forKey:NSURLQuarantinePropertiesKey error:NULL];
|
||||
}
|
||||
|
||||
// Only recurse if it's actually a directory. Don't recurse into a
|
||||
// root-level symbolic link.
|
||||
@@ -612,7 +627,11 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
|
||||
NSDirectoryEnumerator *directoryEnumerator = [manager enumeratorAtURL:rootURL includingPropertiesForKeys:nil options:(NSDirectoryEnumerationOptions)0 errorHandler:nil];
|
||||
|
||||
for (NSURL *file in directoryEnumerator) {
|
||||
[file setResourceValue:[NSNull null] forKey:NSURLQuarantinePropertiesKey error:NULL];
|
||||
id fileResourceValue = nil;
|
||||
[file getResourceValue:&fileResourceValue forKey:NSURLQuarantinePropertiesKey error:NULL];
|
||||
if (fileResourceValue) {
|
||||
[file setResourceValue:[NSNull null] forKey:NSURLQuarantinePropertiesKey error:NULL];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -9,6 +9,7 @@
|
||||
#ifndef SUSTANDARDVERSIONCOMPARATOR_H
|
||||
#define SUSTANDARDVERSIONCOMPARATOR_H
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SUExport.h"
|
||||
#import "SUVersionComparisonProtocol.h"
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -9,7 +9,7 @@
|
||||
#ifndef SUSYSTEMPROFILER_H
|
||||
#define SUSYSTEMPROFILER_H
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class SUHost;
|
||||
@interface SUSystemProfiler : NSObject
|
||||
|
||||
Vendored
+1
@@ -7,6 +7,7 @@
|
||||
// Adapted from Sparkle+, by Tom Harrington.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "SUSystemProfiler.h"
|
||||
|
||||
#import "SUHost.h"
|
||||
|
||||
Vendored
-1
@@ -20,7 +20,6 @@
|
||||
- (void)showModalAlert:(NSAlert *)alert;
|
||||
- (IBAction)cancelDownload:(id)sender;
|
||||
- (void)installAndRestart:(id)sender;
|
||||
- (void)appcastDidFinishLoading:(SUAppcast *)ac;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
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
+3
-1
@@ -9,13 +9,15 @@
|
||||
#ifndef SUUNARCHIVER_H
|
||||
#define SUUNARCHIVER_H
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class SUHost;
|
||||
@protocol SUUnarchiverDelegate;
|
||||
|
||||
@interface SUUnarchiver : NSObject
|
||||
|
||||
@property (copy, readonly) NSString *archivePath;
|
||||
@property (weak, readonly) NSString *updateHostBundlePath;
|
||||
@property (copy, readonly) NSString *updateHostBundlePath;
|
||||
@property (weak) id<SUUnarchiverDelegate> delegate;
|
||||
|
||||
+ (SUUnarchiver *)unarchiverForPath:(NSString *)path updatingHostBundlePath:(NSString *)host;
|
||||
|
||||
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
+20
@@ -9,6 +9,7 @@
|
||||
#ifndef SUUPDATER_H
|
||||
#define SUUPDATER_H
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SUExport.h"
|
||||
#import "SUVersionComparisonProtocol.h"
|
||||
#import "SUVersionDisplayProtocol.h"
|
||||
@@ -32,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;
|
||||
|
||||
@@ -208,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
+1
-9
@@ -9,7 +9,7 @@
|
||||
<key>CFBundleIconFile</key>
|
||||
<string></string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${SPARKLE_BUNDLE_IDENTIFIER}</string>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
@@ -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
+2
@@ -9,6 +9,8 @@
|
||||
#ifndef SPARKLE_H
|
||||
#define SPARKLE_H
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
// This list should include the shared headers. It doesn't matter if some of them aren't shared (unless
|
||||
// there are name-space collisions) so we can list all of them to start with:
|
||||
|
||||
|
||||
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
|
||||
+1
-1
@@ -97,7 +97,7 @@ Gw
|
||||
<button id="17">
|
||||
<rect key="frame" x="105" y="58" width="382" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<buttonCell key="cell" type="check" title="Sempre baixar e instalar atualizações automaticamente" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="43">
|
||||
<buttonCell key="cell" type="check" title="Transferir e instalar atualizações futuras automaticamente" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="43">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
</buttonCell>
|
||||
|
||||
+8
-8
@@ -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="2560" height="1578"/>
|
||||
<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">
|
||||
@@ -57,7 +57,7 @@
|
||||
<binding destination="-2" name="value" keyPath="titleText" id="11"/>
|
||||
</connections>
|
||||
</textField>
|
||||
<textField verticalHuggingPriority="1000" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="17">
|
||||
<textField verticalHuggingPriority="1000" horizontalCompressionResistancePriority="1000" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="17">
|
||||
<rect key="frame" x="106" y="294" width="118" height="14"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" priority="100" constant="100" id="gkn-FW-9aC"/>
|
||||
@@ -75,7 +75,7 @@
|
||||
</binding>
|
||||
</connections>
|
||||
</textField>
|
||||
<button horizontalHuggingPriority="150" verticalHuggingPriority="750" horizontalCompressionResistancePriority="997" translatesAutoresizingMaskIntoConstraints="NO" id="22">
|
||||
<button horizontalHuggingPriority="150" verticalHuggingPriority="750" horizontalCompressionResistancePriority="997" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="22">
|
||||
<rect key="frame" x="336" y="12" width="108" height="32"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" priority="222" constant="90" id="2Zy-5G-GBj"/>
|
||||
@@ -92,8 +92,8 @@ Gw
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" horizontalCompressionResistancePriority="998" translatesAutoresizingMaskIntoConstraints="NO" id="23">
|
||||
<rect key="frame" x="103" y="12" width="147" height="32"/>
|
||||
<buttonCell key="cell" type="push" title="Pular Esta Versão" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="172">
|
||||
<rect key="frame" x="103" y="12" width="161" height="32"/>
|
||||
<buttonCell key="cell" type="push" title="Ignorar Esta Versão" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="172">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
@@ -101,7 +101,7 @@ Gw
|
||||
<action selector="skipThisVersion:" target="-2" id="33"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button horizontalHuggingPriority="20" verticalHuggingPriority="750" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="76">
|
||||
<button horizontalHuggingPriority="20" verticalHuggingPriority="750" horizontalCompressionResistancePriority="1000" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="76">
|
||||
<rect key="frame" x="444" y="12" width="164" height="32"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" priority="222" constant="120" id="N94-uf-6oP"/>
|
||||
@@ -173,7 +173,7 @@ DQ
|
||||
</textField>
|
||||
<button translatesAutoresizingMaskIntoConstraints="NO" id="117">
|
||||
<rect key="frame" x="106" y="49" width="497" height="18"/>
|
||||
<buttonCell key="cell" type="check" title="Sempre baixar e instalar atualizações automaticamente" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="175">
|
||||
<buttonCell key="cell" type="check" title="Transferir e instalar atualizações futuras automaticamente" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="175">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
</buttonCell>
|
||||
|
||||
+4
-4
@@ -140,13 +140,13 @@ Gw
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<subviews>
|
||||
<textField verticalHuggingPriority="750" id="46">
|
||||
<rect key="frame" x="1" y="128" width="358" height="70"/>
|
||||
<rect key="frame" x="1" y="128" width="355" height="70"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" sendsActionOnEndEditing="YES" id="183">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<string key="title">Informações anônimas do sistema são utilizadas para nos ajudar a planejar o desenvolvimento futuro do aplicativo. Caso você tenha dúvidas sobre esse procedimento, por favor contate-nos.
|
||||
<string key="title">As informações anônimas do sistema são usadas para nos ajudar a planejar o desenvolvimento futuro do aplicativo. Contate-nos caso tenha dúvidas sobre este procedimento.
|
||||
|
||||
A seguinte informação seria enviada:</string>
|
||||
As seguintes informações seriam enviadas:</string>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
@@ -156,7 +156,7 @@ A seguinte informação seria enviada:</string>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<clipView key="contentView" id="Xyl-4B-4C7">
|
||||
<rect key="frame" x="1" y="1" width="353" height="113"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" alternatingRowBackgroundColors="YES" multipleSelection="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="14" id="41">
|
||||
<rect key="frame" x="0.0" y="0.0" width="353" height="113"/>
|
||||
|
||||
Vendored
+10
-10
@@ -1,12 +1,12 @@
|
||||
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ foi baixado e está pronto para uso! Gostaria de instalar e reiniciar o %1$@ agora?";
|
||||
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ foi transferido e está pronto para uso! Deseja instalar e reiniciar o %1$@ agora?";
|
||||
|
||||
"%1$@ can't be updated when it's running from a read-only volume like a disk image or an optical drive. Move %1$@ to your Applications folder, relaunch it from there, and try again." = "%1$@ não pode ser atualizado enquanto for executado a partir de um volume somente de leitura, como uma imagem de disco ou CD/DVD. Mova %1$@ para a pasta Aplicativos, reinicie-o e tente novamente.";
|
||||
"%1$@ can't be updated when it's running from a read-only volume like a disk image or an optical drive. Move %1$@ to your Applications folder, relaunch it from there, and try again." = "%1$@ não pode ser atualizado enquanto for executado a partir de um volume somente de leitura, como uma imagem de disco ou CD/DVD. Mova o %1$@ para a pasta Aplicativos, reinicie-o e tente novamente.";
|
||||
|
||||
"%@ %@ is currently the newest version available." = "%1$@ %2$@ é a versão mais recente disponível.";
|
||||
|
||||
"%@ %@ is now available--you have %@. Would you like to download it now?" = "%1$@ %2$@ está disponível--sua versão é %3$@. Gostaria de baixá-lo agora?";
|
||||
"%@ %@ is now available--you have %@. Would you like to download it now?" = "%1$@ %2$@ está disponível – sua versão é %3$@. Deseja transferi-lo agora?";
|
||||
|
||||
"%@ downloaded" = "%@ baixado";
|
||||
"%@ downloaded" = "%@ transferidos";
|
||||
|
||||
"%@ of %@" = "%1$@ de %2$@";
|
||||
|
||||
@@ -14,15 +14,15 @@
|
||||
|
||||
"A new version of %@ is ready to install!" = "Uma nova versão do %@ está pronta para ser instalada!";
|
||||
|
||||
"An error occurred in retrieving update information. Please try again later." = "Ocorreu um erro ao buscar atualizações. Tente novamente mais tarde.";
|
||||
"An error occurred in retrieving update information. Please try again later." = "Ocorreu um erro ao obter informações da atualização. Tente novamente mais tarde.";
|
||||
|
||||
"An error occurred while downloading the update. Please try again later." = "Ocorreu um erro ao baixar a atualização. Tente novamente mais tarde.";
|
||||
"An error occurred while downloading the update. Please try again later." = "Ocorreu um erro ao transferir a atualização. Tente novamente mais tarde.";
|
||||
|
||||
"An error occurred while extracting the archive. Please try again later." = "Ocorreu um erro ao extrair o arquivo. Tente novamente mais tarde.";
|
||||
|
||||
"An error occurred while installing the update. Please try again later." = "Ocorreu um erro ao instalar a atualização. Tente novamente mais tarde.";
|
||||
|
||||
"An error occurred while parsing the update feed." = "Ocorreu um erro ao analisar a fonte de atualização.";
|
||||
"An error occurred while parsing the update feed." = "Ocorreu um erro ao analisar o feed de atualização.";
|
||||
|
||||
"An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@." = "Ocorreu um erro ao reiniciar o %1$@. A nova versão estará disponível da próxima vez que você abrir o %1$@.";
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
"Checking for updates..." = "Buscando atualizações…";
|
||||
|
||||
/* Take care not to overflow the status window. */
|
||||
"Downloading update..." = "Baixando atualização…";
|
||||
"Downloading update..." = "Transferindo atualização…";
|
||||
|
||||
/* Take care not to overflow the status window. */
|
||||
"Extracting update..." = "Extraindo atualização…";
|
||||
@@ -59,9 +59,9 @@
|
||||
|
||||
"Ready to Install" = "Pronto para Instalar";
|
||||
|
||||
"Should %1$@ automatically check for updates? You can always check for updates manually from the %1$@ menu." = "Gostaria que %1$@ buscasse atualizações automaticamente? Você pode buscar por atualizações manualmente, através do menu %1$@.";
|
||||
"Should %1$@ automatically check for updates? You can always check for updates manually from the %1$@ menu." = "Deseja que o %1$@ busque atualizações automaticamente? Você pode buscar atualizações manualmente, através do menu %1$@.";
|
||||
|
||||
"Update Error!" = "Erro na Atualização!";
|
||||
"Update Error!" = "Erro de Atualização!";
|
||||
|
||||
"Updating %@" = "Atualizando %@";
|
||||
|
||||
|
||||
@@ -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-----
|
||||
@@ -7,7 +7,7 @@
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.sparkle-project.SparkleTestApp</string>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</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,41 +11,52 @@
|
||||
#import "SUUnarchiver.h"
|
||||
#import "SUPipedUnarchiver.h"
|
||||
|
||||
@interface SUPipedUnarchiverTest : XCTestCase<SUUnarchiverDelegate>
|
||||
#if __clang_major__ >= 6
|
||||
@interface SUPipedUnarchiverTest : XCTestCase <SUUnarchiverDelegate>
|
||||
|
||||
@property (nonatomic, strong) XCTestExpectation *unarchived;
|
||||
@property (nonatomic, assign) BOOL result;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SUPipedUnarchiverTest {
|
||||
XCTestExpectation *unarchived;
|
||||
BOOL result;
|
||||
}
|
||||
@implementation SUPipedUnarchiverTest
|
||||
|
||||
- (void)setUp {
|
||||
@synthesize unarchived;
|
||||
@synthesize result;
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
[super setUp];
|
||||
unarchived = [self expectationWithDescription:@"unarchived"];
|
||||
self.unarchived = [self expectationWithDescription:@"unarchived"];
|
||||
}
|
||||
|
||||
- (void)tearDown {
|
||||
- (void)tearDown
|
||||
{
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
[super tearDown];
|
||||
}
|
||||
|
||||
- (void) unarchiver:(SUUnarchiver *)unarchiver extractedProgress:(double)_unused {
|
||||
- (void)unarchiver:(SUUnarchiver *)__unused unarchiver extractedProgress:(double)__unused progress
|
||||
{
|
||||
}
|
||||
|
||||
- (void) unarchiverDidFail:(SUUnarchiver *)_unused {
|
||||
result = NO;
|
||||
[unarchived fulfill];
|
||||
- (void)unarchiverDidFail:(SUUnarchiver *)__unused unarchiver
|
||||
{
|
||||
self.result = NO;
|
||||
[self.unarchived fulfill];
|
||||
}
|
||||
|
||||
- (void) unarchiverDidFinish:(SUUnarchiver *)_unused {
|
||||
result = YES;
|
||||
[unarchived fulfill];
|
||||
- (void)unarchiverDidFinish:(SUUnarchiver *)__unused unarchiver
|
||||
{
|
||||
self.result = YES;
|
||||
[self.unarchived fulfill];
|
||||
}
|
||||
|
||||
- (void)testBlah {
|
||||
- (void)testZipExtract
|
||||
{
|
||||
NSString *originalArchivePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"test archive" ofType:@"zip"];
|
||||
NSString *tempDestDir = NSTemporaryDirectory();
|
||||
NSString *tempArchivePath = [[tempDestDir stringByAppendingPathComponent:[NSUUID UUID].UUIDString] stringByAppendingPathExtension:@"zip"];
|
||||
NSString *tempArchivePath = [[tempDestDir stringByAppendingPathComponent:[[NSUUID UUID] UUIDString]] stringByAppendingPathExtension:@"zip"];
|
||||
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
NSString *testFile = [tempDestDir stringByAppendingPathComponent:@"extracted file.txt"];
|
||||
@@ -63,8 +74,9 @@
|
||||
|
||||
[self waitForExpectationsWithTimeout:5.0 handler:nil];
|
||||
|
||||
XCTAssertTrue(result);
|
||||
XCTAssertTrue(self.result);
|
||||
XCTAssertTrue([fm fileExistsAtPath:testFile isDirectory:nil]);
|
||||
}
|
||||
|
||||
@end
|
||||
#endif
|
||||
@@ -16,45 +16,49 @@
|
||||
|
||||
@implementation SUVersionComparisonTestCase
|
||||
|
||||
#define SUAssertOrder(a,b,c) XCTAssertTrue([[SUStandardVersionComparator defaultComparator] compareVersion:a toVersion:b] == c, @"b should be newer than a!")
|
||||
#define SUAssertAscending(a, b) SUAssertOrder(a,b,NSOrderedAscending)
|
||||
#define SUAssertDescending(a, b) SUAssertOrder(a,b,NSOrderedDescending)
|
||||
#define SUAssertEqual(a, b) SUAssertOrder(a,b,NSOrderedSame)
|
||||
#define SUAssertOrder(a, b, c) XCTAssertTrue([[SUStandardVersionComparator defaultComparator] compareVersion:a toVersion:b] == c, @"b should be newer than a!")
|
||||
#define SUAssertAscending(a, b) SUAssertOrder(a, b, NSOrderedAscending)
|
||||
#define SUAssertDescending(a, b) SUAssertOrder(a, b, NSOrderedDescending)
|
||||
#define SUAssertEqual(a, b) SUAssertOrder(a, b, NSOrderedSame)
|
||||
|
||||
- (void)testNumbers
|
||||
{
|
||||
SUAssertAscending(@"1.0", @"1.1");
|
||||
SUAssertEqual(@"1.0", @"1.0");
|
||||
SUAssertDescending(@"2.0", @"1.1");
|
||||
SUAssertDescending(@"0.1", @"0.0.1");
|
||||
//SUAssertDescending(@".1", @"0.0.1"); Known bug, but I'm not sure I care.
|
||||
SUAssertAscending(@"0.1", @"0.1.2");
|
||||
SUAssertAscending(@"1.0", @"1.1");
|
||||
SUAssertEqual(@"1.0", @"1.0");
|
||||
SUAssertDescending(@"2.0", @"1.1");
|
||||
SUAssertDescending(@"0.1", @"0.0.1");
|
||||
//SUAssertDescending(@".1", @"0.0.1"); Known bug, but I'm not sure I care.
|
||||
SUAssertAscending(@"0.1", @"0.1.2");
|
||||
}
|
||||
|
||||
- (void)testPrereleases
|
||||
{
|
||||
SUAssertAscending(@"1.0a1", @"1.0b1");
|
||||
SUAssertAscending(@"1.0b1", @"1.0");
|
||||
SUAssertAscending(@"0.9", @"1.0a1");
|
||||
SUAssertAscending(@"1.0b", @"1.0b2");
|
||||
SUAssertAscending(@"1.0b10", @"1.0b11");
|
||||
SUAssertAscending(@"1.0b9", @"1.0b10");
|
||||
SUAssertAscending(@"1.0rc", @"1.0");
|
||||
SUAssertAscending(@"1.0b", @"1.0");
|
||||
SUAssertAscending(@"1.0pre1", @"1.0");
|
||||
SUAssertAscending(@"1.5.5", @"1.5.6a1");
|
||||
SUAssertAscending(@"1.1.0b1", @"1.1.0b2");
|
||||
SUAssertAscending(@"1.1.1b2", @"1.1.2b1");
|
||||
SUAssertAscending(@"1.1.1b2", @"1.1.2a1");
|
||||
SUAssertAscending(@"1.0a1", @"1.0b1");
|
||||
SUAssertAscending(@"1.0b1", @"1.0");
|
||||
SUAssertAscending(@"0.9", @"1.0a1");
|
||||
SUAssertAscending(@"1.0b", @"1.0b2");
|
||||
SUAssertAscending(@"1.0b10", @"1.0b11");
|
||||
SUAssertAscending(@"1.0b9", @"1.0b10");
|
||||
SUAssertAscending(@"1.0rc", @"1.0");
|
||||
SUAssertAscending(@"1.0b", @"1.0");
|
||||
SUAssertAscending(@"1.0pre1", @"1.0");
|
||||
}
|
||||
|
||||
- (void)testVersionsWithBuildNumbers
|
||||
{
|
||||
SUAssertAscending(@"1.0 (1234)", @"1.0 (1235)");
|
||||
SUAssertAscending(@"1.0b1 (1234)", @"1.0 (1234)");
|
||||
SUAssertAscending(@"1.0b5 (1234)", @"1.0b5 (1235)");
|
||||
SUAssertAscending(@"1.0b5 (1234)", @"1.0.1b5 (1234)");
|
||||
SUAssertAscending(@"1.0.1b5 (1234)", @"1.0.1b6 (1234)");
|
||||
SUAssertAscending(@"2.0.0.2429", @"2.0.0.2430");
|
||||
SUAssertAscending(@"1.1.1.1818", @"2.0.0.2430");
|
||||
SUAssertAscending(@"1.0 (1234)", @"1.0 (1235)");
|
||||
SUAssertAscending(@"1.0b1 (1234)", @"1.0 (1234)");
|
||||
SUAssertAscending(@"1.0b5 (1234)", @"1.0b5 (1235)");
|
||||
SUAssertAscending(@"1.0b5 (1234)", @"1.0.1b5 (1234)");
|
||||
SUAssertAscending(@"1.0.1b5 (1234)", @"1.0.1b6 (1234)");
|
||||
SUAssertAscending(@"2.0.0.2429", @"2.0.0.2430");
|
||||
SUAssertAscending(@"1.1.1.1818", @"2.0.0.2430");
|
||||
|
||||
SUAssertAscending(@"3.3 (5847)", @"3.3.1b1 (5902)");
|
||||
SUAssertAscending(@"3.3 (5847)", @"3.3.1b1 (5902)");
|
||||
}
|
||||
|
||||
- (void)testWordsWithSpaceInFront
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.sparkle-project.Sparkle.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
|
||||
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