Compare commits

...
Author SHA1 Message Date
Dmytro Tretiakov b6b704ea55 Updated release notes. 2014-07-23 18:46:24 +03:00
Dmytro Tretiakov 77fc6ca681 Incremented framework version to 2.0.1. 2014-07-22 13:14:12 +03:00
Dmytro Tretiakov 46c22e2bbf Extra follow-up for prev.rev. 2014-07-14 14:20:55 +03:00
Dmytro Tretiakov 92d7b9f68f DM-2385 [Sparkle FW] SandBox-related Updated Issues. 2014-07-14 14:08:57 +03:00
Dmytro Tretiakov 6b6b6b2405 Removed useless imports. 2014-07-14 14:05:53 +03:00
Dmytro Tretiakov b854b01e6a Made XPC-using check as functions instead of methods. 2014-07-14 14:05:13 +03:00
Dmytro Tretiakov 61e16cf276 Removed compile warnings. 2014-07-14 13:54:47 +03:00
Dmytro Tretiakov e7088fc788 Corrected release notes with proofed text. 2014-05-28 11:14:25 +03:00
Dmytro Tretiakov 54aa6f2cc2 Incremented bundle version to 2.0. Added release notes. 2014-05-27 17:09:21 +03:00
Dmytro Tretiakov acf758e485 Separate check of using XPC installer and XPC downloader. 2014-05-07 12:43:28 +03:00
Dmytro Tretiakov ceedfba634 Made it more compatible with DevMate (for correct statistics in DevMate now updater tries to download release notes even for automatic update). 2014-05-06 19:47:34 +03:00
Dmytro Tretiakov addedeac13 Removed check for min time interval before next update check. 2014-04-30 15:09:34 +03:00
Dmytro Tretiakov eedb0ff0dd Hides XPC using check to private updater API. 2014-04-30 13:40:55 +03:00
Dmytro Tretiakov 67a7bc3d62 Added custom prompt text when asking for admin rights. 2014-04-25 13:28:14 +03:00
Dmytro Tretiakov 65d7c38ab6 Added test deviate domain for sending special headers. 2014-04-24 17:43:57 +03:00
Dmytro Tretiakov 5b786043c2 DM-2131 Update sanboxed app by non-admin user. 2014-04-23 18:14:24 +03:00
Dmytro Tretiakov ca23238d59 DM-2123 Added code sign rules file to exclude headers from code signing. 2014-04-14 14:23:10 +03:00
Dmytro Tretiakov fc1870cbd2 Used defined constants instead of extern strings to add possibility to use these string values directly. 2014-03-25 11:13:00 +02:00
Dmytro Tretiakov 659aec4eaf Added codesign identity for framework. 2014-03-11 17:20:48 +02:00
Dmytro Tretiakov 88a197a7f0 Corrected build configuration to correctly generate dSYM files. 2014-02-28 14:04:15 +02:00
Dmytro Tretiakov 9119d287ab Added delegate methods that interacts with DevMate (beta updates, test mode). 2014-02-10 18:31:42 +02:00
Dmytro Tretiakov 7797a8f58c Updated DMCore lib (corrected HTTP request headers according to new documentation). 2014-02-07 19:25:33 +02:00
Dmytro Tretiakov 1f0da95e59 Updated DMCore lib. 2014-02-05 14:31:32 +02:00
Dmytro Tretiakov 84a2feb0ad Added compatibility with DevMate. 2014-01-27 12:11:14 +02:00
Dmytro Tretiakov bbe75fc6f2 Corrected releasing of xlc connection queue. 2013-10-18 18:53:26 +03:00
Dmytro Tretiakov 9c8e08b7ae Updated archive with built Sparkle framework. 2013-10-18 18:34:35 +03:00
dimaty 371c51fe5a Fixed crash under 10.9. Fixed some memory leaks. 2013-10-18 18:17:57 +03:00
dimaty feb2ad4b64 Fixed compile errors for new LLVM compiler (used in Xcode 5.0). 2013-10-18 18:07:02 +03:00
Dmytro Tretiakov 1e75acb963 Updated Sparkle version to 1.5 2013-08-20 13:24:05 +03:00
Dmytro Tretiakov b3c69f8b8c Updated product archive. 2013-08-19 17:46:47 +03:00
Dmytro Tretiakov 5cd9bdccf6 Merge branch 'sandboxing' 2013-08-19 17:40:24 +03:00
Dmytro Tretiakov 12eede4123 Updated products archive. 2013-08-07 17:01:03 +03:00
Dmytro Tretiakov 9633a57c6c Made download service callback messages with sync reply to make sure that main app receive it.
Leave some connection leaks to avoid crash while closing it.
2013-08-07 13:08:48 +03:00
Dmytro Tretiakov ab389260be Follow up for rev. [67ebc6f] 2013-08-06 18:29:54 +03:00
Dmytro Tretiakov abf70ab8dc Updated xlc services configs. 2013-08-06 16:12:35 +03:00
Dmytro Tretiakov 67ebc6ff74 Adds removing old data before downloading new one via XPC. 2013-08-06 15:16:29 +03:00
Dmytro Tretiakov 1e14f7d7b6 Corrected using of macro. 2013-08-05 17:01:31 +03:00
Dmytro Tretiakov 5bd4c1ecb6 Added sandbox check. 2013-08-05 16:53:10 +03:00
Dmytro Tretiakov 406f3da615 [Downloading XPC service] Added support of additional delegate method. 2013-08-02 17:08:56 +03:00
Dmytro Tretiakov 302eb082d6 [Installation XPC Service] Added xpc message key constants instead of hard-coded string keys. Fixed memory leaks. 2013-08-02 13:01:46 +03:00
Dmytro Tretiakov 16b75653dc Refactored download XPC service: used NSURLDownload instead of lib curl; corrected behavior of SUXPCURLDownload class to be more common with NSURLDownload. 2013-08-01 18:33:38 +03:00
Dmytro Tretiakov fc8176a229 Merged with master. 2013-07-18 18:57:51 +03:00
Vera Tkachenko 502c7fb6db Add 64-bit binary framework. 2013-06-07 19:59:50 +03:00
Vera Tkachenko 71f747aec1 Add configuration for 64bit only. 2013-06-07 19:58:01 +03:00
Erik Aderstedt aebb767cfb Cancel download no longer crashes the app. 2012-08-10 12:29:38 +02:00
Erik Aderstedt 04b1514452 Added limited support for remote release notes. Images / links / style sheets in notes won't work. 2012-08-10 12:25:16 +02:00
Erik Aderstedt 22f9c96a1f Removed additional log statements 2012-08-10 11:30:46 +02:00
Erik Aderstedt 78b08a0bee Put networking code in XPC, too. Minor compiler fixes. 2012-08-10 11:00:53 +02:00
Erik Aderstedt 6fc58a1025 Made XPC service calls asynchronous 2012-08-09 08:39:01 +02:00
Whitney Young dbd2b9b30a Added an XPC service to deal with sandboxing.
This fixes #163. It requires that you copy the XPC service into your main application bundle in
Contents/XPCServices and runs the remove from quarantine step of copying the finish_installation
app as well as launching finish_installation app outside of the sandbox. Sparkle will function
exactly as it does now for applications that do not copy the XPC service into their application
bundle.
2012-03-20 10:01:21 -05:00
56 changed files with 3191 additions and 182 deletions

No files matched your search

+5 -4
View File
@@ -3,11 +3,11 @@
PREBINDING = NO
ZERO_LINK = NO
CURRENT_PROJECT_VERSION = 1.5
SDKROOT = macosx10.7
SDKROOT = macosx10.8
MACOSX_DEPLOYMENT_TARGET[arch=ppc] = 10.4
MACOSX_DEPLOYMENT_TARGET[arch=ppc64] = 10.5
MACOSX_DEPLOYMENT_TARGET[arch=i386] = 10.4
MACOSX_DEPLOYMENT_TARGET[arch=x86_64] = 10.5
MACOSX_DEPLOYMENT_TARGET[arch=x86_64] = 10.7
GCC_C_LANGUAGE_STANDARD = c99
GCC_ENABLE_OBJC_EXCEPTIONS = YES
GCC_DEBUGGING_SYMBOLS = full
@@ -15,7 +15,6 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES
GCC_PREFIX_HEADER = $(SDKROOT)/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h
GCC_FAST_OBJC_DISPATCH = YES
GCC_ENABLE_PASCAL_STRINGS = NO
ARCHS = ppc i386 x86_64
GCC_VERSION = com.apple.compilers.llvm.clang.1_0
CLANG_LINK_OBJC_RUNTIME = NO
@@ -48,4 +47,6 @@ GCC_WARN_UNUSED_VALUE = YES
GCC_WARN_UNUSED_PARAMETER = YES
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES
GCC_WARN_UNDECLARED_SELECTOR = YES
WARNING_CFLAGS = -Wall -Wno-unused-parameter -Werror -Wundef -Wendif-labels -Wpointer-arith -Wcast-align -Wwrite-strings -Wmissing-format-attribute -Wpacked -Wredundant-decls -Winline -Wdisabled-optimization -Winvalid-pch
COMMON_WARNING_FLAGS = -Wall -Wno-unused-parameter -Wundef -Wendif-labels -Wpointer-arith -Wcast-align -Wwrite-strings -Wmissing-format-attribute -Wpacked -Wredundant-decls -Winline -Wdisabled-optimization -Winvalid-pch
WARNING_CFLAGS = $(COMMON_WARNING_FLAGS)
@@ -6,5 +6,6 @@ GCC_GENERATE_DEBUGGING_SYMBOLS = YES
SPARKLE_EXTRA_DEBUG_10_5_ONLY = -fstack-protector -D_FORTIFY_SOURCE=2
SPARKLE_EXTRA_DEBUG = -DDEBUG
OTHER_CFLAGS = $(SPARKLE_EXTRA_DEBUG)
CODE_SIGN_IDENTITY = Mac Developer
// Add $(SPARKLE_EXTRA_DEBUG_10_5_ONLY) to SPARKLE_EXTRA_DEBUG if your deployment is 10.5 or greater.
@@ -0,0 +1,4 @@
// Common
ARCHS = x86_64
VALID_ARCHS = x86_64
@@ -0,0 +1,4 @@
// Common
ARCHS = ppc i386 x86_64
+2 -1
View File
@@ -2,7 +2,8 @@
GCC_OPTIMIZATION_LEVEL = s
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
GCC_GENERATE_DEBUGGING_SYMBOLS = NO
DEAD_CODE_STRIPPING = YES
GCC_TREAT_WARNINGS_AS_ERRORS = YES
GCC_WARN_UNINITIALIZED_AUTOS = YES
WARNING_CFLAGS = $(COMMON_WARNING_FLAGS) -Wno-deprecated-declarations
CODE_SIGN_IDENTITY = Developer ID Application
+2 -2
View File
@@ -1,8 +1,8 @@
// Framework only
INSTALL_PATH = @loader_path/../Frameworks
DYLIB_COMPATIBILITY_VERSION = 1.5
DYLIB_CURRENT_VERSION = 1.5
DYLIB_COMPATIBILITY_VERSION = 2.0
DYLIB_CURRENT_VERSION = 2.0.1
PRODUCT_NAME = Sparkle
WRAPPER_EXTENSION = framework
FRAMEWORK_VERSION = A
+10
View File
@@ -0,0 +1,10 @@
// Sandbox Service only
WRAPPER_EXTENSION = xpc
MACH_O_TYPE = mh_execute
MACOSX_DEPLOYMENT_TARGET = 10.7
MACOSX_DEPLOYMENT_TARGET[arch=x86_64] = 10.7
GCC_WARN_SHADOW = NO
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = NO
@@ -0,0 +1,5 @@
#include "ConfigCommon.xcconfig"
#include "ConfigCommonDebug.xcconfig"
#include "ConfigService.xcconfig"
OTHER_CFLAGS = -DDEBUG
@@ -0,0 +1,3 @@
#include "ConfigCommon.xcconfig"
#include "ConfigCommonRelease.xcconfig"
#include "ConfigService.xcconfig"
+2 -1
View File
@@ -7,4 +7,5 @@ WRAPPER_EXTENSION = octest
FRAMEWORK_SEARCH_PATHS = $(DEVELOPER_LIBRARY_DIR)/Frameworks
GCC_PREFIX_HEADER = $(SYSTEM_LIBRARY_DIR)/Frameworks/Cocoa.framework/Headers/Cocoa.h
GCC_PRECOMPILE_PREFIX_HEADER = YES
MACOSX_DEPLOYMENT_TARGET = 10.6
SDKROOT = macosx10.7
MACOSX_DEPLOYMENT_TARGET = 10.7
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>XPCService</key>
<dict>
<key>ServiceType</key>
<string>Application</string>
<key>JoinExistingSession</key>
<true/>
</dict>
</dict>
</plist>
@@ -0,0 +1,4 @@
//
// Prefix header for all source files of the 'Downloading XPC Service' target in the 'Downloading XPC Service' project
//
+60
View File
@@ -0,0 +1,60 @@
//
// SUDSDownloader.h
// Sparkle
//
// Created by Dmytro Tretiakov on 8/1/13.
//
//
#import <Foundation/Foundation.h>
#define DEBUG_LOGGING_ENABLED defined(DEBUG) && 1
@class SUDSDownloader;
typedef void (^SUDSDownloadDidBegin)(SUDSDownloader *downloader);
typedef void (^SUDSDownloadDidFinish)(SUDSDownloader *downloader);
typedef void (^SUDSDownloadDidFail)(SUDSDownloader *downloader, NSError *error);
typedef void (^SUDSDownloadDidReceiveResponse)(SUDSDownloader *downloader, NSURLResponse *response);
typedef void (^SUDSDownloadDidReceiveData)(SUDSDownloader *downloader, NSUInteger dataLength);
typedef void (^SUDSDownloadDidCreateDestination)(SUDSDownloader *downloader, NSString *destinationPath);
typedef BOOL (^SUDSDownloadShouldDecodeSourceData)(SUDSDownloader *downloader, NSString *MIMEType);
typedef struct SUDSDownloaderCallBacks
{
SUDSDownloadDidBegin downloadDidBegin;
SUDSDownloadDidFinish downloadDidFinish;
SUDSDownloadDidFail downloadDidFail;
SUDSDownloadDidReceiveResponse downloadDidReceiveResponse;
SUDSDownloadDidReceiveData downloadDidReceiveData;
SUDSDownloadDidCreateDestination downloadDidCreateDestination;
SUDSDownloadShouldDecodeSourceData downloadShouldDecodeSourceData;
} SUDSDownloaderCallBacks;
FOUNDATION_EXTERN SUDSDownloaderCallBacks SUDSCopyDownloaderCallBacks(SUDSDownloaderCallBacks callBacks);
FOUNDATION_EXTERN void SUDSReleaseDownloaderCallBacks(SUDSDownloaderCallBacks callBacks);
@interface SUDSDownloader : NSObject <NSURLDownloadDelegate>
{
@private
NSURLRequest *_request;
NSString *_destFilePath;
SUDSDownloaderCallBacks _callBacks;
NSURLDownload *_download;
}
- (id)initWithURLRequest:(NSURLRequest *)request destinationPath:(NSString *)filePath;
+ (id)downloaderWithURLRequest:(NSURLRequest *)request destinationPath:(NSString *)filePath;
- (NSURLRequest *)request;
- (NSString *)destinationPath;
- (void)setCallBacks:(SUDSDownloaderCallBacks)callBacks;
- (void)startDownload;
- (void)stopDownload;
- (BOOL)isInProgress;
@end
+210
View File
@@ -0,0 +1,210 @@
//
// SUDSDownloader.m
// Sparkle
//
// Created by Dmytro Tretiakov on 8/1/13.
//
//
#import "SUDSDownloader.h"
SUDSDownloaderCallBacks SUDSCopyDownloaderCallBacks(SUDSDownloaderCallBacks callBacks)
{
SUDSDownloaderCallBacks callBacksCopy = {0};
if (callBacks.downloadDidBegin)
callBacksCopy.downloadDidBegin = Block_copy(callBacks.downloadDidBegin);
if (callBacks.downloadDidFinish)
callBacksCopy.downloadDidFinish = Block_copy(callBacks.downloadDidFinish);
if (callBacks.downloadDidFail)
callBacksCopy.downloadDidFail = Block_copy(callBacks.downloadDidFail);
if (callBacks.downloadDidReceiveData)
callBacksCopy.downloadDidReceiveData = Block_copy(callBacks.downloadDidReceiveData);
if (callBacks.downloadDidCreateDestination)
callBacksCopy.downloadDidCreateDestination = Block_copy(callBacks.downloadDidCreateDestination);
if (callBacks.downloadDidReceiveResponse)
callBacksCopy.downloadDidReceiveResponse = Block_copy(callBacks.downloadDidReceiveResponse);
if (callBacks.downloadShouldDecodeSourceData)
callBacksCopy.downloadShouldDecodeSourceData = Block_copy(callBacks.downloadShouldDecodeSourceData);
return callBacksCopy;
}
void SUDSReleaseDownloaderCallBacks(SUDSDownloaderCallBacks callBacks)
{
if (callBacks.downloadDidBegin)
Block_release(callBacks.downloadDidBegin);
if (callBacks.downloadDidFinish)
Block_release(callBacks.downloadDidFinish);
if (callBacks.downloadDidFail)
Block_release(callBacks.downloadDidFail);
if (callBacks.downloadDidReceiveData)
Block_release(callBacks.downloadDidReceiveData);
if (callBacks.downloadDidCreateDestination)
Block_release(callBacks.downloadDidCreateDestination);
if (callBacks.downloadDidReceiveResponse)
Block_release(callBacks.downloadDidReceiveResponse);
if (callBacks.downloadShouldDecodeSourceData)
Block_release(callBacks.downloadShouldDecodeSourceData);
}
@implementation SUDSDownloader
- (id)initWithURLRequest:(NSURLRequest *)request destinationPath:(NSString *)filePath
{
self = [super init];
if (self != nil)
{
_request = [request retain];
_destFilePath = [filePath copy];
}
return self;
}
+ (id)downloaderWithURLRequest:(NSURLRequest *)request destinationPath:(NSString *)filePath
{
return [[[[self class] alloc] initWithURLRequest:request destinationPath:filePath] autorelease];
}
- (void)dealloc
{
[self stopDownload];
[_request release];
[_destFilePath release];
SUDSReleaseDownloaderCallBacks(_callBacks);
[super dealloc];
}
- (NSURLRequest *)request
{
return _request;
}
- (NSString *)destinationPath
{
return _destFilePath;
}
- (void)setCallBacks:(SUDSDownloaderCallBacks)callBacks
{
SUDSDownloaderCallBacks oldCallBacks = _callBacks;
_callBacks = SUDSCopyDownloaderCallBacks(callBacks);
SUDSReleaseDownloaderCallBacks(oldCallBacks);
}
- (void)startDownload
{
[self stopDownload];
// to ensure that parent folder exists
[[NSFileManager defaultManager] createDirectoryAtPath:[_destFilePath stringByDeletingLastPathComponent]
withIntermediateDirectories:YES
attributes:nil
error:NULL];
NSURLDownload *urlDownload = [[NSURLDownload alloc] initWithRequest:_request delegate:self];
@synchronized (self)
{
_download = urlDownload;
}
[urlDownload setDestination:_destFilePath allowOverwrite:YES];
}
- (void)stopDownload
{
@synchronized (self)
{
[_download cancel];
[_download release];
_download = nil;
}
}
- (BOOL)isInProgress
{
BOOL result = YES;
@synchronized (self)
{
result = _download != nil;
}
return result;
}
#pragma mark -
- (void)downloadDidBegin:(NSURLDownload *)download
{
#if DEBUG_LOGGING_ENABLED
NSLog(@"XPC Downloader did begin process.");
#endif
if (_callBacks.downloadDidBegin)
_callBacks.downloadDidBegin(self);
}
- (void)download:(NSURLDownload *)download didReceiveResponse:(NSURLResponse *)response
{
#if DEBUG_LOGGING_ENABLED
NSLog(@"XPC Downloader did receive response: %@", [response description]);
#endif
if (_callBacks.downloadDidReceiveResponse)
_callBacks.downloadDidReceiveResponse(self, response);
}
- (void)download:(NSURLDownload *)download didCreateDestination:(NSString *)path
{
#if DEBUG_LOGGING_ENABLED
NSLog(@"XPC Downloader did create destination: %@", path);
#endif
if (_callBacks.downloadDidCreateDestination)
_callBacks.downloadDidCreateDestination(self, path);
}
- (void)download:(NSURLDownload *)download didReceiveDataOfLength:(NSUInteger)length
{
#if DEBUG_LOGGING_ENABLED
NSLog(@"XPC Downloader did receive data of length %ld bytes", (unsigned long)length);
#endif
if (_callBacks.downloadDidReceiveData)
_callBacks.downloadDidReceiveData(self, length);
}
- (void)download:(NSURLDownload *)download didFailWithError:(NSError *)error
{
#if DEBUG_LOGGING_ENABLED
NSLog(@"XPC Downloader did fail: %@", [error description]);
#endif
if (_callBacks.downloadDidFail)
_callBacks.downloadDidFail(self, error);
[self stopDownload];
}
- (void)downloadDidFinish:(NSURLDownload *)download
{
#if DEBUG_LOGGING_ENABLED
NSLog(@"XPC Downloader did finish");
#endif
if (_callBacks.downloadDidFinish)
_callBacks.downloadDidFinish(self);
[self stopDownload];
}
- (BOOL)download:(NSURLDownload *)download shouldDecodeSourceDataOfMIMEType:(NSString *)encodingType
{
BOOL shouldDecode = NO;
#if DEBUG_LOGGING_ENABLED
NSLog(@"XPC Downloader wants decode source data of MIME type: %@", encodingType);
#endif
if (_callBacks.downloadShouldDecodeSourceData)
shouldDecode = _callBacks.downloadShouldDecodeSourceData(self, encodingType);
return shouldDecode;
}
@end
@@ -0,0 +1,29 @@
//
// SUDownloadServiceConstants.h
// Sparkle
//
// Created by Dmytro Tretiakov on 7/29/13.
//
//
#ifndef Sparkle_SUDownloadServiceConstants_h
#define Sparkle_SUDownloadServiceConstants_h
const char * SUDownloadServiceURLRequestDataKey = "request_data"; // data of archived NSURLRequest
const char * SUDownloadServiceDelegateConnectionKey = "connection"; // xpc_connection_t
const char * SUDownloadServiceFilePathKey = "file_path"; // c-string
const char * SUDownloadServiceReceivedDataLengthKey = "received_data_length"; // int64_t
const char * SUDownloadServiceReceivedResponseDataKey = "received_response_data"; // data of archived NSURLResponse
const char * SUDownloadServiceCreatedDestinationPathKey = "created_destination_path"; // c-string
const char * SUDownloadServiceDidBeginDownloadingKey = "did_begin_downloading"; // bool 1
const char * SUDownloadServiceDidFinishDownloadingKey = "did_finish_downloading"; // bool 1
const char * SUDownloadServiceReceivedFailErrorKey = "received_fail_error"; // data of archived NSError
const char * SUDownloadServiceMIMETypeToDecodeKey = "MIME_type_to_decode"; // c-string
const char * SUDownloadServiceShouldDecodeMIMETypeKey = "should_decode_MIME_type"; // bool
const char * SUDownloadServiceErrorCodeKey = "errcode"; // int64_t
const char * SUDownloadServiceErrorMessageKey = "errmsg"; // c-string
const char * SUDownloadServiceErrorDomainKey = "errdomain"; // c-string
#endif
@@ -0,0 +1,36 @@
//
// SUXPCURLDownload.h
// Sparkle
//
// Created by Erik Aderstedt on 2012-08-09.
//
//
#import <Foundation/Foundation.h>
@interface SUXPCURLDownload : NSObject
{
@private
id <NSURLDownloadDelegate> _delegate; // weak ref
xpc_connection_t _connection;
xpc_connection_t _delegateConnection;
NSURLRequest *_request;
NSThread *_startedThread; // weak ref
BOOL _isDownloading;
BOOL _allowOverwrite;
NSString *_destination;
NSString *_connectionDestination;
NSError *_downloadError;
}
- (id <NSURLDownloadDelegate>)delegate;
- (void)setDelegate:(id <NSURLDownloadDelegate>)delegate;
- (id)initWithRequest:(NSURLRequest *)request delegate:(id <NSURLDownloadDelegate>)delegate;
- (void)setDestination:(NSString *)path allowOverwrite:(BOOL)allowOverwrite;
// Delegate methods for this method will be called from another thread.
+ (NSData *)sendSynchronousRequest:(NSURLRequest *)request delegate:(id <NSURLDownloadDelegate>)delegate;
@end
+448
View File
@@ -0,0 +1,448 @@
//
// SUXPCURLDownload.m
// Sparkle
//
// Created by Erik Aderstedt on 2012-08-09.
//
//
#import "SUXPCURLDownload.h"
#import "SUDownloadServiceConstants.h"
#import "SUConstants.h"
#import "SULog.h"
static NSString * const kSUFetchFolderName = @"fetch.XXXXXXXX";
@interface SUXPCURLDownload (Private)
- (void)performBlock:(void (^)(void))block onThread:(NSThread *)thread synchronous:(BOOL)flag;
- (void)fireBlock:(void (^)(void))block;
@end
@implementation SUXPCURLDownload
+ (NSData *)sendSynchronousRequest:(NSURLRequest *)request delegate:(id <NSURLDownloadDelegate>)delegate
{
__block SUXPCURLDownload *download = nil;
static const char *sSynchronousDownloadQueueName = "com.devmate.SynchronousXPCDownloadQueue";
dispatch_queue_t queue = dispatch_queue_create(sSynchronousDownloadQueueName, NULL);
dispatch_sync(queue, ^{
download = [[SUXPCURLDownload alloc] initWithRequest:request delegate:delegate];
});
while (download && download->_isDownloading)
{
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.5]];
}
NSData *downloadData = (nil == download->_downloadError) ? [NSData dataWithContentsOfFile:download->_destination] : nil;
[download release];
dispatch_release(queue);
return downloadData;
}
- (id)initWithRequest:(NSURLRequest *)request delegate:(id <NSURLDownloadDelegate>)delegate
{
self = [super init];
if (self != nil)
{
_request = [request retain];
_delegate = [delegate retain];
_startedThread = [NSThread currentThread];
// Set up a connection.
_connection = [self getSandboxXPCService];
dispatch_async(dispatch_get_current_queue(), ^{
[self startDownload:request];
});
_isDownloading = YES;
}
return self;
}
- (void)dealloc
{
[self cancel];
[_request release];
[_destination release];
[_connectionDestination release];
[_downloadError release];
[super dealloc];
}
- (NSURLRequest *)request
{
return _request;
}
- (void)startDownload:(NSURLRequest *)urlRequest
{
// Send a message to download a specific url.
if ([_delegate respondsToSelector:@selector(download:decideDestinationWithSuggestedFilename:)] && _destination == nil)
{
void (^block)(void) = ^{
[_delegate download:(NSURLDownload *)self decideDestinationWithSuggestedFilename:[[urlRequest URL] lastPathComponent]];
};
[self performBlock:block onThread:_startedThread synchronous:YES];
}
if (nil == _destination)
{
_destination = [[[urlRequest URL] lastPathComponent] copy];
}
// ivar 'destination' now contains the destination URL.
NSURL *tempFolder = [NSURL fileURLWithPath:NSTemporaryDirectory()];
NSString *tempFileTemplate = [[tempFolder URLByAppendingPathComponent:kSUFetchFolderName] path];
NSString *tempFilePath = [tempFileTemplate stringByAppendingPathComponent:[_destination lastPathComponent]];
NSFileManager *fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:tempFilePath])
[fileManager removeItemAtPath:tempFilePath error:nil];
_connectionDestination = [tempFilePath copy];
NSData *requestData = [NSKeyedArchiver archivedDataWithRootObject:urlRequest];
xpc_object_t message = xpc_dictionary_create(NULL, NULL, 0);
xpc_dictionary_set_data(message, SUDownloadServiceURLRequestDataKey, [requestData bytes], [requestData length]);
xpc_dictionary_set_string(message, SUDownloadServiceFilePathKey, [tempFilePath cStringUsingEncoding:NSUTF8StringEncoding]);
xpc_dictionary_set_connection(message, SUDownloadServiceDelegateConnectionKey, _delegateConnection);
xpc_connection_send_message_with_reply(_connection, message, dispatch_get_main_queue(), ^(xpc_object_t object) {
xpc_type_t type = xpc_get_type(object);
if (type == XPC_TYPE_ERROR && nil == _downloadError)
{
NSString *errMessage = @"";
if (object == XPC_ERROR_CONNECTION_INTERRUPTED)
{
errMessage = @"Got XPC_ERROR_CONNECTION_INTERRUPTED error.";
}
else if (object == XPC_ERROR_CONNECTION_INVALID)
{
errMessage = @"Got XPC_ERROR_CONNECTION_INVALID error.";
}
NSDictionary *errInfo = [NSDictionary dictionaryWithObject:errMessage forKey:NSLocalizedDescriptionKey];
_downloadError = [[NSError alloc] initWithDomain:SUSparkleErrorDomain code:SUXPCServiceError userInfo:errInfo];
}
else if (type == XPC_TYPE_DICTIONARY && noErr != xpc_dictionary_get_int64(object, SUDownloadServiceErrorCodeKey) && nil == _downloadError)
{
NSInteger errCode = (NSInteger)xpc_dictionary_get_int64(object, SUDownloadServiceErrorCodeKey);
const char *errDomainStr = xpc_dictionary_get_string(object, SUDownloadServiceErrorDomainKey);
NSString *errDomain = errDomainStr ? [NSString stringWithUTF8String:errDomainStr] : NSCocoaErrorDomain;
const char *errMessage = xpc_dictionary_get_string(object, SUDownloadServiceErrorMessageKey) ? : "";
NSDictionary *errInfo = [NSDictionary dictionaryWithObject:[NSString stringWithUTF8String:errMessage]
forKey:NSLocalizedDescriptionKey];
_downloadError = [[NSError alloc] initWithDomain:errDomain code:errCode userInfo:errInfo];
}
if (nil != _downloadError)
{
if ([_delegate respondsToSelector:@selector(download:didFailWithError:)])
{
void (^block)(void) = ^{
[_delegate download:(NSURLDownload *)self didFailWithError:_downloadError];
_isDownloading = NO;
};
[self performBlock:block onThread:_startedThread synchronous:NO];
}
else
{
SULog(@"SUXPCURLDownload: got download error (%d - %@)", [_downloadError code], [_downloadError localizedDescription]);
_isDownloading = NO;
}
}
});
xpc_release(message);
}
- (id <NSURLDownloadDelegate>)delegate
{
return _delegate;
}
- (void)setDelegate:(id <NSURLDownloadDelegate>)delegate
{
_delegate = delegate;
}
- (void)setDestination:(NSString *)path allowOverwrite:(BOOL)allowOverwrite
{
[_destination release];
_destination = [path copy];
_allowOverwrite = allowOverwrite;
}
- (void)cancel
{
if (_connection)
{
xpc_connection_cancel(_connection);
xpc_release(_connection);
_connection = NULL;
}
if (_delegateConnection)
{
xpc_connection_cancel(_delegateConnection);
xpc_release(_delegateConnection);
_delegateConnection = NULL;
}
}
- (xpc_connection_t)getSandboxXPCService
{
// Set up two connections, one for instructing the XPC and getting a response,
// and another to listen for incoming connections for progress and file creation
// notifications.
_connection = xpc_connection_create("com.andymatuschak.Sparkle.download-service", dispatch_get_main_queue());
if (!_connection)
{
NSLog(@"Can't connect to XPC service");
return (NULL);
}
xpc_connection_set_event_handler(_connection, ^(xpc_object_t event) {
xpc_type_t type = xpc_get_type(event);
if (type == XPC_TYPE_ERROR)
{
if (event == XPC_ERROR_CONNECTION_INTERRUPTED)
{
NSLog(@"Got XPC_ERROR_CONNECTION_INTERRUPTED error.");
// The service has either cancaled itself, crashed, or been
// terminated. The XPC connection is still valid and sending a
// message to it will re-launch the service. If the service is
// state-full, this is the time to initialize the new service.
}
else if (event == XPC_ERROR_CONNECTION_INVALID)
{
NSLog(@"Got XPC_ERROR_CONNECTION_INVALID error.");
// The service is invalid. Either the service name supplied to
// xpc_connection_create() is incorrect or we (this process) have
// canceled the service; we can do any cleanup of appliation
// state at this point.
if (_delegateConnection)
{
xpc_connection_cancel(_delegateConnection);
xpc_release(_delegateConnection);
_delegateConnection = NULL;
}
}
}
});
dispatch_queue_t delegate_queue = dispatch_queue_create("com.andymatuschak.Sparkle.download-service-delegate", NULL);
assert(delegate_queue != NULL);
_delegateConnection = xpc_connection_create(NULL, delegate_queue);
xpc_connection_set_event_handler(_delegateConnection, ^(xpc_object_t event) {
xpc_type_t type = xpc_get_type(event);
if (type == XPC_TYPE_ERROR)
{
if (event == XPC_ERROR_TERMINATION_IMMINENT)
{
NSLog(@"received XPC_ERROR_TERMINATION_IMMINENT");
}
else if (event == XPC_ERROR_CONNECTION_INVALID)
{
NSLog(@"progress connection is closed");
dispatch_release(delegate_queue);
}
}
else if (type == XPC_TYPE_CONNECTION)
{
xpc_connection_t peer = (xpc_connection_t)event;
// A new anonymous connection, from an XPC service that wants to supply us with updates.
char *queue_name = NULL;
dispatch_queue_t peer_event_queue = dispatch_queue_create(queue_name, NULL);
assert(peer_event_queue != NULL);
free(queue_name);
xpc_connection_set_target_queue(peer, peer_event_queue);
xpc_connection_set_event_handler(peer, ^(xpc_object_t nevent) {
xpc_type_t ntype = xpc_get_type(nevent);
if (ntype == XPC_TYPE_ERROR && nevent == XPC_ERROR_CONNECTION_INVALID)
dispatch_release(peer_event_queue);
if (ntype != XPC_TYPE_DICTIONARY)
return;
__block xpc_object_t answer = xpc_dictionary_create_reply(nevent);
xpc_dictionary_apply(nevent, ^bool(const char *key, xpc_object_t value) {
NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init];
if (0 == strcmp(key, SUDownloadServiceDidBeginDownloadingKey))
{
if ([_delegate respondsToSelector:@selector(downloadDidBegin:)])
{
void (^block)(void) = ^ {
[_delegate downloadDidBegin:(NSURLDownload *)self];
};
[self performBlock:block onThread:_startedThread synchronous:NO];
}
}
else if (0 == strcmp(key, SUDownloadServiceReceivedResponseDataKey))
{
if ([_delegate respondsToSelector:@selector(download:didReceiveResponse:)])
{
size_t dataLength = 0;
const void * responseDataBytes = xpc_dictionary_get_data(nevent, SUDownloadServiceReceivedResponseDataKey, &dataLength);
NSData *responseData = [NSData dataWithBytes:responseDataBytes length:(NSUInteger)dataLength];
NSURLResponse *response = [NSKeyedUnarchiver unarchiveObjectWithData:responseData];
void (^block)(void) = ^ {
[_delegate download:(NSURLDownload *)self didReceiveResponse:response];
};
[self performBlock:block onThread:_startedThread synchronous:NO];
}
}
else if (0 == strcmp(key, SUDownloadServiceReceivedDataLengthKey))
{
if ([_delegate respondsToSelector:@selector(download:didReceiveDataOfLength:)])
{
int64_t dataLength = xpc_dictionary_get_int64(nevent, SUDownloadServiceReceivedDataLengthKey);
void (^block)(void) = ^ {
[_delegate download:(NSURLDownload *)self didReceiveDataOfLength:(NSUInteger)dataLength];
};
[self performBlock:block onThread:_startedThread synchronous:NO];
}
}
else if (0 == strcmp(key, SUDownloadServiceCreatedDestinationPathKey))
{
[_connectionDestination release];
_connectionDestination = [[NSString alloc] initWithCString:xpc_dictionary_get_string(nevent, SUDownloadServiceCreatedDestinationPathKey)
encoding:NSUTF8StringEncoding];
}
else if (0 == strcmp(key, SUDownloadServiceReceivedFailErrorKey))
{
size_t dataLength = 0;
const void * errorDataBytes = xpc_dictionary_get_data(nevent, SUDownloadServiceReceivedFailErrorKey, &dataLength);
NSData *errorData = [NSData dataWithBytes:errorDataBytes length:dataLength];
NSError *error = [NSKeyedUnarchiver unarchiveObjectWithData:errorData];
_downloadError = [error retain];
}
else if (0 == strcmp(key, SUDownloadServiceDidFinishDownloadingKey))
{
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *destPath = _destination;
if (nil == destPath || [destPath isEqualToString:[destPath lastPathComponent]])
{
destPath = _connectionDestination;
}
else if (!_allowOverwrite)
{
NSUInteger index = 1;
NSString *parentFolder = [destPath stringByDeletingLastPathComponent];
NSString *initialFileName = [[destPath lastPathComponent] stringByDeletingPathExtension];
NSString *fileExtension = [destPath pathExtension];
while ([fileManager fileExistsAtPath:destPath])
{
NSString *fileName = [initialFileName stringByAppendingFormat:@"_%ld", index];
destPath = [[parentFolder stringByAppendingPathComponent:fileName] stringByAppendingPathExtension:fileExtension];
++index;
}
}
NSError *error = nil;
BOOL success = YES;
if (![destPath isEqualToString:_connectionDestination])
{
success = success && [fileManager createDirectoryAtPath:[destPath stringByDeletingLastPathComponent]
withIntermediateDirectories:YES
attributes:nil
error:&error];
if (success && [fileManager fileExistsAtPath:destPath])
success = [fileManager removeItemAtPath:destPath error:&error];
success = success && [fileManager moveItemAtPath:_connectionDestination toPath:destPath error:&error];
}
if (success)
{
[self setDestination:destPath allowOverwrite:_allowOverwrite];
void (^block)(void) = ^ {
if ([_delegate respondsToSelector:@selector(download:didCreateDestination:)])
[_delegate download:(NSURLDownload *)self didCreateDestination:destPath];
if ([_delegate respondsToSelector:@selector(downloadDidFinish:)])
[_delegate downloadDidFinish:(NSURLDownload *)self];
_isDownloading = NO;
};
[self performBlock:block onThread:_startedThread synchronous:NO];
}
else
{
_downloadError = [error retain];
}
}
else if (0 == strcmp(key, SUDownloadServiceMIMETypeToDecodeKey))
{
void (^block)(void) = ^{
BOOL shouldDecode = NO;
if ([_delegate respondsToSelector:@selector(download:shouldDecodeSourceDataOfMIMEType:)])
{
NSString *MIMEType = [NSString stringWithCString:xpc_dictionary_get_string(nevent, SUDownloadServiceMIMETypeToDecodeKey)
encoding:NSUTF8StringEncoding];
shouldDecode = [_delegate download:(NSURLDownload *)self shouldDecodeSourceDataOfMIMEType:MIMEType];
}
xpc_dictionary_set_bool(answer, SUDownloadServiceShouldDecodeMIMETypeKey, YES);
};
[self performBlock:block onThread:_startedThread synchronous:YES];
}
[localPool release];
return true;
});
xpc_connection_send_message(peer, answer);
xpc_release(answer);
});
xpc_connection_resume(peer);
}
});
// Need to resume the service in order for it to process messages.
xpc_connection_resume(_delegateConnection);
xpc_connection_resume(_connection);
return _connection;
}
#pragma mark - Private
- (void)performBlock:(void (^)(void))block onThread:(NSThread *)thread synchronous:(BOOL)flag
{
void (^blockCopy)(void) = block != NULL ? Block_copy(block) : NULL;
[self performSelector:@selector(fireBlock:) onThread:thread withObject:blockCopy waitUntilDone:flag];
}
- (void)fireBlock:(void (^)(void))block
{
if (NULL == block)
return;
block();
Block_release(block);
}
@end
+265
View File
@@ -0,0 +1,265 @@
//
// main.m
// Downloading XPC Service
//
// Created by Erik Aderstedt on 2012-08-09.
// Based on the Apple sample code 'SandboxedFetch'.
//
#import <xpc/xpc.h>
#import <asl.h>
#import <assert.h>
#import <errno.h>
#import <stdio.h>
#import "SUDownloadServiceConstants.h"
#import "SUDSDownloader.h"
#import "SUConstants.h"
static void fetch_process_request(xpc_object_t request, xpc_object_t reply);
static void fetch_peer_event_handler(xpc_connection_t peer, xpc_object_t event);
static void fetch_event_handler(xpc_connection_t peer);
#pragma mark -
// Process the XPC request, create a temporary file to hold downloaded,
// data, and build/return XPC reply.
static void fetch_process_request(xpc_object_t request, xpc_object_t reply)
{
__block int32_t errcode = 0;
__block const char *errmsg = NULL;
__block const char *errdomain = NULL;
xpc_connection_t connection = NULL;
NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init];
do
{
size_t dataLength = 0;
const void *data = xpc_dictionary_get_data(request, SUDownloadServiceURLRequestDataKey, &dataLength);
NSData *requestData = [NSData dataWithBytes:data length:dataLength];
NSURLRequest *urlRequest = [NSKeyedUnarchiver unarchiveObjectWithData:requestData];
if (nil == urlRequest)
{
errcode = SUXPCServiceError;
errdomain = [SUSparkleErrorDomain cStringUsingEncoding:NSUTF8StringEncoding];
errmsg = "Invalid URL request data";
break;
}
// Get the URL and XPC connection from the XPC request
connection = xpc_dictionary_create_connection(request, SUDownloadServiceDelegateConnectionKey);
if (connection == NULL)
{
errcode = SUXPCServiceError;
errdomain = [SUSparkleErrorDomain cStringUsingEncoding:NSUTF8StringEncoding];
errmsg = "Invalid XPC delegate connection";
break;
}
// Set up XPC connection endpoint for sending progress reports and receiving cancel notification.
__block BOOL shouldStopDownload = NO;
xpc_connection_set_event_handler(connection, ^(xpc_object_t event) {
xpc_type_t type = xpc_get_type(event);
// If the remote end of this connection has gone away then stop download
if (XPC_TYPE_ERROR == type &&
(XPC_ERROR_CONNECTION_INTERRUPTED == event || XPC_ERROR_CONNECTION_INVALID == event))
{
asl_log(NULL, NULL, ASL_LEVEL_NOTICE, "Stopping download process...\n");
shouldStopDownload = YES;
}
});
xpc_connection_resume(connection);
NSString *destinationPath = [NSString stringWithCString:xpc_dictionary_get_string(request, SUDownloadServiceFilePathKey)
encoding:NSUTF8StringEncoding];
SUDSDownloader *downloader = [SUDSDownloader downloaderWithURLRequest:urlRequest
destinationPath:destinationPath];
SUDSDownloaderCallBacks callBacks = {0};
callBacks.downloadDidReceiveData = ^(SUDSDownloader *downloader, NSUInteger dataLength) {
xpc_object_t message = xpc_dictionary_create(NULL, NULL, 0);
xpc_dictionary_set_int64(message, SUDownloadServiceReceivedDataLengthKey, (int64_t)dataLength);
xpc_object_t answer = xpc_connection_send_message_with_reply_sync(connection, message);
xpc_release(message);
xpc_release(answer);
};
callBacks.downloadDidReceiveResponse = ^(SUDSDownloader *downloader, NSURLResponse *response) {
NSData *responseData = [NSKeyedArchiver archivedDataWithRootObject:response];
xpc_object_t message = xpc_dictionary_create(NULL, NULL, 0);
xpc_dictionary_set_data(message, SUDownloadServiceReceivedResponseDataKey, [responseData bytes], [responseData length]);
xpc_object_t answer = xpc_connection_send_message_with_reply_sync(connection, message);
xpc_release(message);
xpc_release(answer);
};
callBacks.downloadDidCreateDestination = ^(SUDSDownloader *downloader, NSString *destinationPath) {
xpc_object_t message = xpc_dictionary_create(NULL, NULL, 0);
xpc_dictionary_set_string(message, SUDownloadServiceCreatedDestinationPathKey, [destinationPath cStringUsingEncoding:NSUTF8StringEncoding]);
xpc_object_t answer = xpc_connection_send_message_with_reply_sync(connection, message);
xpc_release(message);
xpc_release(answer);
};
callBacks.downloadDidBegin = ^(SUDSDownloader *downloader) {
xpc_object_t message = xpc_dictionary_create(NULL, NULL, 0);
xpc_dictionary_set_bool(message, SUDownloadServiceDidBeginDownloadingKey, true);
xpc_object_t answer = xpc_connection_send_message_with_reply_sync(connection, message);
xpc_release(message);
xpc_release(answer);
};
callBacks.downloadDidFail = ^(SUDSDownloader *downloader, NSError *error) {
errcode = (int32_t)[error code];
errdomain = [[error domain] cStringUsingEncoding:NSUTF8StringEncoding];
errmsg = [[error localizedDescription] cStringUsingEncoding:NSUTF8StringEncoding];
NSData *errorData = [NSKeyedArchiver archivedDataWithRootObject:error];
xpc_object_t message = xpc_dictionary_create(NULL, NULL, 0);
xpc_dictionary_set_data(message, SUDownloadServiceReceivedFailErrorKey, [errorData bytes], [errorData length]);
xpc_object_t answer = xpc_connection_send_message_with_reply_sync(connection, message);
xpc_release(message);
xpc_release(answer);
};
callBacks.downloadDidFinish = ^(SUDSDownloader *downloader) {
xpc_object_t message = xpc_dictionary_create(NULL, NULL, 0);
xpc_dictionary_set_bool(message, SUDownloadServiceDidFinishDownloadingKey, true);
xpc_object_t answer = xpc_connection_send_message_with_reply_sync(connection, message);
xpc_release(message);
xpc_release(answer);
};
callBacks.downloadShouldDecodeSourceData = ^BOOL(SUDSDownloader *downloader, NSString *MIMEType) {
xpc_object_t message = xpc_dictionary_create(NULL, NULL, 0);
xpc_dictionary_set_string(message, SUDownloadServiceMIMETypeToDecodeKey, [MIMEType cStringUsingEncoding:NSUTF8StringEncoding]);
xpc_object_t answer = xpc_connection_send_message_with_reply_sync(connection, message);
xpc_release(message);
BOOL result = NO;
if (xpc_get_type(answer) == XPC_TYPE_DICTIONARY)
result = (BOOL)xpc_dictionary_get_bool(answer, SUDownloadServiceShouldDecodeMIMETypeKey);
xpc_release(answer);
return result;
};
[downloader setCallBacks:callBacks];
[downloader startDownload];
while ([downloader isInProgress])
{
if (shouldStopDownload)
{
[downloader stopDownload];
asl_log(NULL, NULL, ASL_LEVEL_NOTICE, "Download process stopped.\n");
break;
}
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.1, true);
}
}
while (NO);
[localPool release];
#if DEBUG_LOGGING_ENABLED
NSLog(@"Download process finished. Will send last message...");
#endif
// Clean up and add errcode/errmsg to reply
if (connection)
{
xpc_connection_cancel(connection);
xpc_release(connection);
}
xpc_dictionary_set_int64(reply, SUDownloadServiceErrorCodeKey, (int64_t)errcode);
if (errmsg)
{
xpc_dictionary_set_string(reply, SUDownloadServiceErrorMessageKey, errmsg);
}
if (errdomain)
{
xpc_dictionary_set_string(reply, SUDownloadServiceErrorDomainKey, errdomain);
}
}
static void fetch_peer_event_handler(xpc_connection_t peer, xpc_object_t event)
{
// Get the object type.
xpc_type_t type = xpc_get_type(event);
if (XPC_TYPE_ERROR == type)
{
// Handle an error.
if (XPC_ERROR_CONNECTION_INVALID == event)
{
// The client process on the other end of the connection
// has either crashed or cancelled the connection.
asl_log(NULL, NULL, ASL_LEVEL_NOTICE, "peer(%d) received "
"XPC_ERROR_CONNECTION_INVALID",
xpc_connection_get_pid(peer));
xpc_connection_cancel(peer);
}
else if (XPC_ERROR_TERMINATION_IMMINENT == event)
{
// Handle per-connection termination cleanup. This
// service is about to exit.
asl_log(NULL, NULL, ASL_LEVEL_NOTICE, "peer(%d) received "
"XPC_ERROR_TERMINATION_IMMINENT",
xpc_connection_get_pid(peer));
}
}
else if (XPC_TYPE_DICTIONARY == type)
{
xpc_object_t requestMessage = event;
xpc_object_t replyMessage = xpc_dictionary_create_reply(requestMessage);
assert(replyMessage != NULL);
// Process request and build a reply message.
fetch_process_request(requestMessage, replyMessage);
xpc_connection_send_message(peer, replyMessage);
xpc_release(replyMessage);
}
}
static void release_dispatch_queue(void *queue)
{
dispatch_release(queue);
}
static void fetch_event_handler(xpc_connection_t peer)
{
// Generate an unique name for the queue to handle messages from
// this peer and create a new dispatch queue for it.
char *queue_name = NULL;
asprintf(&queue_name, "%s-peer-%d", "com.andymatuschak.Sparkle.download-service", xpc_connection_get_pid(peer));
dispatch_queue_t peer_event_queue = dispatch_queue_create(queue_name, DISPATCH_QUEUE_SERIAL);
assert(peer_event_queue != NULL);
free(queue_name);
// Set the target queue for connection.
xpc_connection_set_target_queue(peer, peer_event_queue);
xpc_connection_set_context(peer, peer_event_queue);
xpc_connection_set_finalizer_f(peer, release_dispatch_queue);
// Set the handler block for connection.
xpc_connection_set_event_handler(peer, ^(xpc_object_t event) {
fetch_peer_event_handler(peer, event);
});
// Enable the peer connection to receive messages.
xpc_connection_resume(peer);
}
int main(int argc, const char *argv[])
{
xpc_main(fetch_event_handler);
exit(EXIT_FAILURE);
}
@@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */
BIN
View File
Binary file not shown.
+2 -2
View File
@@ -19,9 +19,9 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.5</string>
<string>${DYLIB_CURRENT_VERSION}</string>
<key>CFBundleShortVersionString</key>
<string>1.5 Beta (git)</string>
<string>${DYLIB_CURRENT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
@@ -0,0 +1,39 @@
//
// SUInstallServiceConstants.h
// Sparkle
//
// Created by Dmytro Tretiakov on 8/2/13.
//
//
#ifndef Sparkle_SUInstallServiceConstants_h
#define Sparkle_SUInstallServiceConstants_h
typedef enum _SUInstallSerciveTask
{
SUInstallServiceTaskCopyPath = 1LL,
SUInstallServiceTaskAuthCopyPath = 2LL,
SUInstallServiceTaskLaunchTask = 3LL
} SUInstallServiceTask;
const char * SUInstallServiceTaskTypeKey = "task_type"; // int64_t
// SUInstallServiceTaskCopyPath & SUInstallServiceTaskAuthCopyPath keys
const char * SUInstallServiceSourcePathKey = "source_path"; // c-string
const char * SUInstallServiceDestinationPathKey = "destination_path"; // c-string
const char * SUInstallServiceTempNameKey = "tmp_name"; // c-string
// SUInstallServiceTaskLaunchTask keys
const char * SUInstallServiceLaunchTaksPathKey = "launch_task_path";
const char * SUInstallServiceLaunchTaskArgumentsKey = "launch_task_arguments"; // xpc_array of c-strings
const char * SUInstallServiceLaunchTaskEnvironmentKey = "launch_task_environment"; // xpc_dictionary with keys and values of c-strings
const char * SUInstallServiceLaunchTaskCurrentDirKey = "launch_task_cur_dir"; // c-string
const char * SUInstallServiceLaunchTaskInputDataKey = "launch_task_input_data"; // xpc_data
const char * SUInstallServiceLaunchTaskReplyImmediatelyKey = "launch_task_reply_immediately"; // bool
// Reply keys
const char * SUInstallServiceErrorCodeKey = "error_code"; // int64_t
const char * SUInstallServiceErrorLocalizedDescriptionKey = "error_localized_description"; // c-string
const char * SUInstallServiceLaunchTaskOutputDataKey = "launch_task_output_data"; // xpc_data
#endif
+29
View File
@@ -0,0 +1,29 @@
//
// SUXPCInstaller.h
// Sparkle
//
// Created by Whitney Young on 3/19/12.
// Copyright (c) 2012 FadingRed. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface SUXPCInstaller : NSObject
+ (BOOL)copyPathWithAuthentication:(NSString *)src overPath:(NSString *)dst temporaryName:(NSString *)tmp error:(NSError **)outError;
+ (BOOL)copyPathContent:(NSString *)src toDirectory:(NSString *)dstDir error:(NSError **)outError; // dstDir will be created if absent
+ (void)launchTaskWithLaunchPath:(NSString *)path arguments:(NSArray *)arguments completionHandler:(void (^)(void))completionHandler;
+ (void)launchTaskWithPath:(NSString *)launchPath
arguments:(NSArray *)arguments
environment:(NSDictionary *)environment
currentDirectoryPath:(NSString *)currentDirPath
inputData:(NSData *)inputData
waitForTaskResult:(BOOL)waitForTaskResult
waitUntilDone:(BOOL)waitUntilDone // for sync/async logic
completionHandler:(void (^)(int result, NSData *outputData))completionHandler;
@end
+269
View File
@@ -0,0 +1,269 @@
//
// SUXPCInstaller.m
// Sparkle
//
// Created by Whitney Young on 3/19/12.
// Copyright (c) 2012 FadingRed. All rights reserved.
//
#import <xpc/xpc.h>
#import "SUXPCInstaller.h"
#import "SUInstallServiceConstants.h"
@implementation SUXPCInstaller
+ (xpc_connection_t)getSandboxXPCService
{
__block xpc_connection_t serviceConnection = xpc_connection_create("com.andymatuschak.Sparkle.install-service", dispatch_get_main_queue());
if (!serviceConnection)
{
NSLog(@"Can't connect to XPC service");
return (NULL);
}
xpc_connection_set_event_handler(serviceConnection, ^(xpc_object_t event) {
xpc_type_t type = xpc_get_type(event);
if (type == XPC_TYPE_ERROR)
{
if (event == XPC_ERROR_CONNECTION_INVALID)
{
// The service is invalid. Either the service name supplied to
// xpc_connection_create() is incorrect or we (this process) have
// canceled the service; we can do any cleanup of appliation
// state at this point.
xpc_release(serviceConnection);
}
}
});
// Need to resume the service in order for it to process messages.
xpc_connection_resume(serviceConnection);
return (serviceConnection);
}
+ (BOOL)copyPathWithAuthentication:(NSString *)src overPath:(NSString *)dst temporaryName:(NSString *)tmp error:(NSError **)outError
{
xpc_connection_t connection = [self getSandboxXPCService];
xpc_object_t message = xpc_dictionary_create(NULL, NULL, 0);
xpc_dictionary_set_int64(message, SUInstallServiceTaskTypeKey, (int64_t)SUInstallServiceTaskAuthCopyPath);
if (src)
xpc_dictionary_set_string(message, SUInstallServiceSourcePathKey, [src fileSystemRepresentation]);
if (dst)
xpc_dictionary_set_string(message, SUInstallServiceDestinationPathKey, [dst fileSystemRepresentation]);
if (tmp)
xpc_dictionary_set_string(message, SUInstallServiceTempNameKey, [tmp UTF8String]);
__block BOOL xpcDidReply = NO;
__block NSError *error = nil;
dispatch_queue_t queue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL);
xpc_connection_send_message_with_reply(connection, message, queue, ^(xpc_object_t response) {
if (XPC_TYPE_ERROR == xpc_get_type(response))
{
NSDictionary *errorInfo = [NSDictionary dictionaryWithObject:@"Internal XPC error."
forKey:NSLocalizedDescriptionKey];
error = [[NSError alloc] initWithDomain:SUSparkleErrorDomain code:SUXPCServiceError userInfo:errorInfo];
}
else if (XPC_TYPE_DICTIONARY == xpc_get_type(response))
{
const char *errorString = xpc_dictionary_get_string(response, SUInstallServiceErrorLocalizedDescriptionKey);
if (errorString != NULL)
{
NSDictionary *errorInfo = [NSDictionary dictionaryWithObject:[NSString stringWithCString:errorString encoding:NSUTF8StringEncoding]
forKey:NSLocalizedDescriptionKey];
error = [[NSError alloc] initWithDomain:SUSparkleErrorDomain code:SUXPCServiceError userInfo:errorInfo];
}
}
xpcDidReply = YES;
});
while (NO == xpcDidReply)
{
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.2]];
}
xpc_release(message);
dispatch_release(queue);
[error autorelease];
if (nil != error && NULL != outError)
{
*outError = error;
}
return (nil == error);
}
+ (BOOL)copyPathContent:(NSString *)src toDirectory:(NSString *)dstDir error:(NSError **)outError
{
xpc_connection_t connection = [self getSandboxXPCService];
xpc_object_t message = xpc_dictionary_create(NULL, NULL, 0);
xpc_dictionary_set_int64(message, SUInstallServiceTaskTypeKey, (int64_t)SUInstallServiceTaskCopyPath);
if (src)
xpc_dictionary_set_string(message, SUInstallServiceSourcePathKey, [src fileSystemRepresentation]);
if (dstDir)
xpc_dictionary_set_string(message, SUInstallServiceDestinationPathKey, [dstDir fileSystemRepresentation]);
__block BOOL xpcDidReply = NO;
__block NSError *error = nil;
dispatch_queue_t queue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL);
xpc_connection_send_message_with_reply(connection, message, queue, ^(xpc_object_t response) {
if (XPC_TYPE_ERROR == xpc_get_type(response))
{
NSDictionary *errorInfo = [NSDictionary dictionaryWithObject:@"Internal XPC error."
forKey:NSLocalizedDescriptionKey];
error = [[NSError alloc] initWithDomain:SUSparkleErrorDomain code:SUXPCServiceError userInfo:errorInfo];
}
else if (XPC_TYPE_DICTIONARY == xpc_get_type(response))
{
const char *errorString = xpc_dictionary_get_string(response, SUInstallServiceErrorLocalizedDescriptionKey);
if (errorString != NULL)
{
NSDictionary *errorInfo = [NSDictionary dictionaryWithObject:[NSString stringWithCString:errorString encoding:NSUTF8StringEncoding]
forKey:NSLocalizedDescriptionKey];
error = [[NSError alloc] initWithDomain:SUSparkleErrorDomain code:SUXPCServiceError userInfo:errorInfo];
}
}
xpcDidReply = YES;
});
while (NO == xpcDidReply)
{
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.2]];
}
xpc_release(message);
dispatch_release(queue);
[error autorelease];
if (nil != error && NULL != outError)
{
*outError = error;
}
return (nil == error);
}
+ (void)launchTaskWithLaunchPath:(NSString *)path arguments:(NSArray *)arguments completionHandler:(void (^)(void))completionHandler
{
void (^handler)(int, NSData *) = completionHandler != nil ? ^(int r, NSData *d) { completionHandler(); } : nil;
[self launchTaskWithPath:path
arguments:arguments
environment:nil
currentDirectoryPath:nil
inputData:nil
waitForTaskResult:NO
waitUntilDone:NO
completionHandler:handler];
}
+ (void)launchTaskWithPath:(NSString *)launchPath
arguments:(NSArray *)arguments
environment:(NSDictionary *)environment
currentDirectoryPath:(NSString *)currentDirPath
inputData:(NSData *)inputData
waitForTaskResult:(BOOL)waitForTaskResult
waitUntilDone:(BOOL)waitUntilDone
completionHandler:(void (^)(int result, NSData *outputData))completionHandler
{
xpc_connection_t connection = [self getSandboxXPCService];
xpc_object_t message = xpc_dictionary_create(NULL, NULL, 0);
xpc_dictionary_set_int64(message, SUInstallServiceTaskTypeKey, (int64_t)SUInstallServiceTaskLaunchTask);
if ([launchPath length])
{
xpc_dictionary_set_string(message, SUInstallServiceLaunchTaksPathKey, [launchPath fileSystemRepresentation]);
}
if ([arguments count])
{
xpc_object_t array = xpc_array_create(NULL, 0);
for (NSString *argument in arguments)
{
if (![argument isKindOfClass:[NSString class]])
argument = [argument description];
xpc_array_set_string(array, XPC_ARRAY_APPEND, [argument UTF8String]);
}
xpc_dictionary_set_value(message, SUInstallServiceLaunchTaskArgumentsKey, array);
xpc_release(array);
}
if ([environment count])
{
__block xpc_object_t dict = xpc_dictionary_create(NULL, NULL, 0);
[environment enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
NSString *xpc_key = [key isKindOfClass:[NSString class]] ? key : [key description];
NSString *xpc_value = [obj isKindOfClass:[NSString class]] ? obj : [obj description];
xpc_dictionary_set_string(dict, [xpc_key UTF8String], [xpc_value UTF8String]);
}];
xpc_dictionary_set_value(message, SUInstallServiceLaunchTaskEnvironmentKey, dict);
xpc_release(dict);
}
if ([currentDirPath length])
{
xpc_dictionary_set_string(message, SUInstallServiceLaunchTaskCurrentDirKey, [currentDirPath fileSystemRepresentation]);
}
if ([inputData length])
{
xpc_dictionary_set_data(message, SUInstallServiceLaunchTaskInputDataKey, [inputData bytes], [inputData length]);
}
xpc_dictionary_set_bool(message, SUInstallServiceLaunchTaskReplyImmediatelyKey, waitForTaskResult ? false : true);
__block BOOL xpcTaskDidReply = NO;
xpc_connection_send_message_with_reply(connection, message, dispatch_get_current_queue(), ^(xpc_object_t response) {
int taskResult = 0;
NSData *outputData = nil;
if (completionHandler != NULL)
{
xpc_type_t type = xpc_get_type(response);
if (type == XPC_TYPE_ERROR)
{
taskResult = SUXPCServiceError;
}
else if (type == XPC_TYPE_DICTIONARY)
{
taskResult = (int)xpc_dictionary_get_int64(response, SUInstallServiceErrorCodeKey);
size_t bytesLen = 0;
const void *bytes = xpc_dictionary_get_data(response, SUInstallServiceLaunchTaskOutputDataKey, &bytesLen);
if (NULL != bytes)
{
outputData = [NSData dataWithBytes:bytes length:bytesLen];
}
}
completionHandler(taskResult, outputData);
}
xpcTaskDidReply = YES;
});
xpc_release(message);
if (waitUntilDone)
{
while (NO == xpcTaskDidReply)
{
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.2]];
}
}
}
@end
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>XPCService</key>
<dict>
<key>ServiceType</key>
<string>Application</string>
<key>JoinExistingSession</key>
<true/>
</dict>
</dict>
</plist>
+377
View File
@@ -0,0 +1,377 @@
//
// main.m
// Update
//
// Created by Whitney Young on 3/19/12.
// Copyright (c) 2012 FadingRed. All rights reserved.
//
#include <xpc/xpc.h>
#include <asl.h>
#import <Foundation/Foundation.h>
#import "SUPlainInstallerInternals.h"
#import "SUInstallServiceConstants.h"
#import "SULog.h"
#import "SUConstants.h"
static xpc_object_t SUSICopyPathContent(xpc_object_t message)
{
if (NULL == message)
return NULL;
const char *src = xpc_dictionary_get_string(message, SUInstallServiceSourcePathKey);
const char *dst = xpc_dictionary_get_string(message, SUInstallServiceDestinationPathKey);
NSFileManager *manager = [NSFileManager defaultManager];
NSString *sourcePath = src ? [manager stringWithFileSystemRepresentation:src length:strlen(src)] : nil;
NSString *targetPath = dst ? [manager stringWithFileSystemRepresentation:dst length:strlen(dst)] : nil;
NSError *error = nil;
do
{
if (nil == sourcePath)
{
NSDictionary *errorInfo = [NSDictionary dictionaryWithObject:@"Source path is absent." forKey:NSLocalizedDescriptionKey];
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUXPCServiceError userInfo:errorInfo];
break;
}
if (nil == targetPath)
{
NSDictionary *errorInfo = [NSDictionary dictionaryWithObject:@"Destination path is absent." forKey:NSLocalizedDescriptionKey];
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUXPCServiceError userInfo:errorInfo];
break;
}
NSArray *contents = nil;
BOOL isSrcDirectory = NO;
BOOL isSrcExist = [manager fileExistsAtPath:sourcePath isDirectory:&isSrcDirectory];
isSrcDirectory = isSrcDirectory && ![[NSWorkspace sharedWorkspace] isFilePackageAtPath:sourcePath];
if (isSrcExist && isSrcDirectory)
{
contents = [manager contentsOfDirectoryAtPath:sourcePath error:&error];
}
else if (isSrcExist)
{
contents = [NSArray arrayWithObject:@""];
}
else
{
NSDictionary *errorInfo = [NSDictionary dictionaryWithObject:@"Source does not exist on disk." forKey:NSLocalizedDescriptionKey];
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUXPCServiceError userInfo:errorInfo];
}
if (nil != error)
{
break;
}
BOOL isDstDirectory = NO;
BOOL isDstExist = [manager fileExistsAtPath:targetPath isDirectory:&isDstDirectory];
if (isSrcDirectory && (!isDstExist || !isDstDirectory))
{
if (isDstExist)
[manager removeItemAtPath:targetPath error:&error];
[manager createDirectoryAtPath:targetPath withIntermediateDirectories:YES attributes:nil error:&error];
}
else if (!isSrcDirectory)
{
if (isDstExist && !isDstDirectory)
[manager removeItemAtPath:targetPath error:&error];
[manager createDirectoryAtPath:targetPath withIntermediateDirectories:YES attributes:nil error:&error];
}
if (nil != error)
{
break;
}
for (NSString *item in contents)
{
NSString *fromPath = [item length] ? [sourcePath stringByAppendingPathComponent:item] : sourcePath;
NSString *toPath = [item length] ? [targetPath stringByAppendingPathComponent:item] : [targetPath stringByAppendingPathComponent:[sourcePath lastPathComponent]];
if (![manager isReadableFileAtPath:fromPath])
{
SULog(@"XPC Install Service: will skip \"%@\"", fromPath);
continue;
}
SULog(@"XPC Install Service: will copy \"%@\" to \"%@\"", fromPath, toPath);
if ([manager fileExistsAtPath:toPath])
[manager removeItemAtPath:toPath error:&error];
if (![manager copyItemAtPath:fromPath toPath:toPath error:&error])
break;
}
}
while (NO);
xpc_object_t reply = xpc_dictionary_create_reply(message);
if (nil != error)
{
xpc_dictionary_set_int64(reply, SUInstallServiceErrorCodeKey, (int64_t)[error code]);
const char *errorMsg = [[error localizedDescription] length] ? [[error localizedDescription] UTF8String] : "";
xpc_dictionary_set_string(reply, SUInstallServiceErrorLocalizedDescriptionKey, errorMsg);
}
return reply;
}
static xpc_object_t SUISCopyPathWithAuthentication(xpc_object_t message)
{
if (NULL == message)
return NULL;
const char *src = xpc_dictionary_get_string(message, SUInstallServiceSourcePathKey);
const char *dst = xpc_dictionary_get_string(message, SUInstallServiceDestinationPathKey);
const char *tmp = xpc_dictionary_get_string(message, SUInstallServiceTempNameKey);
NSFileManager *manager = [NSFileManager defaultManager];
NSString *relaunchPathToCopy = src ? [manager stringWithFileSystemRepresentation:src length:strlen(src)] : nil;
NSString *targetPath = dst ? [manager stringWithFileSystemRepresentation:dst length:strlen(dst)] : nil;
NSString *temporaryName = tmp ? [NSString stringWithUTF8String:tmp] : nil;
NSError *error = nil;
BOOL result = [SUPlainInstaller copyPathWithAuthentication:relaunchPathToCopy overPath:targetPath temporaryName:temporaryName error:&error];
// send response to indicate ok
xpc_object_t reply = xpc_dictionary_create_reply(message);
if (!result && error != nil)
{
xpc_dictionary_set_int64(reply, SUInstallServiceErrorCodeKey, (int64_t)[error code]);
const char *errorMsg = [[error localizedDescription] length] ? [[error localizedDescription] UTF8String] : "";
xpc_dictionary_set_string(reply, SUInstallServiceErrorLocalizedDescriptionKey, errorMsg);
}
return reply;
}
static xpc_object_t SUISLaunchTask(xpc_object_t message)
{
if (NULL == message)
return NULL;
const char *path = xpc_dictionary_get_string(message, SUInstallServiceLaunchTaksPathKey);
NSString *launchPath = path ? [[NSFileManager defaultManager] stringWithFileSystemRepresentation:path length:strlen(path)] : nil;
xpc_object_t array = xpc_dictionary_get_value(message, SUInstallServiceLaunchTaskArgumentsKey);
NSArray *arguments = nil;
if (NULL != array)
{
size_t count = xpc_array_get_count(array);
NSMutableArray *mutableArgs = [NSMutableArray arrayWithCapacity:count];
for (size_t i = 0; i < count; i++)
{
[mutableArgs addObject:[NSString stringWithUTF8String:xpc_array_get_string(array, i)]];
}
arguments = mutableArgs;
}
xpc_object_t dict = xpc_dictionary_get_value(message, SUInstallServiceLaunchTaskEnvironmentKey);
NSDictionary *environment = nil;
if (NULL != dict)
{
size_t count = xpc_dictionary_get_count(dict);
__block NSMutableDictionary *mutableEnv = [NSMutableDictionary dictionaryWithCapacity:count];
xpc_dictionary_apply(dict, ^bool(const char *key, xpc_object_t value) {
NSString *envKey = [NSString stringWithUTF8String:key];
NSString *envValue = [NSString stringWithUTF8String:value];
[mutableEnv setObject:envValue forKey:envKey];
return true;
});
environment = mutableEnv;
}
path = xpc_dictionary_get_string(message, SUInstallServiceLaunchTaskCurrentDirKey);
NSString *currentDirPath = path ? [[NSFileManager defaultManager] stringWithFileSystemRepresentation:path length:strlen(path)] : nil;
size_t bytesLen = 0;
const void *bytes = xpc_dictionary_get_data(message, SUInstallServiceLaunchTaskInputDataKey, &bytesLen);
NSData *inputData = bytes ? [NSData dataWithBytes:bytes length:bytesLen] : nil;
bool shouldReplyImmediatly = xpc_dictionary_get_bool(message, SUInstallServiceLaunchTaskReplyImmediatelyKey);
// prepare NSTask
NSTask *task = [[[NSTask alloc] init] autorelease];
NSPipe *inputPipe = [NSPipe pipe];
NSPipe *outputPipe = [NSPipe pipe];
[task setStandardInput:inputPipe];
[task setStandardOutput:outputPipe];
[task setStandardError:outputPipe];
if (launchPath != nil)
[task setLaunchPath:launchPath];
if ([arguments count])
[task setArguments:arguments];
if ([environment count])
[task setEnvironment:environment];
if (currentDirPath != nil)
[task setCurrentDirectoryPath:currentDirPath];
__block NSData *outputData = nil;
__block int taskResult = 0;
__block BOOL isTaskRunning = YES;
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
NSArray *notificationObjects = nil;
if (!shouldReplyImmediatly)
{
id object1 = [notificationCenter addObserverForName:NSFileHandleReadToEndOfFileCompletionNotification
object:[outputPipe fileHandleForReading]
queue:[NSOperationQueue mainQueue]
usingBlock:^(NSNotification *note) {
outputData = [[[note userInfo] objectForKey:NSFileHandleNotificationDataItem] retain];
isTaskRunning = NO;
}];
id object2 = [notificationCenter addObserverForName:NSTaskDidTerminateNotification
object:task
queue:[NSOperationQueue mainQueue]
usingBlock:^(NSNotification *note) {
taskResult = [task terminationStatus];
}];
notificationObjects = [NSArray arrayWithObjects:object1, object2, nil];
}
[[outputPipe fileHandleForReading] readToEndOfFileInBackgroundAndNotifyForModes:[NSArray arrayWithObject:NSDefaultRunLoopMode]];
@try
{
[task launch];
if ([inputData length])
{
[[inputPipe fileHandleForWriting] writeData:inputData];
[[inputPipe fileHandleForWriting] closeFile];
}
if (!shouldReplyImmediatly)
{
// loop until we are done receiving the data
while (YES == isTaskRunning)
{
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.5, true);
}
}
}
@catch (...)
{
taskResult = SUXPCServiceError;
}
// send response to indicate ok
xpc_object_t reply = xpc_dictionary_create_reply(message);
xpc_dictionary_set_int64(reply, SUInstallServiceErrorCodeKey, (int64_t)taskResult);
if (outputData != nil)
{
xpc_dictionary_set_data(reply, SUInstallServiceLaunchTaskOutputDataKey, [outputData bytes], [outputData length]);
}
for (id object in notificationObjects)
{
[notificationCenter removeObserver:object];
}
[outputData release];
return reply;
}
static void peer_event_handler(xpc_connection_t peer, xpc_object_t event)
{
xpc_type_t type = xpc_get_type(event);
if (type == XPC_TYPE_ERROR)
{
if (event == XPC_ERROR_CONNECTION_INVALID)
{
// The client process on the other end of the connection has either
// crashed or cancelled the connection. After receiving this error,
// the connection is in an invalid state, and you do not need to
// call xpc_connection_cancel(). Just tear down any associated state
// here.
}
else if (event == XPC_ERROR_TERMINATION_IMMINENT)
{
// Handle per-connection termination cleanup.
}
}
else if (type == XPC_TYPE_DICTIONARY)
{
// Handle the message.
SUInstallServiceTask task = (SUInstallServiceTask)xpc_dictionary_get_int64(event, SUInstallServiceTaskTypeKey);
NSLog(@"XPC Installer: should start task with id = %lld", (int64_t)task);
xpc_object_t reply = NULL;
NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init];
switch (task)
{
case SUInstallServiceTaskCopyPath:
{
reply = SUSICopyPathContent(event);
break;
}
case SUInstallServiceTaskAuthCopyPath:
{
reply = SUISCopyPathWithAuthentication(event);
break;
}
case SUInstallServiceTaskLaunchTask:
{
reply = SUISLaunchTask(event);
break;
}
default:
{
SULog(@"XPC Install Service: Unknown XPC service task %lld", (int64_t)task);
reply = xpc_dictionary_create_reply(event);
xpc_dictionary_set_int64(reply, SUInstallServiceErrorCodeKey, (int64_t)SUXPCServiceError);
xpc_dictionary_set_string(reply, SUInstallServiceErrorLocalizedDescriptionKey, "Unknown install cervice task.");
break;
}
}
[localPool release];
if (NULL == reply)
{
reply = xpc_dictionary_create_reply(event);
}
xpc_connection_send_message(peer, reply);
xpc_release(reply);
}
}
static void event_handler(xpc_connection_t peer)
{
// By defaults, new connections will target the default dispatch
// concurrent queue.
xpc_connection_set_event_handler(peer, ^(xpc_object_t event) {
peer_event_handler(peer, event);
});
// This will tell the connection to begin listening for events. If you
// have some other initialization that must be done asynchronously, then
// you can defer this call until after that initialization is done.
xpc_connection_resume(peer);
}
int main(int argc, const char *argv[])
{
xpc_main(event_handler);
return 0;
}
@@ -0,0 +1,11 @@
//
// install_service.pch
// Sparkle
//
// Created by Dmytro Tretiakov on 4/25/14.
//
//
#define SPARKLE_BUNDLE [NSBundle mainBundle]
#define SULocalizedString(key,comment) NSLocalizedStringFromTableInBundle(key, @"Sparkle", SPARKLE_BUNDLE, comment)
+4 -2
View File
@@ -9,6 +9,8 @@
#ifndef NTSYNCHRONOUSTASK_H
#define NTSYNCHRONOUSTASK_H
#import <Foundation/Foundation.h>
@interface NTSynchronousTask : NSObject
{
@private
@@ -23,9 +25,9 @@
// pass nil for directory if not needed
// returns the result
+(int) task:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input output: (NSData**)outData;
+ (int)task:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input output:(NSData**)outData;
+(NSData*)task:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input;
+ (NSData*)task:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input;
- (void)run:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input;
- (int)result;
+2 -6
View File
@@ -6,12 +6,8 @@
// Copyright 2005 Steve Gehrman. All rights reserved.
//
#import "SUUpdater.h"
#import "SUAppcast.h"
#import "SUAppcastItem.h"
#import "SUVersionComparisonProtocol.h"
#import "NTSynchronousTask.h"
#import <AppKit/NSApplication.h>
@implementation NTSynchronousTask
@@ -232,7 +228,7 @@
}
+(int) task:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input output: (NSData**)outData
+ (int)task:(NSString*)toolPath directory:(NSString*)currentDirectory withArgs:(NSArray*)args input:(NSData*)input output:(NSData**)outData
{
// we need this wacky pool here, otherwise we run out of pipes, the pipes are internally autoreleased
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
Binary file not shown.
+21
View File
@@ -0,0 +1,21 @@
{\rtf1\ansi\ansicpg1252\cocoartf1265\cocoasubrtf210
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;\red38\green38\blue38;}
\margl1440\margr1440\vieww9000\viewh8400\viewkind0
\deftab720
\pard\pardeftab720
\f0\b\fs26 \cf2 Version 2.0.1:\
\pard\pardeftab720\sl380
\b0 \cf2 \'96 Bug fixing for the application updates in Sandboxed environment.\
\pard\pardeftab720
\cf2 \
\pard\pardeftab720
\b \cf2 Version 2.0:\
\pard\pardeftab720\sl380
\b0 \cf2 \'96 Works correctly with Sandboxed environment\
\'96 Added simple integration of beta updates check and test mode\
\'96 Integrated with DevMate service (sends additional info for statistics)}
+41
View File
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>rules</key>
<dict>
<key>^Resources/</key>
<true/>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^version.plist$</key>
<true/>
<key>^Headers/</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^PrivateHeaders/</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
</dict>
</dict>
</plist>
+5 -2
View File
@@ -14,21 +14,24 @@
{
@private
NSArray *items;
NSString *userAgentString;
NSMutableDictionary *appcastValues;
id delegate;
NSString *downloadFilename;
NSURLDownload *download;
}
- (void)fetchAppcastFromURL:(NSURL *)url;
- (void)setDelegate:delegate;
- (void)setDelegate:(id)delegate;
- (void)setUserAgentString:(NSString *)userAgentString;
- (void)setAppcastValue:(NSString *)value forKey:(NSString *)key;
- (void)setAllAppcastValues:(NSDictionary *)inAppcastValues;
- (NSArray *)items;
@end
@interface NSObject (SUAppcastDelegate)
- (void)appcast:(SUAppcast *)appcast willFetchURLRequest:(NSMutableURLRequest *)request;
- (void)appcastDidFinishLoading:(SUAppcast *)appcast;
- (void)appcast:(SUAppcast *)appcast failedToLoadWithError:(NSError *)error;
@end
+49 -15
View File
@@ -6,7 +6,7 @@
// Copyright 2006 Andy Matuschak. All rights reserved.
//
#import "SUUpdater.h"
#import "SUUpdater_Private.h"
#import "SUAppcast.h"
#import "SUAppcastItem.h"
@@ -14,6 +14,7 @@
#import "SUAppcast.h"
#import "SUConstants.h"
#import "SULog.h"
#import "SUXPCURLDownload.h"
@interface NSXMLElement (SUAppcastExtensions)
- (NSDictionary *)attributesAsDictionary;
@@ -42,13 +43,9 @@
- (void)dealloc
{
[items release];
items = nil;
[userAgentString release];
userAgentString = nil;
[appcastValues release];
[downloadFilename release];
downloadFilename = nil;
[download release];
download = nil;
[super dealloc];
}
@@ -61,10 +58,20 @@
- (void)fetchAppcastFromURL:(NSURL *)url
{
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:30.0];
if (userAgentString)
[request setValue:userAgentString forHTTPHeaderField:@"User-Agent"];
download = [[NSURLDownload alloc] initWithRequest:request delegate:self];
if ([appcastValues count])
[request setAllHTTPHeaderFields:appcastValues];
if ([delegate respondsToSelector:@selector(appcast:willFetchURLRequest:)])
[delegate appcast:self willFetchURLRequest:request];
if (SUShouldUseXPCDownloader())
{
download = (NSURLDownload *)[[SUXPCURLDownload alloc] initWithRequest:request delegate:self];
}
else
{
download = [[NSURLDownload alloc] initWithRequest:request delegate:self];
}
}
- (void)download:(NSURLDownload *)aDownload decideDestinationWithSuggestedFilename:(NSString *)filename
@@ -286,11 +293,38 @@
- (void)setUserAgentString:(NSString *)uas
{
if (uas != userAgentString)
{
[userAgentString release];
userAgentString = [uas copy];
}
[self setAppcastValue:uas forKey:@"User-Agent"];
}
- (void)setAppcastValue:(NSString *)value forKey:(NSString *)key
{
if (nil == key)
return;
if (nil == appcastValues)
appcastValues = [[NSMutableDictionary alloc] init];
if (nil == value)
[appcastValues removeObjectForKey:key];
else
[appcastValues setValue:[[value copy] autorelease] forKey:key];
}
- (void)setAllAppcastValues:(NSDictionary *)inAppcastValues
{
if (0 == [inAppcastValues count])
return;
NSEnumerator *keyEnumerator = [inAppcastValues keyEnumerator];
id key = nil;
while ((key = [keyEnumerator nextObject]))
{
id value = [inAppcastValues objectForKey:key];
if (![key isKindOfClass:[NSString class]] || ![value isKindOfClass:[NSString class]])
continue;
[self setAppcastValue:value forKey:key];
}
}
- (void)setDelegate:del
+42 -1
View File
@@ -11,9 +11,50 @@
#import "SUAutomaticUpdateAlert.h"
#import "SUHost.h"
#import "SUConstants.h"
#import "SUUpdater_Private.h"
#import "SUXPCURLDownload.h"
@implementation SUAutomaticUpdateDriver
// -------------------------------------------------------------------
#if SPARKLE_IS_COMPATIBLE_WITH_DEVMATE
static NSString * const kSUAutomaticUpdateParamName = @"autoupdate";
- (void)downloadReleaseNotesAndWaitUntilDone
{
NSURL *releaseNotesURL = [updateItem releaseNotesURL];
if (nil == releaseNotesURL || [releaseNotesURL isFileURL])
return;
NSString *URLString = [releaseNotesURL absoluteString];
URLString = [URLString stringByAppendingFormat:@"%@%@=1", ([releaseNotesURL query] != nil) ? @"&" : @"?", kSUAutomaticUpdateParamName];
releaseNotesURL = [NSURL URLWithString:URLString];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:releaseNotesURL];
[request setCachePolicy:NSURLRequestReloadIgnoringCacheData];
[self updateURLRequestIfNeeds:request];
if (SUShouldUseXPCDownloader())
{
[SUXPCURLDownload sendSynchronousRequest:request delegate:nil];
}
else
{
[NSURLConnection sendSynchronousRequest:request returningResponse:NULL error:NULL];
}
}
- (void)didFindValidUpdate
{
// For correct DevMate statistics need to send request for Release Notes.
[self downloadReleaseNotesAndWaitUntilDone];
[super didFindValidUpdate];
}
#endif // SPARKLE_IS_COMPATIBLE_WITH_DEVMATE
// -------------------------------------------------------------------
- (void)unarchiverDidFinish:(SUUnarchiver *)ua
{
alert = [[SUAutomaticUpdateAlert alloc] initWithAppcastItem:updateItem host:host delegate:self];
@@ -36,7 +77,7 @@
- (void)applicationDidBecomeActive:(NSNotification *)aNotification
{
[[alert window] makeKeyAndOrderFront:self];
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"NSApplicationDidBecomeActiveNotification" object:NSApp];
[[NSNotificationCenter defaultCenter] removeObserver:self name:NSApplicationDidBecomeActiveNotification object:NSApp];
}
- (void)automaticUpdateAlert:(SUAutomaticUpdateAlert *)aua finishedWithChoice:(SUAutomaticInstallationChoice)choice;
+1
View File
@@ -36,6 +36,7 @@
- (void)didFindValidUpdate;
- (void)didNotFindUpdate;
- (void)updateURLRequestIfNeeds:(NSMutableURLRequest *)request;
- (void)downloadUpdate;
- (void)download:(NSURLDownload *)d decideDestinationWithSuggestedFilename:(NSString *)name;
- (void)downloadDidFinish:(NSURLDownload *)d;
+93 -6
View File
@@ -20,6 +20,27 @@
#import "SUBinaryDeltaCommon.h"
#import "SUCodeSigningVerifier.h"
#import "SUUpdater_Private.h"
#import "SUXPCInstaller.h"
#import "SUXPCURLDownload.h"
#if SPARKLE_IS_COMPATIBLE_WITH_DEVMATE
CF_EXPORT CFDictionaryRef DMCopyHTTPRequestHeaders(CFBundleRef appBundle, CFDataRef httpBodyData);
NSArray *SUGetAllDevMateURLHosts(void);
NSArray *SUGetAllDevMateURLHosts(void)
{
static NSArray *sAllKnownDevMateURLHosts = nil;
if (nil == sAllKnownDevMateURLHosts)
{
sAllKnownDevMateURLHosts = [[NSArray alloc] initWithObjects:
@"updates.devmate.com",
@"test.updates.aws.devmate.vpn",
nil];
}
return sAllKnownDevMateURLHosts;
}
#endif
@interface SUBasicUpdateDriver () <NSURLDownloadDelegate>; @end
@@ -140,6 +161,27 @@
[self abortUpdateWithError:error];
}
- (void)appcast:(SUAppcast *)appcast willFetchURLRequest:(NSMutableURLRequest *)request
{
[self updateURLRequestIfNeeds:request];
}
- (void)updateURLRequestIfNeeds:(NSMutableURLRequest *)request
{
#if SPARKLE_IS_COMPATIBLE_WITH_DEVMATE
if ([SUGetAllDevMateURLHosts() containsObject:[[request URL] host]])
{
CFBundleRef hostBundle = CFBundleCreate(kCFAllocatorDefault, (CFURLRef)[NSURL fileURLWithPath:[host bundlePath]]);
NSDictionary *devmateHeaders = (NSDictionary *)DMCopyHTTPRequestHeaders(hostBundle, NULL) ? : [NSDictionary new];
[request setAllHTTPHeaderFields:(NSDictionary *)devmateHeaders];
[devmateHeaders release];
if (NULL != hostBundle)
CFRelease(hostBundle);
}
#endif
}
- (void)didFindValidUpdate
{
if ([[updater delegate] respondsToSelector:@selector(updater:didFindValidUpdate:)])
@@ -158,11 +200,24 @@
{
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[updateItem fileURL]];
[request setValue:[updater userAgentString] forHTTPHeaderField:@"User-Agent"];
download = [[NSURLDownload alloc] initWithRequest:request delegate:self];
[self updateURLRequestIfNeeds:request];
if (SUShouldUseXPCDownloader())
download = (NSURLDownload *)[[SUXPCURLDownload alloc] initWithRequest:request delegate:self];
else
download = [[NSURLDownload alloc] initWithRequest:request delegate:self];
}
- (void)download:(NSURLDownload *)d decideDestinationWithSuggestedFilename:(NSString *)name
{
if (SUShouldUseXPCDownloader())
{
// The downloader will determine a file name, somewhere within our sandbox.
downloadPath = nil;
[d setDestination:name allowOverwrite:YES];
return;
}
// If name ends in .txt, the server probably has a stupid MIME configuration. We'll give the developer the benefit of the doubt and chop that off.
if ([[name pathExtension] isEqualToString:@"txt"])
name = [name stringByDeletingPathExtension];
@@ -204,6 +259,13 @@
[download setDestination:downloadPath allowOverwrite:YES];
}
- (void)download:(NSURLDownload *)download didCreateDestination:(NSString *)path {
[downloadPath autorelease];
downloadPath = [path retain];
[tempDir autorelease];
tempDir = [[downloadPath stringByDeletingLastPathComponent] retain];
}
- (BOOL)validateUpdateDownloadedToPath:(NSString *)downloadedPath extractedToPath:(NSString *)extractedPath DSASignature:(NSString *)DSASignature publicDSAKey:(NSString *)publicDSAKey
{
NSString *newBundlePath = [SUInstaller appPathInUpdateFolder:extractedPath forHost:host];
@@ -238,7 +300,7 @@
}
- (void)extractUpdate
{
{
SUUnarchiver *unarchiver = [SUUnarchiver unarchiverForPath:downloadPath updatingHost:host];
if (!unarchiver)
{
@@ -326,7 +388,23 @@
#endif
// Only the paranoid survive: if there's already a stray copy of relaunch there, we would have problems.
if( [SUPlainInstaller copyPathWithAuthentication: relaunchPathToCopy overPath: targetPath temporaryName: nil error: &error] )
BOOL copiedRelaunchTool = NO;
if (SUShouldUseXPCInstaller())
{
copiedRelaunchTool = [SUXPCInstaller copyPathWithAuthentication:relaunchPathToCopy overPath:targetPath temporaryName:nil error:&error];
}
else
{
copiedRelaunchTool = [SUPlainInstaller copyPathWithAuthentication:relaunchPathToCopy overPath:targetPath temporaryName:nil error:&error];
}
[self finishRelaunchAfterSuccessfulCopying:copiedRelaunchTool fromPath:relaunchPathToCopy toPath:targetPath relaunch:relaunch];
}
- (void)finishRelaunchAfterSuccessfulCopying:(BOOL)copiedRelaunchTool fromPath:(NSString *)relaunchPathToCopy toPath:(NSString *)targetPath relaunch:(BOOL)relaunch
{
NSError *error = nil;
if( copiedRelaunchTool )
relaunchPath = [targetPath retain];
else
[self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURelaunchError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:SULocalizedString(@"An error occurred while extracting the archive. Please try again later.", nil), NSLocalizedDescriptionKey, [NSString stringWithFormat:@"Couldn't copy relauncher (%@) to temporary path (%@)! %@", relaunchPathToCopy, targetPath, (error ? [error localizedDescription] : @"")], NSLocalizedFailureReasonErrorKey, nil]]];
@@ -347,9 +425,18 @@
if ([[updater delegate] respondsToSelector:@selector(pathToRelaunchForUpdater:)])
pathToRelaunch = [[updater delegate] pathToRelaunchForUpdater:updater];
NSString *relaunchToolPath = [relaunchPath stringByAppendingPathComponent: @"/Contents/MacOS/finish_installation"];
[NSTask launchedTaskWithLaunchPath: relaunchToolPath arguments:[NSArray arrayWithObjects:[host bundlePath], pathToRelaunch, [NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]], tempDir, relaunch ? @"1" : @"0", nil]];
[NSApp terminate:self];
NSArray *arguments = [NSArray arrayWithObjects:[host bundlePath], pathToRelaunch, [NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]], tempDir, relaunch ? @"1" : @"0", nil];
if (SUShouldUseXPCInstaller())
{
[SUXPCInstaller launchTaskWithLaunchPath:relaunchToolPath arguments:arguments completionHandler:^{
[NSApp terminate:self];
}];
}
else
{
[NSTask launchedTaskWithLaunchPath:relaunchToolPath arguments:arguments];
[NSApp terminate:self];
}
}
- (void)cleanUpDownload
-1
View File
@@ -11,7 +11,6 @@
#import "SUBinaryDeltaApply.h"
#import "SUUnarchiver_Private.h"
#import "SUHost.h"
#import "NTSynchronousTask.h"
@implementation SUBinaryDeltaUnarchiver
+8
View File
@@ -12,8 +12,16 @@
#import <Foundation/Foundation.h>
@interface SUCodeSigningVerifier : NSObject
+ (BOOL)codeSignatureIsValidAtPath:(NSString *)destinationPath error:(NSError **)error;
+ (BOOL)hostApplicationIsCodeSigned;
+ (BOOL)hostApplicationIsSandboxed;
+ (BOOL)hostAppAllowsNetworkOutgoingConnections;
@end
FOUNDATION_EXTERN BOOL SUShouldUseXPCDownloader(void);
FOUNDATION_EXTERN BOOL SUShouldUseXPCInstaller(void);
#endif
+143 -15
View File
@@ -13,13 +13,11 @@
@implementation SUCodeSigningVerifier
extern OSStatus SecCodeCopySelf(SecCSFlags flags, SecCodeRef *self) __attribute__((weak_import));
extern OSStatus SecCodeCopyDesignatedRequirement(SecStaticCodeRef code, SecCSFlags flags, SecRequirementRef *requirement) __attribute__((weak_import));
extern OSStatus SecStaticCodeCreateWithPath(CFURLRef path, SecCSFlags flags, SecStaticCodeRef *staticCode) __attribute__((weak_import));
extern OSStatus SecStaticCodeCheckValidityWithErrors(SecStaticCodeRef staticCode, SecCSFlags flags, SecRequirementRef requirement, CFErrorRef *errors) __attribute__((weak_import));
extern OSStatus SecRequirementCreateWithString(CFStringRef text, SecCSFlags flags, SecRequirementRef *requirement) __attribute__((weak_import));
extern OSStatus SecCodeCheckValidity(SecCodeRef code, SecCSFlags flags, SecRequirementRef requirement) __attribute__((weak_import));
+ (BOOL)codeSignatureIsValidAtPath:(NSString *)destinationPath error:(NSError **)error
{
@@ -68,19 +66,149 @@ finally:
+ (BOOL)hostApplicationIsCodeSigned
{
// This API didn't exist prior to 10.6.
if (SecCodeCopySelf == NULL) return NO;
static BOOL sIsCodesigned = NO;
OSStatus result;
SecCodeRef hostCode = NULL;
result = SecCodeCopySelf(kSecCSDefaultFlags, &hostCode);
if (result != 0) return NO;
static BOOL onceToken = NO;
while (!onceToken)
{
onceToken = YES;
// This API didn't exist prior to 10.6.
if (SecCodeCopySelf == NULL)
break;
SecRequirementRef requirement = NULL;
result = SecCodeCopyDesignatedRequirement(hostCode, kSecCSDefaultFlags, &requirement);
if (hostCode) CFRelease(hostCode);
if (requirement) CFRelease(requirement);
return (result == 0);
SecCodeRef hostCode = NULL;
OSStatus result = SecCodeCopySelf(kSecCSDefaultFlags, &hostCode);
if (result != noErr)
break;
SecRequirementRef requirement = NULL;
result = SecCodeCopyDesignatedRequirement(hostCode, kSecCSDefaultFlags, &requirement);
if (hostCode) CFRelease(hostCode);
if (requirement) CFRelease(requirement);
sIsCodesigned = (noErr == result);
}
return sIsCodesigned;
}
+ (BOOL)hostApplicationIsSandboxed
{
static BOOL sIsAppSandboxed = NO;
static BOOL onceToken = NO;
while (!onceToken)
{
onceToken = YES;
// This API didn't exist prior to 10.6
if (SecCodeCopySelf == NULL)
break;
SecCodeRef hostCode = NULL;
SecRequirementRef hostRequirement = NULL;
#define Cleanup() \
{ \
if (hostCode) CFRelease(hostCode); \
if (hostRequirement) CFRelease(hostRequirement); \
}
OSStatus status = SecCodeCopySelf(kSecCSDefaultFlags, &hostCode);
if (status != noErr || hostCode == NULL)
{
Cleanup();
break;
}
CFStringRef requirementString = CFSTR("entitlement[\"com.apple.security.app-sandbox\"] exists");
status = SecRequirementCreateWithString(requirementString, kSecCSDefaultFlags, &hostRequirement);
if (status != noErr || hostRequirement == NULL)
{
Cleanup();
break;
}
status = SecCodeCheckValidity(hostCode, kSecCSDefaultFlags, hostRequirement);
sIsAppSandboxed = (noErr == status);
Cleanup();
}
return sIsAppSandboxed;
}
+ (BOOL)hostAppAllowsNetworkOutgoingConnections
{
static BOOL sIsAppAllowsOutgoingConnections = NO;
static BOOL onceToken = NO;
while (!onceToken)
{
onceToken = YES;
if (![self hostApplicationIsSandboxed])
{
sIsAppAllowsOutgoingConnections = YES;
break;
}
SecCodeRef hostCode = NULL;
SecRequirementRef hostRequirement = NULL;
#define Cleanup() \
{ \
if (hostCode) CFRelease(hostCode); \
if (hostRequirement) CFRelease(hostRequirement); \
}
OSStatus status = SecCodeCopySelf(kSecCSDefaultFlags, &hostCode);
if (status != noErr || hostCode == NULL)
{
Cleanup();
break;
}
CFStringRef requirementString = CFSTR("entitlement[\"com.apple.security.network.client\"] exists");
status = SecRequirementCreateWithString(requirementString, kSecCSDefaultFlags, &hostRequirement);
if (status != noErr || hostRequirement == NULL)
{
Cleanup();
break;
}
status = SecCodeCheckValidity(hostCode, kSecCSDefaultFlags, hostRequirement);
sIsAppAllowsOutgoingConnections = (noErr == status);
Cleanup();
}
return sIsAppAllowsOutgoingConnections;
}
@end
#pragma mark -
BOOL SUShouldUseXPCDownloader(void)
{
if ([SUCodeSigningVerifier hostAppAllowsNetworkOutgoingConnections])
return NO;
NSString *xpcServicePrefixPath = [[NSBundle mainBundle] bundlePath];
NSString *xpcServiceSuffixPath = @"Contents/XPCServices/com.andymatuschak.Sparkle.download-service.xpc";
return [[NSFileManager defaultManager] fileExistsAtPath:[xpcServicePrefixPath stringByAppendingPathComponent:xpcServiceSuffixPath]];
}
BOOL SUShouldUseXPCInstaller(void)
{
if (![SUCodeSigningVerifier hostApplicationIsSandboxed])
return NO;
NSString *xpcServicePrefixPath = [[NSBundle mainBundle] bundlePath];
NSString *xpcServiceSuffixPath = @"Contents/XPCServices/com.andymatuschak.Sparkle.install-service.xpc";
return [[NSFileManager defaultManager] fileExistsAtPath:[xpcServicePrefixPath stringByAppendingPathComponent:xpcServiceSuffixPath]];
}
+3
View File
@@ -10,6 +10,8 @@
#ifndef SUCONSTANTS_H
#define SUCONSTANTS_H
#import <Foundation/Foundation.h>
// -----------------------------------------------------------------------------
// Preprocessor flags:
// -----------------------------------------------------------------------------
@@ -87,6 +89,7 @@ extern OSStatus SUMissingInstallerToolError;
extern OSStatus SURelaunchError;
extern OSStatus SUInstallationError;
extern OSStatus SUDowngradeError;
extern OSStatus SUXPCServiceError;
// -----------------------------------------------------------------------------
+1 -5
View File
@@ -6,11 +6,6 @@
// Copyright 2006 Andy Matuschak. All rights reserved.
//
#import "SUUpdater.h"
#import "SUAppcast.h"
#import "SUAppcastItem.h"
#import "SUVersionComparisonProtocol.h"
#import "SUConstants.h"
NSString *const SUUpdaterWillRestartNotification = @"SUUpdaterWillRestartNotificationName";
@@ -55,3 +50,4 @@ OSStatus SUMissingInstallerToolError = 4003;
OSStatus SURelaunchError = 4004;
OSStatus SUInstallationError = 4005;
OSStatus SUDowngradeError = 4006;
OSStatus SUXPCServiceError = 4007;
+5
View File
@@ -11,6 +11,9 @@
#import <Security/cssm.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
/* CDSA Specific */
static CSSM_CSP_HANDLE cdsaInit( void );
static void cdsaRelease( CSSM_CSP_HANDLE cspHandle );
@@ -355,3 +358,5 @@ static Boolean su_copyBytesToData( CSSM_DATA_PTR data, CSSM_SIZE size, const uin
}
return retval;
}
#pragma GCC diagnostic pop
+143 -59
View File
@@ -9,6 +9,8 @@
#import "SUDiskImageUnarchiver.h"
#import "SUUnarchiver_Private.h"
#import "NTSynchronousTask.h"
#import "SUCodeSigningVerifier.h"
#import "SUXPCInstaller.h"
#import "SULog.h"
#import <CoreServices/CoreServices.h>
@@ -22,13 +24,37 @@
// Called on a non-main thread.
- (void)extractDMG
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSData *result = [NTSynchronousTask task:@"/usr/bin/hdiutil" directory:@"/" withArgs:[NSArray arrayWithObjects: @"isencrypted", archivePath, nil] input:NULL];
if([self isEncrypted:result] && [delegate respondsToSelector:@selector(unarchiver:requiresPasswordReturnedViaInvocation:)]) {
NSString *hdiutilPath = @"/usr/bin/hdiutil";
NSArray *args = [NSArray arrayWithObjects: @"isencrypted", archivePath, nil];
NSString *currentDirPath = @"/";
__block NSData *result = nil;
if (SUShouldUseXPCInstaller())
{
[SUXPCInstaller launchTaskWithPath:hdiutilPath
arguments:args
environment:nil
currentDirectoryPath:currentDirPath
inputData:nil
waitForTaskResult:YES
waitUntilDone:YES
completionHandler:^(int resultCode, NSData *outputData) {
result = [outputData copy];
}];
[result autorelease];
}
else
{
result = [NTSynchronousTask task:hdiutilPath directory:currentDirPath withArgs:args input:nil];
}
if ([self isEncrypted:result] && [delegate respondsToSelector:@selector(unarchiver:requiresPasswordReturnedViaInvocation:)])
{
[self performSelectorOnMainThread:@selector(requestPasswordFromDelegate) withObject:nil waitUntilDone:NO];
} else {
}
else
{
[self extractDMGWithPassword:nil];
}
@@ -38,7 +64,6 @@
// Called on a non-main thread.
- (void)extractDMGWithPassword:(NSString *)password
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
BOOL mountedSuccessfully = NO;
@@ -46,9 +71,7 @@
SULog(@"Extracting %@ as a DMG", archivePath);
// get a unique mount point path
NSString *mountPointName = nil;
NSString *mountPoint = nil;
FSRef tmpRef;
do
{
CFUUIDRef uuid = CFUUIDCreate(NULL);
@@ -57,98 +80,139 @@
CFStringRef uuidString = CFUUIDCreateString(NULL, uuid);
if (uuidString)
{
mountPoint = [@"/Volumes" stringByAppendingPathComponent:(NSString*)uuidString];
mountPoint = [@"/Volumes" stringByAppendingPathComponent:(NSString *)uuidString];
CFRelease(uuidString);
}
CFRelease(uuid);
}
}
while (noErr == FSPathMakeRefWithOptions((UInt8 *)[mountPoint fileSystemRepresentation], kFSPathMakeRefDoNotFollowLeafSymlink, &tmpRef, NULL));
while ([[NSFileManager defaultManager] fileExistsAtPath:mountPoint]);
NSData *promptData = nil;
if (password) {
if ([password length])
{
NSString *data = [NSString stringWithFormat:@"%@\nyes\n", password];
const char *bytes = [data cStringUsingEncoding:NSUTF8StringEncoding];
NSUInteger length = [data lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
promptData = [NSData dataWithBytes:bytes length:length];
}
else
{
promptData = [NSData dataWithBytes:"yes\n" length:4];
}
BOOL shouldUseXPC = SUShouldUseXPCInstaller();
NSString *hdiutilPath = @"/usr/bin/hdiutil";
NSArray* arguments = [NSArray arrayWithObjects:@"attach", archivePath, @"-mountpoint", mountPoint, /*@"-noverify",*/ @"-nobrowse", @"-noautoopen", nil];
NSString *currentDirPath = @"/";
NSData *output = nil;
NSInteger taskResult = -1;
__block NSData *output = nil;
__block NSInteger taskResult = -1;
@try
{
NTSynchronousTask* task = [[NTSynchronousTask alloc] init];
if (shouldUseXPC)
{
[SUXPCInstaller launchTaskWithPath:hdiutilPath
arguments:arguments
environment:nil
currentDirectoryPath:currentDirPath
inputData:promptData
waitForTaskResult:YES
waitUntilDone:YES
completionHandler:^(int result, NSData *outputData) {
taskResult = (NSInteger)result;
output = [outputData copy];
}];
[output autorelease];
}
else
{
NTSynchronousTask* task = [[NTSynchronousTask alloc] init];
[task run:hdiutilPath directory:currentDirPath withArgs:arguments input:promptData];
[task run:@"/usr/bin/hdiutil" directory:@"/" withArgs:arguments input:promptData];
taskResult = [task result];
output = [[[task output] copy] autorelease];
[task release];
taskResult = [task result];
output = [[[task output] copy] autorelease];
[task release];
}
}
@catch (NSException *localException)
{
{
SULog(@"Got DMG mount exception: %@ - %@", [localException name], [localException reason]);
goto reportError;
}
if (taskResult != 0)
{
NSString* resultStr = output ? [[[NSString alloc] initWithData: output encoding: NSUTF8StringEncoding] autorelease] : nil;
if (password != nil && [resultStr rangeOfString:@"Authentication error"].location != NSNotFound && [delegate respondsToSelector:@selector(unarchiver:requiresPasswordReturnedViaInvocation:)]) {
NSString *resultStr = output ? [[[NSString alloc] initWithData:output encoding:NSUTF8StringEncoding] autorelease] : nil;
if (password != nil &&
[resultStr rangeOfString:@"Authentication error"].location != NSNotFound &&
[delegate respondsToSelector:@selector(unarchiver:requiresPasswordReturnedViaInvocation:)])
{
[self performSelectorOnMainThread:@selector(requestPasswordFromDelegate) withObject:nil waitUntilDone:NO];
goto finally;
} else {
SULog( @"hdiutil failed with code: %d data: <<%@>>", taskResult, resultStr );
}
else
{
SULog( @"hdiutil failed with code: %d data: <<%@>>", taskResult, resultStr);
goto reportError;
}
}
mountedSuccessfully = YES;
// Now that we've mounted it, we need to copy out its contents.
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) {
// On 10.7 and later we don't want to use the File Manager API and instead want to use NSFileManager (fixes #827357).
NSFileManager *manager = [[[NSFileManager alloc] init] autorelease];
NSError *error = nil;
NSArray *contents = [manager contentsOfDirectoryAtPath:mountPoint error:&error];
if (error)
if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_6)
{
if (shouldUseXPC)
{
SULog(@"Couldn't enumerate contents of archive mounted at %@: %@", mountPoint, error);
goto reportError;
}
NSEnumerator *contentsEnumerator = [contents objectEnumerator];
NSString *item;
while ((item = [contentsEnumerator nextObject]))
{
NSString *fromPath = [mountPoint stringByAppendingPathComponent:item];
NSString *toPath = [[archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:item];
NSError *error = nil;
[SUXPCInstaller copyPathContent:mountPoint
toDirectory:[archivePath stringByDeletingLastPathComponent]
error:&error];
// We skip any files in the DMG which are not readable.
if (![manager isReadableFileAtPath:fromPath])
continue;
SULog(@"copyItemAtPath:%@ toPath:%@", fromPath, toPath);
if (![manager copyItemAtPath:fromPath toPath:toPath error:&error])
if (nil != error)
{
SULog(@"Couldn't copy item: %@ : %@", error, error.userInfo ? error.userInfo : @"");
SULog(@"Couldn't copy volume content: %d - %@", [error code], [error localizedDescription]);
goto reportError;
}
}
else
{
// On 10.7 and later we don't want to use the File Manager API and instead want to use NSFileManager (fixes #827357).
NSFileManager *manager = [[[NSFileManager alloc] init] autorelease];
NSError *error = nil;
NSArray *contents = [manager contentsOfDirectoryAtPath:mountPoint error:&error];
if (error)
{
SULog(@"Couldn't enumerate contents of archive mounted at %@: %@", mountPoint, error);
goto reportError;
}
NSEnumerator *contentsEnumerator = [contents objectEnumerator];
NSString *item = nil;
while ((item = [contentsEnumerator nextObject]))
{
NSString *fromPath = [mountPoint stringByAppendingPathComponent:item];
NSString *toPath = [[archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:item];
// We skip any files in the DMG which are not readable.
if (![manager isReadableFileAtPath:fromPath])
continue;
SULog(@"copyItemAtPath:%@ toPath:%@", fromPath, toPath);
if (![manager copyItemAtPath:fromPath toPath:toPath error:&error])
{
SULog(@"Couldn't copy item: %@ : %@", error, error.userInfo ? error.userInfo : @"");
goto reportError;
}
}
}
}
else {
FSRef srcRef, dstRef;
OSStatus err;
err = FSPathMakeRef((UInt8 *)[mountPoint fileSystemRepresentation], &srcRef, NULL);
if (err != noErr) goto reportError;
err = FSPathMakeRef((UInt8 *)[[archivePath stringByDeletingLastPathComponent] fileSystemRepresentation], &dstRef, NULL);
if (err != noErr) goto reportError;
err = FSCopyObjectSync(&srcRef, &dstRef, (CFStringRef)mountPointName, NULL, kFSFileOperationSkipSourcePermissionErrors);
if (err != noErr) goto reportError;
else
{
SULog(@"This version of Sparkle don't support OS X version earlier than 10.6");
goto reportError;
}
[self performSelectorOnMainThread:@selector(notifyDelegateOfSuccess) withObject:nil waitUntilDone:NO];
@@ -159,9 +223,29 @@ reportError:
finally:
if (mountedSuccessfully)
[NSTask launchedTaskWithLaunchPath:@"/usr/bin/hdiutil" arguments:[NSArray arrayWithObjects:@"detach", mountPoint, @"-force", nil]];
{
NSArray *args = [NSArray arrayWithObjects:@"detach", mountPoint, @"-force", nil];
if (shouldUseXPC)
{
[SUXPCInstaller launchTaskWithPath:hdiutilPath
arguments:args
environment:nil
currentDirectoryPath:nil
inputData:nil
waitForTaskResult:NO
waitUntilDone:NO
completionHandler:nil];
}
else
{
[NSTask launchedTaskWithLaunchPath:hdiutilPath arguments:args];
}
}
else
SULog(@"Can't mount DMG %@",archivePath);
{
SULog(@"Can't mount DMG %@", archivePath);
}
[pool drain];
}
+104 -49
View File
@@ -22,7 +22,7 @@
#import <dirent.h>
#import <unistd.h>
#import <sys/param.h>
#import <dlfcn.h>
@interface SUPlainInstaller (MMExtendedAttributes)
// Removes the directory tree rooted at |root| from the file quarantine.
@@ -48,27 +48,104 @@
// Authorization code based on generous contribution from Allan Odgaard. Thanks, Allan!
static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authorization, const char* executablePath, AuthorizationFlags options, const char* const* arguments)
static BOOL SUAuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authorization, const char* executablePath, AuthorizationFlags options, const 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)
// Create func pointer to AuthorizationExecuteWithPrivileges in case it doesn't exist
// in this version of MacOS
static OSStatus (*_AuthExecuteWithPrivilegesFunc)(AuthorizationRef authorization,
const char *pathToTool,
AuthorizationFlags options,
char * const *arguments,
FILE **communicationsPipe) = NULL;
// Check to see if we have the correct function in our loaded libraries
if (NULL == _AuthExecuteWithPrivilegesFunc)
{
// On 10.7, AuthorizationExecuteWithPrivileges is deprecated. We want
// to still use it since there's no good alternative (without requiring
// code signing). We'll look up the function through dyld and fail if
// it is no longer accessible. If Apple removes the function entirely
// this will fail gracefully. If they keep the function and throw some
// sort of exception, this won't fail gracefully, but that's a risk
// we'll have to take for now.
// Pattern by Andy Kim from Potion Factory LLC
_AuthExecuteWithPrivilegesFunc = dlsym(RTLD_DEFAULT, "AuthorizationExecuteWithPrivileges");
}
if (NULL != _AuthExecuteWithPrivilegesFunc &&
errAuthorizationSuccess == _AuthExecuteWithPrivilegesFunc(authorization, executablePath, options, (char* const*)arguments, NULL))
{
int status;
int status = 0;
pid_t pid = wait(&status);
if (pid == -1 || !WIFEXITED(status) || WEXITSTATUS(status) != 0)
returnValue = NO;
}
else
{
returnValue = NO;
}
signal(SIGCHLD, oldSigChildHandler);
return returnValue;
}
static void SUAuthorizationRelease(AuthorizationRef authorization)
{
if (NULL == authorization)
return;
AuthorizationFree(authorization, kAuthorizationFlagDefaults);
}
static AuthorizationRef SUAuthorizationCreate(OSStatus *outStatus)
{
AuthorizationRef auth = NULL;
OSStatus authStat = errAuthorizationDenied;
while (errAuthorizationDenied == authStat)
{
authStat = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &auth);
}
if (errAuthorizationSuccess == authStat)
{
AuthorizationFlags theFlags = kAuthorizationFlagDefaults | kAuthorizationFlagPreAuthorize | kAuthorizationFlagInteractionAllowed | kAuthorizationFlagExtendRights;
AuthorizationItem rightsItems = {kAuthorizationRightExecute, 0, NULL, 0};
AuthorizationRights authRights = {1, &rightsItems};
AuthorizationItem envItems[1];
envItems[0].name = kAuthorizationEnvironmentPrompt;
envItems[0].value = (void *)[SULocalizedString(@"The update requires administrative permissions to be completed.", nil) cStringUsingEncoding:NSUTF8StringEncoding];
envItems[0].valueLength = strlen((const char *)envItems[0].value);
envItems[0].flags = 0;
AuthorizationEnvironment environment;
environment.count = sizeof(envItems) / sizeof(AuthorizationItem);
environment.items = envItems;
authStat = AuthorizationCopyRights(auth, &authRights, &environment, theFlags, NULL);
}
if (errAuthorizationSuccess != authStat)
{
SUAuthorizationRelease(auth);
auth = NULL;
}
if (NULL != outStatus)
{
*outStatus = authStat;
}
return auth;
}
@implementation SUPlainInstaller (Internals)
+ (NSString *)temporaryNameForPath:(NSString *)path
@@ -176,17 +253,10 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
}
}
AuthorizationRef auth = NULL;
OSStatus authStat = errAuthorizationDenied;
while (authStat == errAuthorizationDenied) {
authStat = AuthorizationCreate(NULL,
kAuthorizationEmptyEnvironment,
kAuthorizationFlagDefaults,
&auth);
}
AuthorizationRef auth = SUAuthorizationCreate(NULL);
BOOL res = NO;
if (authStat == errAuthorizationSuccess) {
if (NULL != auth)
{
res = YES;
char uidgid[42];
@@ -209,7 +279,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 };
res = AuthorizationExecuteWithPrivilegesAndWait( auth, "/usr/sbin/chown", kAuthorizationFlagDefaults, coParams );
res = SUAuthorizationExecuteWithPrivilegesAndWait( auth, "/usr/sbin/chown", kAuthorizationFlagDefaults, coParams );
if( !res )
SULog( @"chown -R %s %s failed.", uidgid, srcPath );
}
@@ -218,7 +288,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
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 };
res = AuthorizationExecuteWithPrivilegesAndWait( auth, "/bin/rm", kAuthorizationFlagDefaults, rmParams );
res = SUAuthorizationExecuteWithPrivilegesAndWait( auth, "/bin/rm", kAuthorizationFlagDefaults, rmParams );
if( !res )
SULog( @"rm failed" );
}
@@ -226,7 +296,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
if( res && haveDst ) // Move old exe to tmp path.
{
const char* mvParams[] = { "-f", dstPath, tmpPath, NULL };
res = AuthorizationExecuteWithPrivilegesAndWait( auth, "/bin/mv", kAuthorizationFlagDefaults, mvParams );
res = SUAuthorizationExecuteWithPrivilegesAndWait( auth, "/bin/mv", kAuthorizationFlagDefaults, mvParams );
if( !res )
SULog( @"mv 1 failed" );
}
@@ -234,7 +304,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
if( res ) // Move new exe to old exe's path.
{
const char* mvParams2[] = { "-f", srcPath, dstPath, NULL };
res = AuthorizationExecuteWithPrivilegesAndWait( auth, "/bin/mv", kAuthorizationFlagDefaults, mvParams2 );
res = SUAuthorizationExecuteWithPrivilegesAndWait( auth, "/bin/mv", kAuthorizationFlagDefaults, mvParams2 );
if( !res )
SULog( @"mv 2 failed" );
}
@@ -242,10 +312,10 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
// if( res && haveDst /*&& !foundTrash*/ ) // If we managed to put the old exe in the trash, leave it there for the user to delete or recover.
// { // ... Otherwise we better delete it, wouldn't want dozens of old versions lying around next to the new one.
// const char* rmParams2[] = { "-rf", tmpPath, NULL };
// res = AuthorizationExecuteWithPrivilegesAndWait( auth, "/bin/rm", kAuthorizationFlagDefaults, rmParams2 );
// res = SUAuthorizationExecuteWithPrivilegesAndWait( auth, "/bin/rm", kAuthorizationFlagDefaults, rmParams2 );
// }
AuthorizationFree(auth, 0);
SUAuthorizationRelease(auth);
// If the currently-running application is trusted, the new
// version should be trusted as well. Remove it from the
@@ -289,18 +359,9 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
struct stat dstSB;
stat(dstContainerPath, &dstSB);
AuthorizationRef auth = NULL;
OSStatus authStat = errAuthorizationDenied;
while( authStat == errAuthorizationDenied )
{
authStat = AuthorizationCreate(NULL,
kAuthorizationEmptyEnvironment,
kAuthorizationFlagDefaults,
&auth);
}
AuthorizationRef auth = SUAuthorizationCreate(NULL);
BOOL res = NO;
if (authStat == errAuthorizationSuccess)
if (NULL != auth)
{
res = YES;
@@ -311,7 +372,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 };
res = AuthorizationExecuteWithPrivilegesAndWait( auth, "/usr/sbin/chown", kAuthorizationFlagDefaults, coParams );
res = SUAuthorizationExecuteWithPrivilegesAndWait( auth, "/usr/sbin/chown", kAuthorizationFlagDefaults, coParams );
if( !res )
SULog(@"Can't set permissions");
}
@@ -320,7 +381,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
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 };
res = AuthorizationExecuteWithPrivilegesAndWait( auth, "/bin/rm", kAuthorizationFlagDefaults, rmParams );
res = SUAuthorizationExecuteWithPrivilegesAndWait( auth, "/bin/rm", kAuthorizationFlagDefaults, rmParams );
if( !res )
SULog(@"Can't remove destination file");
}
@@ -328,12 +389,12 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
if( res ) // Move!.
{
const char* mvParams[] = { "-f", srcPath, dstPath, NULL };
res = AuthorizationExecuteWithPrivilegesAndWait( auth, "/bin/mv", kAuthorizationFlagDefaults, mvParams );
res = SUAuthorizationExecuteWithPrivilegesAndWait( auth, "/bin/mv", kAuthorizationFlagDefaults, mvParams );
if( !res )
SULog(@"Can't move source file");
}
AuthorizationFree(auth, 0);
SUAuthorizationRelease(auth);
if (!res)
{
@@ -358,30 +419,21 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
const char* srcPath = [src fileSystemRepresentation];
AuthorizationRef auth = NULL;
OSStatus authStat = errAuthorizationDenied;
while( authStat == errAuthorizationDenied )
{
authStat = AuthorizationCreate(NULL,
kAuthorizationEmptyEnvironment,
kAuthorizationFlagDefaults,
&auth);
}
AuthorizationRef auth = SUAuthorizationCreate(NULL);
BOOL res = NO;
if (authStat == errAuthorizationSuccess)
if (NULL != auth)
{
res = YES;
if( res ) // If there's something at our tmp path (previous failed update or whatever) delete that first.
{
const char* rmParams[] = { "-rf", srcPath, NULL };
res = AuthorizationExecuteWithPrivilegesAndWait( auth, "/bin/rm", kAuthorizationFlagDefaults, rmParams );
res = SUAuthorizationExecuteWithPrivilegesAndWait( auth, "/bin/rm", kAuthorizationFlagDefaults, rmParams );
if( !res )
SULog(@"Can't remove destination file");
}
AuthorizationFree(auth, 0);
SUAuthorizationRelease(auth);
if (!res)
{
@@ -534,7 +586,10 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
// new home in case it's moved across filesystems: if that
// happens, the move is actually a copy, and it may result
// in the application being quarantined.
[self performSelectorOnMainThread:@selector(releaseFromQuarantine:) withObject:dst waitUntilDone:YES];
if ([NSThread isMultiThreaded])
[self performSelectorOnMainThread:@selector(releaseFromQuarantine:) withObject:dst waitUntilDone:YES];
else
[self releaseFromQuarantine:dst];
return YES;
}
+11 -2
View File
@@ -59,7 +59,12 @@
- (void)applicationDidBecomeActive:(NSNotification *)aNotification
{
[[updateAlert window] makeKeyAndOrderFront:self];
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"NSApplicationDidBecomeActiveNotification" object:NSApp];
[[NSNotificationCenter defaultCenter] removeObserver:self name:NSApplicationDidBecomeActiveNotification object:NSApp];
}
- (void)updateAlert:(SUUpdateAlert *)updateAlert willLoadReleaseNotesWithRequest:(NSMutableURLRequest *)request
{
[self updateURLRequestIfNeeds:request];
}
- (void)updateAlert:(SUUpdateAlert *)alert finishedWithChoice:(SUUpdateAlertChoice)choice
@@ -201,7 +206,11 @@
- (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 alertWithMessageText:SULocalizedString(@"Update Error!", nil)
defaultButton:SULocalizedString(@"Cancel Update", nil)
alternateButton:nil
otherButton:nil
informativeTextWithFormat:[error localizedDescription], nil];
[self showModalAlert:alert];
[super abortUpdateWithError:error];
}
+5 -1
View File
@@ -22,7 +22,7 @@ typedef enum
} SUUpdateAlertChoice;
@class WebView, SUAppcastItem, SUHost;
@interface SUUpdateAlert : SUWindowController {
@interface SUUpdateAlert : SUWindowController <NSURLDownloadDelegate> {
SUAppcastItem *updateItem;
SUHost *host;
id delegate;
@@ -35,6 +35,9 @@ typedef enum
IBOutlet NSButton *laterButton;
NSProgressIndicator *releaseNotesSpinner;
BOOL webViewFinishedLoading;
NSURLDownload *releaseNotesDownloader;
NSString *downloadedReleaseNotesPath;
}
- (id)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)host;
@@ -49,6 +52,7 @@ typedef enum
@end
@interface NSObject (SUUpdateAlertDelegate)
- (void)updateAlert:(SUUpdateAlert *)updateAlert willLoadReleaseNotesWithRequest:(NSMutableURLRequest *)request;
- (void)updateAlert:(SUUpdateAlert *)updateAlert finishedWithChoice:(SUUpdateAlertChoice)updateChoice;
- (void)updateAlert:(SUUpdateAlert *)updateAlert shouldAllowAutoUpdate: (BOOL*)shouldAllowAutoUpdate;
@end
+34 -2
View File
@@ -15,8 +15,9 @@
#import "SUHost.h"
#import <WebKit/WebKit.h>
#import "SUUpdater_Private.h"
#import "SUConstants.h"
#import "SUXPCURLDownload.h"
@interface WebView (SUTenFiveProperty)
@@ -50,6 +51,9 @@
{
[updateItem release];
[host release];
[releaseNotesDownloader release];
[downloadedReleaseNotesPath release];
[super dealloc];
}
@@ -115,7 +119,23 @@
}
else
{
[[releaseNotesView mainFrame] loadRequest:[NSURLRequest requestWithURL:[updateItem releaseNotesURL] cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:30]];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[updateItem releaseNotesURL]
cachePolicy:NSURLRequestReloadIgnoringCacheData
timeoutInterval:30];
if ([delegate respondsToSelector:@selector(updateAlert:willLoadReleaseNotesWithRequest:)])
{
[delegate updateAlert:self willLoadReleaseNotesWithRequest:request];
}
if (SUShouldUseXPCDownloader())
{
[releaseNotesDownloader release];
releaseNotesDownloader = (NSURLDownload *)[[SUXPCURLDownload alloc] initWithRequest:request delegate:self];
}
else
{
[[releaseNotesView mainFrame] loadRequest:request];
}
}
}
else
@@ -124,6 +144,18 @@
}
}
- (void)download:(NSURLDownload *)aDownload didCreateDestination:(NSString *)path
{
[downloadedReleaseNotesPath release];
downloadedReleaseNotesPath = [path copy];
}
- (void)downloadDidFinish:(NSURLDownload *)aDownload
{
NSString *s = [NSString stringWithContentsOfFile:downloadedReleaseNotesPath encoding:NSUTF8StringEncoding error:nil];
[[releaseNotesView mainFrame] loadHTMLString:s baseURL:nil];
}
- (BOOL)showsReleaseNotes
{
NSNumber *shouldShowReleaseNotes = [host objectForInfoDictionaryKey:SUShowReleaseNotesKey];
+15
View File
@@ -140,6 +140,21 @@
@end
// -----------------------------------------------------------------------------
// SUUpdater Delegate: DevMate Interaction
// -----------------------------------------------------------------------------
// NOTE!!! Implemented delegate methods have higher priority than values saved in user preferences
#define SUUpdaterChecksForBetaUpdatesPrefKey @"SUUpdaterChecksForBetaUpdates" // bool value
#define SUUpdaterIsInTestModePrefKey @"SUUpdaterIsInTestMode" // bool value
@interface NSObject (SUUpdaterDelegate_DevMateInteraction)
- (BOOL)updaterShouldCheckForBetaUpdates:(SUUpdater *)updater;
- (BOOL)isUpdaterInTestMode:(SUUpdater *)updater;
@end
// -----------------------------------------------------------------------------
// Constants:
+32 -3
View File
@@ -213,8 +213,8 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault
// Now we want to figure out how long until we check again.
NSTimeInterval delayUntilCheck, updateCheckInterval = [self updateCheckInterval];
if (updateCheckInterval < SU_MIN_CHECK_INTERVAL)
updateCheckInterval = SU_MIN_CHECK_INTERVAL;
if (updateCheckInterval < 5 /*SU_MIN_CHECK_INTERVAL*/)
updateCheckInterval = 5 /*SU_MIN_CHECK_INTERVAL*/;
if (intervalSinceCheck < updateCheckInterval)
delayUntilCheck = (updateCheckInterval - intervalSinceCheck); // It hasn't been long enough.
else
@@ -479,7 +479,7 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault
const NSTimeInterval oneWeek = 60 * 60 * 24 * 7;
sendingSystemProfile &= (-[lastSubmitDate timeIntervalSinceNow] >= oneWeek);
NSArray *parameters = [NSArray array];
NSArray *parameters = [self devmateFeedParameters];
if ([delegate respondsToSelector:@selector(feedParametersForUpdater:sendingSystemProfile:)])
parameters = [parameters arrayByAddingObjectsFromArray:[delegate feedParametersForUpdater:self sendingSystemProfile:sendingSystemProfile]];
if (sendingSystemProfile)
@@ -554,4 +554,33 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault
- (id)delegate { return delegate; }
- (NSBundle *)hostBundle { return [host bundle]; }
#pragma mark - DevMate Interaction
- (NSArray *)devmateFeedParameters
{
NSMutableArray *parameters = [NSMutableArray array];
BOOL isInTestMode = [host boolForUserDefaultsKey:SUUpdaterIsInTestModePrefKey];
if ([delegate respondsToSelector:@selector(isUpdaterInTestMode:)])
{
isInTestMode = [delegate isUpdaterInTestMode:self];
}
if (isInTestMode)
{
[parameters addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"test", @"key", @"1", @"value", nil]];
}
BOOL shouldCheckBeta = [host boolForUserDefaultsKey:SUUpdaterChecksForBetaUpdatesPrefKey];
if ([delegate respondsToSelector:@selector(updaterShouldCheckForBetaUpdates:)])
{
shouldCheckBeta = [delegate updaterShouldCheckForBetaUpdates:self];
}
if (shouldCheckBeta)
{
[parameters addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"beta", @"key", @"1", @"value", nil]];
}
return parameters;
}
@end
+1
View File
@@ -7,6 +7,7 @@
//
#import "SUUpdater.h"
#import "SUCodeSigningVerifier.h"
@interface SUUpdater (Private)
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
</dict>
</plist>
+10
View File
@@ -18,6 +18,16 @@
#define NSAppKitVersionNumber10_6 1038
#endif
#ifndef NSAppKitVersionNumber10_7
#define NSAppKitVersionNumber10_7 1138
#endif
#ifndef MAC_OS_X_VERSION_10_7
#define MAC_OS_X_VERSION_10_7 1070
#endif
#define SPARKLE_IS_COMPATIBLE_WITH_DEVMATE (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7)
#ifdef __OBJC__
#define SPARKLE_BUNDLE [NSBundle bundleWithIdentifier:@"org.andymatuschak.Sparkle"]
+527 -1
View File
@@ -7,6 +7,16 @@
objects = {
/* Begin PBXBuildFile section */
0305627915D2A73D00B43EF8 /* com.andymatuschak.Sparkle.install-service.xpc in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8B887B5E1517F3AB000BB292 /* com.andymatuschak.Sparkle.install-service.xpc */; };
03B5E64115D399500038BB67 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 03B5E63F15D399500038BB67 /* InfoPlist.strings */; };
03B5E64415D399500038BB67 /* download_service.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B5E64315D399500038BB67 /* download_service.m */; };
03B5E64B15D39CD90038BB67 /* SUXPCURLDownload.h in Headers */ = {isa = PBXBuildFile; fileRef = 03B5E64915D39CD90038BB67 /* SUXPCURLDownload.h */; };
03B5E65A15D3DC3C0038BB67 /* com.andymatuschak.Sparkle.download-service.xpc in CopyFiles */ = {isa = PBXBuildFile; fileRef = 03B5E63A15D399500038BB67 /* com.andymatuschak.Sparkle.download-service.xpc */; };
03B5E65B15D3E0490038BB67 /* SUXPCURLDownload.m in Sources */ = {isa = PBXBuildFile; fileRef = 03B5E64A15D39CD90038BB67 /* SUXPCURLDownload.m */; };
3330768F190A5CB8005602B2 /* Sparkle.strings in Resources */ = {isa = PBXBuildFile; fileRef = 61AAE8220A321A7F00D8810D /* Sparkle.strings */; };
338A79F11919191500EDD837 /* SULog.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C14F05136EF6DB00649790 /* SULog.m */; };
338A79F319193CDC00EDD837 /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; };
33D081831888446F00394A94 /* libDMCore.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 33D081821888446E00394A94 /* libDMCore.a */; };
3772FEA913DE0B6B00F79537 /* SUVersionDisplayProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 3772FEA813DE0B6B00F79537 /* SUVersionDisplayProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
525A2790133D6AE900FD8D70 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 525A278F133D6AE900FD8D70 /* Cocoa.framework */; };
525A27A0133D6B9700FD8D70 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 525A278F133D6AE900FD8D70 /* Cocoa.framework */; };
@@ -133,12 +143,34 @@
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, ); }; };
8B887B7E1517F888000BB292 /* SUXPCInstaller.h in Headers */ = {isa = PBXBuildFile; fileRef = 8B887B7C1517F888000BB292 /* SUXPCInstaller.h */; };
8B887B7F1517F888000BB292 /* SUXPCInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B887B7D1517F888000BB292 /* SUXPCInstaller.m */; };
8B887B811517FAA3000BB292 /* SUPlainInstallerInternals.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B5F8E509C4CE3C00B25A18 /* SUPlainInstallerInternals.m */; };
8B887B821517FAA4000BB292 /* SUPlainInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 618FA5040DAE8AB80026945C /* SUPlainInstaller.m */; };
8B887B831517FAE9000BB292 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55C14F31136EFC2400649790 /* SystemConfiguration.framework */; };
8B887B841517FAEC000BB292 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6117796E0D1112E000749C97 /* IOKit.framework */; };
8B887B861517FAFE000BB292 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B5F8F609C4CEB300B25A18 /* Security.framework */; };
8B887B881517FB1C000BB292 /* SUInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 618FA5000DAE88B40026945C /* SUInstaller.m */; };
8B887B891517FB3E000BB292 /* SULog.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C14F05136EF6DB00649790 /* SULog.m */; };
8B887B8A1517FB43000BB292 /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; };
8B887B8B1517FB52000BB292 /* SUPackageInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 618FA5210DAE8E8A0026945C /* SUPackageInstaller.m */; };
8B887B8C1517FB5D000BB292 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */; };
8B887B8E15180767000BB292 /* install_service.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B887B8D15180767000BB292 /* install_service.m */; };
93FB277A156BD80D001937C7 /* SUPasswordPrompt.h in Headers */ = {isa = PBXBuildFile; fileRef = 93FB2778156BD80D001937C7 /* SUPasswordPrompt.h */; };
93FB277B156BD80D001937C7 /* SUPasswordPrompt.m in Sources */ = {isa = PBXBuildFile; fileRef = 93FB2779156BD80D001937C7 /* SUPasswordPrompt.m */; };
93FB277F156BD826001937C7 /* SUPasswordPrompt.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93FB277D156BD826001937C7 /* SUPasswordPrompt.xib */; };
BE98879117C264D7002311CF /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D69BFE84028FC02AAC07 /* Foundation.framework */; };
BEA931AD17AA3EF7007D20A6 /* SUDSDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = BEA931AC17AA3EF7007D20A6 /* SUDSDownloader.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
03B5E65C15D3E32A0038BB67 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 03B5E63915D399500038BB67;
remoteInfo = "Downloading XPC Service";
};
55C14F96136F044100649790 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
@@ -167,9 +199,27 @@
remoteGlobalIDString = 8DC2EF4F0486A6940098B216;
remoteInfo = Sparkle;
};
8B887B731517F472000BB292 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 8B887B5D1517F3AB000BB292;
remoteInfo = Service;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
0305627015D2A70400B43EF8 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = Contents/XPCServices;
dstSubfolderSpec = 1;
files = (
0305627915D2A73D00B43EF8 /* com.andymatuschak.Sparkle.install-service.xpc in CopyFiles */,
03B5E65A15D3DC3C0038BB67 /* com.andymatuschak.Sparkle.download-service.xpc in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
61B5FB4D09C4E9FA00B25A18 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
@@ -187,8 +237,22 @@
0263187514FEBB42005EBF43 /* uk */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = uk; path = uk.lproj/SUAutomaticUpdateAlert.xib; sourceTree = "<group>"; };
0263187614FEBB42005EBF43 /* uk */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = uk; path = uk.lproj/SUUpdateAlert.xib; sourceTree = "<group>"; };
0263187714FEBB42005EBF43 /* uk */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = uk; path = uk.lproj/SUUpdatePermissionPrompt.xib; sourceTree = "<group>"; };
02AC40CE1743CC23005207B1 /* ConfigCommonProject64bit.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigCommonProject64bit.xcconfig; sourceTree = "<group>"; };
02AC40CF1743CC23005207B1 /* ConfigCommonProjectUniversalBinary.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigCommonProjectUniversalBinary.xcconfig; sourceTree = "<group>"; };
0305626E15D2A68800B43EF8 /* Sparkle Test App.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "Sparkle Test App.entitlements"; sourceTree = "<group>"; };
03B5E63A15D399500038BB67 /* com.andymatuschak.Sparkle.download-service.xpc */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "com.andymatuschak.Sparkle.download-service.xpc"; sourceTree = BUILT_PRODUCTS_DIR; };
03B5E63E15D399500038BB67 /* Downloading XPC Service-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Downloading XPC Service-Info.plist"; sourceTree = "<group>"; };
03B5E64015D399500038BB67 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
03B5E64215D399500038BB67 /* Downloading XPC Service-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Downloading XPC Service-Prefix.pch"; sourceTree = "<group>"; };
03B5E64315D399500038BB67 /* download_service.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = download_service.m; sourceTree = "<group>"; };
03B5E64915D39CD90038BB67 /* SUXPCURLDownload.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUXPCURLDownload.h; sourceTree = "<group>"; };
03B5E64A15D39CD90038BB67 /* SUXPCURLDownload.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUXPCURLDownload.m; sourceTree = "<group>"; };
0867D69BFE84028FC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
3329F06D18FBFBA800556010 /* ResourceRules.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = ResourceRules.plist; sourceTree = "<group>"; };
33307690190A5D8B005602B2 /* install_service.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = install_service.pch; sourceTree = "<group>"; };
33CE69761934D1F8009D5956 /* ReleaseNotes.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = ReleaseNotes.rtf; sourceTree = "<group>"; };
33D081821888446E00394A94 /* libDMCore.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libDMCore.a; path = External/libDMCore.a; sourceTree = "<group>"; };
3772FEA813DE0B6B00F79537 /* SUVersionDisplayProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUVersionDisplayProtocol.h; sourceTree = "<group>"; };
525A278F133D6AE900FD8D70 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
550347001370023A00AE7681 /* Sparkle.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Sparkle.icns; sourceTree = "<group>"; };
@@ -397,11 +461,23 @@
61F614540E24A12D009F47E7 /* it */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Sparkle.strings; sourceTree = "<group>"; };
61F83F6F0DBFE137006FDD30 /* SUBasicUpdateDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUBasicUpdateDriver.h; sourceTree = "<group>"; };
61F83F700DBFE137006FDD30 /* SUBasicUpdateDriver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUBasicUpdateDriver.m; sourceTree = "<group>"; };
8B887B5E1517F3AB000BB292 /* com.andymatuschak.Sparkle.install-service.xpc */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "com.andymatuschak.Sparkle.install-service.xpc"; sourceTree = BUILT_PRODUCTS_DIR; };
8B887B701517F447000BB292 /* ConfigService.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigService.xcconfig; sourceTree = "<group>"; };
8B887B711517F447000BB292 /* ConfigServiceDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigServiceDebug.xcconfig; sourceTree = "<group>"; };
8B887B721517F447000BB292 /* ConfigServiceRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigServiceRelease.xcconfig; sourceTree = "<group>"; };
8B887B7C1517F888000BB292 /* SUXPCInstaller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUXPCInstaller.h; sourceTree = "<group>"; };
8B887B7D1517F888000BB292 /* SUXPCInstaller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUXPCInstaller.m; sourceTree = "<group>"; };
8B887B8D15180767000BB292 /* install_service.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = install_service.m; sourceTree = "<group>"; };
8B887B8F15180773000BB292 /* SandboxService.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = SandboxService.plist; sourceTree = "<group>"; };
8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8DC2EF5B0486A6940098B216 /* Sparkle.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Sparkle.framework; sourceTree = BUILT_PRODUCTS_DIR; };
93FB2778156BD80D001937C7 /* SUPasswordPrompt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUPasswordPrompt.h; sourceTree = "<group>"; };
93FB2779156BD80D001937C7 /* SUPasswordPrompt.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUPasswordPrompt.m; sourceTree = "<group>"; };
93FB277E156BD826001937C7 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/SUPasswordPrompt.xib; sourceTree = "<group>"; };
BE18CC4F17ABAF5B004493DC /* SUInstallServiceConstants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUInstallServiceConstants.h; sourceTree = "<group>"; };
BE9928D117A6AF1200B4523B /* SUDownloadServiceConstants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUDownloadServiceConstants.h; sourceTree = "<group>"; };
BEA931AB17AA3EF7007D20A6 /* SUDSDownloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUDSDownloader.h; sourceTree = "<group>"; };
BEA931AC17AA3EF7007D20A6 /* SUDSDownloader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUDSDownloader.m; sourceTree = "<group>"; };
FA1941CA0D94A70100DD942E /* ConfigFrameworkDebug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = ConfigFrameworkDebug.xcconfig; sourceTree = "<group>"; };
FA1941CB0D94A70100DD942E /* ConfigTestAppDebug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = ConfigTestAppDebug.xcconfig; sourceTree = "<group>"; };
FA1941CC0D94A70100DD942E /* ConfigCommonRelease.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = ConfigCommonRelease.xcconfig; sourceTree = "<group>"; };
@@ -421,6 +497,14 @@
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
03B5E63715D399500038BB67 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
BE98879117C264D7002311CF /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
55C14BB5136EEF1500649790 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@@ -460,6 +544,17 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
8B887B5B1517F3AB000BB292 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
8B887B831517FAE9000BB292 /* SystemConfiguration.framework in Frameworks */,
8B887B841517FAEC000BB292 /* IOKit.framework in Frameworks */,
8B887B8C1517FB5D000BB292 /* AppKit.framework in Frameworks */,
8B887B861517FAFE000BB292 /* Security.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
8DC2EF560486A6940098B216 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@@ -472,6 +567,7 @@
5D1AF82B0FD768180065DB48 /* libz.dylib in Frameworks */,
525A2790133D6AE900FD8D70 /* Cocoa.framework in Frameworks */,
55C14F32136EFC2400649790 /* SystemConfiguration.framework in Frameworks */,
33D081831888446F00394A94 /* libDMCore.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -486,23 +582,53 @@
612279D90DB5470200AB99EA /* Sparkle Unit Tests.octest */,
5D06E8D00FD68C7C005AE3F6 /* BinaryDelta */,
55C14BB7136EEF1500649790 /* finish_installation.app */,
8B887B5E1517F3AB000BB292 /* com.andymatuschak.Sparkle.install-service.xpc */,
03B5E63A15D399500038BB67 /* com.andymatuschak.Sparkle.download-service.xpc */,
);
name = Products;
sourceTree = "<group>";
};
03B5E63C15D399500038BB67 /* Downloading XPC Service */ = {
isa = PBXGroup;
children = (
03B5E64915D39CD90038BB67 /* SUXPCURLDownload.h */,
03B5E64A15D39CD90038BB67 /* SUXPCURLDownload.m */,
03B5E64315D399500038BB67 /* download_service.m */,
BEA931AB17AA3EF7007D20A6 /* SUDSDownloader.h */,
BEA931AC17AA3EF7007D20A6 /* SUDSDownloader.m */,
BE9928D117A6AF1200B4523B /* SUDownloadServiceConstants.h */,
03B5E63D15D399500038BB67 /* Supporting Files */,
);
path = "Downloading XPC Service";
sourceTree = "<group>";
};
03B5E63D15D399500038BB67 /* Supporting Files */ = {
isa = PBXGroup;
children = (
03B5E63E15D399500038BB67 /* Downloading XPC Service-Info.plist */,
03B5E63F15D399500038BB67 /* InfoPlist.strings */,
03B5E64215D399500038BB67 /* Downloading XPC Service-Prefix.pch */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
0867D691FE84028FC02AAC07 /* Sparkle */ = {
isa = PBXGroup;
children = (
33CE69761934D1F8009D5956 /* ReleaseNotes.rtf */,
61F83F6E0DBFE07A006FDD30 /* Update Control */,
61299B3909CB055000B7442F /* Appcast Support */,
618FA6DB0DB485440026945C /* Installation */,
55C14BD5136EEFD000649790 /* finish_installation tool */,
6101354A0DD25B7F0049ACDF /* Unarchiving */,
61299B3A09CB056100B7442F /* User Interface */,
8B887B621517F3AC000BB292 /* Installation XPC Service */,
03B5E63C15D399500038BB67 /* Downloading XPC Service */,
61B5F8F309C4CE5900B25A18 /* Other Sources */,
089C1665FE841158C02AAC07 /* Framework Resources */,
61227A100DB5484000AB99EA /* Tests */,
61B5F91D09C4CF7F00B25A18 /* Test Application Sources */,
33D081811888444000394A94 /* External Frameworks and Libraries */,
0867D69AFE84028FC02AAC07 /* Apple Frameworks and Libraries */,
FA1941C40D94A6EA00DD942E /* Configurations */,
034768DFFF38A50411DB9C8B /* Products */,
@@ -531,6 +657,7 @@
089C1665FE841158C02AAC07 /* Framework Resources */ = {
isa = PBXGroup;
children = (
3329F06D18FBFBA800556010 /* ResourceRules.plist */,
8DC2EF5A0486A6940098B216 /* Info.plist */,
615AE3CF0D64DC40001CA7BD /* SUModelTranslation.plist */,
61C268090E2DB5D000175E6C /* License.txt */,
@@ -544,6 +671,14 @@
name = "Framework Resources";
sourceTree = "<group>";
};
33D081811888444000394A94 /* External Frameworks and Libraries */ = {
isa = PBXGroup;
children = (
33D081821888446E00394A94 /* libDMCore.a */,
);
name = "External Frameworks and Libraries";
sourceTree = "<group>";
};
55C14BD5136EEFD000649790 /* finish_installation tool */ = {
isa = PBXGroup;
children = (
@@ -670,6 +805,7 @@
61B5F91D09C4CF7F00B25A18 /* Test Application Sources */ = {
isa = PBXGroup;
children = (
0305626E15D2A68800B43EF8 /* Sparkle Test App.entitlements */,
61BBDF810A49220C00378739 /* Sparkle.icns */,
61B5F92A09C4CFD800B25A18 /* InfoPlist.strings */,
61B5F92C09C4CFD800B25A18 /* MainMenu.nib */,
@@ -724,9 +860,40 @@
name = "Update Control";
sourceTree = "<group>";
};
8B887B621517F3AC000BB292 /* Installation XPC Service */ = {
isa = PBXGroup;
children = (
8B887B801517F8B4000BB292 /* Service */,
8B887B631517F3AC000BB292 /* Interface */,
);
path = "Installation XPC Service";
sourceTree = "<group>";
};
8B887B631517F3AC000BB292 /* Interface */ = {
isa = PBXGroup;
children = (
BE18CC4F17ABAF5B004493DC /* SUInstallServiceConstants.h */,
8B887B7C1517F888000BB292 /* SUXPCInstaller.h */,
8B887B7D1517F888000BB292 /* SUXPCInstaller.m */,
);
name = Interface;
sourceTree = "<group>";
};
8B887B801517F8B4000BB292 /* Service */ = {
isa = PBXGroup;
children = (
33307690190A5D8B005602B2 /* install_service.pch */,
8B887B8D15180767000BB292 /* install_service.m */,
8B887B8F15180773000BB292 /* SandboxService.plist */,
);
name = Service;
sourceTree = "<group>";
};
FA1941C40D94A6EA00DD942E /* Configurations */ = {
isa = PBXGroup;
children = (
02AC40CE1743CC23005207B1 /* ConfigCommonProject64bit.xcconfig */,
02AC40CF1743CC23005207B1 /* ConfigCommonProjectUniversalBinary.xcconfig */,
5D06E8F10FD68D21005AE3F6 /* ConfigBinaryDelta.xcconfig */,
5D06E8F20FD68D21005AE3F6 /* ConfigBinaryDeltaDebug.xcconfig */,
5D06E8F30FD68D21005AE3F6 /* ConfigBinaryDeltaRelease.xcconfig */,
@@ -744,6 +911,9 @@
FA1941CE0D94A70100DD942E /* ConfigRelaunch.xcconfig */,
FA1941D30D94A70100DD942E /* ConfigRelaunchDebug.xcconfig */,
FA1941D40D94A70100DD942E /* ConfigRelaunchRelease.xcconfig */,
8B887B701517F447000BB292 /* ConfigService.xcconfig */,
8B887B711517F447000BB292 /* ConfigServiceDebug.xcconfig */,
8B887B721517F447000BB292 /* ConfigServiceRelease.xcconfig */,
FA3AAF3B1050B273004B3130 /* ConfigUnitTest.xcconfig */,
FA3AAF3A1050B273004B3130 /* ConfigUnitTestDebug.xcconfig */,
FA3AAF391050B273004B3130 /* ConfigUnitTestRelease.xcconfig */,
@@ -798,6 +968,8 @@
55C14F06136EF6DB00649790 /* SULog.h in Headers */,
55C14F0F136EF73600649790 /* finish_installation.pch in Headers */,
6158A1C5137904B300487EC1 /* SUUpdater_Private.h in Headers */,
8B887B7E1517F888000BB292 /* SUXPCInstaller.h in Headers */,
03B5E64B15D39CD90038BB67 /* SUXPCURLDownload.h in Headers */,
93FB277A156BD80D001937C7 /* SUPasswordPrompt.h in Headers */,
61B078CE15A5FB6100600039 /* SUCodeSigningVerifier.h in Headers */,
);
@@ -806,6 +978,23 @@
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
03B5E63915D399500038BB67 /* Downloading XPC Service */ = {
isa = PBXNativeTarget;
buildConfigurationList = 03B5E64515D399500038BB67 /* Build configuration list for PBXNativeTarget "Downloading XPC Service" */;
buildPhases = (
03B5E63615D399500038BB67 /* Sources */,
03B5E63715D399500038BB67 /* Frameworks */,
03B5E63815D399500038BB67 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = "Downloading XPC Service";
productName = "Downloading XPC Service";
productReference = 03B5E63A15D399500038BB67 /* com.andymatuschak.Sparkle.download-service.xpc */;
productType = "com.apple.product-type.bundle";
};
55C14BB6136EEF1500649790 /* finish_installation */ = {
isa = PBXNativeTarget;
buildConfigurationList = 55C14BBE136EEF1500649790 /* Build configuration list for PBXNativeTarget "finish_installation" */;
@@ -868,6 +1057,7 @@
61B5F8FF09C4CEE200B25A18 /* Sources */,
61B5F90009C4CEE200B25A18 /* Frameworks */,
61B5FB4D09C4E9FA00B25A18 /* CopyFiles */,
0305627015D2A70400B43EF8 /* CopyFiles */,
);
buildRules = (
);
@@ -879,6 +1069,23 @@
productReference = 61B5F90209C4CEE200B25A18 /* Sparkle Test App.app */;
productType = "com.apple.product-type.application";
};
8B887B5D1517F3AB000BB292 /* Installation XPC Service */ = {
isa = PBXNativeTarget;
buildConfigurationList = 8B887B6E1517F3AC000BB292 /* Build configuration list for PBXNativeTarget "Installation XPC Service" */;
buildPhases = (
8B887B5A1517F3AB000BB292 /* Sources */,
8B887B5B1517F3AB000BB292 /* Frameworks */,
8B887B5C1517F3AB000BB292 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = "Installation XPC Service";
productName = Update;
productReference = 8B887B5E1517F3AB000BB292 /* com.andymatuschak.Sparkle.install-service.xpc */;
productType = "com.apple.product-type.bundle";
};
8DC2EF4F0486A6940098B216 /* Sparkle */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "Sparkle" */;
@@ -895,6 +1102,8 @@
);
dependencies = (
55C14F97136F044100649790 /* PBXTargetDependency */,
8B887B741517F472000BB292 /* PBXTargetDependency */,
03B5E65D15D3E32A0038BB67 /* PBXTargetDependency */,
);
name = Sparkle;
productInstallPath = "$(HOME)/Library/Frameworks";
@@ -965,11 +1174,21 @@
612279D80DB5470200AB99EA /* Sparkle Unit Tests */,
5D06E8CF0FD68C7C005AE3F6 /* BinaryDelta */,
55C14BB6136EEF1500649790 /* finish_installation */,
8B887B5D1517F3AB000BB292 /* Installation XPC Service */,
03B5E63915D399500038BB67 /* Downloading XPC Service */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
03B5E63815D399500038BB67 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
03B5E64115D399500038BB67 /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
55C14BB3136EEF1500649790 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
@@ -998,6 +1217,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
8B887B5C1517F3AB000BB292 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
3330768F190A5CB8005602B2 /* Sparkle.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
8DC2EF520486A6940098B216 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
@@ -1092,6 +1319,17 @@
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
03B5E63615D399500038BB67 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
338A79F11919191500EDD837 /* SULog.m in Sources */,
338A79F319193CDC00EDD837 /* SUConstants.m in Sources */,
03B5E64415D399500038BB67 /* download_service.m in Sources */,
BEA931AD17AA3EF7007D20A6 /* SUDSDownloader.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
55C14BB4136EEF1500649790 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@@ -1136,6 +1374,20 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
8B887B5A1517F3AB000BB292 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8B887B881517FB1C000BB292 /* SUInstaller.m in Sources */,
8B887B821517FAA4000BB292 /* SUPlainInstaller.m in Sources */,
8B887B811517FAA3000BB292 /* SUPlainInstallerInternals.m in Sources */,
8B887B8B1517FB52000BB292 /* SUPackageInstaller.m in Sources */,
8B887B8A1517FB43000BB292 /* SUConstants.m in Sources */,
8B887B891517FB3E000BB292 /* SULog.m in Sources */,
8B887B8E15180767000BB292 /* install_service.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
8DC2EF540486A6940098B216 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@@ -1174,6 +1426,8 @@
5D06E8ED0FD68CE4005AE3F6 /* SUBinaryDeltaCommon.m in Sources */,
5D06E93A0FD69271005AE3F6 /* SUBinaryDeltaUnarchiver.m in Sources */,
55C14F07136EF6DB00649790 /* SULog.m in Sources */,
8B887B7F1517F888000BB292 /* SUXPCInstaller.m in Sources */,
03B5E65B15D3E0490038BB67 /* SUXPCURLDownload.m in Sources */,
93FB277B156BD80D001937C7 /* SUPasswordPrompt.m in Sources */,
61B078CF15A5FB6100600039 /* SUCodeSigningVerifier.m in Sources */,
);
@@ -1182,6 +1436,11 @@
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
03B5E65D15D3E32A0038BB67 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 03B5E63915D399500038BB67 /* Downloading XPC Service */;
targetProxy = 03B5E65C15D3E32A0038BB67 /* PBXContainerItemProxy */;
};
55C14F97136F044100649790 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 55C14BB6136EEF1500649790 /* finish_installation */;
@@ -1202,9 +1461,22 @@
target = 8DC2EF4F0486A6940098B216 /* Sparkle */;
targetProxy = 61FA528C0E2D9EB200EF58AD /* PBXContainerItemProxy */;
};
8B887B741517F472000BB292 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 8B887B5D1517F3AB000BB292 /* Installation XPC Service */;
targetProxy = 8B887B731517F472000BB292 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
03B5E63F15D399500038BB67 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
03B5E64015D399500038BB67 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
55C14BDA136EF20D00649790 /* SUAutomaticUpdateAlert.xib */ = {
isa = PBXVariantGroup;
children = (
@@ -1361,11 +1633,92 @@
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
03B5E64615D399500038BB67 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 8B887B711517F447000BB292 /* ConfigServiceDebug.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Downloading XPC Service/Downloading XPC Service-Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = "Downloading XPC Service/Downloading XPC Service-Info.plist";
MACH_O_TYPE = mh_execute;
PRODUCT_NAME = "com.andymatuschak.Sparkle.download-service";
WRAPPER_EXTENSION = xpc;
};
name = Debug;
};
03B5E64715D399500038BB67 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 8B887B721517F447000BB292 /* ConfigServiceRelease.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Downloading XPC Service/Downloading XPC Service-Prefix.pch";
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = "Downloading XPC Service/Downloading XPC Service-Info.plist";
MACH_O_TYPE = mh_execute;
PRODUCT_NAME = "com.andymatuschak.Sparkle.download-service";
WRAPPER_EXTENSION = xpc;
};
name = Release;
};
03B5E64815D399500038BB67 /* Release (GC dual-mode; 10.5+) */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 8B887B721517F447000BB292 /* ConfigServiceRelease.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Downloading XPC Service/Downloading XPC Service-Prefix.pch";
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = "Downloading XPC Service/Downloading XPC Service-Info.plist";
MACH_O_TYPE = mh_execute;
PRODUCT_NAME = "com.andymatuschak.Sparkle.download-service";
WRAPPER_EXTENSION = xpc;
};
name = "Release (GC dual-mode; 10.5+)";
};
1DEB91AE08733DA50010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = FA1941CA0D94A70100DD942E /* ConfigFrameworkDebug.xcconfig */;
buildSettings = {
CODE_SIGN_RESOURCE_RULES_PATH = ResourceRules.plist;
COMBINE_HIDPI_IMAGES = YES;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/External",
);
};
name = Debug;
};
@@ -1373,18 +1726,25 @@
isa = XCBuildConfiguration;
baseConfigurationReference = FA1941D50D94A70100DD942E /* ConfigFrameworkRelease.xcconfig */;
buildSettings = {
CODE_SIGN_RESOURCE_RULES_PATH = ResourceRules.plist;
COMBINE_HIDPI_IMAGES = YES;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/External",
);
};
name = Release;
};
1DEB91B208733DA50010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 02AC40CE1743CC23005207B1 /* ConfigCommonProject64bit.xcconfig */;
buildSettings = {
};
name = Debug;
};
1DEB91B308733DA50010E9CD /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 02AC40CE1743CC23005207B1 /* ConfigCommonProject64bit.xcconfig */;
buildSettings = {
};
name = Release;
@@ -1420,7 +1780,6 @@
ALWAYS_SEARCH_USER_PATHS = NO;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = finish_installation.pch;
@@ -1481,6 +1840,7 @@
};
61072EAD0DF263BD008FE88B /* Release (GC dual-mode; 10.5+) */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 02AC40CF1743CC23005207B1 /* ConfigCommonProjectUniversalBinary.xcconfig */;
buildSettings = {
};
name = "Release (GC dual-mode; 10.5+)";
@@ -1489,7 +1849,12 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 61072EB20DF2640C008FE88B /* ConfigFrameworkReleaseGCSupport.xcconfig */;
buildSettings = {
CODE_SIGN_RESOURCE_RULES_PATH = ResourceRules.plist;
COMBINE_HIDPI_IMAGES = YES;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/External",
);
};
name = "Release (GC dual-mode; 10.5+)";
};
@@ -1497,6 +1862,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 615409A8103BA09100125AF1 /* ConfigTestAppReleaseGCSupport.xcconfig */;
buildSettings = {
CODE_SIGN_ENTITLEMENTS = "Sparkle Test App.entitlements";
COMBINE_HIDPI_IMAGES = YES;
};
name = "Release (GC dual-mode; 10.5+)";
@@ -1529,6 +1895,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = FA1941CB0D94A70100DD942E /* ConfigTestAppDebug.xcconfig */;
buildSettings = {
CODE_SIGN_ENTITLEMENTS = "Sparkle Test App.entitlements";
COMBINE_HIDPI_IMAGES = YES;
};
name = Debug;
@@ -1537,18 +1904,161 @@
isa = XCBuildConfiguration;
baseConfigurationReference = FA1941D20D94A70100DD942E /* ConfigTestAppRelease.xcconfig */;
buildSettings = {
CODE_SIGN_ENTITLEMENTS = "Sparkle Test App.entitlements";
COMBINE_HIDPI_IMAGES = YES;
};
name = Release;
};
8B887B6B1517F3AC000BB292 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 8B887B711517F447000BB292 /* ConfigServiceDebug.xcconfig */;
buildSettings = {
GCC_PREFIX_HEADER = "Installation XPC Service/install_service.pch";
INFOPLIST_FILE = "Installation XPC Service/SandboxService.plist";
PRODUCT_NAME = "com.andymatuschak.Sparkle.install-service";
};
name = Debug;
};
8B887B6C1517F3AC000BB292 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 8B887B721517F447000BB292 /* ConfigServiceRelease.xcconfig */;
buildSettings = {
GCC_PREFIX_HEADER = "Installation XPC Service/install_service.pch";
INFOPLIST_FILE = "Installation XPC Service/SandboxService.plist";
PRODUCT_NAME = "com.andymatuschak.Sparkle.install-service";
};
name = Release;
};
8B887B6D1517F3AC000BB292 /* Release (GC dual-mode; 10.5+) */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 8B887B721517F447000BB292 /* ConfigServiceRelease.xcconfig */;
buildSettings = {
GCC_PREFIX_HEADER = "Installation XPC Service/install_service.pch";
INFOPLIST_FILE = "Installation XPC Service/SandboxService.plist";
PRODUCT_NAME = "com.andymatuschak.Sparkle.install-service";
};
name = "Release (GC dual-mode; 10.5+)";
};
BE2786B3179847A5000CA04E /* Deployment */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 02AC40CE1743CC23005207B1 /* ConfigCommonProject64bit.xcconfig */;
buildSettings = {
};
name = Deployment;
};
BE2786B4179847A5000CA04E /* Deployment */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = FA1941D50D94A70100DD942E /* ConfigFrameworkRelease.xcconfig */;
buildSettings = {
CODE_SIGN_RESOURCE_RULES_PATH = ResourceRules.plist;
COMBINE_HIDPI_IMAGES = YES;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/External",
);
};
name = Deployment;
};
BE2786B5179847A5000CA04E /* Deployment */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = FA1941D20D94A70100DD942E /* ConfigTestAppRelease.xcconfig */;
buildSettings = {
CODE_SIGN_ENTITLEMENTS = "Sparkle Test App.entitlements";
COMBINE_HIDPI_IMAGES = YES;
};
name = Deployment;
};
BE2786B6179847A5000CA04E /* Deployment */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = FA3AAF391050B273004B3130 /* ConfigUnitTestRelease.xcconfig */;
buildSettings = {
COMBINE_HIDPI_IMAGES = YES;
};
name = Deployment;
};
BE2786B7179847A5000CA04E /* Deployment */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 5D06E8F30FD68D21005AE3F6 /* ConfigBinaryDeltaRelease.xcconfig */;
buildSettings = {
};
name = Deployment;
};
BE2786B8179847A5000CA04E /* Deployment */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = FA1941D40D94A70100DD942E /* ConfigRelaunchRelease.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = YES;
GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = finish_installation.pch;
INFOPLIST_FILE = "finish_installation-Info.plist";
INSTALL_PATH = "$(HOME)/Applications";
OTHER_LDFLAGS = (
"-framework",
Foundation,
"-framework",
AppKit,
);
PRODUCT_NAME = finish_installation;
ZERO_LINK = NO;
};
name = Deployment;
};
BE2786B9179847A5000CA04E /* Deployment */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 8B887B721517F447000BB292 /* ConfigServiceRelease.xcconfig */;
buildSettings = {
GCC_PREFIX_HEADER = "Installation XPC Service/install_service.pch";
INFOPLIST_FILE = "Installation XPC Service/SandboxService.plist";
PRODUCT_NAME = "com.andymatuschak.Sparkle.install-service";
};
name = Deployment;
};
BE2786BA179847A5000CA04E /* Deployment */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 8B887B721517F447000BB292 /* ConfigServiceRelease.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Downloading XPC Service/Downloading XPC Service-Prefix.pch";
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = "Downloading XPC Service/Downloading XPC Service-Info.plist";
MACH_O_TYPE = mh_execute;
PRODUCT_NAME = "com.andymatuschak.Sparkle.download-service";
WRAPPER_EXTENSION = xpc;
};
name = Deployment;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
03B5E64515D399500038BB67 /* Build configuration list for PBXNativeTarget "Downloading XPC Service" */ = {
isa = XCConfigurationList;
buildConfigurations = (
03B5E64615D399500038BB67 /* Debug */,
03B5E64715D399500038BB67 /* Release */,
BE2786BA179847A5000CA04E /* Deployment */,
03B5E64815D399500038BB67 /* Release (GC dual-mode; 10.5+) */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "Sparkle" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1DEB91AE08733DA50010E9CD /* Debug */,
1DEB91AF08733DA50010E9CD /* Release */,
BE2786B4179847A5000CA04E /* Deployment */,
61072EAE0DF263BD008FE88B /* Release (GC dual-mode; 10.5+) */,
);
defaultConfigurationIsVisible = 0;
@@ -1559,6 +2069,7 @@
buildConfigurations = (
1DEB91B208733DA50010E9CD /* Debug */,
1DEB91B308733DA50010E9CD /* Release */,
BE2786B3179847A5000CA04E /* Deployment */,
61072EAD0DF263BD008FE88B /* Release (GC dual-mode; 10.5+) */,
);
defaultConfigurationIsVisible = 0;
@@ -1569,6 +2080,7 @@
buildConfigurations = (
55C14BBB136EEF1500649790 /* Debug */,
55C14BBC136EEF1500649790 /* Release */,
BE2786B8179847A5000CA04E /* Deployment */,
55C14BBD136EEF1500649790 /* Release (GC dual-mode; 10.5+) */,
);
defaultConfigurationIsVisible = 0;
@@ -1579,6 +2091,7 @@
buildConfigurations = (
5D06E8D20FD68C7D005AE3F6 /* Debug */,
5D06E8D30FD68C7D005AE3F6 /* Release */,
BE2786B7179847A5000CA04E /* Deployment */,
5D06E8D40FD68C7D005AE3F6 /* Release (GC dual-mode; 10.5+) */,
);
defaultConfigurationIsVisible = 0;
@@ -1589,6 +2102,7 @@
buildConfigurations = (
612279DB0DB5470300AB99EA /* Debug */,
612279DC0DB5470300AB99EA /* Release */,
BE2786B6179847A5000CA04E /* Deployment */,
61072EB10DF263BD008FE88B /* Release (GC dual-mode; 10.5+) */,
);
defaultConfigurationIsVisible = 0;
@@ -1599,11 +2113,23 @@
buildConfigurations = (
61B5F90609C4CEE300B25A18 /* Debug */,
61B5F90709C4CEE300B25A18 /* Release */,
BE2786B5179847A5000CA04E /* Deployment */,
61072EAF0DF263BD008FE88B /* Release (GC dual-mode; 10.5+) */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
8B887B6E1517F3AC000BB292 /* Build configuration list for PBXNativeTarget "Installation XPC Service" */ = {
isa = XCConfigurationList;
buildConfigurations = (
8B887B6B1517F3AC000BB292 /* Debug */,
8B887B6C1517F3AC000BB292 /* Release */,
BE2786B9179847A5000CA04E /* Deployment */,
8B887B6D1517F3AC000BB292 /* Release (GC dual-mode; 10.5+) */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 0867D690FE84028FC02AAC07 /* Project object */;
@@ -79,7 +79,7 @@
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
@@ -110,7 +110,7 @@
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
buildConfiguration = "Deployment"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Binary file not shown.