diff --git a/Configurations/ConfigCommon.xcconfig b/Configurations/ConfigCommon.xcconfig index 26ab1639..fc78b29e 100644 --- a/Configurations/ConfigCommon.xcconfig +++ b/Configurations/ConfigCommon.xcconfig @@ -34,19 +34,19 @@ MACOSX_DEPLOYMENT_TARGET = 10.8 PRODUCT_NAME = ${TARGET_NAME} PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.Sparkle.${PRODUCT_NAME:rfc1034identifier} +INSTALLER_CONNECTION_PRODUCT_NAME = SparkleInstallerConnection +INSTALLER_STATUS_PRODUCT_NAME = SparkleInstallerStatus INSTALLER_LAUNCHER_PRODUCT_NAME = SparkleInstallerLauncher TEMPORARY_DOWNLOADER_PRODUCT_NAME = SparkleTemporaryDownloader PERSISTENT_DOWNLOADER_PRODUCT_NAME = SparklePersistentDownloader -REMOTE_MESSAGE_PORT_PRODUCT_NAME = SparkleRemoteMessagePort -LOCAL_MESSAGE_PORT_PRODUCT_NAME = SparkleLocalMessagePort +INSTALLER_CONNECTION_BUNDLE_ID = org.sparkle-project.${INSTALLER_CONNECTION_PRODUCT_NAME} +INSTALLER_STATUS_BUNDLE_ID = org.sparkle-project.${INSTALLER_STATUS_PRODUCT_NAME} INSTALLER_LAUNCHER_BUNDLE_ID = org.sparkle-project.${INSTALLER_LAUNCHER_PRODUCT_NAME} TEMPORARY_DOWNLOADER_BUNDLE_ID = org.sparkle-project.${TEMPORARY_DOWNLOADER_PRODUCT_NAME} PERSISTENT_DOWNLOADER_BUNDLE_ID = org.sparkle-project.${PERSISTENT_DOWNLOADER_PRODUCT_NAME} -REMOTE_MESSAGE_PORT_BUNDLE_ID = org.sparkle-project.${REMOTE_MESSAGE_PORT_PRODUCT_NAME} -LOCAL_MESSAGE_PORT_BUNDLE_ID = org.sparkle-project.${LOCAL_MESSAGE_PORT_PRODUCT_NAME} -GCC_PREPROCESSOR_DEFINITIONS_COMMON = SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME=$(SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) SPARKLE_AUTOMATED_DOWNGRADES=$(SPARKLE_AUTOMATED_DOWNGRADES) SPARKLE_APPEND_VERSION_NUMBER=$(SPARKLE_APPEND_VERSION_NUMBER) SPARKLE_BUNDLE_IDENTIFIER=\"$(SPARKLE_BUNDLE_IDENTIFIER)\" CURRENT_PROJECT_VERSION=\"$(CURRENT_PROJECT_VERSION)\" SPARKLE_RELAUNCH_TOOL_NAME=\"$(SPARKLE_RELAUNCH_TOOL_NAME)\" SPARKLE_INSTALLER_PROGRESS_TOOL_NAME=\"$(SPARKLE_INSTALLER_PROGRESS_TOOL_NAME)\" SPARKLE_ICON_NAME=\"$(SPARKLE_ICON_NAME)\" INSTALLER_LAUNCHER_BUNDLE_ID=\"${INSTALLER_LAUNCHER_BUNDLE_ID}\" TEMPORARY_DOWNLOADER_BUNDLE_ID=\"${TEMPORARY_DOWNLOADER_BUNDLE_ID}\" PERSISTENT_DOWNLOADER_BUNDLE_ID=\"${PERSISTENT_DOWNLOADER_BUNDLE_ID}\" REMOTE_MESSAGE_PORT_BUNDLE_ID=\"${REMOTE_MESSAGE_PORT_BUNDLE_ID}\" LOCAL_MESSAGE_PORT_BUNDLE_ID=\"${LOCAL_MESSAGE_PORT_BUNDLE_ID}\" INSTALLER_LAUNCHER_PRODUCT_NAME=\"${INSTALLER_LAUNCHER_PRODUCT_NAME}\" TEMPORARY_DOWNLOADER_PRODUCT_NAME=\"${TEMPORARY_DOWNLOADER_PRODUCT_NAME}\" PERSISTENT_DOWNLOADER_PRODUCT_NAME=\"${PERSISTENT_DOWNLOADER_PRODUCT_NAME}\" REMOTE_MESSAGE_PORT_PRODUCT_NAME=\"${REMOTE_MESSAGE_PORT_PRODUCT_NAME}\" LOCAL_MESSAGE_PORT_PRODUCT_NAME=\"${LOCAL_MESSAGE_PORT_PRODUCT_NAME}\" SPARKLE_FILEOP_TOOL_NAME=\"$(SPARKLE_FILEOP_TOOL_NAME)\" +GCC_PREPROCESSOR_DEFINITIONS_COMMON = SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME=$(SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) SPARKLE_AUTOMATED_DOWNGRADES=$(SPARKLE_AUTOMATED_DOWNGRADES) SPARKLE_APPEND_VERSION_NUMBER=$(SPARKLE_APPEND_VERSION_NUMBER) SPARKLE_BUNDLE_IDENTIFIER=\"$(SPARKLE_BUNDLE_IDENTIFIER)\" CURRENT_PROJECT_VERSION=\"$(CURRENT_PROJECT_VERSION)\" SPARKLE_RELAUNCH_TOOL_NAME=\"$(SPARKLE_RELAUNCH_TOOL_NAME)\" SPARKLE_INSTALLER_PROGRESS_TOOL_NAME=\"$(SPARKLE_INSTALLER_PROGRESS_TOOL_NAME)\" SPARKLE_ICON_NAME=\"$(SPARKLE_ICON_NAME)\" INSTALLER_LAUNCHER_BUNDLE_ID=\"${INSTALLER_LAUNCHER_BUNDLE_ID}\" INSTALLER_CONNECTION_BUNDLE_ID=\"${INSTALLER_CONNECTION_BUNDLE_ID}\" INSTALLER_STATUS_BUNDLE_ID=\"${INSTALLER_STATUS_BUNDLE_ID}\" TEMPORARY_DOWNLOADER_BUNDLE_ID=\"${TEMPORARY_DOWNLOADER_BUNDLE_ID}\" PERSISTENT_DOWNLOADER_BUNDLE_ID=\"${PERSISTENT_DOWNLOADER_BUNDLE_ID}\" INSTALLER_LAUNCHER_PRODUCT_NAME=\"${INSTALLER_LAUNCHER_PRODUCT_NAME}\" INSTALLER_CONNECTION_PRODUCT_NAME=\"${INSTALLER_CONNECTION_PRODUCT_NAME}\" INSTALLER_STATUS_PRODUCT_NAME=\"${INSTALLER_STATUS_PRODUCT_NAME}\" TEMPORARY_DOWNLOADER_PRODUCT_NAME=\"${TEMPORARY_DOWNLOADER_PRODUCT_NAME}\" PERSISTENT_DOWNLOADER_PRODUCT_NAME=\"${PERSISTENT_DOWNLOADER_PRODUCT_NAME}\" SPARKLE_FILEOP_TOOL_NAME=\"$(SPARKLE_FILEOP_TOOL_NAME)\" CLANG_ENABLE_OBJC_ARC = YES GCC_ENABLE_PASCAL_STRINGS = NO diff --git a/Configurations/ConfigInstallerConnection.xcconfig b/Configurations/ConfigInstallerConnection.xcconfig new file mode 100644 index 00000000..5048cc00 --- /dev/null +++ b/Configurations/ConfigInstallerConnection.xcconfig @@ -0,0 +1,6 @@ +// InstallerConnection + +INFOPLIST_FILE = InstallerConnection/Info.plist +WRAPPER_EXTENSION = xpc +PRODUCT_BUNDLE_IDENTIFIER = ${INSTALLER_CONNECTION_BUNDLE_ID} +PRODUCT_NAME = ${INSTALLER_CONNECTION_PRODUCT_NAME} diff --git a/Configurations/ConfigInstallerConnectionDebug.xcconfig b/Configurations/ConfigInstallerConnectionDebug.xcconfig new file mode 100644 index 00000000..51a4d689 --- /dev/null +++ b/Configurations/ConfigInstallerConnectionDebug.xcconfig @@ -0,0 +1,5 @@ +// InstallerConnection Debug + +#include "ConfigInstallerConnection.xcconfig" + +CODE_SIGN_IDENTITY = - diff --git a/Configurations/ConfigInstallerStatus.xcconfig b/Configurations/ConfigInstallerStatus.xcconfig new file mode 100644 index 00000000..93bcbda2 --- /dev/null +++ b/Configurations/ConfigInstallerStatus.xcconfig @@ -0,0 +1,6 @@ +// InstallerStatus + +INFOPLIST_FILE = InstallerStatus/Info.plist +WRAPPER_EXTENSION = xpc +PRODUCT_BUNDLE_IDENTIFIER = ${INSTALLER_STATUS_BUNDLE_ID} +PRODUCT_NAME = ${INSTALLER_STATUS_PRODUCT_NAME} diff --git a/Configurations/ConfigInstallerStatusDebug.xcconfig b/Configurations/ConfigInstallerStatusDebug.xcconfig new file mode 100644 index 00000000..86c48100 --- /dev/null +++ b/Configurations/ConfigInstallerStatusDebug.xcconfig @@ -0,0 +1,5 @@ +// InstallerStatus Debug + +#include "ConfigInstallerStatus.xcconfig" + +CODE_SIGN_IDENTITY = - diff --git a/Configurations/ConfigLocalMessagePort.xcconfig b/Configurations/ConfigLocalMessagePort.xcconfig deleted file mode 100644 index e4557056..00000000 --- a/Configurations/ConfigLocalMessagePort.xcconfig +++ /dev/null @@ -1,6 +0,0 @@ -// LocalMessagePort - -INFOPLIST_FILE = LocalMessagePort/Info.plist -WRAPPER_EXTENSION = xpc -PRODUCT_BUNDLE_IDENTIFIER = ${LOCAL_MESSAGE_PORT_BUNDLE_ID} -PRODUCT_NAME = ${LOCAL_MESSAGE_PORT_PRODUCT_NAME} diff --git a/Configurations/ConfigLocalMessagePortDebug.xcconfig b/Configurations/ConfigLocalMessagePortDebug.xcconfig deleted file mode 100644 index 6b9fa638..00000000 --- a/Configurations/ConfigLocalMessagePortDebug.xcconfig +++ /dev/null @@ -1,5 +0,0 @@ -// LocalMessagePort Debug - -#include "ConfigLocalMessagePort.xcconfig" - -CODE_SIGN_IDENTITY = - diff --git a/Configurations/ConfigRemoteMessagePort.xcconfig b/Configurations/ConfigRemoteMessagePort.xcconfig deleted file mode 100644 index 7b42287e..00000000 --- a/Configurations/ConfigRemoteMessagePort.xcconfig +++ /dev/null @@ -1,6 +0,0 @@ -// RemoteMessagePort - -INFOPLIST_FILE = RemoteMessagePort/Info.plist -WRAPPER_EXTENSION = xpc -PRODUCT_BUNDLE_IDENTIFIER = ${REMOTE_MESSAGE_PORT_BUNDLE_ID} -PRODUCT_NAME = ${REMOTE_MESSAGE_PORT_PRODUCT_NAME} diff --git a/Configurations/ConfigRemoteMessagePortDebug.xcconfig b/Configurations/ConfigRemoteMessagePortDebug.xcconfig deleted file mode 100644 index 0bf89b4a..00000000 --- a/Configurations/ConfigRemoteMessagePortDebug.xcconfig +++ /dev/null @@ -1,5 +0,0 @@ -// RemoteMessagePort Debug - -#include "ConfigRemoteMessagePort.xcconfig" - -CODE_SIGN_IDENTITY = - diff --git a/Configurations/make-release-package.sh b/Configurations/make-release-package.sh index ee7792d4..64e969c5 100755 --- a/Configurations/make-release-package.sh +++ b/Configurations/make-release-package.sh @@ -24,8 +24,8 @@ if [ "$ACTION" = "" ] ; then cp -R "$CONFIGURATION_BUILD_DIR/SparkleInstallerLauncher.xpc" "$CONFIGURATION_BUILD_DIR/staging/XPCServices" cp -R "$CONFIGURATION_BUILD_DIR/SparklePersistentDownloader.xpc" "$CONFIGURATION_BUILD_DIR/staging/XPCServices" cp -R "$CONFIGURATION_BUILD_DIR/SparkleTemporaryDownloader.xpc" "$CONFIGURATION_BUILD_DIR/staging/XPCServices" - cp -R "$CONFIGURATION_BUILD_DIR/SparkleLocalMessagePort.xpc" "$CONFIGURATION_BUILD_DIR/staging/XPCServices" - cp -R "$CONFIGURATION_BUILD_DIR/SparkleRemoteMessagePort.xpc" "$CONFIGURATION_BUILD_DIR/staging/XPCServices" + cp -R "$CONFIGURATION_BUILD_DIR/SparkleInstallerConnection.xpc" "$CONFIGURATION_BUILD_DIR/staging/XPCServices" + cp -R "$CONFIGURATION_BUILD_DIR/SparkleInstallerStatus.xpc" "$CONFIGURATION_BUILD_DIR/staging/XPCServices" cp "$SRCROOT/TemporaryDownloader/SparkleTemporaryDownloader.entitlements" "$CONFIGURATION_BUILD_DIR/staging/XPCServices" cp "$SRCROOT/PersistentDownloader/SparklePersistentDownloader.entitlements" "$CONFIGURATION_BUILD_DIR/staging/XPCServices" @@ -40,8 +40,8 @@ if [ "$ACTION" = "" ] ; then cp -R "$CONFIGURATION_BUILD_DIR/SparkleInstallerLauncher.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/XPCServices" cp -R "$CONFIGURATION_BUILD_DIR/SparklePersistentDownloader.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/XPCServices" cp -R "$CONFIGURATION_BUILD_DIR/SparkleTemporaryDownloader.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/XPCServices" - cp -R "$CONFIGURATION_BUILD_DIR/SparkleLocalMessagePort.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/XPCServices" - cp -R "$CONFIGURATION_BUILD_DIR/SparkleRemoteMessagePort.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/XPCServices" + cp -R "$CONFIGURATION_BUILD_DIR/SparkleInstallerConnection.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/XPCServices" + cp -R "$CONFIGURATION_BUILD_DIR/SparkleInstallerStatus.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/XPCServices" fi cd "$CONFIGURATION_BUILD_DIR/staging" diff --git a/LocalMessagePort/Info.plist b/InstallerConnection/Info.plist similarity index 100% rename from LocalMessagePort/Info.plist rename to InstallerConnection/Info.plist diff --git a/InstallerConnection/SUInstallerCommunicationProtocol.h b/InstallerConnection/SUInstallerCommunicationProtocol.h new file mode 100644 index 00000000..109fd79c --- /dev/null +++ b/InstallerConnection/SUInstallerCommunicationProtocol.h @@ -0,0 +1,19 @@ +// +// SUInstallerCommunicationProtocol.h +// Sparkle +// +// Created by Mayur Pawashe on 7/9/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol SUInstallerCommunicationProtocol + +- (void)handleMessageWithIdentifier:(int32_t)identifier data:(NSData *)data; + +@end + +NS_ASSUME_NONNULL_END diff --git a/InstallerConnection/SUInstallerConnection.h b/InstallerConnection/SUInstallerConnection.h new file mode 100644 index 00000000..dfbcc5fc --- /dev/null +++ b/InstallerConnection/SUInstallerConnection.h @@ -0,0 +1,22 @@ +// +// SUInstallerConnection.h +// InstallerConnection +// +// Created by Mayur Pawashe on 7/9/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import +#import "SUInstallerConnectionProtocol.h" + +NS_ASSUME_NONNULL_BEGIN + +// This object implements the protocol which we have defined. It provides the actual behavior for the service. It is 'exported' by the service to make it available to the process hosting the service over an NSXPCConnection. +@interface SUInstallerConnection : NSObject + +// Due to XPC reasons, this delegate is strongly referenced, until it's invalidated +- (instancetype)initWithDelegate:(id)delegate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/InstallerConnection/SUInstallerConnection.m b/InstallerConnection/SUInstallerConnection.m new file mode 100644 index 00000000..9db088a5 --- /dev/null +++ b/InstallerConnection/SUInstallerConnection.m @@ -0,0 +1,113 @@ +// +// SUInstallerConnection.m +// InstallerConnection +// +// Created by Mayur Pawashe on 7/9/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import "SUInstallerConnection.h" +#import "SUSystemAuthorization.h" + +static NSString *SUInstallerConnectionKeepAliveReason = @"Installer Connection Keep Alive"; + +@interface SUInstallerConnection () + +// Intentionally not weak for XPC reasons +@property (nonatomic) id delegate; + +@property (nonatomic) BOOL disabledAutomaticTermination; +@property (nonatomic, copy) void (^invalidationBlock)(void); +@property (nonatomic) NSXPCConnection *connection; + +@end + +@implementation SUInstallerConnection + +@synthesize delegate = _delegate; +@synthesize disabledAutomaticTermination = _disabledAutomaticTermination; +@synthesize invalidationBlock = _invalidationBlock; +@synthesize connection = _connection; + +- (instancetype)initWithDelegate:(id)delegate +{ + self = [super init]; + if (self != nil) { + _delegate = delegate; + + // If we are a XPC service, protect it from being terminated until the invalidation handler is set + _disabledAutomaticTermination = YES; + [[NSProcessInfo processInfo] disableAutomaticTermination:SUInstallerConnectionKeepAliveReason]; + } + return self; +} + +- (void)enableAutomaticTermination +{ + if (self.disabledAutomaticTermination) { + [[NSProcessInfo processInfo] enableAutomaticTermination:SUInstallerConnectionKeepAliveReason]; + self.disabledAutomaticTermination = NO; + } +} + +- (void)setInvalidationHandler:(void (^)(void))invalidationHandler +{ + self.invalidationBlock = invalidationHandler; + + // No longer needed because of invalidation callback + [self enableAutomaticTermination]; +} + +- (void)setServiceName:(NSString *)serviceName +{ + NSXPCConnectionOptions options = SUGrantsSystemAuthorizationAccess() ? NSXPCConnectionPrivileged : 0; + NSXPCConnection *connection = [[NSXPCConnection alloc] initWithMachServiceName:serviceName options:options]; + + connection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)]; + connection.exportedObject = self.delegate; + + connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)]; + + self.connection = connection; + + __weak SUInstallerConnection *weakSelf = self; + self.connection.interruptionHandler = ^{ + [weakSelf invalidate]; + }; + + self.connection.invalidationHandler = ^{ + SUInstallerConnection *strongSelf = weakSelf; + if (strongSelf != nil) { + strongSelf.connection = nil; + [strongSelf invalidate]; + } + }; + + [self.connection resume]; +} + +- (void)handleMessageWithIdentifier:(int32_t)identifier data:(NSData *)data +{ + [self.connection.remoteObjectProxy handleMessageWithIdentifier:identifier data:data]; +} + +// This method can be called by us or from a remote +- (void)invalidate +{ + dispatch_async(dispatch_get_main_queue(), ^{ + [self.connection invalidate]; + self.connection = nil; + + if (self.invalidationBlock != nil) { + self.invalidationBlock(); + self.invalidationBlock = nil; + } + + // Break the retain cycle + self.delegate = nil; + + [self enableAutomaticTermination]; + }); +} + +@end diff --git a/InstallerConnection/SUInstallerConnectionProtocol.h b/InstallerConnection/SUInstallerConnectionProtocol.h new file mode 100644 index 00000000..03cf0e94 --- /dev/null +++ b/InstallerConnection/SUInstallerConnectionProtocol.h @@ -0,0 +1,24 @@ +// +// SUInstallerConnectionProtocol.h +// InstallerConnection +// +// Created by Mayur Pawashe on 7/9/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import +#import "SUInstallerCommunicationProtocol.h" + +NS_ASSUME_NONNULL_BEGIN + +@protocol SUInstallerConnectionProtocol + +- (void)setInvalidationHandler:(void (^)(void))invalidationHandler; + +- (void)setServiceName:(NSString *)serviceName; + +- (void)invalidate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/InstallerConnection/SUXPCInstallerConnection.h b/InstallerConnection/SUXPCInstallerConnection.h new file mode 100644 index 00000000..da201369 --- /dev/null +++ b/InstallerConnection/SUXPCInstallerConnection.h @@ -0,0 +1,21 @@ +// +// SUXPCInstallerConnection.h +// Sparkle +// +// Created by Mayur Pawashe on 7/10/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import +#import "SUInstallerConnectionProtocol.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface SUXPCInstallerConnection : NSObject + +// Due to XPC reasons, this delegate is strongly referenced, until it's invalidated +- (instancetype)initWithDelegate:(id)delegate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/InstallerConnection/SUXPCInstallerConnection.m b/InstallerConnection/SUXPCInstallerConnection.m new file mode 100644 index 00000000..af28c0d3 --- /dev/null +++ b/InstallerConnection/SUXPCInstallerConnection.m @@ -0,0 +1,89 @@ +// +// SUXPCInstallerConnection.m +// Sparkle +// +// Created by Mayur Pawashe on 7/10/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import "SUXPCInstallerConnection.h" + +@interface SUXPCInstallerConnection () + +@property (nonatomic) NSXPCConnection *connection; +@property (nonatomic) id delegate; // intentionally not weak for XPC reasons +@property (nonatomic, copy) void (^invalidationBlock)(void); + +@end + +@implementation SUXPCInstallerConnection + +@synthesize connection = _connection; +@synthesize delegate = _delegate; +@synthesize invalidationBlock = _invalidationBlock; + +- (instancetype)initWithDelegate:(id)delegate +{ + self = [super init]; + if (self != nil) { + _connection = [[NSXPCConnection alloc] initWithServiceName:@INSTALLER_CONNECTION_BUNDLE_ID]; + _connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerConnectionProtocol)]; + + __weak SUXPCInstallerConnection *weakSelf = self; + _connection.invalidationHandler = ^{ + [weakSelf invokeInvalidation]; + }; + + _connection.interruptionHandler = ^{ + [weakSelf invokeInvalidation]; + [weakSelf.connection invalidate]; + }; + + _delegate = delegate; + + _connection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)]; + _connection.exportedObject = _delegate; + + [_connection resume]; + } + return self; +} + +- (void)setInvalidationHandler:(void (^)(void))invalidationHandler +{ + self.invalidationBlock = invalidationHandler; + + __weak SUXPCInstallerConnection *weakSelf = self; + [self.connection.remoteObjectProxy setInvalidationHandler:^{ + [weakSelf invokeInvalidation]; + }]; +} + +- (void)setServiceName:(NSString *)serviceName +{ + [self.connection.remoteObjectProxy setServiceName:serviceName]; +} + +- (void)handleMessageWithIdentifier:(int32_t)identifier data:(NSData *)data +{ + [self.connection.remoteObjectProxy handleMessageWithIdentifier:identifier data:data]; +} + +- (void)invalidate +{ + [self.connection.remoteObjectProxy invalidate]; + [self.connection invalidate]; + self.connection = nil; +} + +- (void)invokeInvalidation +{ + if (self.invalidationBlock != nil) { + self.invalidationBlock(); + self.invalidationBlock = nil; + } + // Break our retain cycle + self.delegate = nil; +} + +@end diff --git a/LocalMessagePort/main.m b/InstallerConnection/main.m similarity index 70% rename from LocalMessagePort/main.m rename to InstallerConnection/main.m index ffcf2f84..9a82857e 100644 --- a/LocalMessagePort/main.m +++ b/InstallerConnection/main.m @@ -1,14 +1,14 @@ // // main.m -// LocalMessagePort +// InstallerConnection // -// Created by Mayur Pawashe on 6/14/16. +// Created by Mayur Pawashe on 7/9/16. // Copyright © 2016 Sparkle Project. All rights reserved. // #import -#import "SULocalMessagePort.h" -#import "SULocalMessagePortDelegate.h" +#import "SUInstallerConnection.h" +#import "SUInstallerCommunicationProtocol.h" @interface ServiceDelegate : NSObject @end @@ -19,10 +19,13 @@ // This method is where the NSXPCListener configures, accepts, and resumes a new incoming NSXPCConnection. // Configure the connection. - newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SULocalMessagePortProtocol)]; - newConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SULocalMessagePortDelegate)]; + // First, set the interface that the exported object implements. + newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerConnectionProtocol)]; + newConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)]; - newConnection.exportedObject = [[SULocalMessagePort alloc] initWithDelegate:newConnection.remoteObjectProxy]; + SUInstallerConnection *exportedObject = [[SUInstallerConnection alloc] initWithDelegate:newConnection.remoteObjectProxy]; + + newConnection.exportedObject = exportedObject; // Resuming the connection allows the system to deliver more incoming messages. [newConnection resume]; diff --git a/InstallerLauncher/SUInstallerLauncher.m b/InstallerLauncher/SUInstallerLauncher.m index e9d95c9e..16dc43f3 100644 --- a/InstallerLauncher/SUInstallerLauncher.m +++ b/InstallerLauncher/SUInstallerLauncher.m @@ -9,55 +9,65 @@ #import "SUInstallerLauncher.h" #import "SUFileManager.h" #import "SULog.h" -#import +#import "SUMessageTypes.h" +#import +#import "SUSystemAuthorization.h" @implementation SUInstallerLauncher -- (void)launchInstallerAtPath:(NSString *)installerPath withHostBundleIdentifier:(NSString *)hostBundleIdentifier inheritingPrivileges:(BOOL)inheritingPrivileges completion:(void (^)(BOOL success))completionHandler +- (void)launchInstallerAtPath:(NSString *)installerPath withHostBundleIdentifier:(NSString *)hostBundleIdentifier allowingInteraction:(BOOL)allowingInteraction completion:(void (^)(BOOL success))completionHandler { dispatch_async(dispatch_get_main_queue(), ^{ - NSError *quarantineError = nil; SUFileManager *fileManager = [SUFileManager defaultManager]; - if (![fileManager releaseItemFromQuarantineAtRootURL:[NSURL fileURLWithPath:installerPath] error:&quarantineError]) { + NSURL *installerURL = [NSURL fileURLWithPath:installerPath]; + + NSError *quarantineError = nil; + if (![fileManager releaseItemFromQuarantineAtRootURL:installerURL error:&quarantineError]) { // This may or may not be a fatal error depending on if the process is sandboxed or not SULog(@"Failed to release quarantine on installer at %@ with error %@", installerPath, quarantineError); } - NSArray *arguments = @[hostBundleIdentifier, @(inheritingPrivileges).stringValue]; + NSString *executablePath = [[[installerPath stringByAppendingPathComponent:@"Contents"] stringByAppendingPathComponent:@"MacOS"] stringByAppendingPathComponent:@SPARKLE_RELAUNCH_TOOL_NAME]; - if (!inheritingPrivileges) { - // This new process does not inherit privileges because it's being launched via LaunchServices - // This allows the installer app to make authorization requests for example from a non-sandboxed XPC service - // From testing I have found this is necessary if the entirety of Sparkle's framework is inside a XPC service - NSError *launchError = nil; - NSRunningApplication *runningApplication = [[NSWorkspace sharedWorkspace] launchApplicationAtURL:[NSURL fileURLWithPath:installerPath] options:(NSWorkspaceLaunchOptions)(NSWorkspaceLaunchDefault | NSWorkspaceLaunchNewInstance) configuration:@{NSWorkspaceLaunchConfigurationArguments : arguments} error:&launchError]; - - if (runningApplication == nil) { - SULog(@"Failed to launch %@ app with error: %@", @SPARKLE_RELAUNCH_TOOL_NAME, launchError); - } - - completionHandler(runningApplication != nil); - } else { - // This new process inherits privileges and thus will not use the authorization reference API, nor request a dialog for authorization - // If we have root permissions, so will this new process - // The reason I don't create a NSBundle to locate the executable is because I worry about NSBundle caching and if we enter here multiple times - NSString *executablePath = [[[installerPath stringByAppendingPathComponent:@"Contents"] stringByAppendingPathComponent:@"MacOS"] stringByAppendingPathComponent:@SPARKLE_RELAUNCH_TOOL_NAME]; - - NSTask *task = [[NSTask alloc] init]; - task.launchPath = executablePath; - task.arguments = arguments; - - BOOL success = NO; - @try { - [task launch]; - success = YES; - } @catch (NSException *exception) { - SULog(@"Failed to launch %@ app with exception: %@", @SPARKLE_RELAUNCH_TOOL_NAME, exception); - } - - completionHandler(success); + NSError *ownershipError = nil; + if (![fileManager changeOwnerAndGroupOfItemAtRootURL:[NSURL fileURLWithPath:executablePath] toMatchURL:installerURL error:&ownershipError]) { + // This may or may not be a fatal error + SULog(@"Failed to change ownership on installer executable at %@ with error %@", executablePath, ownershipError); } + + NSArray *arguments = @[hostBundleIdentifier, @(allowingInteraction).stringValue]; + + BOOL grantsSystemPrivilege = NO; + AuthorizationRef auth = SUCreateAuthorization(&grantsSystemPrivilege); + Boolean submittedJob = false; + if (auth != NULL) { + CFStringRef domain = (grantsSystemPrivilege ? kSMDomainSystemLaunchd : kSMDomainUserLaunchd); + NSString *label = [NSString stringWithFormat:@"%@-sparkle-updater", hostBundleIdentifier]; + + CFErrorRef removeError = NULL; + if (!SMJobRemove(domain, (__bridge CFStringRef)(label), auth, true, &removeError)) { + if (removeError != NULL) { + SULog(@"Remove error: %@", removeError); + CFRelease(removeError); + } + } + + NSDictionary *jobDictionary = @{@"Label" : label, @"ProgramArguments" : [@[executablePath] arrayByAddingObjectsFromArray:arguments], @"EnableTransactions" : @NO, @"KeepAlive" : @{@"SuccessfulExit" : @NO}, @"RunAtLoad" : @NO, @"NICE" : @0, @"LaunchOnlyOnce": @YES, @"MachServices" : @{SUAutoUpdateServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES, SUStatusInfoServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES}}; + + CFErrorRef submitError = NULL; + submittedJob = SMJobSubmit(domain, (__bridge CFDictionaryRef)(jobDictionary), auth, &submitError); + if (!submittedJob) { + if (submitError != NULL) { + SULog(@"Submit error: %@", submitError); + CFRelease(submitError); + } + } + + AuthorizationFree(auth, kAuthorizationFlagDefaults); + } + + completionHandler(submittedJob == true); }); } diff --git a/InstallerLauncher/SUInstallerLauncherProtocol.h b/InstallerLauncher/SUInstallerLauncherProtocol.h index 72b84794..76054683 100644 --- a/InstallerLauncher/SUInstallerLauncherProtocol.h +++ b/InstallerLauncher/SUInstallerLauncherProtocol.h @@ -10,6 +10,6 @@ @protocol SUInstallerLauncherProtocol -- (void)launchInstallerAtPath:(NSString *)installerPath withHostBundleIdentifier:(NSString *)hostBundleIdentifier inheritingPrivileges:(BOOL)inheritingPrivileges completion:(void (^)(BOOL success))completionHandler; +- (void)launchInstallerAtPath:(NSString *)installerPath withHostBundleIdentifier:(NSString *)hostBundleIdentifier allowingInteraction:(BOOL)allowingInteraction completion:(void (^)(BOOL success))completionHandler; @end diff --git a/RemoteMessagePort/Info.plist b/InstallerStatus/Info.plist similarity index 100% rename from RemoteMessagePort/Info.plist rename to InstallerStatus/Info.plist diff --git a/InstallerStatus/SUInstallerStatus.h b/InstallerStatus/SUInstallerStatus.h new file mode 100644 index 00000000..445f8a2a --- /dev/null +++ b/InstallerStatus/SUInstallerStatus.h @@ -0,0 +1,15 @@ +// +// SUInstallerStatus.h +// InstallerStatus +// +// Created by Mayur Pawashe on 7/10/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import +#import "SUInstallerStatusProtocol.h" + +// This object implements the protocol which we have defined. It provides the actual behavior for the service. It is 'exported' by the service to make it available to the process hosting the service over an NSXPCConnection. +@interface SUInstallerStatus : NSObject + +@end diff --git a/InstallerStatus/SUInstallerStatus.m b/InstallerStatus/SUInstallerStatus.m new file mode 100644 index 00000000..834834fb --- /dev/null +++ b/InstallerStatus/SUInstallerStatus.m @@ -0,0 +1,78 @@ +// +// SUInstallerStatus.m +// InstallerStatus +// +// Created by Mayur Pawashe on 7/10/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import "SUInstallerStatus.h" +#import "SUSystemAuthorization.h" + +@interface SUInstallerStatus () + +@property (nonatomic, copy) void (^invalidationBlock)(void); +@property (nonatomic) NSXPCConnection *connection; + +@end + +@implementation SUInstallerStatus + +@synthesize invalidationBlock = _invalidationBlock; +@synthesize connection = _connection; + +- (void)setInvalidationHandler:(void (^)(void))invalidationHandler +{ + self.invalidationBlock = invalidationHandler; +} + +- (void)setServiceName:(NSString *)serviceName +{ + NSXPCConnectionOptions options = SUGrantsSystemAuthorizationAccess() ? NSXPCConnectionPrivileged : 0; + NSXPCConnection *connection = [[NSXPCConnection alloc] initWithMachServiceName:serviceName options:options]; + + connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUStatusInfoProtocol)]; + + self.connection = connection; + + __weak SUInstallerStatus *weakSelf = self; + self.connection.interruptionHandler = ^{ + [weakSelf invalidate]; + }; + + self.connection.invalidationHandler = ^{ + SUInstallerStatus *strongSelf = weakSelf; + if (strongSelf != nil) { + strongSelf.connection = nil; + [strongSelf invalidate]; + } + }; + + [self.connection resume]; +} + +- (void)probeStatusInfoWithReply:(void (^)(NSData * _Nullable installationInfoData))reply +{ + [self.connection.remoteObjectProxy probeStatusInfoWithReply:reply]; +} + +- (void)probeStatusConnectivityWithReply:(void (^)(void))reply +{ + [self.connection.remoteObjectProxy probeStatusConnectivityWithReply:reply]; +} + +// This method can be called by us or from a remote +- (void)invalidate +{ + dispatch_async(dispatch_get_main_queue(), ^{ + [self.connection invalidate]; + self.connection = nil; + + if (self.invalidationBlock != nil) { + self.invalidationBlock(); + self.invalidationBlock = nil; + } + }); +} + +@end diff --git a/InstallerStatus/SUInstallerStatusProtocol.h b/InstallerStatus/SUInstallerStatusProtocol.h new file mode 100644 index 00000000..0a73e226 --- /dev/null +++ b/InstallerStatus/SUInstallerStatusProtocol.h @@ -0,0 +1,21 @@ +// +// SUInstallerStatusProtocol.h +// InstallerStatus +// +// Created by Mayur Pawashe on 7/10/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import +#import "SUStatusInfoProtocol.h" + +// The protocol that this service will vend as its API. This header file will also need to be visible to the process hosting the service. +@protocol SUInstallerStatusProtocol + +- (void)setInvalidationHandler:(void (^)(void))invalidationHandler; + +- (void)setServiceName:(NSString *)serviceName; + +- (void)invalidate; + +@end diff --git a/InstallerStatus/SUXPCInstallerStatus.h b/InstallerStatus/SUXPCInstallerStatus.h new file mode 100644 index 00000000..f48839fa --- /dev/null +++ b/InstallerStatus/SUXPCInstallerStatus.h @@ -0,0 +1,14 @@ +// +// SUXPCInstallerStatus.h +// Sparkle +// +// Created by Mayur Pawashe on 7/10/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import +#import "SUInstallerStatusProtocol.h" + +@interface SUXPCInstallerStatus : NSObject + +@end diff --git a/InstallerStatus/SUXPCInstallerStatus.m b/InstallerStatus/SUXPCInstallerStatus.m new file mode 100644 index 00000000..4866281f --- /dev/null +++ b/InstallerStatus/SUXPCInstallerStatus.m @@ -0,0 +1,85 @@ +// +// SUXPCInstallerStatus.m +// Sparkle +// +// Created by Mayur Pawashe on 7/10/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import "SUXPCInstallerStatus.h" + +@interface SUXPCInstallerStatus () + +@property (nonatomic) NSXPCConnection *connection; +@property (nonatomic, copy) void (^invalidationBlock)(void); + +@end + +@implementation SUXPCInstallerStatus + +@synthesize connection = _connection; +@synthesize invalidationBlock = _invalidationBlock; + +- (instancetype)init +{ + self = [super init]; + if (self != nil) { + _connection = [[NSXPCConnection alloc] initWithServiceName:@INSTALLER_STATUS_BUNDLE_ID]; + _connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerStatusProtocol)]; + + __weak SUXPCInstallerStatus *weakSelf = self; + _connection.invalidationHandler = ^{ + [weakSelf invokeInvalidation]; + }; + + _connection.interruptionHandler = ^{ + [weakSelf invokeInvalidation]; + [weakSelf.connection invalidate]; + }; + + [_connection resume]; + } + return self; +} + +- (void)setInvalidationHandler:(void (^)(void))invalidationHandler +{ + self.invalidationBlock = invalidationHandler; + + __weak SUXPCInstallerStatus *weakSelf = self; + [self.connection.remoteObjectProxy setInvalidationHandler:^{ + [weakSelf invokeInvalidation]; + }]; +} + +- (void)setServiceName:(NSString *)serviceName +{ + [self.connection.remoteObjectProxy setServiceName:serviceName]; +} + +- (void)probeStatusInfoWithReply:(void (^)(NSData * _Nullable installationInfoData))reply +{ + [self.connection.remoteObjectProxy probeStatusInfoWithReply:reply]; +} + +- (void)probeStatusConnectivityWithReply:(void (^)(void))reply +{ + [self.connection.remoteObjectProxy probeStatusConnectivityWithReply:reply]; +} + +- (void)invalidate +{ + [self.connection.remoteObjectProxy invalidate]; + [self.connection invalidate]; + self.connection = nil; +} + +- (void)invokeInvalidation +{ + if (self.invalidationBlock != nil) { + self.invalidationBlock(); + self.invalidationBlock = nil; + } +} + +@end diff --git a/RemoteMessagePort/main.m b/InstallerStatus/main.m similarity index 61% rename from RemoteMessagePort/main.m rename to InstallerStatus/main.m index 237cd56d..ef27775b 100644 --- a/RemoteMessagePort/main.m +++ b/InstallerStatus/main.m @@ -1,13 +1,13 @@ // // main.m -// RemoteMessagePort +// InstallerStatus // -// Created by Mayur Pawashe on 4/3/16. +// Created by Mayur Pawashe on 7/10/16. // Copyright © 2016 Sparkle Project. All rights reserved. // #import -#import "SURemoteMessagePort.h" +#import "SUInstallerStatus.h" @interface ServiceDelegate : NSObject @end @@ -18,13 +18,17 @@ // This method is where the NSXPCListener configures, accepts, and resumes a new incoming NSXPCConnection. // Configure the connection. - newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SURemoteMessagePortProtocol)]; + // First, set the interface that the exported object implements. + newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerStatusProtocol)]; - newConnection.exportedObject = [[SURemoteMessagePort alloc] init]; + // Next, set the object that the connection exports. All messages sent on the connection to this service will be sent to the exported object to handle. The connection retains the exported object. + SUInstallerStatus *exportedObject = [SUInstallerStatus new]; + newConnection.exportedObject = exportedObject; // Resuming the connection allows the system to deliver more incoming messages. [newConnection resume]; + // Returning YES from this method tells the system that you have accepted this connection. If you want to reject the connection for some reason, call -invalidate on the connection and return NO. return YES; } diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index e5ade964..34ba7bbd 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -123,13 +123,6 @@ 720E21781D0CED2B003A311C /* SUFileOperationConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 72E641A61D090F51000404CA /* SUFileOperationConstants.m */; }; 720E217B1D0D00BF003A311C /* SUUpdaterCycle.h in Headers */ = {isa = PBXBuildFile; fileRef = 720E21791D0D00BF003A311C /* SUUpdaterCycle.h */; }; 720E217C1D0D00BF003A311C /* SUUpdaterCycle.m in Sources */ = {isa = PBXBuildFile; fileRef = 720E217A1D0D00BF003A311C /* SUUpdaterCycle.m */; }; - 720E217E1D10EB04003A311C /* SULocalMessagePortProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 720E217D1D10EB04003A311C /* SULocalMessagePortProtocol.h */; }; - 720E218A1D10EDB4003A311C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 720E21891D10EDB4003A311C /* main.m */; }; - 720E218E1D10EDB4003A311C /* SparkleLocalMessagePort.xpc in Embed XPC Services */ = {isa = PBXBuildFile; fileRef = 720E21831D10EDB4003A311C /* SparkleLocalMessagePort.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; - 720E21941D10EE1F003A311C /* SULocalMessagePort.m in Sources */ = {isa = PBXBuildFile; fileRef = 7297463F1C9119F300FC134E /* SULocalMessagePort.m */; }; - 720E21991D10F4FC003A311C /* SUXPCLocalMessagePort.h in Headers */ = {isa = PBXBuildFile; fileRef = 720E21971D10F4FC003A311C /* SUXPCLocalMessagePort.h */; }; - 720E219A1D10F4FC003A311C /* SUXPCLocalMessagePort.m in Sources */ = {isa = PBXBuildFile; fileRef = 720E21981D10F4FC003A311C /* SUXPCLocalMessagePort.m */; }; - 720E219C1D11ED83003A311C /* SULocalMessagePortDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 720E219B1D11ED83003A311C /* SULocalMessagePortDelegate.h */; }; 7210C7681B9A9A1500EB90AC /* SUUnarchiverTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7210C7671B9A9A1500EB90AC /* SUUnarchiverTest.swift */; }; 72162B061C82C8B30013C1C5 /* SUParameterAssert.h in Headers */ = {isa = PBXBuildFile; fileRef = 72162B051C82C8B30013C1C5 /* SUParameterAssert.h */; }; 72162B081C82C9600013C1C5 /* SULocalizations.h in Headers */ = {isa = PBXBuildFile; fileRef = 72162B071C82C9600013C1C5 /* SULocalizations.h */; }; @@ -140,7 +133,6 @@ 721BC20F1D1CDE55002BC71E /* SULocalCacheDirectory.m in Sources */ = {isa = PBXBuildFile; fileRef = 721BC20D1D1CDE55002BC71E /* SULocalCacheDirectory.m */; }; 721BC2101D1CDE55002BC71E /* SULocalCacheDirectory.m in Sources */ = {isa = PBXBuildFile; fileRef = 721BC20D1D1CDE55002BC71E /* SULocalCacheDirectory.m */; }; 721C245A1CB75756005440CB /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 525A278F133D6AE900FD8D70 /* Cocoa.framework */; }; - 721C245B1CB75765005440CB /* SURemoteMessagePort.m in Sources */ = {isa = PBXBuildFile; fileRef = 729746441C91212400FC134E /* SURemoteMessagePort.m */; }; 721C245C1CB7576E005440CB /* SUStatusController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6196CFE409C71ADE000DC222 /* SUStatusController.m */; }; 721C245D1CB757C4005440CB /* SUApplicationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 725602D41C83551C00DAA70E /* SUApplicationInfo.m */; }; 721C245E1CB757DE005440CB /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; }; @@ -167,6 +159,28 @@ 724A0A3B1CF7AEEA00D8C3D5 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 724A0A351CF7AEEA00D8C3D5 /* main.m */; }; 724A0A3D1CF7AEEA00D8C3D5 /* SUTemporaryDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 724A0A381CF7AEEA00D8C3D5 /* SUTemporaryDownloader.m */; }; 724A0A3E1CF7AF0E00D8C3D5 /* SUTemporaryDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 724A0A381CF7AEEA00D8C3D5 /* SUTemporaryDownloader.m */; }; + 724BB3671D30B2C5005D534A /* SUMessageTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 729746561C936D5E00FC134E /* SUMessageTypes.m */; }; + 724BB3711D31D0B7005D534A /* SUInstallerConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3701D31D0B7005D534A /* SUInstallerConnection.m */; }; + 724BB3731D31D0B7005D534A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3721D31D0B7005D534A /* main.m */; }; + 724BB3771D31D0B7005D534A /* SparkleInstallerConnection.xpc in Embed XPC Services */ = {isa = PBXBuildFile; fileRef = 724BB36C1D31D0B7005D534A /* SparkleInstallerConnection.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + 724BB3841D3203BA005D534A /* SparkleInstallerConnection.xpc in Embed XPC Services */ = {isa = PBXBuildFile; fileRef = 724BB36C1D31D0B7005D534A /* SparkleInstallerConnection.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + 724BB3871D32A167005D534A /* SUXPCInstallerConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 724BB3851D32A167005D534A /* SUXPCInstallerConnection.h */; }; + 724BB3881D32A167005D534A /* SUXPCInstallerConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3861D32A167005D534A /* SUXPCInstallerConnection.m */; }; + 724BB3891D32B915005D534A /* SUInstallerConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3701D31D0B7005D534A /* SUInstallerConnection.m */; }; + 724BB38D1D33283C005D534A /* StatusInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB38C1D33283C005D534A /* StatusInfo.m */; }; + 724BB3981D333832005D534A /* SUInstallerStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3971D333832005D534A /* SUInstallerStatus.m */; }; + 724BB39A1D333832005D534A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3991D333832005D534A /* main.m */; }; + 724BB39E1D333832005D534A /* SparkleInstallerStatus.xpc in Embed XPC Services */ = {isa = PBXBuildFile; fileRef = 724BB3931D333832005D534A /* SparkleInstallerStatus.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + 724BB3A81D33461B005D534A /* SUXPCInstallerStatus.h in Headers */ = {isa = PBXBuildFile; fileRef = 724BB3A61D33461B005D534A /* SUXPCInstallerStatus.h */; }; + 724BB3A91D33461B005D534A /* SUXPCInstallerStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3A71D33461B005D534A /* SUXPCInstallerStatus.m */; }; + 724BB3AA1D3347C2005D534A /* SUInstallerStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3971D333832005D534A /* SUInstallerStatus.m */; }; + 724BB3AF1D34828A005D534A /* SUSystemAuthorization.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3AC1D347EDE005D534A /* SUSystemAuthorization.m */; }; + 724BB3B01D3482BA005D534A /* SUSystemAuthorization.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3AC1D347EDE005D534A /* SUSystemAuthorization.m */; }; + 724BB3B11D3484B2005D534A /* SUSystemAuthorization.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3AC1D347EDE005D534A /* SUSystemAuthorization.m */; }; + 724BB3B21D34862A005D534A /* SUSystemAuthorization.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3AC1D347EDE005D534A /* SUSystemAuthorization.m */; }; + 724BB3B31D35A6E6005D534A /* SUInstallerStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3971D333832005D534A /* SUInstallerStatus.m */; }; + 724BB3B41D35AA44005D534A /* SUSystemAuthorization.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3AC1D347EDE005D534A /* SUSystemAuthorization.m */; }; + 724BB3B71D35ABA8005D534A /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B5F8F609C4CEB300B25A18 /* Security.framework */; }; 725602D51C83551C00DAA70E /* SUApplicationInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 725602D31C83551C00DAA70E /* SUApplicationInfo.h */; }; 725602D61C83551C00DAA70E /* SUApplicationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 725602D41C83551C00DAA70E /* SUApplicationInfo.m */; }; 725CB9571C7120410064365A /* SUUserDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 725CB9561C7120410064365A /* SUUserDriver.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -236,12 +250,6 @@ 729746391C8FC04F00FC134E /* SUDiskImageUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 6102FE490E07803800F85D09 /* SUDiskImageUnarchiver.m */; }; 7297463A1C8FCA4900FC134E /* SUDSAVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A2E09CA2DAB00B7442F /* SUDSAVerifier.m */; }; 7297463C1C8FF6AE00FC134E /* SUCodeSigningVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B078CD15A5FB6100600039 /* SUCodeSigningVerifier.m */; }; - 729746401C9119F300FC134E /* SULocalMessagePort.h in Headers */ = {isa = PBXBuildFile; fileRef = 7297463E1C9119F300FC134E /* SULocalMessagePort.h */; }; - 729746411C9119F300FC134E /* SULocalMessagePort.m in Sources */ = {isa = PBXBuildFile; fileRef = 7297463F1C9119F300FC134E /* SULocalMessagePort.m */; }; - 729746421C9119F300FC134E /* SULocalMessagePort.m in Sources */ = {isa = PBXBuildFile; fileRef = 7297463F1C9119F300FC134E /* SULocalMessagePort.m */; }; - 729746451C91212400FC134E /* SURemoteMessagePort.h in Headers */ = {isa = PBXBuildFile; fileRef = 729746431C91212400FC134E /* SURemoteMessagePort.h */; }; - 729746461C91212400FC134E /* SURemoteMessagePort.m in Sources */ = {isa = PBXBuildFile; fileRef = 729746441C91212400FC134E /* SURemoteMessagePort.m */; }; - 729746471C91212400FC134E /* SURemoteMessagePort.m in Sources */ = {isa = PBXBuildFile; fileRef = 729746441C91212400FC134E /* SURemoteMessagePort.m */; }; 729746571C936D5E00FC134E /* SUMessageTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 729746551C936D5E00FC134E /* SUMessageTypes.h */; }; 729746581C936D5E00FC134E /* SUMessageTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 729746561C936D5E00FC134E /* SUMessageTypes.m */; }; 729746591C936D5E00FC134E /* SUMessageTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 729746561C936D5E00FC134E /* SUMessageTypes.m */; }; @@ -302,11 +310,6 @@ 72D954B31CBB42DA006F28BD /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* Sparkle.framework */; }; 72D954B51CBB447A006F28BD /* Sparkle.framework in Copy Sparkle */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* Sparkle.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 72D954B81CBB467F006F28BD /* SUCommandLineUserDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 72D954B71CBB467F006F28BD /* SUCommandLineUserDriver.m */; }; - 72E41A391CB209CA003D47E0 /* SURemoteMessagePortProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 72E41A381CB209CA003D47E0 /* SURemoteMessagePortProtocol.h */; }; - 72E41A451CB20BA7003D47E0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 72E41A441CB20BA7003D47E0 /* main.m */; }; - 72E41A501CB210AE003D47E0 /* SURemoteMessagePort.m in Sources */ = {isa = PBXBuildFile; fileRef = 729746441C91212400FC134E /* SURemoteMessagePort.m */; }; - 72E41A531CB21125003D47E0 /* SUXPCRemoteMessagePort.h in Headers */ = {isa = PBXBuildFile; fileRef = 72E41A511CB21125003D47E0 /* SUXPCRemoteMessagePort.h */; }; - 72E41A541CB21125003D47E0 /* SUXPCRemoteMessagePort.m in Sources */ = {isa = PBXBuildFile; fileRef = 72E41A521CB21125003D47E0 /* SUXPCRemoteMessagePort.m */; }; 72E45CF31B640CDD005C701A /* SUTestApplicationDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 72E45CF21B640CDD005C701A /* SUTestApplicationDelegate.m */; }; 72E45CF71B640DAE005C701A /* SUUpdateSettingsWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 72E45CF51B640DAE005C701A /* SUUpdateSettingsWindowController.m */; }; 72E45CF81B640DAE005C701A /* SUUpdateSettingsWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 72E45CF61B640DAE005C701A /* SUUpdateSettingsWindowController.xib */; }; @@ -331,7 +334,6 @@ 72F94F5D1CC455B4002DEE68 /* SparkleInstallerLauncher.xpc in Embed XPC Services */ = {isa = PBXBuildFile; fileRef = 726E07AD1CAF08D6001A286B /* SparkleInstallerLauncher.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 72F94F5E1CC455B4002DEE68 /* SparklePersistentDownloader.xpc in Embed XPC Services */ = {isa = PBXBuildFile; fileRef = 726E07EF1CAF37BD001A286B /* SparklePersistentDownloader.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 72F94F5F1CC455B4002DEE68 /* SparkleTemporaryDownloader.xpc in Embed XPC Services */ = {isa = PBXBuildFile; fileRef = 728638F31CAF5A5F00783084 /* SparkleTemporaryDownloader.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; - 72F94F601CC455B4002DEE68 /* SparkleRemoteMessagePort.xpc in Embed XPC Services */ = {isa = PBXBuildFile; fileRef = 72E41A3E1CB20BA7003D47E0 /* SparkleRemoteMessagePort.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 767B61AC1972D488004E0C3C /* SUGuidedPackageInstaller.h in Headers */ = {isa = PBXBuildFile; fileRef = 767B61AA1972D488004E0C3C /* SUGuidedPackageInstaller.h */; }; 767B61AE1972D488004E0C3C /* SUGuidedPackageInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 767B61AB1972D488004E0C3C /* SUGuidedPackageInstaller.m */; }; C23E885B1BE7B24F0050BB73 /* SparkleTestCodeSignApp.enc.dmg in Resources */ = {isa = PBXBuildFile; fileRef = C23E88591BE7AF890050BB73 /* SparkleTestCodeSignApp.enc.dmg */; }; @@ -425,12 +427,19 @@ remoteGlobalIDString = 8DC2EF4F0486A6940098B216; remoteInfo = Sparkle; }; - 720E218C1D10EDB4003A311C /* PBXContainerItemProxy */ = { + 724BB3821D3203A9005D534A /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; proxyType = 1; - remoteGlobalIDString = 720E21821D10EDB3003A311C; - remoteInfo = LocalMessagePort; + remoteGlobalIDString = 724BB36B1D31D0B7005D534A; + remoteInfo = SparkleInstallerConnection; + }; + 724BB39C1D333832005D534A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 724BB3921D333832005D534A; + remoteInfo = InstallerStatus; }; 726B2B621C645FC900388755 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; @@ -495,13 +504,6 @@ remoteGlobalIDString = 728638F21CAF5A5F00783084; remoteInfo = SparkleAppcastDownloader; }; - 72F94F671CC48669002DEE68 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 72E41A3D1CB20BA7003D47E0; - remoteInfo = SparkleRemoteMessagePort; - }; 72F94F6A1CC4A0C8002DEE68 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; @@ -523,13 +525,6 @@ remoteGlobalIDString = 728638F21CAF5A5F00783084; remoteInfo = SparkleAppcastDownloader; }; - 72F94F701CC4A0C8002DEE68 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 72E41A3D1CB20BA7003D47E0; - remoteInfo = SparkleRemoteMessagePort; - }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -566,17 +561,28 @@ name = "Copy Frameworks"; runOnlyForDeploymentPostprocessing = 0; }; + 724BB37D1D31D0B7005D534A /* Embed XPC Services */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "$(CONTENTS_FOLDER_PATH)/XPCServices"; + dstSubfolderSpec = 16; + files = ( + 724BB3771D31D0B7005D534A /* SparkleInstallerConnection.xpc in Embed XPC Services */, + ); + name = "Embed XPC Services"; + runOnlyForDeploymentPostprocessing = 0; + }; 726E4A261C86C88F00C57C6A /* Embed XPC Services */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = "$(CONTENTS_FOLDER_PATH)/XPCServices"; dstSubfolderSpec = 16; files = ( + 724BB39E1D333832005D534A /* SparkleInstallerStatus.xpc in Embed XPC Services */, + 724BB3841D3203BA005D534A /* SparkleInstallerConnection.xpc in Embed XPC Services */, 72F94F5D1CC455B4002DEE68 /* SparkleInstallerLauncher.xpc in Embed XPC Services */, 72F94F5E1CC455B4002DEE68 /* SparklePersistentDownloader.xpc in Embed XPC Services */, 72F94F5F1CC455B4002DEE68 /* SparkleTemporaryDownloader.xpc in Embed XPC Services */, - 72F94F601CC455B4002DEE68 /* SparkleRemoteMessagePort.xpc in Embed XPC Services */, - 720E218E1D10EDB4003A311C /* SparkleLocalMessagePort.xpc in Embed XPC Services */, 726E4A211C86C88F00C57C6A /* TestAppHelper.xpc in Embed XPC Services */, ); name = "Embed XPC Services"; @@ -844,15 +850,6 @@ 720B16431C66433D006985FB /* SUTestApplicationTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SUTestApplicationTest.swift; path = UITests/SUTestApplicationTest.swift; sourceTree = SOURCE_ROOT; }; 720E21791D0D00BF003A311C /* SUUpdaterCycle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUUpdaterCycle.h; sourceTree = ""; }; 720E217A1D0D00BF003A311C /* SUUpdaterCycle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUUpdaterCycle.m; sourceTree = ""; }; - 720E217D1D10EB04003A311C /* SULocalMessagePortProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SULocalMessagePortProtocol.h; path = Sparkle/SULocalMessagePortProtocol.h; sourceTree = SOURCE_ROOT; }; - 720E21831D10EDB4003A311C /* SparkleLocalMessagePort.xpc */ = {isa = PBXFileReference; explicitFileType = "wrapper.xpc-service"; includeInIndex = 0; path = SparkleLocalMessagePort.xpc; sourceTree = BUILT_PRODUCTS_DIR; }; - 720E21891D10EDB4003A311C /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 720E218B1D10EDB4003A311C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 720E21951D10F1C4003A311C /* ConfigLocalMessagePort.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigLocalMessagePort.xcconfig; sourceTree = ""; }; - 720E21961D10F1C4003A311C /* ConfigLocalMessagePortDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigLocalMessagePortDebug.xcconfig; sourceTree = ""; }; - 720E21971D10F4FC003A311C /* SUXPCLocalMessagePort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUXPCLocalMessagePort.h; path = Sparkle/SUXPCLocalMessagePort.h; sourceTree = SOURCE_ROOT; }; - 720E21981D10F4FC003A311C /* SUXPCLocalMessagePort.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUXPCLocalMessagePort.m; path = Sparkle/SUXPCLocalMessagePort.m; sourceTree = SOURCE_ROOT; }; - 720E219B1D11ED83003A311C /* SULocalMessagePortDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SULocalMessagePortDelegate.h; path = Sparkle/SULocalMessagePortDelegate.h; sourceTree = SOURCE_ROOT; }; 7210C7671B9A9A1500EB90AC /* SUUnarchiverTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SUUnarchiverTest.swift; sourceTree = ""; }; 72162B051C82C8B30013C1C5 /* SUParameterAssert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUParameterAssert.h; sourceTree = ""; }; 72162B071C82C9600013C1C5 /* SULocalizations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SULocalizations.h; sourceTree = ""; }; @@ -886,6 +883,33 @@ 724A0A371CF7AEEA00D8C3D5 /* SUTemporaryDownloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUTemporaryDownloader.h; path = TemporaryDownloader/SUTemporaryDownloader.h; sourceTree = SOURCE_ROOT; }; 724A0A381CF7AEEA00D8C3D5 /* SUTemporaryDownloader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUTemporaryDownloader.m; path = TemporaryDownloader/SUTemporaryDownloader.m; sourceTree = SOURCE_ROOT; }; 724A0A391CF7AEEA00D8C3D5 /* SUTemporaryDownloaderProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUTemporaryDownloaderProtocol.h; path = TemporaryDownloader/SUTemporaryDownloaderProtocol.h; sourceTree = SOURCE_ROOT; }; + 724BB36C1D31D0B7005D534A /* SparkleInstallerConnection.xpc */ = {isa = PBXFileReference; explicitFileType = "wrapper.xpc-service"; includeInIndex = 0; path = SparkleInstallerConnection.xpc; sourceTree = BUILT_PRODUCTS_DIR; }; + 724BB36E1D31D0B7005D534A /* SUInstallerConnectionProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUInstallerConnectionProtocol.h; sourceTree = ""; }; + 724BB36F1D31D0B7005D534A /* SUInstallerConnection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUInstallerConnection.h; sourceTree = ""; }; + 724BB3701D31D0B7005D534A /* SUInstallerConnection.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SUInstallerConnection.m; sourceTree = ""; }; + 724BB3721D31D0B7005D534A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 724BB3741D31D0B7005D534A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 724BB37E1D31D1EA005D534A /* ConfigInstallerConnection.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigInstallerConnection.xcconfig; sourceTree = ""; }; + 724BB37F1D31D1EA005D534A /* ConfigInstallerConnectionDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigInstallerConnectionDebug.xcconfig; sourceTree = ""; }; + 724BB3801D31F186005D534A /* SUInstallerCommunicationProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUInstallerCommunicationProtocol.h; sourceTree = ""; }; + 724BB3851D32A167005D534A /* SUXPCInstallerConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUXPCInstallerConnection.h; sourceTree = ""; }; + 724BB3861D32A167005D534A /* SUXPCInstallerConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUXPCInstallerConnection.m; sourceTree = ""; }; + 724BB38B1D33283C005D534A /* StatusInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StatusInfo.h; sourceTree = ""; }; + 724BB38C1D33283C005D534A /* StatusInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StatusInfo.m; sourceTree = ""; }; + 724BB38E1D332EA6005D534A /* SUStatusInfoProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SUStatusInfoProtocol.h; path = ../Sparkle/Autoupdate/SUStatusInfoProtocol.h; sourceTree = ""; }; + 724BB3931D333832005D534A /* SparkleInstallerStatus.xpc */ = {isa = PBXFileReference; explicitFileType = "wrapper.xpc-service"; includeInIndex = 0; path = SparkleInstallerStatus.xpc; sourceTree = BUILT_PRODUCTS_DIR; }; + 724BB3951D333832005D534A /* SUInstallerStatusProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUInstallerStatusProtocol.h; sourceTree = ""; }; + 724BB3961D333832005D534A /* SUInstallerStatus.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUInstallerStatus.h; sourceTree = ""; }; + 724BB3971D333832005D534A /* SUInstallerStatus.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SUInstallerStatus.m; sourceTree = ""; }; + 724BB3991D333832005D534A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 724BB39B1D333832005D534A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 724BB3A41D3338C8005D534A /* ConfigInstallerStatus.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigInstallerStatus.xcconfig; sourceTree = ""; }; + 724BB3A51D3338C8005D534A /* ConfigInstallerStatusDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigInstallerStatusDebug.xcconfig; sourceTree = ""; }; + 724BB3A61D33461B005D534A /* SUXPCInstallerStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUXPCInstallerStatus.h; sourceTree = ""; }; + 724BB3A71D33461B005D534A /* SUXPCInstallerStatus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUXPCInstallerStatus.m; sourceTree = ""; }; + 724BB3AB1D347EDE005D534A /* SUSystemAuthorization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUSystemAuthorization.h; path = Sparkle/SUSystemAuthorization.h; sourceTree = SOURCE_ROOT; }; + 724BB3AC1D347EDE005D534A /* SUSystemAuthorization.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUSystemAuthorization.m; path = Sparkle/SUSystemAuthorization.m; sourceTree = SOURCE_ROOT; }; + 724BB3B51D35AAC3005D534A /* ServiceManagement.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ServiceManagement.framework; path = System/Library/Frameworks/ServiceManagement.framework; sourceTree = SDKROOT; }; 725602D31C83551C00DAA70E /* SUApplicationInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUApplicationInfo.h; sourceTree = ""; }; 725602D41C83551C00DAA70E /* SUApplicationInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUApplicationInfo.m; sourceTree = ""; }; 725CB9561C7120410064365A /* SUUserDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUUserDriver.h; sourceTree = ""; }; @@ -951,10 +975,6 @@ 7297461F1C8E8D9A00FC134E /* TerminationListener.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TerminationListener.m; sourceTree = ""; }; 729746211C8E8F1100FC134E /* AppInstaller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppInstaller.h; sourceTree = ""; }; 729746221C8E8F1100FC134E /* AppInstaller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppInstaller.m; sourceTree = ""; }; - 7297463E1C9119F300FC134E /* SULocalMessagePort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SULocalMessagePort.h; path = Sparkle/SULocalMessagePort.h; sourceTree = SOURCE_ROOT; }; - 7297463F1C9119F300FC134E /* SULocalMessagePort.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SULocalMessagePort.m; path = Sparkle/SULocalMessagePort.m; sourceTree = SOURCE_ROOT; }; - 729746431C91212400FC134E /* SURemoteMessagePort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SURemoteMessagePort.h; path = ../SURemoteMessagePort.h; sourceTree = ""; }; - 729746441C91212400FC134E /* SURemoteMessagePort.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SURemoteMessagePort.m; path = ../SURemoteMessagePort.m; sourceTree = ""; }; 729746551C936D5E00FC134E /* SUMessageTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUMessageTypes.h; sourceTree = ""; }; 729746561C936D5E00FC134E /* SUMessageTypes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUMessageTypes.m; sourceTree = ""; }; 729F10FD1C65A9B500DFCCC5 /* ConfigUITest.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigUITest.xcconfig; sourceTree = ""; }; @@ -1007,13 +1027,6 @@ 72D954B01CBB41E2006F28BD /* ConfigSparkleTool.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigSparkleTool.xcconfig; sourceTree = ""; }; 72D954B61CBB467F006F28BD /* SUCommandLineUserDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUCommandLineUserDriver.h; sourceTree = ""; }; 72D954B71CBB467F006F28BD /* SUCommandLineUserDriver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUCommandLineUserDriver.m; sourceTree = ""; }; - 72E41A381CB209CA003D47E0 /* SURemoteMessagePortProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SURemoteMessagePortProtocol.h; path = Sparkle/SURemoteMessagePortProtocol.h; sourceTree = SOURCE_ROOT; }; - 72E41A3E1CB20BA7003D47E0 /* SparkleRemoteMessagePort.xpc */ = {isa = PBXFileReference; explicitFileType = "wrapper.xpc-service"; includeInIndex = 0; path = SparkleRemoteMessagePort.xpc; sourceTree = BUILT_PRODUCTS_DIR; }; - 72E41A441CB20BA7003D47E0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 72E41A461CB20BA7003D47E0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 72E41A511CB21125003D47E0 /* SUXPCRemoteMessagePort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUXPCRemoteMessagePort.h; path = Sparkle/SUXPCRemoteMessagePort.h; sourceTree = SOURCE_ROOT; }; - 72E41A521CB21125003D47E0 /* SUXPCRemoteMessagePort.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUXPCRemoteMessagePort.m; path = Sparkle/SUXPCRemoteMessagePort.m; sourceTree = SOURCE_ROOT; }; - 72E41A551CB22F44003D47E0 /* ConfigRemoteMessagePort.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigRemoteMessagePort.xcconfig; sourceTree = ""; }; 72E45CF11B640CDD005C701A /* SUTestApplicationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUTestApplicationDelegate.h; sourceTree = ""; }; 72E45CF21B640CDD005C701A /* SUTestApplicationDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUTestApplicationDelegate.m; sourceTree = ""; }; 72E45CF41B640DAE005C701A /* SUUpdateSettingsWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUUpdateSettingsWindowController.h; sourceTree = ""; }; @@ -1033,7 +1046,6 @@ 72F94ED51CC3441A002DEE68 /* ConfigInstallerLauncherDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigInstallerLauncherDebug.xcconfig; sourceTree = ""; }; 72F94ED61CC344A7002DEE68 /* ConfigPersistentDownloaderDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigPersistentDownloaderDebug.xcconfig; sourceTree = ""; }; 72F94ED71CC344E4002DEE68 /* ConfigTemporaryDownloaderDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigTemporaryDownloaderDebug.xcconfig; sourceTree = ""; }; - 72F94ED81CC34529002DEE68 /* ConfigRemoteMessagePortDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigRemoteMessagePortDebug.xcconfig; sourceTree = ""; }; 72F94EDA1CC36C37002DEE68 /* ConfigTestAppDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigTestAppDebug.xcconfig; sourceTree = ""; }; 72F94EDB1CC36C6F002DEE68 /* ConfigTestAppHelperDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigTestAppHelperDebug.xcconfig; sourceTree = ""; }; 72F94F561CC44DE1002DEE68 /* SUXPCServiceInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUXPCServiceInfo.h; sourceTree = ""; }; @@ -1108,18 +1120,26 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 720E21801D10EDB3003A311C /* Frameworks */ = { + 721C24421CB753E6005440CB /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 724BB3B71D35ABA8005D534A /* Security.framework in Frameworks */, + 721C245A1CB75756005440CB /* Cocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 724BB3691D31D0B7005D534A /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - 721C24421CB753E6005440CB /* Frameworks */ = { + 724BB3901D333832005D534A /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 721C245A1CB75756005440CB /* Cocoa.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1167,13 +1187,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 72E41A3B1CB20BA7003D47E0 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; 72E641981D090F1C000404CA /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -1212,11 +1225,11 @@ 726E07AD1CAF08D6001A286B /* SparkleInstallerLauncher.xpc */, 726E07EF1CAF37BD001A286B /* SparklePersistentDownloader.xpc */, 728638F31CAF5A5F00783084 /* SparkleTemporaryDownloader.xpc */, - 72E41A3E1CB20BA7003D47E0 /* SparkleRemoteMessagePort.xpc */, 721C24451CB753E6005440CB /* Updater.app */, 72D9549E1CBB415B006F28BD /* sparkle.app */, 72E6419B1D090F1C000404CA /* fileop */, - 720E21831D10EDB4003A311C /* SparkleLocalMessagePort.xpc */, + 724BB36C1D31D0B7005D534A /* SparkleInstallerConnection.xpc */, + 724BB3931D333832005D534A /* SparkleInstallerStatus.xpc */, ); name = Products; sourceTree = ""; @@ -1243,6 +1256,7 @@ 0867D69AFE84028FC02AAC07 /* Frameworks */ = { isa = PBXGroup; children = ( + 724BB3B51D35AAC3005D534A /* ServiceManagement.framework */, 721BC20A1D17A5AD002BC71E /* CoreServices.framework */, 721BC2081D17A553002BC71E /* Carbon.framework */, 721BC2061D17A532002BC71E /* CoreFoundation.framework */, @@ -1379,6 +1393,8 @@ 55C14BD3136EEFCE00649790 /* Autoupdate.m */, 729746211C8E8F1100FC134E /* AppInstaller.h */, 729746221C8E8F1100FC134E /* AppInstaller.m */, + 724BB38B1D33283C005D534A /* StatusInfo.h */, + 724BB38C1D33283C005D534A /* StatusInfo.m */, 7297461E1C8E8D9A00FC134E /* TerminationListener.h */, 7297461F1C8E8D9A00FC134E /* TerminationListener.m */, 726E075E1CA4E9A5001A286B /* SUInstallationInputData.h */, @@ -1605,16 +1621,6 @@ name = "Update Control"; sourceTree = ""; }; - 720E21841D10EDB4003A311C /* LocalMessagePort */ = { - isa = PBXGroup; - children = ( - 720E21891D10EDB4003A311C /* main.m */, - 720E218B1D10EDB4003A311C /* Info.plist */, - ); - name = LocalMessagePort; - path = ../LocalMessagePort; - sourceTree = ""; - }; 721C24461CB753E6005440CB /* Installer Progress */ = { isa = PBXGroup; children = ( @@ -1630,6 +1636,38 @@ path = "../Installer Progress"; sourceTree = ""; }; + 724BB36D1D31D0B7005D534A /* InstallerConnection */ = { + isa = PBXGroup; + children = ( + 724BB3801D31F186005D534A /* SUInstallerCommunicationProtocol.h */, + 724BB36E1D31D0B7005D534A /* SUInstallerConnectionProtocol.h */, + 724BB36F1D31D0B7005D534A /* SUInstallerConnection.h */, + 724BB3701D31D0B7005D534A /* SUInstallerConnection.m */, + 724BB3851D32A167005D534A /* SUXPCInstallerConnection.h */, + 724BB3861D32A167005D534A /* SUXPCInstallerConnection.m */, + 724BB3721D31D0B7005D534A /* main.m */, + 724BB3741D31D0B7005D534A /* Info.plist */, + ); + name = InstallerConnection; + path = ../InstallerConnection; + sourceTree = ""; + }; + 724BB3941D333832005D534A /* InstallerStatus */ = { + isa = PBXGroup; + children = ( + 724BB38E1D332EA6005D534A /* SUStatusInfoProtocol.h */, + 724BB3951D333832005D534A /* SUInstallerStatusProtocol.h */, + 724BB3961D333832005D534A /* SUInstallerStatus.h */, + 724BB3971D333832005D534A /* SUInstallerStatus.m */, + 724BB3A61D33461B005D534A /* SUXPCInstallerStatus.h */, + 724BB3A71D33461B005D534A /* SUXPCInstallerStatus.m */, + 724BB3991D333832005D534A /* main.m */, + 724BB39B1D333832005D534A /* Info.plist */, + ); + name = InstallerStatus; + path = ../InstallerStatus; + sourceTree = ""; + }; 725F97811C8A997300265BE4 /* User Driver */ = { isa = PBXGroup; children = ( @@ -1716,23 +1754,14 @@ 729746481C91483B00FC134E /* IPC */ = { isa = PBXGroup; children = ( - 720E217D1D10EB04003A311C /* SULocalMessagePortProtocol.h */, - 7297463E1C9119F300FC134E /* SULocalMessagePort.h */, - 7297463F1C9119F300FC134E /* SULocalMessagePort.m */, - 720E21971D10F4FC003A311C /* SUXPCLocalMessagePort.h */, - 720E21981D10F4FC003A311C /* SUXPCLocalMessagePort.m */, - 720E219B1D11ED83003A311C /* SULocalMessagePortDelegate.h */, - 72E41A381CB209CA003D47E0 /* SURemoteMessagePortProtocol.h */, - 729746431C91212400FC134E /* SURemoteMessagePort.h */, - 729746441C91212400FC134E /* SURemoteMessagePort.m */, - 72E41A511CB21125003D47E0 /* SUXPCRemoteMessagePort.h */, - 72E41A521CB21125003D47E0 /* SUXPCRemoteMessagePort.m */, 729746551C936D5E00FC134E /* SUMessageTypes.h */, 729746561C936D5E00FC134E /* SUMessageTypes.m */, 726E075A1CA3A6D6001A286B /* SUSecureCoding.h */, 726E075B1CA3A6D6001A286B /* SUSecureCoding.m */, 72D954791CBA1FFE006F28BD /* SUInstallationInfo.h */, 72D9547A1CBA1FFE006F28BD /* SUInstallationInfo.m */, + 724BB3AB1D347EDE005D534A /* SUSystemAuthorization.h */, + 724BB3AC1D347EDE005D534A /* SUSystemAuthorization.m */, ); name = IPC; path = Autoupdate; @@ -1767,16 +1796,6 @@ path = "sparkle-cli"; sourceTree = ""; }; - 72E41A3F1CB20BA7003D47E0 /* RemoteMessagePort */ = { - isa = PBXGroup; - children = ( - 72E41A441CB20BA7003D47E0 /* main.m */, - 72E41A461CB20BA7003D47E0 /* Info.plist */, - ); - name = RemoteMessagePort; - path = ../RemoteMessagePort; - sourceTree = ""; - }; 72E6419C1D090F1C000404CA /* fileop */ = { isa = PBXGroup; children = ( @@ -1796,8 +1815,8 @@ 728638F41CAF5A5F00783084 /* TemporaryDownloader */, 726E07AE1CAF08D6001A286B /* InstallerLauncher */, 726E07F01CAF37BD001A286B /* PersistentDownloader */, - 720E21841D10EDB4003A311C /* LocalMessagePort */, - 72E41A3F1CB20BA7003D47E0 /* RemoteMessagePort */, + 724BB36D1D31D0B7005D534A /* InstallerConnection */, + 724BB3941D333832005D534A /* InstallerStatus */, ); name = "XPC Services"; sourceTree = ""; @@ -1825,16 +1844,16 @@ 149B78641B7D3A4800D7D62C /* ConfigUnitTestCoverage.xcconfig */, 729F10FD1C65A9B500DFCCC5 /* ConfigUITest.xcconfig */, 729F10FE1C65A9B500DFCCC5 /* ConfigUITestCoverage.xcconfig */, + 724BB37E1D31D1EA005D534A /* ConfigInstallerConnection.xcconfig */, + 724BB37F1D31D1EA005D534A /* ConfigInstallerConnectionDebug.xcconfig */, 726E07C11CAF1E79001A286B /* ConfigInstallerLauncher.xcconfig */, 72F94ED51CC3441A002DEE68 /* ConfigInstallerLauncherDebug.xcconfig */, + 724BB3A41D3338C8005D534A /* ConfigInstallerStatus.xcconfig */, + 724BB3A51D3338C8005D534A /* ConfigInstallerStatusDebug.xcconfig */, 728638EE1CAF589C00783084 /* ConfigPersistentDownloader.xcconfig */, 72F94ED61CC344A7002DEE68 /* ConfigPersistentDownloaderDebug.xcconfig */, - 720E21951D10F1C4003A311C /* ConfigLocalMessagePort.xcconfig */, - 720E21961D10F1C4003A311C /* ConfigLocalMessagePortDebug.xcconfig */, 728639041CAF614000783084 /* ConfigTemporaryDownloader.xcconfig */, 72F94ED71CC344E4002DEE68 /* ConfigTemporaryDownloaderDebug.xcconfig */, - 72E41A551CB22F44003D47E0 /* ConfigRemoteMessagePort.xcconfig */, - 72F94ED81CC34529002DEE68 /* ConfigRemoteMessagePortDebug.xcconfig */, 72D954B01CBB41E2006F28BD /* ConfigSparkleTool.xcconfig */, 14732BC91960F70A00593899 /* make-release-package.sh */, 14652F7919A93E5F00959E44 /* set-git-version-info.sh */, @@ -1869,14 +1888,12 @@ 726DF88E1C84277600188804 /* SUStatusCompletionResults.h in Headers */, 72A450531C69A68900D67EEA /* SUUpdatePermission.h in Headers */, 7229E1B61C97C91100CB50D0 /* SUUpdateDriver.h in Headers */, - 729746401C9119F300FC134E /* SULocalMessagePort.h in Headers */, 61299B3609CB04E000B7442F /* Sparkle.h in Headers */, - 720E219C1D11ED83003A311C /* SULocalMessagePortDelegate.h in Headers */, - 720E217E1D10EB04003A311C /* SULocalMessagePortProtocol.h in Headers */, 72F94F581CC44DE1002DEE68 /* SUXPCServiceInfo.h in Headers */, 72162B081C82C9600013C1C5 /* SULocalizations.h in Headers */, 61B5FC0D09C4FC8200B25A18 /* SUAppcast.h in Headers */, 72A1C2631CD6849C004CD282 /* SUUpdatePermissionPrompt.h in Headers */, + 724BB3A81D33461B005D534A /* SUXPCInstallerStatus.h in Headers */, 7246E0A31C83B685003B4E75 /* SUStandardUpdaterController.h in Headers */, 61299A8D09CA790200B7442F /* SUUnarchiver.h in Headers */, 61B5FC7009C51F4A00B25A18 /* SUAppcastItem.h in Headers */, @@ -1894,12 +1911,10 @@ 767B61AC1972D488004E0C3C /* SUGuidedPackageInstaller.h in Headers */, 618FA5010DAE88B40026945C /* SUInstaller.h in Headers */, 55C14F06136EF6DB00649790 /* SULog.h in Headers */, - 72E41A531CB21125003D47E0 /* SUXPCRemoteMessagePort.h in Headers */, 726F2CE51BC9C33D001971A4 /* SUOperatingSystem.h in Headers */, 72B767E61C9CFD7200A07552 /* SUAutomaticUpdateDriver.h in Headers */, 618FA5220DAE8E8A0026945C /* SUPackageInstaller.h in Headers */, 728337A61C9E6FF40085AA99 /* SUProbeInstallStatus.h in Headers */, - 720E21991D10F4FC003A311C /* SUXPCLocalMessagePort.h in Headers */, 72B767CA1C9B707000A07552 /* SUAppcastDriver.h in Headers */, 6102FE460E077FCE00F85D09 /* SUPipedUnarchiver.h in Headers */, 726E075C1CA3A6D6001A286B /* SUSecureCoding.h in Headers */, @@ -1909,8 +1924,6 @@ 61A225A40D1C4AC000430CCD /* SUStandardVersionComparator.h in Headers */, 7229E1B91C97CC4D00CB50D0 /* SUScheduledUpdateDriver.h in Headers */, 7293A1AE1CEE933800B957A7 /* SUURLRequest.h in Headers */, - 72E41A391CB209CA003D47E0 /* SURemoteMessagePortProtocol.h in Headers */, - 729746451C91212400FC134E /* SURemoteMessagePort.h in Headers */, 6196CFF909C72148000DC222 /* SUStatusController.h in Headers */, 72B767DE1C9CDB9700A07552 /* SUUserInitiatedUpdateDriver.h in Headers */, 61A2279C0D1CEE7600430CCD /* SUSystemProfiler.h in Headers */, @@ -1918,6 +1931,7 @@ 72B767D21C9C7B9300A07552 /* SUProbingUpdateDriver.h in Headers */, 7229E1BD1C98EFF200CB50D0 /* SUDownloadDriver.h in Headers */, 72B767CE1C9B924900A07552 /* SUInstallerDriver.h in Headers */, + 724BB3871D32A167005D534A /* SUXPCInstallerConnection.h in Headers */, 61B5FCDF09C52A9F00B25A18 /* SUUpdateAlert.h in Headers */, 61B5F8ED09C4CE3C00B25A18 /* SUUpdater.h in Headers */, 61A2259E0D1C495D00430CCD /* SUVersionComparisonProtocol.h in Headers */, @@ -1955,7 +1969,6 @@ 72F94F6B1CC4A0C8002DEE68 /* PBXTargetDependency */, 72F94F6D1CC4A0C8002DEE68 /* PBXTargetDependency */, 72F94F6F1CC4A0C8002DEE68 /* PBXTargetDependency */, - 72F94F711CC4A0C8002DEE68 /* PBXTargetDependency */, 1454BA1619637EDB00344E57 /* PBXTargetDependency */, 14732BCF1960F73500593899 /* PBXTargetDependency */, 1454BA1819637EE900344E57 /* PBXTargetDependency */, @@ -2037,35 +2050,18 @@ ); dependencies = ( 61B5F91C09C4CF7200B25A18 /* PBXTargetDependency */, + 724BB3831D3203A9005D534A /* PBXTargetDependency */, 72F94F621CC48669002DEE68 /* PBXTargetDependency */, 72F94F641CC48669002DEE68 /* PBXTargetDependency */, 72F94F661CC48669002DEE68 /* PBXTargetDependency */, - 720E218D1D10EDB4003A311C /* PBXTargetDependency */, - 72F94F681CC48669002DEE68 /* PBXTargetDependency */, 726E4A201C86C88F00C57C6A /* PBXTargetDependency */, + 724BB39D1D333832005D534A /* PBXTargetDependency */, ); name = "Sparkle Test App"; productName = "Test Application"; productReference = 61B5F90209C4CEE200B25A18 /* Sparkle Test App.app */; productType = "com.apple.product-type.application"; }; - 720E21821D10EDB3003A311C /* SparkleLocalMessagePort */ = { - isa = PBXNativeTarget; - buildConfigurationList = 720E218F1D10EDB4003A311C /* Build configuration list for PBXNativeTarget "SparkleLocalMessagePort" */; - buildPhases = ( - 720E217F1D10EDB3003A311C /* Sources */, - 720E21801D10EDB3003A311C /* Frameworks */, - 720E21811D10EDB3003A311C /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = SparkleLocalMessagePort; - productName = LocalMessagePort; - productReference = 720E21831D10EDB4003A311C /* SparkleLocalMessagePort.xpc */; - productType = "com.apple.product-type.xpc-service"; - }; 721C24441CB753E6005440CB /* Installer Progress */ = { isa = PBXNativeTarget; buildConfigurationList = 721C24561CB753E7005440CB /* Build configuration list for PBXNativeTarget "Installer Progress" */; @@ -2083,6 +2079,40 @@ productReference = 721C24451CB753E6005440CB /* Updater.app */; productType = "com.apple.product-type.application"; }; + 724BB36B1D31D0B7005D534A /* SparkleInstallerConnection */ = { + isa = PBXNativeTarget; + buildConfigurationList = 724BB3781D31D0B7005D534A /* Build configuration list for PBXNativeTarget "SparkleInstallerConnection" */; + buildPhases = ( + 724BB3681D31D0B7005D534A /* Sources */, + 724BB3691D31D0B7005D534A /* Frameworks */, + 724BB36A1D31D0B7005D534A /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SparkleInstallerConnection; + productName = InstallerConnection; + productReference = 724BB36C1D31D0B7005D534A /* SparkleInstallerConnection.xpc */; + productType = "com.apple.product-type.xpc-service"; + }; + 724BB3921D333832005D534A /* SparkleInstallerStatus */ = { + isa = PBXNativeTarget; + buildConfigurationList = 724BB39F1D333832005D534A /* Build configuration list for PBXNativeTarget "SparkleInstallerStatus" */; + buildPhases = ( + 724BB38F1D333832005D534A /* Sources */, + 724BB3901D333832005D534A /* Frameworks */, + 724BB3911D333832005D534A /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SparkleInstallerStatus; + productName = InstallerStatus; + productReference = 724BB3931D333832005D534A /* SparkleInstallerStatus.xpc */; + productType = "com.apple.product-type.xpc-service"; + }; 726B2B5C1C645FC900388755 /* UI Tests */ = { isa = PBXNativeTarget; buildConfigurationList = 726B2B671C645FC900388755 /* Build configuration list for PBXNativeTarget "UI Tests" */; @@ -2190,23 +2220,6 @@ productReference = 72D9549E1CBB415B006F28BD /* sparkle.app */; productType = "com.apple.product-type.application"; }; - 72E41A3D1CB20BA7003D47E0 /* SparkleRemoteMessagePort */ = { - isa = PBXNativeTarget; - buildConfigurationList = 72E41A4A1CB20BA7003D47E0 /* Build configuration list for PBXNativeTarget "SparkleRemoteMessagePort" */; - buildPhases = ( - 72E41A3A1CB20BA7003D47E0 /* Sources */, - 72E41A3B1CB20BA7003D47E0 /* Frameworks */, - 72E41A3C1CB20BA7003D47E0 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = SparkleRemoteMessagePort; - productName = RemoteMessagePort; - productReference = 72E41A3E1CB20BA7003D47E0 /* SparkleRemoteMessagePort.xpc */; - productType = "com.apple.product-type.xpc-service"; - }; 72E6419A1D090F1C000404CA /* fileop */ = { isa = PBXNativeTarget; buildConfigurationList = 72E6419F1D090F1C000404CA /* Build configuration list for PBXNativeTarget "fileop" */; @@ -2236,6 +2249,7 @@ 6131B1910DDCDE32005215F0 /* Run Script: Set Git Version Info */, 6195D4B40E40505A00D41A50 /* Run Script: Link fr_CA to fr */, 61E31A85103299750051D188 /* Run Script: Link pt to pt_BR */, + 724BB37D1D31D0B7005D534A /* Embed XPC Services */, ); buildRules = ( ); @@ -2270,12 +2284,15 @@ }; }; }; - 720E21821D10EDB3003A311C = { - CreatedOnToolsVersion = 7.3.1; - }; 721C24441CB753E6005440CB = { CreatedOnToolsVersion = 7.3; }; + 724BB36B1D31D0B7005D534A = { + CreatedOnToolsVersion = 7.3.1; + }; + 724BB3921D333832005D534A = { + CreatedOnToolsVersion = 7.3.1; + }; 726B2B5C1C645FC900388755 = { CreatedOnToolsVersion = 7.2.1; TestTargetID = 61B5F90109C4CEE200B25A18; @@ -2310,9 +2327,6 @@ 72D9549D1CBB415B006F28BD = { CreatedOnToolsVersion = 7.3; }; - 72E41A3D1CB20BA7003D47E0 = { - CreatedOnToolsVersion = 7.3; - }; 72E6419A1D090F1C000404CA = { CreatedOnToolsVersion = 7.3.1; }; @@ -2378,10 +2392,10 @@ targets = ( 8DC2EF4F0486A6940098B216 /* Sparkle */, 726E07AC1CAF08D6001A286B /* SparkleInstallerLauncher */, + 724BB36B1D31D0B7005D534A /* SparkleInstallerConnection */, + 724BB3921D333832005D534A /* SparkleInstallerStatus */, 726E07EE1CAF37BD001A286B /* SparklePersistentDownloader */, 728638F21CAF5A5F00783084 /* SparkleTemporaryDownloader */, - 72E41A3D1CB20BA7003D47E0 /* SparkleRemoteMessagePort */, - 720E21821D10EDB3003A311C /* SparkleLocalMessagePort */, 61B5F90109C4CEE200B25A18 /* Sparkle Test App */, 726E4A151C86C88F00C57C6A /* TestAppHelper */, 612279D80DB5470200AB99EA /* Sparkle Unit Tests */, @@ -2444,13 +2458,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 720E21811D10EDB3003A311C /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; 721C24431CB753E6005440CB /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -2460,6 +2467,20 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 724BB36A1D31D0B7005D534A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 724BB3911D333832005D534A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 726B2B5B1C645FC900388755 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -2502,13 +2523,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 72E41A3C1CB20BA7003D47E0 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; 8DC2EF520486A6940098B216 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -2644,14 +2658,13 @@ 767B61AE1972D488004E0C3C /* SUGuidedPackageInstaller.m in Sources */, 55C14F0C136EF6EA00649790 /* SUHost.m in Sources */, 55C14F0D136EF6F200649790 /* SUInstaller.m in Sources */, + 724BB38D1D33283C005D534A /* StatusInfo.m in Sources */, 729746231C8E8F1100FC134E /* AppInstaller.m in Sources */, 55C14F08136EF6DB00649790 /* SULog.m in Sources */, 726F2CE71BC9C3E2001971A4 /* SUOperatingSystem.m in Sources */, 55C14F24136EF86F00649790 /* SUPackageInstaller.m in Sources */, - 729746471C91212400FC134E /* SURemoteMessagePort.m in Sources */, 55C14F21136EF84D00649790 /* SUPlainInstaller.m in Sources */, 55C14F22136EF86000649790 /* SUStandardVersionComparator.m in Sources */, - 729746421C9119F300FC134E /* SULocalMessagePort.m in Sources */, 726E07621CA4E9A5001A286B /* SUInstallationInputData.m in Sources */, 729746591C936D5E00FC134E /* SUMessageTypes.m in Sources */, ); @@ -2725,19 +2738,12 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 720E217F1D10EDB3003A311C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 720E21941D10EE1F003A311C /* SULocalMessagePort.m in Sources */, - 720E218A1D10EDB4003A311C /* main.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 721C24411CB753E6005440CB /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 724BB3B41D35AA44005D534A /* SUSystemAuthorization.m in Sources */, + 724BB3B31D35A6E6005D534A /* SUInstallerStatus.m in Sources */, 72D954831CBAD34F006F28BD /* main.m in Sources */, 721C24621CB75C68005440CB /* SULog.m in Sources */, 72D954811CBACC35006F28BD /* InstallerProgressAppController.m in Sources */, @@ -2747,7 +2753,26 @@ 721C245E1CB757DE005440CB /* SUConstants.m in Sources */, 721C245D1CB757C4005440CB /* SUApplicationInfo.m in Sources */, 721C245C1CB7576E005440CB /* SUStatusController.m in Sources */, - 721C245B1CB75765005440CB /* SURemoteMessagePort.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 724BB3681D31D0B7005D534A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 724BB3B11D3484B2005D534A /* SUSystemAuthorization.m in Sources */, + 724BB3731D31D0B7005D534A /* main.m in Sources */, + 724BB3711D31D0B7005D534A /* SUInstallerConnection.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 724BB38F1D333832005D534A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 724BB3B21D34862A005D534A /* SUSystemAuthorization.m in Sources */, + 724BB39A1D333832005D534A /* main.m in Sources */, + 724BB3981D333832005D534A /* SUInstallerStatus.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2763,6 +2788,8 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 724BB3AF1D34828A005D534A /* SUSystemAuthorization.m in Sources */, + 724BB3671D30B2C5005D534A /* SUMessageTypes.m in Sources */, 72E641B31D0918E4000404CA /* SUFileOperationConstants.m in Sources */, 726E07C01CAF15B7001A286B /* SULog.m in Sources */, 726E07BF1CAF0C6C001A286B /* SUConstants.m in Sources */, @@ -2814,15 +2841,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 72E41A3A1CB20BA7003D47E0 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 72E41A501CB210AE003D47E0 /* SURemoteMessagePort.m in Sources */, - 72E41A451CB20BA7003D47E0 /* main.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 72E641971D090F1C000404CA /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -2838,11 +2856,15 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 724BB3B01D3482BA005D534A /* SUSystemAuthorization.m in Sources */, + 724BB3AA1D3347C2005D534A /* SUInstallerStatus.m in Sources */, + 724BB3891D32B915005D534A /* SUInstallerConnection.m in Sources */, 72E641AC1D090F7F000404CA /* SUFileOperationConstants.m in Sources */, 721BC20F1D1CDE55002BC71E /* SULocalCacheDirectory.m in Sources */, 724A0A3E1CF7AF0E00D8C3D5 /* SUTemporaryDownloader.m in Sources */, 723B5DAA1CF7AB6A00365F95 /* SUPersistentDownloader.m in Sources */, 72F94F5A1CC450DE002DEE68 /* SUInstallerLauncher.m in Sources */, + 724BB3A91D33461B005D534A /* SUXPCInstallerStatus.m in Sources */, 72B767E31C9CE90A00A07552 /* SUCoreBasedUpdateDriver.m in Sources */, 7297463C1C8FF6AE00FC134E /* SUCodeSigningVerifier.m in Sources */, 72D9547C1CBA1FFF006F28BD /* SUInstallationInfo.m in Sources */, @@ -2860,12 +2882,10 @@ 72B767CF1C9B924900A07552 /* SUInstallerDriver.m in Sources */, 720E217C1D0D00BF003A311C /* SUUpdaterCycle.m in Sources */, 72A450541C69A68900D67EEA /* SUUpdatePermission.m in Sources */, + 724BB3881D32A167005D534A /* SUXPCInstallerConnection.m in Sources */, 7229E1BA1C97CC4D00CB50D0 /* SUScheduledUpdateDriver.m in Sources */, - 729746411C9119F300FC134E /* SULocalMessagePort.m in Sources */, 726E07611CA4E9A5001A286B /* SUInstallationInputData.m in Sources */, 7275F9C21B5F1F2900B1D19E /* SUFileManager.m in Sources */, - 72E41A541CB21125003D47E0 /* SUXPCRemoteMessagePort.m in Sources */, - 720E219A1D10F4FC003A311C /* SUXPCLocalMessagePort.m in Sources */, 725CB95B1C7121830064365A /* SUStandardUserDriver.m in Sources */, 61EF67560E25B58D00F754E0 /* SUHost.m in Sources */, 55C14F07136EF6DB00649790 /* SULog.m in Sources */, @@ -2884,7 +2904,6 @@ 72B767CB1C9B707000A07552 /* SUAppcastDriver.m in Sources */, 726E075D1CA3A6D6001A286B /* SUSecureCoding.m in Sources */, 72B767DB1C9CD2E400A07552 /* SUUIBasedUpdateDriver.m in Sources */, - 729746461C91212400FC134E /* SURemoteMessagePort.m in Sources */, 72B09CE81CE6BCBD0052EF9E /* SUURLDownload.m in Sources */, 729746581C936D5E00FC134E /* SUMessageTypes.m in Sources */, ); @@ -2953,10 +2972,15 @@ target = 8DC2EF4F0486A6940098B216 /* Sparkle */; targetProxy = 61FA528C0E2D9EB200EF58AD /* PBXContainerItemProxy */; }; - 720E218D1D10EDB4003A311C /* PBXTargetDependency */ = { + 724BB3831D3203A9005D534A /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 720E21821D10EDB3003A311C /* SparkleLocalMessagePort */; - targetProxy = 720E218C1D10EDB4003A311C /* PBXContainerItemProxy */; + target = 724BB36B1D31D0B7005D534A /* SparkleInstallerConnection */; + targetProxy = 724BB3821D3203A9005D534A /* PBXContainerItemProxy */; + }; + 724BB39D1D333832005D534A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 724BB3921D333832005D534A /* SparkleInstallerStatus */; + targetProxy = 724BB39C1D333832005D534A /* PBXContainerItemProxy */; }; 726B2B631C645FC900388755 /* PBXTargetDependency */ = { isa = PBXTargetDependency; @@ -3003,11 +3027,6 @@ target = 728638F21CAF5A5F00783084 /* SparkleTemporaryDownloader */; targetProxy = 72F94F651CC48669002DEE68 /* PBXContainerItemProxy */; }; - 72F94F681CC48669002DEE68 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 72E41A3D1CB20BA7003D47E0 /* SparkleRemoteMessagePort */; - targetProxy = 72F94F671CC48669002DEE68 /* PBXContainerItemProxy */; - }; 72F94F6B1CC4A0C8002DEE68 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 726E07AC1CAF08D6001A286B /* SparkleInstallerLauncher */; @@ -3023,11 +3042,6 @@ target = 728638F21CAF5A5F00783084 /* SparkleTemporaryDownloader */; targetProxy = 72F94F6E1CC4A0C8002DEE68 /* PBXContainerItemProxy */; }; - 72F94F711CC4A0C8002DEE68 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 72E41A3D1CB20BA7003D47E0 /* SparkleRemoteMessagePort */; - targetProxy = 72F94F701CC4A0C8002DEE68 /* PBXContainerItemProxy */; - }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ @@ -3369,34 +3383,6 @@ }; name = Release; }; - 720E21901D10EDB4003A311C /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 720E21961D10F1C4003A311C /* ConfigLocalMessagePortDebug.xcconfig */; - buildSettings = { - }; - name = Debug; - }; - 720E21911D10EDB4003A311C /* Coverage */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 720E21951D10F1C4003A311C /* ConfigLocalMessagePort.xcconfig */; - buildSettings = { - }; - name = Coverage; - }; - 720E21921D10EDB4003A311C /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 720E21951D10F1C4003A311C /* ConfigLocalMessagePort.xcconfig */; - buildSettings = { - }; - name = Release; - }; - 720E21931D10EDB4003A311C /* Release-HTTP */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 720E21951D10F1C4003A311C /* ConfigLocalMessagePort.xcconfig */; - buildSettings = { - }; - name = "Release-HTTP"; - }; 721C24531CB753E7005440CB /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 721C24571CB754E8005440CB /* ConfigInstallerProgress.xcconfig */; @@ -3418,6 +3404,62 @@ }; name = Release; }; + 724BB3791D31D0B7005D534A /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 724BB37F1D31D1EA005D534A /* ConfigInstallerConnectionDebug.xcconfig */; + buildSettings = { + }; + name = Debug; + }; + 724BB37A1D31D0B7005D534A /* Coverage */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 724BB37E1D31D1EA005D534A /* ConfigInstallerConnection.xcconfig */; + buildSettings = { + }; + name = Coverage; + }; + 724BB37B1D31D0B7005D534A /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 724BB37E1D31D1EA005D534A /* ConfigInstallerConnection.xcconfig */; + buildSettings = { + }; + name = Release; + }; + 724BB37C1D31D0B7005D534A /* Release-HTTP */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 724BB37E1D31D1EA005D534A /* ConfigInstallerConnection.xcconfig */; + buildSettings = { + }; + name = "Release-HTTP"; + }; + 724BB3A01D333832005D534A /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 724BB3A51D3338C8005D534A /* ConfigInstallerStatusDebug.xcconfig */; + buildSettings = { + }; + name = Debug; + }; + 724BB3A11D333832005D534A /* Coverage */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 724BB3A41D3338C8005D534A /* ConfigInstallerStatus.xcconfig */; + buildSettings = { + }; + name = Coverage; + }; + 724BB3A21D333832005D534A /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 724BB3A41D3338C8005D534A /* ConfigInstallerStatus.xcconfig */; + buildSettings = { + }; + name = Release; + }; + 724BB3A31D333832005D534A /* Release-HTTP */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 724BB3A41D3338C8005D534A /* ConfigInstallerStatus.xcconfig */; + buildSettings = { + }; + name = "Release-HTTP"; + }; 726B2B641C645FC900388755 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 729F10FD1C65A9B500DFCCC5 /* ConfigUITest.xcconfig */; @@ -3558,27 +3600,6 @@ }; name = Release; }; - 72E41A4B1CB20BA7003D47E0 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72F94ED81CC34529002DEE68 /* ConfigRemoteMessagePortDebug.xcconfig */; - buildSettings = { - }; - name = Debug; - }; - 72E41A4C1CB20BA7003D47E0 /* Coverage */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72F94ED81CC34529002DEE68 /* ConfigRemoteMessagePortDebug.xcconfig */; - buildSettings = { - }; - name = Coverage; - }; - 72E41A4D1CB20BA7003D47E0 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72E41A551CB22F44003D47E0 /* ConfigRemoteMessagePort.xcconfig */; - buildSettings = { - }; - name = Release; - }; 72E641A01D090F1C000404CA /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 72E641B01D09119F000404CA /* ConfigFileop.xcconfig */; @@ -3648,13 +3669,6 @@ }; name = "Release-HTTP"; }; - 72F94EA41CC2A23A002DEE68 /* Release-HTTP */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 72E41A551CB22F44003D47E0 /* ConfigRemoteMessagePort.xcconfig */; - buildSettings = { - }; - name = "Release-HTTP"; - }; 72F94EA51CC2A23A002DEE68 /* Release-HTTP */ = { isa = XCBuildConfiguration; baseConfigurationReference = FA1941CD0D94A70100DD942E /* ConfigTestApp.xcconfig */; @@ -3833,17 +3847,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 720E218F1D10EDB4003A311C /* Build configuration list for PBXNativeTarget "SparkleLocalMessagePort" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 720E21901D10EDB4003A311C /* Debug */, - 720E21911D10EDB4003A311C /* Coverage */, - 720E21921D10EDB4003A311C /* Release */, - 720E21931D10EDB4003A311C /* Release-HTTP */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; 721C24561CB753E7005440CB /* Build configuration list for PBXNativeTarget "Installer Progress" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -3855,6 +3858,26 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 724BB3781D31D0B7005D534A /* Build configuration list for PBXNativeTarget "SparkleInstallerConnection" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 724BB3791D31D0B7005D534A /* Debug */, + 724BB37A1D31D0B7005D534A /* Coverage */, + 724BB37B1D31D0B7005D534A /* Release */, + 724BB37C1D31D0B7005D534A /* Release-HTTP */, + ); + defaultConfigurationIsVisible = 0; + }; + 724BB39F1D333832005D534A /* Build configuration list for PBXNativeTarget "SparkleInstallerStatus" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 724BB3A01D333832005D534A /* Debug */, + 724BB3A11D333832005D534A /* Coverage */, + 724BB3A21D333832005D534A /* Release */, + 724BB3A31D333832005D534A /* Release-HTTP */, + ); + defaultConfigurationIsVisible = 0; + }; 726B2B671C645FC900388755 /* Build configuration list for PBXNativeTarget "UI Tests" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -3921,17 +3944,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 72E41A4A1CB20BA7003D47E0 /* Build configuration list for PBXNativeTarget "SparkleRemoteMessagePort" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 72E41A4B1CB20BA7003D47E0 /* Debug */, - 72E41A4C1CB20BA7003D47E0 /* Coverage */, - 72E41A4D1CB20BA7003D47E0 /* Release */, - 72F94EA41CC2A23A002DEE68 /* Release-HTTP */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; 72E6419F1D090F1C000404CA /* Build configuration list for PBXNativeTarget "fileop" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/Sparkle/Autoupdate/AppInstaller.h b/Sparkle/Autoupdate/AppInstaller.h index 8f0fe7b0..84174fe6 100644 --- a/Sparkle/Autoupdate/AppInstaller.h +++ b/Sparkle/Autoupdate/AppInstaller.h @@ -11,8 +11,10 @@ @interface AppInstaller : NSObject -- (instancetype)initWithHostBundleIdentifier:(NSString *)hostBundleIdentifier inheritsPrivileges:(BOOL)inheritsPrivileges; +- (instancetype)initWithHostBundleIdentifier:(NSString *)hostBundleIdentifier allowingInteraction:(BOOL)allowsInteraction; - (void)start; +- (void)cleanupAndExitWithStatus:(int)status __attribute__((noreturn)); + @end diff --git a/Sparkle/Autoupdate/AppInstaller.m b/Sparkle/Autoupdate/AppInstaller.m index 962fa1c8..a7478ab3 100644 --- a/Sparkle/Autoupdate/AppInstaller.m +++ b/Sparkle/Autoupdate/AppInstaller.m @@ -8,6 +8,7 @@ #import "AppInstaller.h" #import "TerminationListener.h" +#import "StatusInfo.h" #import "SUInstaller.h" #import "SULog.h" #import "SUHost.h" @@ -15,8 +16,6 @@ #import "SUStandardVersionComparator.h" #import "SUDSAVerifier.h" #import "SUCodeSigningVerifier.h" -#import "SURemoteMessagePort.h" -#import "SULocalMessagePort.h" #import "SUMessageTypes.h" #import "SUSecureCoding.h" #import "SUInstallationInputData.h" @@ -27,6 +26,7 @@ #import "SUAuthorizationEnvironment.h" #import "SUApplicationInfo.h" #import "SUErrors.h" +#import "SUInstallerCommunicationProtocol.h" /*! * Terminate the application after a delay from launching the new update to avoid OS activation issues @@ -42,19 +42,21 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.5; */ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; -@interface AppInstaller () +@interface AppInstaller () + +@property (nonatomic) NSXPCListener* xpcListener; +@property (nonatomic) NSXPCConnection *activeConnection; +@property (nonatomic) id communicator; +@property (nonatomic) StatusInfo *statusInfo; @property (nonatomic, strong) TerminationListener *terminationListener; @property (nonatomic, readonly, copy) NSString *hostBundleIdentifier; -@property (nonatomic, readonly) BOOL inheritsPrivileges; +@property (nonatomic, readonly) BOOL allowsInteraction; @property (nonatomic) SUHost *host; -@property (nonatomic) SULocalMessagePort *localPort; -@property (nonatomic) SURemoteMessagePort *remotePort; @property (nonatomic) SUInstallationInputData *installationData; @property (nonatomic, assign) BOOL shouldRelaunch; @property (nonatomic, assign) BOOL shouldShowUI; -@property (nonatomic) NSData *installationInfoData; @property (nonatomic) id installer; @property (nonatomic) BOOL willCompleteInstallation; @@ -68,16 +70,17 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; @implementation AppInstaller +@synthesize xpcListener = _xpcListener; +@synthesize activeConnection = _activeConnection; +@synthesize communicator = _communicator; +@synthesize statusInfo = _statusInfo; @synthesize hostBundleIdentifier = _hostBundleIdentifier; -@synthesize inheritsPrivileges = _inheritsPrivileges; +@synthesize allowsInteraction = _allowsInteraction; @synthesize terminationListener = _terminationListener; -@synthesize localPort = _localPort; -@synthesize remotePort = _remotePort; @synthesize host = _host; @synthesize installationData = _installationData; @synthesize shouldRelaunch = _shouldRelaunch; @synthesize shouldShowUI = _shouldShowUI; -@synthesize installationInfoData = _installationInfoData; @synthesize installer = _installer; @synthesize willCompleteInstallation = _willCompleteInstallation; @synthesize installerQueue = _installerQueue; @@ -85,7 +88,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; @synthesize performedStage2Installation = _performedStage2Installation; @synthesize performedStage3Installation = _performedStage3Installation; -- (instancetype)initWithHostBundleIdentifier:(NSString *)hostBundleIdentifier inheritsPrivileges:(BOOL)inheritsPrivileges +- (instancetype)initWithHostBundleIdentifier:(NSString *)hostBundleIdentifier allowingInteraction:(BOOL)allowsInteraction { if (!(self = [super init])) { return nil; @@ -93,66 +96,63 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; _hostBundleIdentifier = [hostBundleIdentifier copy]; - _inheritsPrivileges = inheritsPrivileges; + _allowsInteraction = allowsInteraction; - self.localPort = [[SULocalMessagePort alloc] init]; + _xpcListener = [[NSXPCListener alloc] initWithMachServiceName:SUAutoUpdateServiceNameForBundleIdentifier(hostBundleIdentifier)]; + _xpcListener.delegate = self; - [self.localPort setServiceName:SUAutoUpdateServiceNameForBundleIdentifier(hostBundleIdentifier)]; - - __weak AppInstaller *weakSelf = self; - [self.localPort setMessageCallback:^NSData * _Nullable(int32_t identifier, NSData * _Nonnull data) { - return [weakSelf handleMessageWithIdentifier:identifier data:data]; - }]; - - [self.localPort setInvalidationCallback:^{ - dispatch_async(dispatch_get_main_queue(), ^{ - AppInstaller *strongSelf = weakSelf; - if (strongSelf.localPort != nil) { - [strongSelf cleanupAndExitWithStatus:EXIT_FAILURE]; - } - }); - }]; - - [self startRemotePortWithCompletion:^(BOOL success) { - if (!success) { - SULog(@"Failed creating remote message port from installer"); - [self cleanupAndExitWithStatus:EXIT_FAILURE]; - } - }]; + _statusInfo = [[StatusInfo alloc] initWithHostBundleIdentifier:hostBundleIdentifier]; return self; } -- (void)startRemotePortWithCompletion:(void (^)(BOOL))completionHandler +- (BOOL)listener:(NSXPCListener *)__unused listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection { - if (self.remotePort != nil) { - completionHandler(YES); - return; + SULog(@"Incoming connection: %@", newConnection); + + if (self.activeConnection != nil) { + SULog(@"Rejecting multiple connections..."); + [newConnection invalidate]; + return NO; } - self.remotePort = [[SURemoteMessagePort alloc] initWithServiceName:SUUpdateDriverServiceNameForBundleIdentifier(self.hostBundleIdentifier)]; + self.activeConnection = newConnection; + + newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)]; + newConnection.exportedObject = self; + + newConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)]; __weak AppInstaller *weakSelf = self; - [self.remotePort connectWithLookupCompletion:^(BOOL success) { + newConnection.interruptionHandler = ^{ + [weakSelf.activeConnection invalidate]; + }; + + newConnection.invalidationHandler = ^{ dispatch_async(dispatch_get_main_queue(), ^{ - completionHandler(success); - - if (success) { - [weakSelf.remotePort setInvalidationHandler:^{ - dispatch_async(dispatch_get_main_queue(), ^{ - AppInstaller *strongSelf = weakSelf; - if (strongSelf != nil) { - if (strongSelf.remotePort != nil && !strongSelf.willCompleteInstallation) { - SULog(@"Invalidation on remote port being called, and installation is not close enough to completion!"); - [strongSelf cleanupAndExitWithStatus:EXIT_FAILURE]; - } - strongSelf.remotePort = nil; - } - }); - }]; + AppInstaller *strongSelf = weakSelf; + if (strongSelf != nil) { + if (strongSelf.activeConnection != nil && !strongSelf.willCompleteInstallation) { + SULog(@"Invalidation on remote port being called, and installation is not close enough to completion!"); + [strongSelf cleanupAndExitWithStatus:EXIT_FAILURE]; + } + strongSelf.communicator = nil; + strongSelf.activeConnection = nil; } }); - }]; + }; + + [newConnection resume]; + + self.communicator = newConnection.remoteObjectProxy; + + return YES; +} + +- (void)start +{ + [self.xpcListener resume]; + [self.statusInfo startListener]; } /** @@ -243,18 +243,6 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; return YES; } -- (void)start -{ - [self.remotePort sendMessageWithIdentifier:SURequestInstallationParameters data:[NSData data] completion:^(BOOL success) { - if (!success) { - dispatch_async(dispatch_get_main_queue(), ^{ - SULog(@"Error: Failed to send request for installation parameters"); - [self cleanupAndExitWithStatus:EXIT_FAILURE]; - }); - } - }]; -} - - (void)extractAndInstallUpdate { NSString *downloadPath = [self.installationData.updateDirectoryPath stringByAppendingPathComponent:self.installationData.downloadName]; @@ -272,11 +260,8 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; if (sizeof(progress) == sizeof(uint64_t)) { uint64_t progressValue = CFSwapInt64HostToLittle(*(uint64_t *)&progress); NSData *data = [NSData dataWithBytes:&progressValue length:sizeof(progressValue)]; - [self.remotePort sendMessageWithIdentifier:SUExtractedArchiveWithProgress data:data completion:^(BOOL success) { - if (!success) { - SULog(@"Error sending extracted progress"); - } - }]; + + [self.communicator handleMessageWithIdentifier:SUExtractedArchiveWithProgress data:data]; } } @@ -286,20 +271,12 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; // Eg: one common case is if a delta update fails, client may want to fall back to regular update self.installationData = nil; - [self.remotePort sendMessageWithIdentifier:SUArchiveExtractionFailed data:[NSData data] completion:^(BOOL success) { - if (!success) { - SULog(@"Error sending extraction failed"); - } - }]; + [self.communicator handleMessageWithIdentifier:SUArchiveExtractionFailed data:[NSData data]]; } - (void)unarchiverDidFinish { - [self.remotePort sendMessageWithIdentifier:SUValidationStarted data:[NSData data] completion:^(BOOL success) { - if (!success) { - SULog(@"Error sending validation finish"); - } - }]; + [self.communicator handleMessageWithIdentifier:SUValidationStarted data:[NSData data]]; NSString *downloadPath = [self.installationData.updateDirectoryPath stringByAppendingPathComponent:self.installationData.downloadName]; BOOL validationSuccess = [self validateUpdateForHost:self.host downloadedToPath:downloadPath extractedToPath:self.installationData.updateDirectoryPath DSASignature:self.installationData.dsaSignature]; @@ -308,20 +285,14 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; SULog(@"Error: update validation was a failure"); [self cleanupAndExitWithStatus:EXIT_FAILURE]; } else { - [self.remotePort sendMessageWithIdentifier:SUInstallationStartedStage1 data:[NSData data] completion:^(BOOL success) { - if (!success) { - SULog(@"Error sending stage 1 started"); - } - }]; + [self.communicator handleMessageWithIdentifier:SUInstallationStartedStage1 data:[NSData data]]; [self startInstallation]; } } -- (NSData *)handleMessageWithIdentifier:(int32_t)identifier data:(NSData *)data +- (void)handleMessageWithIdentifier:(int32_t)identifier data:(NSData *)data { - NSData *replyData = nil; - if (identifier == SUInstallationData && self.installationData == nil) { dispatch_async(dispatch_get_main_queue(), ^{ SUInstallationInputData *installationData = (SUInstallationInputData *)SUUnarchiveRootObjectSecurely(data, [SUInstallationInputData class]); @@ -357,16 +328,14 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; } }); } else if (identifier == SUSentUpdateAppcastItemData) { - if (self.installationInfoData == nil) { + if (self.statusInfo.installationInfoData == nil) { SUAppcastItem *updateItem = (SUAppcastItem *)SUUnarchiveRootObjectSecurely(data, [SUAppcastItem class]); if (updateItem != nil) { SUInstallationInfo *installationInfo = [[SUInstallationInfo alloc] initWithAppcastItem:updateItem canSilentlyInstall:[self.installer canInstallSilently]]; - self.installationInfoData = SUArchiveRootObjectSecurely(installationInfo); + self.statusInfo.installationInfoData = SUArchiveRootObjectSecurely(installationInfo); } } - } else if (identifier == SUReceiveUpdateAppcastItemData) { - replyData = self.installationInfoData; } else if (identifier == SUResumeInstallationToStage2 && data.length == sizeof(uint8_t) * 2) { uint8_t relaunch = *((const uint8_t *)data.bytes); uint8_t showsUI = *((const uint8_t *)data.bytes + 1); @@ -378,26 +347,16 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; // Allow handling if we should relaunch at any time self.shouldRelaunch = (BOOL)relaunch; - // We should try re-creating the remote port if necessary, in case the client has - // restarted since and wants a reply back when we say it's OK to terminate the app - [self startRemotePortWithCompletion:^(BOOL success) { - if (!success) { - SULog(@"Installer failed to set up remote port to updater before resuming installation"); + dispatch_async(dispatch_get_main_queue(), ^{ + if (self.performedStage1Installation) { + // Resume the installation if we aren't done with stage 2 yet, and remind the client we are prepared to relaunch + dispatch_async(self.installerQueue, ^{ + [self performStage2InstallationIfNeeded]; + }); } - - dispatch_async(dispatch_get_main_queue(), ^{ - if (self.performedStage1Installation) { - // Resume the installation if we aren't done with stage 2 yet, and remind the client we are prepared to relaunch - dispatch_async(self.installerQueue, ^{ - [self performStage2InstallationIfNeeded]; - }); - } - }); - }]; + }); }); } - - return replyData; } - (void)startInstallation @@ -408,7 +367,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; dispatch_async(self.installerQueue, ^{ NSError *installerError = nil; - id installer = [SUInstaller installerForHost:self.host updateDirectory:self.installationData.updateDirectoryPath inheritsPrivileges:self.inheritsPrivileges versionComparator:[SUStandardVersionComparator standardVersionComparator] error:&installerError]; + id installer = [SUInstaller installerForHost:self.host updateDirectory:self.installationData.updateDirectoryPath allowingInteraction:self.allowsInteraction versionComparator:[SUStandardVersionComparator standardVersionComparator] error:&installerError]; if (installer == nil) { SULog(@"Error: Failed to create installer instance with error: %@", installerError); @@ -441,12 +400,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; NSData *sendData = [NSData dataWithBytes:sendInformation length:sizeof(sendInformation)]; - [self.remotePort sendMessageWithIdentifier:SUInstallationFinishedStage1 data:sendData completion:^(BOOL success) { - if (!success) { - SULog(@"Error sending stage 1 finish"); - [self cleanupAndExitWithStatus:EXIT_FAILURE]; - } - }]; + [self.communicator handleMessageWithIdentifier:SUInstallationFinishedStage1 data:sendData]; self.performedStage1Installation = YES; @@ -465,7 +419,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; SUAuthorizationEnvironment *environment = nil; NSURL *tempIconDirectoryURL = nil; - if (self.shouldShowUI && !self.inheritsPrivileges && [self.installer mayNeedToRequestAuthorization]) { + if (self.shouldShowUI && self.allowsInteraction && [self.installer mayNeedToRequestAuthorization]) { NSString *prompt = [NSString stringWithFormat:NSLocalizedString(@"%1$@ wants to update.", nil), self.host.name]; NSString *iconPath = nil; @@ -505,7 +459,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; } NSError *secondStageError = nil; - BOOL performedSecondStage = [self.installer performSecondStageAllowingAuthorization:!self.inheritsPrivileges fileOperationToolPath:fileOperationToolPath environment:environment allowingUI:self.shouldShowUI error:&secondStageError]; + BOOL performedSecondStage = [self.installer performSecondStageAllowingAuthorization:self.allowsInteraction fileOperationToolPath:fileOperationToolPath environment:environment allowingUI:self.shouldShowUI error:&secondStageError]; if (tempIconDirectoryURL != nil) { [[SUFileManager defaultManager] removeItemAtURL:tempIconDirectoryURL error:NULL]; @@ -535,15 +489,11 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; uint8_t sendInfo[] = {cancelled, targetTerminated}; NSData *sendData = [NSData dataWithBytes:sendInfo length:sizeof(sendInfo)]; - [self.remotePort sendMessageWithIdentifier:SUInstallationFinishedStage2 data:sendData completion:^(BOOL success) { - if (!success) { - SULog(@"Error sending stage 2 finish"); - } - - if (installationCancelled) { - cleanupAndExit(); - } - }]; + [self.communicator handleMessageWithIdentifier:SUInstallationFinishedStage2 data:sendData]; + + if (installationCancelled) { + cleanupAndExit(); + } }); } @@ -571,7 +521,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(SUDisplayProgressTimeDelay * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ // Make sure we're still eligible for showing the installer progress // Also if the updater process is still alive, showing the progress should not be our duty - if (shouldLaunchInstallerProgress && self.remotePort == nil) { + if (shouldLaunchInstallerProgress && self.communicator == nil) { NSError *launchError = nil; NSArray *arguments = @[self.host.bundlePath]; @@ -615,17 +565,13 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; [installerProgressRunningApplication terminate]; shouldLaunchInstallerProgress = NO; - [self.remotePort sendMessageWithIdentifier:SUInstallationFinishedStage3 data:[NSData data] completion:^(BOOL success) { - if (!success) { - SULog(@"Error sending stage 3 finish"); - } - }]; + [self.communicator handleMessageWithIdentifier:SUInstallationFinishedStage3 data:[NSData data]]; - // Invalidate the local port before re-launching the updated app + // Invalidate the status info listener before re-launching the updated app // If we don't do this, the updated app could think the installation can be resumable, // if it checks for updates immediately on launch - [self.localPort invalidate]; - self.localPort = nil; + [self.statusInfo invalidate]; + self.statusInfo = nil; NSString *installationPath = [SUInstaller installationPathForHost:self.host]; @@ -658,11 +604,14 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; { // It's nice to tell the other end we're invalidating - [self.localPort invalidate]; - self.localPort = nil; + [self.activeConnection invalidate]; + self.activeConnection = nil; - [self.remotePort invalidate]; - self.remotePort = nil; + [self.xpcListener invalidate]; + self.xpcListener = nil; + + [self.statusInfo invalidate]; + self.statusInfo = nil; NSError *theError = nil; if (![[NSFileManager defaultManager] removeItemAtPath:self.installationData.updateDirectoryPath error:&theError]) { diff --git a/Sparkle/Autoupdate/Autoupdate.m b/Sparkle/Autoupdate/Autoupdate.m index 67a322c2..f8a664ca 100644 --- a/Sparkle/Autoupdate/Autoupdate.m +++ b/Sparkle/Autoupdate/Autoupdate.m @@ -11,10 +11,20 @@ int main(int __unused argc, const char __unused *argv[]) } NSString *hostBundleIdentifier = args[1]; - BOOL inheritsPrivileges = args[2].boolValue; + BOOL allowsInteraction = args[2].boolValue; - AppInstaller *appInstaller = [[AppInstaller alloc] initWithHostBundleIdentifier:hostBundleIdentifier inheritsPrivileges:inheritsPrivileges]; + AppInstaller *appInstaller = [[AppInstaller alloc] initWithHostBundleIdentifier:hostBundleIdentifier allowingInteraction:allowsInteraction]; [appInstaller start]; + + // Ignore SIGTERM because we are going to catch it ourselves + signal(SIGTERM, SIG_IGN); + + dispatch_source_t sigtermSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_SIGNAL, SIGTERM, 0, dispatch_get_main_queue()); + dispatch_source_set_event_handler(sigtermSource, ^{ + [appInstaller cleanupAndExitWithStatus:SIGTERM]; + }); + dispatch_resume(sigtermSource); + [[NSRunLoop currentRunLoop] run]; } diff --git a/Sparkle/Autoupdate/SUMessageTypes.h b/Sparkle/Autoupdate/SUMessageTypes.h index dfa1a9f7..4573cacb 100644 --- a/Sparkle/Autoupdate/SUMessageTypes.h +++ b/Sparkle/Autoupdate/SUMessageTypes.h @@ -18,34 +18,26 @@ extern NSString *SUAppcastItemArchiveKey; typedef NS_ENUM(int32_t, SUInstallerMessageType) { SUInstallerNotStarted = 0, - SURequestInstallationParameters = 1, - SUExtractedArchiveWithProgress = 2, - SUArchiveExtractionFailed = 3, - SUValidationStarted = 4, - SUInstallationStartedStage1 = 5, - SUInstallationFinishedStage1 = 6, - SUInstallationFinishedStage2 = 7, - SUInstallationFinishedStage3 = 8 + SUExtractedArchiveWithProgress = 1, + SUArchiveExtractionFailed = 2, + SUValidationStarted = 3, + SUInstallationStartedStage1 = 4, + SUInstallationFinishedStage1 = 5, + SUInstallationFinishedStage2 = 6, + SUInstallationFinishedStage3 = 7 }; typedef NS_ENUM(int32_t, SUUpdaterMessageType) { SUInstallationData = 0, SUSentUpdateAppcastItemData = 1, - SUReceiveUpdateAppcastItemData = 2, - SUResumeInstallationToStage2 = 3 -}; - -typedef NS_ENUM(int32_t, SUInstallStatusMessageType) -{ - SUAppcastItemData = 0, - SUWaitingOnUpdateData = 1 + SUResumeInstallationToStage2 = 2 }; BOOL SUInstallerMessageTypeIsLegal(SUInstallerMessageType oldMessageType, SUInstallerMessageType newMessageType); -NSString *SUUpdateDriverServiceNameForBundleIdentifier(NSString *bundleIdentifier); - NSString *SUAutoUpdateServiceNameForBundleIdentifier(NSString *bundleIdentifier); +NSString *SUStatusInfoServiceNameForBundleIdentifier(NSString *bundleIdentifier); + NS_ASSUME_NONNULL_END diff --git a/Sparkle/Autoupdate/SUMessageTypes.m b/Sparkle/Autoupdate/SUMessageTypes.m index 84a0fc8e..3c68b2ab 100644 --- a/Sparkle/Autoupdate/SUMessageTypes.m +++ b/Sparkle/Autoupdate/SUMessageTypes.m @@ -18,15 +18,12 @@ BOOL SUInstallerMessageTypeIsLegal(SUInstallerMessageType oldMessageType, SUInst case SUInstallerNotStarted: legal = (oldMessageType == SUInstallerNotStarted); break; - case SURequestInstallationParameters: - legal = (oldMessageType == SUInstallerNotStarted); - break; case SUExtractedArchiveWithProgress: case SUArchiveExtractionFailed: - legal = (oldMessageType == SURequestInstallationParameters || oldMessageType == SUExtractedArchiveWithProgress); + legal = (oldMessageType == SUInstallerNotStarted || oldMessageType == SUExtractedArchiveWithProgress); break; case SUValidationStarted: - legal = (oldMessageType == SURequestInstallationParameters || oldMessageType == SUExtractedArchiveWithProgress); + legal = (oldMessageType == SUInstallerNotStarted || oldMessageType == SUExtractedArchiveWithProgress); break; case SUInstallationStartedStage1: legal = (oldMessageType == SUValidationStarted); @@ -44,12 +41,12 @@ BOOL SUInstallerMessageTypeIsLegal(SUInstallerMessageType oldMessageType, SUInst return legal; } -NSString *SUUpdateDriverServiceNameForBundleIdentifier(NSString *bundleIdentifier) -{ - return [NSString stringWithFormat:@"%@-sparkle-updater", bundleIdentifier]; -} - NSString *SUAutoUpdateServiceNameForBundleIdentifier(NSString *bundleIdentifier) { - return [NSString stringWithFormat:@"%@-sparkle-installer", bundleIdentifier]; + return [NSString stringWithFormat:@"%@-spkinstll", bundleIdentifier]; +} + +NSString *SUStatusInfoServiceNameForBundleIdentifier(NSString *bundleIdentifier) +{ + return [NSString stringWithFormat:@"%@-spkstat", bundleIdentifier]; } diff --git a/Sparkle/Autoupdate/SUStatusInfoProtocol.h b/Sparkle/Autoupdate/SUStatusInfoProtocol.h new file mode 100644 index 00000000..54c76aaf --- /dev/null +++ b/Sparkle/Autoupdate/SUStatusInfoProtocol.h @@ -0,0 +1,21 @@ +// +// SUStatusInfoProtocol.h +// Sparkle +// +// Created by Mayur Pawashe on 7/10/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol SUStatusInfoProtocol + +- (void)probeStatusInfoWithReply:(void (^)(NSData * _Nullable installationInfoData))reply; + +- (void)probeStatusConnectivityWithReply:(void (^)(void))reply; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Sparkle/Autoupdate/StatusInfo.h b/Sparkle/Autoupdate/StatusInfo.h new file mode 100644 index 00000000..12fc98fe --- /dev/null +++ b/Sparkle/Autoupdate/StatusInfo.h @@ -0,0 +1,26 @@ +// +// StatusInfo.h +// Sparkle +// +// Created by Mayur Pawashe on 7/10/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import +#import "SUStatusInfoProtocol.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface StatusInfo : NSObject + +- (instancetype)initWithHostBundleIdentifier:(NSString *)bundleIdentifier; + +@property (nonatomic, nullable) NSData *installationInfoData; + +- (void)startListener; + +- (void)invalidate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Sparkle/Autoupdate/StatusInfo.m b/Sparkle/Autoupdate/StatusInfo.m new file mode 100644 index 00000000..1f8d99b8 --- /dev/null +++ b/Sparkle/Autoupdate/StatusInfo.m @@ -0,0 +1,67 @@ +// +// StatusInfo.m +// Sparkle +// +// Created by Mayur Pawashe on 7/10/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import "StatusInfo.h" +#import "SUMessageTypes.h" +#import "SULog.h" + +@interface StatusInfo () + +@property (nonatomic) NSXPCListener *xpcListener; + +@end + +@implementation StatusInfo + +@synthesize xpcListener = _xpcListener; +@synthesize installationInfoData = _installationInfoData; + +- (instancetype)initWithHostBundleIdentifier:(NSString *)bundleIdentifier +{ + self = [super init]; + if (self != nil) { + _xpcListener = [[NSXPCListener alloc] initWithMachServiceName:SUStatusInfoServiceNameForBundleIdentifier(bundleIdentifier)]; + _xpcListener.delegate = self; + } + return self; +} + +- (void)startListener +{ + [self.xpcListener resume]; +} + +- (void)invalidate +{ + [self.xpcListener invalidate]; + self.xpcListener = nil; +} + +- (BOOL)listener:(NSXPCListener *)__unused listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection +{ + newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUStatusInfoProtocol)]; + newConnection.exportedObject = self; + + [newConnection resume]; + + return YES; +} + +- (void)probeStatusInfoWithReply:(void (^)(NSData * _Nullable))reply +{ + dispatch_async(dispatch_get_main_queue(), ^{ + reply(self.installationInfoData); + }); +} + +- (void)probeStatusConnectivityWithReply:(void (^)(void))reply +{ + reply(); +} + +@end diff --git a/Sparkle/InstallerProgress/InstallerProgressAppController.h b/Sparkle/InstallerProgress/InstallerProgressAppController.h index 7c1e518b..f91aa592 100644 --- a/Sparkle/InstallerProgress/InstallerProgressAppController.h +++ b/Sparkle/InstallerProgress/InstallerProgressAppController.h @@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN @protocol InstallerProgressAppControllerDelegate; -@interface InstallerProgressAppController : NSObject +@interface InstallerProgressAppController : NSObject - (instancetype)initWithApplication:(NSApplication *)application arguments:(NSArray *)arguments delegate:(id)delegate; diff --git a/Sparkle/InstallerProgress/InstallerProgressAppController.m b/Sparkle/InstallerProgress/InstallerProgressAppController.m index ff58d107..db6a4e7e 100644 --- a/Sparkle/InstallerProgress/InstallerProgressAppController.m +++ b/Sparkle/InstallerProgress/InstallerProgressAppController.m @@ -8,7 +8,7 @@ #import "InstallerProgressAppController.h" #import "InstallerProgressAppControllerDelegate.h" -#import "SURemoteMessagePort.h" +#import "SUInstallerStatus.h" #import "SUMessageTypes.h" #import "SULog.h" #import "SUApplicationInfo.h" @@ -25,7 +25,7 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3; @property (nonatomic, readonly) NSApplication *application; @property (nonatomic, readonly) NSBundle *bundle; @property (nonatomic, readonly, weak) id delegate; -@property (nonatomic, readonly) SURemoteMessagePort *remotePort; +@property (nonatomic, readonly) id statusInfo; @end @@ -34,7 +34,7 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3; @synthesize application = _application; @synthesize bundle = _bundle; @synthesize delegate = _delegate; -@synthesize remotePort = _remotePort; +@synthesize statusInfo = _statusInfo; - (instancetype)initWithApplication:(NSApplication *)application arguments:(NSArray *)arguments delegate:(id)delegate { @@ -64,7 +64,15 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3; _application = application; _delegate = delegate; _bundle = bundle; - _remotePort = [[SURemoteMessagePort alloc] initWithServiceName:SUAutoUpdateServiceNameForBundleIdentifier(bundleIdentifier)]; + _statusInfo = [[SUInstallerStatus alloc] init]; + + [_statusInfo setInvalidationHandler:^{ + dispatch_async(dispatch_get_main_queue(), ^{ + [application terminate:nil]; + }); + }]; + + [_statusInfo setServiceName:SUStatusInfoServiceNameForBundleIdentifier(bundleIdentifier)]; } return self; } @@ -76,22 +84,10 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3; - (void)applicationDidFinishLaunching:(NSNotification *)__unused notification { - __weak InstallerProgressAppController *weakSelf = self; - [self.remotePort connectWithLookupCompletion:^(BOOL success) { - if (!success) { - [NSApp terminate:nil]; - } else { - [weakSelf.remotePort setInvalidationHandler:^{ - [weakSelf.application terminate:nil]; - }]; - - dispatch_async(dispatch_get_main_queue(), ^{ - InstallerProgressAppController *strongSelf = weakSelf; - if (strongSelf != nil) { - [strongSelf.delegate applicationDidFinishLaunchingWithTargetBundle:strongSelf.bundle]; - } - }); - } + [self.statusInfo probeStatusConnectivityWithReply:^{ + dispatch_async(dispatch_get_main_queue(), ^{ + [self.delegate applicationDidFinishLaunchingWithTargetBundle:self.bundle]; + }); }]; } diff --git a/Sparkle/SUGuidedPackageInstaller.m b/Sparkle/SUGuidedPackageInstaller.m index dd8f4205..f6644b17 100644 --- a/Sparkle/SUGuidedPackageInstaller.m +++ b/Sparkle/SUGuidedPackageInstaller.m @@ -53,7 +53,7 @@ } // If we're root, we can allow using the authorization APIs - self.fileManager = (allowsAuthorization || (geteuid() == 0)) ? [SUFileManager fileManagerWithAuthorizationToolPath:fileOperationToolPath environment:authorizationEnvironment] : [SUFileManager defaultManager]; + self.fileManager = (allowsAuthorization || [self isRootUser]) ? [SUFileManager fileManagerWithAuthorizationToolPath:fileOperationToolPath environment:authorizationEnvironment] : [SUFileManager defaultManager]; return [self.fileManager grantAuthorizationPrivilegesWithError:error]; } @@ -68,10 +68,14 @@ return NO; } +- (BOOL)isRootUser +{ + return (geteuid() == 0); +} + - (BOOL)canInstallSilently { - // Are we root? - return (geteuid() == 0); + return [self isRootUser]; } - (BOOL)mayNeedToRequestAuthorization diff --git a/Sparkle/SUInstaller.h b/Sparkle/SUInstaller.h index 2c57b650..d6fc3b96 100644 --- a/Sparkle/SUInstaller.h +++ b/Sparkle/SUInstaller.h @@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN @interface SUInstaller : NSObject -+ (nullable id)installerForHost:(SUHost *)host updateDirectory:(NSString *)updateDirectory inheritsPrivileges:(BOOL)inheritsPrivileges versionComparator:(id )comparator error:(NSError **)error; ++ (nullable id)installerForHost:(SUHost *)host updateDirectory:(NSString *)updateDirectory allowingInteraction:(BOOL)allowsInteraction versionComparator:(id )comparator error:(NSError **)error; + (NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host isPackage:(BOOL *)isPackagePtr isGuided:(nullable BOOL *)isGuidedPtr; diff --git a/Sparkle/SUInstaller.m b/Sparkle/SUInstaller.m index 8a461c64..1e043c16 100644 --- a/Sparkle/SUInstaller.m +++ b/Sparkle/SUInstaller.m @@ -112,7 +112,7 @@ return newAppDownloadPath; } -+ (nullable id)installerForHost:(SUHost *)host updateDirectory:(NSString *)updateDirectory inheritsPrivileges:(BOOL)inheritsPrivileges versionComparator:(id )comparator error:(NSError * __autoreleasing *)error ++ (nullable id)installerForHost:(SUHost *)host updateDirectory:(NSString *)updateDirectory allowingInteraction:(BOOL)allowsInteraction versionComparator:(id )comparator error:(NSError * __autoreleasing *)error { BOOL isPackage = NO; BOOL isGuided = NO; @@ -125,10 +125,10 @@ return nil; } - // If the installer inherits privileges, it could be running as root - // If it's running as root, using a non-guided package installer does not work properly so avoid it at all costs + // If the installer does not allow interaction, we could be running as root + // If we are running as root, using a non-guided package installer does not work properly so avoid it at all costs id installer = nil; - if (isPackage && (isGuided || inheritsPrivileges)) { + if (isPackage && (isGuided || !allowsInteraction)) { installer = [[SUGuidedPackageInstaller alloc] initWithPackagePath:newDownloadPath]; } else if (isPackage) { installer = [[SUPackageInstaller alloc] initWithPackagePath:newDownloadPath]; diff --git a/Sparkle/SUInstallerDriver.m b/Sparkle/SUInstallerDriver.m index 483fd851..f780ecd3 100644 --- a/Sparkle/SUInstallerDriver.m +++ b/Sparkle/SUInstallerDriver.m @@ -9,13 +9,7 @@ #import "SUInstallerDriver.h" #import "SULog.h" #import "SUMessageTypes.h" -#import "SULocalMessagePort.h" -#import "SUXPCLocalMessagePort.h" -#import "SULocalMessagePortDelegate.h" -#import "SURemoteMessagePort.h" -#import "SUXPCRemoteMessagePort.h" #import "SUXPCServiceInfo.h" -#import "SURemoteMessagePortProtocol.h" #import "SUUpdaterDelegate.h" #import "SUAppcastItem.h" #import "SULog.h" @@ -27,12 +21,15 @@ #import "SUInstallationInputData.h" #import "SUInstallerLauncher.h" #import "SUXPCServiceInfo.h" +#import "SUInstallerConnection.h" +#import "SUInstallerConnectionProtocol.h" +#import "SUXPCInstallerConnection.h" #ifdef _APPKITDEFINES_H #error This is a "core" class and should NOT import AppKit #endif -@interface SUInstallerDriver () +@interface SUInstallerDriver () @property (nonatomic, readonly) SUHost *host; @property (nonatomic, readonly, copy) NSString *cachePath; @@ -40,8 +37,9 @@ @property (nonatomic, weak, readonly) id delegate; @property (nonatomic) SUInstallerMessageType currentStage; @property (nonatomic) BOOL startedInstalling; -@property (nonatomic) id localPort; -@property (nonatomic) id remotePort; + +@property (nonatomic) id installerConnection; + @property (nonatomic) BOOL postponedOnce; @property (nonatomic, weak, readonly) id updater; @property (nonatomic, weak, readonly) id updaterDelegate; @@ -61,8 +59,7 @@ @synthesize delegate = _delegate; @synthesize currentStage = _currentStage; @synthesize startedInstalling = _startedInstalling; -@synthesize localPort = _localPort; -@synthesize remotePort = _remotePort; +@synthesize installerConnection = _installerConnection; @synthesize postponedOnce = _postponedOnce; @synthesize updater = _updater; @synthesize updaterDelegate = _updaterDelegate; @@ -85,102 +82,45 @@ return self; } -- (void)localMessagePortReceivedMessageWithIdentifier:(int32_t)identifier data:(NSData *)data +- (void)setUpConnection { - dispatch_async(dispatch_get_main_queue(), ^{ - [self handleMessageWithIdentifier:identifier data:data]; - }); -} - -- (void)setUpLocalPort -{ - if (self.localPort != nil) { + if (self.installerConnection != nil) { return; } NSString *hostBundleIdentifier = self.host.bundle.bundleIdentifier; assert(hostBundleIdentifier != nil); - __weak SUInstallerDriver *weakSelf = self; - - if (SUXPCServiceExists(@LOCAL_MESSAGE_PORT_PRODUCT_NAME)) { - self.localPort = [[SUXPCLocalMessagePort alloc] initWithDelegate:self]; + if (!SUXPCServiceExists(@INSTALLER_CONNECTION_PRODUCT_NAME)) { + self.installerConnection = [[SUInstallerConnection alloc] initWithDelegate:self]; } else { - self.localPort = [[SULocalMessagePort alloc] initWithDelegate:self]; + self.installerConnection = [[SUXPCInstallerConnection alloc] initWithDelegate:self]; } - [self.localPort setServiceName:SUUpdateDriverServiceNameForBundleIdentifier(hostBundleIdentifier)]; - - [self.localPort setInvalidationCallback:^{ + __weak SUInstallerDriver *weakSelf = self; + [self.installerConnection setInvalidationHandler:^{ dispatch_async(dispatch_get_main_queue(), ^{ SUInstallerDriver *strongSelf = weakSelf; - if (strongSelf.localPort != nil) { - NSError *invalidationError = + if (strongSelf.installerConnection != nil) { + NSError *remoteError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred while running the updater. Please try again later.", nil), - NSLocalizedFailureReasonErrorKey:@"The local port connection from the updater was invalidated" + NSLocalizedFailureReasonErrorKey:@"The remote port connection was invalidated from the updater" } ]; - - [strongSelf.delegate installerIsRequestingAbortInstallWithError:invalidationError]; + [strongSelf.delegate installerIsRequestingAbortInstallWithError:remoteError]; } }); }]; -} - -- (void)setUpRemotePortWithCompletion:(void (^)(BOOL))completionHandler -{ - if (self.remotePort != nil) { - completionHandler(YES); - return; - } - - NSString *hostBundleIdentifier = self.host.bundle.bundleIdentifier; - assert(hostBundleIdentifier != nil); NSString *serviceName = SUAutoUpdateServiceNameForBundleIdentifier(hostBundleIdentifier); - if (!SUXPCServiceExists(@REMOTE_MESSAGE_PORT_PRODUCT_NAME)) { - self.remotePort = [[SURemoteMessagePort alloc] initWithServiceName:serviceName]; - } else { - self.remotePort = [[SUXPCRemoteMessagePort alloc] initWithServiceName:serviceName]; - } - __weak SUInstallerDriver *weakSelf = self; + [self.installerConnection setServiceName:serviceName]; - [self.remotePort connectWithLookupCompletion:^(BOOL lookupSuccess) { - dispatch_async(dispatch_get_main_queue(), ^{ - completionHandler(lookupSuccess); - - if (lookupSuccess) { - [weakSelf.remotePort setInvalidationHandler:^{ - dispatch_async(dispatch_get_main_queue(), ^{ - SUInstallerDriver *strongSelf = weakSelf; - if (strongSelf.remotePort != nil) { - NSError *remoteError = - [NSError - errorWithDomain:SUSparkleErrorDomain - code:SUInstallationError - userInfo:@{ - NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred while running the updater. Please try again later.", nil), - NSLocalizedFailureReasonErrorKey:@"The remote port connection was invalidated from the updater" - } - ]; - [strongSelf.delegate installerIsRequestingAbortInstallWithError:remoteError]; - } - }); - }]; - } - }); - }]; -} - -- (void)launchInstallToolWithCompletion:(void (^)(NSError * _Nullable ))completionHandler -{ - [self setUpLocalPort]; - [self launchAutoUpdateWithCompletion:completionHandler]; + [self sendInstallationData]; } // This can be called multiple times (eg: if a delta update fails, this may be called again with a regular update item) @@ -192,8 +132,8 @@ self.currentStage = SUInstallerNotStarted; - if (self.localPort == nil) { - [self launchInstallToolWithCompletion:completionHandler]; + if (self.installerConnection == nil) { + [self launchAutoUpdateWithCompletion:completionHandler]; } else { // The Install tool is already alive; just send out installation input data again [self sendInstallationData]; @@ -239,49 +179,26 @@ return; } - __weak SUInstallerDriver *weakSelf = self; - [self setUpRemotePortWithCompletion:^(BOOL setupSuccess) { - SUInstallerDriver *strongSelf = weakSelf; - if (strongSelf == nil) { - return; - } - - if (!setupSuccess) { - NSError *remoteError = - [NSError - errorWithDomain:SUSparkleErrorDomain - code:SUInstallationError - userInfo:@{ - NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred while running the updater. Please try again later.", nil), - NSLocalizedFailureReasonErrorKey:@"The remote port connection failed being created" - } - ]; - - [strongSelf.delegate installerIsRequestingAbortInstallWithError:remoteError]; - } else { - [strongSelf.remotePort sendMessageWithIdentifier:SUInstallationData data:archivedData completion:^(BOOL success) { - if (!success) { - dispatch_async(dispatch_get_main_queue(), ^{ - [weakSelf.delegate installerIsRequestingAbortInstallWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey:SULocalizedString(@"An error occurred while starting the installer parameters. Please try again later.", nil) }]]; - }); - } - }]; - - strongSelf.currentStage = SURequestInstallationParameters; - } - }]; + [self.installerConnection handleMessageWithIdentifier:SUInstallationData data:archivedData]; + + self.currentStage = SUInstallerNotStarted; } - (void)handleMessageWithIdentifier:(int32_t)identifier data:(NSData *)data +{ + dispatch_async(dispatch_get_main_queue(), ^{ + [self _handleMessageWithIdentifier:identifier data:data]; + }); +} + +- (void)_handleMessageWithIdentifier:(int32_t)identifier data:(NSData *)data { if (!SUInstallerMessageTypeIsLegal(self.currentStage, identifier)) { SULog(@"Error: received out of order message with current stage: %d, requested stage: %d", self.currentStage, identifier); return; } - if (identifier == SURequestInstallationParameters) { - [self sendInstallationData]; - } else if (identifier == SUExtractedArchiveWithProgress) { + if (identifier == SUExtractedArchiveWithProgress) { if (data.length == sizeof(double) && sizeof(double) == sizeof(uint64_t)) { uint64_t progressValue = CFSwapInt64LittleToHost(*(const uint64_t *)data.bytes); double progress = *(double *)&progressValue; @@ -311,11 +228,7 @@ NSData *updateItemData = SUArchiveRootObjectSecurely(self.updateItem); if (updateItemData != nil) { - [self.remotePort sendMessageWithIdentifier:SUSentUpdateAppcastItemData data:updateItemData completion:^(BOOL success) { - if (!success) { - SULog(@"Error: Failed to send update appcast item to installer"); - } - }]; + [self.installerConnection handleMessageWithIdentifier:SUSentUpdateAppcastItemData data:updateItemData]; } else { SULog(@"Error: Archived data to send for appcast item is nil"); } @@ -362,11 +275,8 @@ } else if (identifier == SUInstallationFinishedStage3) { self.currentStage = identifier; - [self.remotePort invalidate]; - self.remotePort = nil; - - [self.localPort invalidate]; - self.localPort = nil; + [self.installerConnection invalidate]; + self.installerConnection = nil; [self.delegate installerDidFinishInstallation]; [self.delegate installerIsRequestingAbortInstallWithError:nil]; @@ -501,12 +411,12 @@ installerLauncher = launcherConnection.remoteObjectProxy; } - BOOL shouldInheritPrivileges = NO; - if ([self.updaterDelegate respondsToSelector:@selector(updaterShouldInheritInstallPrivileges:)]) { - shouldInheritPrivileges = [self.updaterDelegate updaterShouldInheritInstallPrivileges:self.updater]; + BOOL shouldAllowInstallerInteraction = NO; + if ([self.updaterDelegate respondsToSelector:@selector(updaterShouldAllowInstallerInteraction:)]) { + shouldAllowInstallerInteraction = [self.updaterDelegate updaterShouldAllowInstallerInteraction:self.updater]; } - [installerLauncher launchInstallerAtPath:relaunchToolPath withHostBundleIdentifier:hostBundleIdentifier inheritingPrivileges:shouldInheritPrivileges completion:^(BOOL success) { + [installerLauncher launchInstallerAtPath:relaunchToolPath withHostBundleIdentifier:hostBundleIdentifier allowingInteraction:shouldAllowInstallerInteraction completion:^(BOOL success) { dispatch_async(dispatch_get_main_queue(), ^{ retrievedLaunchStatus = YES; [launcherConnection invalidate]; @@ -517,6 +427,8 @@ completionHandler(error); } else { + [self setUpConnection]; + completionHandler(nil); } }); @@ -570,58 +482,27 @@ } } - // Set up local and remote ports to the installer if they are not set up already - [self setUpLocalPort]; + // Set up connection to the installer if one is not set up already + [self setUpConnection]; - __weak SUInstallerDriver *weakSelf = self; - [self setUpRemotePortWithCompletion:^(BOOL setupSuccess) { - SUInstallerDriver *strongSelf = weakSelf; - if (strongSelf == nil) { - return; - } - - if (!setupSuccess) { - [strongSelf.delegate installerIsRequestingAbortInstallWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey:SULocalizedString(@"An error occurred while starting the remote port for the installer. Please try again later.", nil) }]]; - } else { - // For resumability, we'll assume we are far enough for the installation to continue - strongSelf.currentStage = SUInstallationFinishedStage1; - - strongSelf.willRelaunch = relaunch; - - uint8_t response[2] = {(uint8_t)relaunch, (uint8_t)showUI}; - NSData *responseData = [NSData dataWithBytes:response length:sizeof(response)]; - - [strongSelf.remotePort sendMessageWithIdentifier:SUResumeInstallationToStage2 data:responseData completion:^(BOOL success) { - if (!success) { - dispatch_async(dispatch_get_main_queue(), ^{ - NSError *remoteError = - [NSError - errorWithDomain:SUSparkleErrorDomain - code:SUInstallationError - userInfo:@{ - NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred while running the updater. Please try again later.", nil), - NSLocalizedFailureReasonErrorKey:@"The remote port connection failed to send resume install message" - } - ]; - [weakSelf.delegate installerIsRequestingAbortInstallWithError:remoteError]; - }); - } - // otherwise we'll terminate later when the installer tells us stage 2 is done - }]; - } - }]; + // For resumability, we'll assume we are far enough for the installation to continue + self.currentStage = SUInstallationFinishedStage1; + + self.willRelaunch = relaunch; + + uint8_t response[2] = {(uint8_t)relaunch, (uint8_t)showUI}; + NSData *responseData = [NSData dataWithBytes:response length:sizeof(response)]; + + [self.installerConnection handleMessageWithIdentifier:SUResumeInstallationToStage2 data:responseData]; + + // we'll terminate later when the installer tells us stage 2 is done } - (void)abortInstall { - if (self.localPort != nil) { - [self.localPort invalidate]; - self.localPort = nil; - } - - if (self.remotePort != nil) { - [self.remotePort invalidate]; - self.remotePort = nil; + if (self.installerConnection != nil) { + [self.installerConnection invalidate]; + self.installerConnection = nil; } } diff --git a/Sparkle/SULocalMessagePort.h b/Sparkle/SULocalMessagePort.h deleted file mode 100644 index f3d18519..00000000 --- a/Sparkle/SULocalMessagePort.h +++ /dev/null @@ -1,27 +0,0 @@ -// -// SULocalMessagePort.h -// Sparkle -// -// Created by Mayur Pawashe on 3/9/16. -// Copyright © 2016 Sparkle Project. All rights reserved. -// - -#import -#import "SULocalMessagePortProtocol.h" -#import "SULocalMessagePortDelegate.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface SULocalMessagePort : NSObject - -- (instancetype)init; - -// Due to XPC reasons, this delegate is strongly referenced. Make sure to -invalidate when done with this instance. -- (instancetype)initWithDelegate:(id)delegate; - -// messageCallback may be invoked on non-main thread -- (void)setMessageCallback:(NSData * _Nullable(^)(int32_t identifier, NSData *data))messageCallback; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Sparkle/SULocalMessagePort.m b/Sparkle/SULocalMessagePort.m deleted file mode 100644 index 4048cc0a..00000000 --- a/Sparkle/SULocalMessagePort.m +++ /dev/null @@ -1,177 +0,0 @@ -// -// SULocalMessagePort.m -// Sparkle -// -// Created by Mayur Pawashe on 3/9/16. -// Copyright © 2016 Sparkle Project. All rights reserved. -// - -#import "SULocalMessagePort.h" - -static NSString *SULocalServiceLookupReason = @"Local Service Connection"; - -@interface SULocalMessagePort () - -@property (nonatomic) CFMessagePortRef messagePort; -@property (nonatomic, nullable) id delegate; -@property (nonatomic, copy) NSData * _Nullable(^messageHandler)(int32_t, NSData *); -@property (nonatomic, copy) void (^invalidationBlock)(void); -@property (nonatomic, readonly) dispatch_queue_t messageQueue; -@property (nonatomic) BOOL disabledAutomaticTermination; - -@end - -@implementation SULocalMessagePort - -@synthesize messagePort = _messagePort; -@synthesize delegate = _delegate; -@synthesize messageHandler = _messageHandler; -@synthesize invalidationBlock = _invalidationBlock; -@synthesize messageQueue = _messageQueue; -@synthesize disabledAutomaticTermination = _disabledAutomaticTermination; - -- (instancetype)init -{ - self = [super init]; - if (self != nil) { - _messageQueue = dispatch_queue_create("org.sparkle-project.sparkle-local-port", DISPATCH_QUEUE_SERIAL); - - // If we are a XPC service, protect it from being terminated until the invalidation handler is set - _disabledAutomaticTermination = YES; - [[NSProcessInfo processInfo] disableAutomaticTermination:SULocalServiceLookupReason]; - } - return self; -} - -- (instancetype)initWithDelegate:(id)delegate -{ - self = [self init]; - if (self != nil) { - _delegate = delegate; - } - return self; -} - -- (void)dealloc -{ - [self enableAutomaticTermination]; -} - -- (void)setServiceName:(NSString *)serviceName -{ - assert(self.messagePort == NULL); - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wcast-qual" - CFMessagePortContext context = {.version = 0, .info = (void *)CFBridgingRetain(self), .retain = NULL, .release = NULL, .copyDescription = NULL}; -#pragma clang diagnostic pop - CFMessagePortRef messagePort = CFMessagePortCreateLocal(kCFAllocatorDefault, (CFStringRef)serviceName, messagePortCallback, &context, NULL); - - if (messagePort == NULL) { - CFRelease((__bridge CFTypeRef)(self)); - self.messageHandler = nil; - [self removeDelegate]; - [self enableAutomaticTermination]; - } else { - self.messagePort = messagePort; - CFMessagePortSetDispatchQueue(messagePort, self.messageQueue); - } -} - -- (void)setMessageCallback:(NSData * _Nullable(^)(int32_t identifier, NSData *data))messageCallback -{ - self.messageHandler = messageCallback; -} - -- (void)enableAutomaticTermination -{ - if (self.disabledAutomaticTermination) { - [[NSProcessInfo processInfo] enableAutomaticTermination:SULocalServiceLookupReason]; - self.disabledAutomaticTermination = NO; - } -} - -- (void)setInvalidationCallback:(void (^)(void))invalidationCallback -{ - // We can disable automatic termination now because we will be protected by the invalidationHandler (if this is a XPC service) - [self enableAutomaticTermination]; - - if (self.messagePort == NULL) { - invalidationCallback(); - } else { - self.invalidationBlock = [invalidationCallback copy]; - CFMessagePortSetInvalidationCallBack(self.messagePort, messageInvalidationCallback); - } -} - -- (void)invalidate -{ - dispatch_async(self.messageQueue, ^{ - if (self.invalidationBlock != nil) { - self.invalidationBlock = nil; - CFMessagePortInvalidate(self.messagePort); - } else { - [self removeDelegate]; - } - }); -} - -- (void)removeDelegate -{ - // Remove our delegate right away but make sure it is released on main thread - __block id delegate = self.delegate; - if (delegate != nil) { - self.delegate = nil; - dispatch_async(dispatch_get_main_queue(), ^{ - delegate = nil; - }); - } -} - -// Called on non-main thread -static CFDataRef messagePortCallback(CFMessagePortRef __unused messagePort, SInt32 messageID, CFDataRef dataRef, void *info) -{ - @autoreleasepool { - SULocalMessagePort *self = (__bridge SULocalMessagePort *)info; - // Create a copy that we can safely pass it asynchronously - // Warning: Do not use a convenience -[NSData copy] or an equivalent call. This crashes, and ASAN will let you know it crashes - // Most likely because the bytes are set to be freed internally, and not deep copied or something - NSData *data = [NSData dataWithBytes:CFDataGetBytePtr(dataRef) length:(NSUInteger)CFDataGetLength(dataRef)]; - - NSData *replyData = nil; - if (self.delegate != nil) { - [self.delegate localMessagePortReceivedMessageWithIdentifier:messageID data:data]; - } else if (self.messageHandler != nil) { - replyData = self.messageHandler(messageID, data); - } - - return (CFDataRef)CFBridgingRetain(replyData); - } -} - -// Called on non-main thread -static void messageInvalidationCallback(CFMessagePortRef messagePort, void *info) -{ - @autoreleasepool { - SULocalMessagePort *self = (__bridge SULocalMessagePort *)info; - - dispatch_async(self.messageQueue, ^{ - [self removeDelegate]; - - // note that messageHandler is deallocated on same queue that we're receiving messages from, which is good - self.messageHandler = nil; - - if (self.invalidationBlock != nil) { - self.invalidationBlock(); - self.invalidationBlock = nil; - } - - self.messagePort = NULL; - - CFRelease(messagePort); - CFRelease((__bridge CFTypeRef)(self)); - }); - } -} - -@end diff --git a/Sparkle/SULocalMessagePortDelegate.h b/Sparkle/SULocalMessagePortDelegate.h deleted file mode 100644 index 818bf486..00000000 --- a/Sparkle/SULocalMessagePortDelegate.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// SULocalMessagePortDelegate.h -// Sparkle -// -// Created by Mayur Pawashe on 6/15/16. -// Copyright © 2016 Sparkle Project. All rights reserved. -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol SULocalMessagePortDelegate - -// Note: this method may not be called on the main thread -// Due to XPC/asynchronous reasons, this cannot return any reply data back -- (void)localMessagePortReceivedMessageWithIdentifier:(int32_t)identifier data:(NSData *)data; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Sparkle/SULocalMessagePortProtocol.h b/Sparkle/SULocalMessagePortProtocol.h deleted file mode 100644 index 1236b01b..00000000 --- a/Sparkle/SULocalMessagePortProtocol.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// SULocalMessagePortProtocol.h -// Sparkle -// -// Created by Mayur Pawashe on 6/14/16. -// Copyright © 2016 Sparkle Project. All rights reserved. -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol SULocalMessagePortProtocol - -- (void)setServiceName:(NSString *)serviceName; - -- (void)setInvalidationCallback:(void (^)(void))invalidationCallback; - -- (void)invalidate; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Sparkle/SUProbeInstallStatus.m b/Sparkle/SUProbeInstallStatus.m index 94b62ee9..b408125a 100644 --- a/Sparkle/SUProbeInstallStatus.m +++ b/Sparkle/SUProbeInstallStatus.m @@ -7,15 +7,18 @@ // #import "SUProbeInstallStatus.h" -#import "SULocalMessagePort.h" -#import "SURemoteMessagePort.h" -#import "SUXPCRemoteMessagePort.h" #import "SUXPCServiceInfo.h" -#import "SURemoteMessagePortProtocol.h" #import "SUHost.h" #import "SUMessageTypes.h" #import "SUInstallationInfo.h" #import "SUSecureCoding.h" +#import "SUInstallerStatus.h" +#import "SUXPCInstallerStatus.h" +#import "SULog.h" + +// This timeout is if probing the installer takes too long +// It should be at least more than 1 second since a probe can take around that much time +#define PROBE_TIMEOUT 7 @implementation SUProbeInstallStatus @@ -24,20 +27,45 @@ NSString *hostBundleIdentifier = host.bundle.bundleIdentifier; assert(hostBundleIdentifier != nil); - id remotePort = nil; - NSString *serviceName = SUAutoUpdateServiceNameForBundleIdentifier(hostBundleIdentifier); - if (!SUXPCServiceExists(@REMOTE_MESSAGE_PORT_PRODUCT_NAME)) { - remotePort = [[SURemoteMessagePort alloc] initWithServiceName:serviceName]; + id installerStatus = nil; + if (!SUXPCServiceExists(@INSTALLER_STATUS_PRODUCT_NAME)) { + installerStatus = [[SUInstallerStatus alloc] init]; } else { - remotePort = [[SUXPCRemoteMessagePort alloc] initWithServiceName:serviceName]; + installerStatus = [[SUXPCInstallerStatus alloc] init]; } - [remotePort connectWithLookupCompletion:^(BOOL success) { - if (success) { - [remotePort invalidate]; - } - completionHandler(success); + __block BOOL handledCompletion = NO; + + [installerStatus setInvalidationHandler:^{ + dispatch_async(dispatch_get_main_queue(), ^{ + if (!handledCompletion) { + completionHandler(NO); + handledCompletion = YES; + } + }); }]; + + NSString *serviceName = SUStatusInfoServiceNameForBundleIdentifier(hostBundleIdentifier); + [installerStatus setServiceName:serviceName]; + + [installerStatus probeStatusConnectivityWithReply:^{ + dispatch_async(dispatch_get_main_queue(), ^{ + if (!handledCompletion) { + completionHandler(YES); + handledCompletion = YES; + } + }); + [installerStatus invalidate]; + }]; + + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(PROBE_TIMEOUT * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + if (!handledCompletion) { + SULog(@"Timed out while probing installer progress"); + completionHandler(NO); + handledCompletion = YES; + } + [installerStatus invalidate]; + }); } + (void)probeInstallerUpdateItemForHost:(SUHost *)host completion:(void (^)(SUInstallationInfo * _Nullable))completionHandler @@ -45,36 +73,51 @@ NSString *hostBundleIdentifier = host.bundle.bundleIdentifier; assert(hostBundleIdentifier != nil); - id remotePort = nil; - NSString *serviceName = SUAutoUpdateServiceNameForBundleIdentifier(hostBundleIdentifier); - if (!SUXPCServiceExists(@REMOTE_MESSAGE_PORT_PRODUCT_NAME)) { - remotePort = [[SURemoteMessagePort alloc] initWithServiceName:serviceName]; + id installerStatus = nil; + if (!SUXPCServiceExists(@INSTALLER_STATUS_PRODUCT_NAME)) { + installerStatus = [[SUInstallerStatus alloc] init]; } else { - remotePort = [[SUXPCRemoteMessagePort alloc] initWithServiceName:serviceName]; + installerStatus = [[SUXPCInstallerStatus alloc] init]; } - [remotePort connectWithLookupCompletion:^(BOOL lookupSuccess) { - if (!lookupSuccess) { - completionHandler(nil); - } else { - [remotePort sendMessageWithIdentifier:SUReceiveUpdateAppcastItemData data:[NSData data] reply:^(BOOL success, NSData * _Nullable replyData) { - [remotePort invalidate]; - - if (!success || replyData == nil) { - completionHandler(nil); - } else { - NSData *nonNullReplyData = replyData; - SUInstallationInfo *installationInfo = (SUInstallationInfo *)SUUnarchiveRootObjectSecurely(nonNullReplyData, [SUInstallationInfo class]); - - if (installationInfo != nil) { - completionHandler(installationInfo); - } else { - completionHandler(nil); - } - } - }]; - } + __block BOOL handledCompletion = NO; + + [installerStatus setInvalidationHandler:^{ + dispatch_async(dispatch_get_main_queue(), ^{ + if (!handledCompletion) { + completionHandler(nil); + handledCompletion = YES; + } + }); }]; + + NSString *serviceName = SUStatusInfoServiceNameForBundleIdentifier(hostBundleIdentifier); + [installerStatus setServiceName:serviceName]; + + [installerStatus probeStatusInfoWithReply:^(NSData * _Nullable installationInfoData) { + SUInstallationInfo *installationInfo = nil; + if (installationInfoData != nil) { + installationInfo = (SUInstallationInfo *)SUUnarchiveRootObjectSecurely((NSData * _Nonnull)installationInfoData, [SUInstallationInfo class]); + } + + dispatch_async(dispatch_get_main_queue(), ^{ + if (!handledCompletion) { + completionHandler(installationInfo); + handledCompletion = YES; + } + }); + + [installerStatus invalidate]; + }]; + + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(PROBE_TIMEOUT * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + if (!handledCompletion) { + SULog(@"Timed out while probing installer info data"); + completionHandler(nil); + handledCompletion = YES; + } + [installerStatus invalidate]; + }); } @end diff --git a/Sparkle/SURemoteMessagePort.h b/Sparkle/SURemoteMessagePort.h deleted file mode 100644 index a9ff1fae..00000000 --- a/Sparkle/SURemoteMessagePort.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// SURemoteMessagePort.h -// Sparkle -// -// Created by Mayur Pawashe on 3/9/16. -// Copyright © 2016 Sparkle Project. All rights reserved. -// - -#import -#import "SURemoteMessagePortProtocol.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface SURemoteMessagePort : NSObject - -- (instancetype)init; -- (instancetype)initWithServiceName:(NSString *)serviceName; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Sparkle/SURemoteMessagePort.m b/Sparkle/SURemoteMessagePort.m deleted file mode 100644 index 18b161ae..00000000 --- a/Sparkle/SURemoteMessagePort.m +++ /dev/null @@ -1,193 +0,0 @@ -// -// SURemoteMessagePort.m -// Sparkle -// -// Created by Mayur Pawashe on 3/9/16. -// Copyright © 2016 Sparkle Project. All rights reserved. -// - -#import "SURemoteMessagePort.h" - -// Because remote message ports returned to us upon creation can be re-used, we maintain a global table so that -// each instance we create can have its own invalidation block. We really invalidate a port for a service name if -// the number of ports for that service reach 0. If we don't maintain a table, we could run into trouble. -// For instance, invalidating one remote message port could invalidate another. -static NSMutableDictionary *> *gMessagePortsTable; -static dispatch_queue_t gMessageQueue; - -static NSString *SURemoteServiceLookupReason = @"Remote Service Connection"; - -@interface SURemoteMessagePort () - -@property (nonatomic, copy) NSString *serviceName; -@property (nonatomic) CFMessagePortRef messagePort; -@property (nonatomic, copy) void (^invalidationCallback)(void); -@property (nonatomic) BOOL disabledAutomaticTermination; - -@end - -@implementation SURemoteMessagePort - -@synthesize serviceName = _serviceName; -@synthesize messagePort = _messagePort; -@synthesize invalidationCallback = _invalidationCallback; -@synthesize disabledAutomaticTermination = _disabledAutomaticTermination; - -- (instancetype)init -{ - self = [super init]; - if (self != nil) { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - gMessagePortsTable = [[NSMutableDictionary alloc] init]; - gMessageQueue = dispatch_queue_create("org.sparkle-project.remote-message-port", DISPATCH_QUEUE_SERIAL); - }); - - // If we are a XPC service, protect it from being terminated until the invalidation handler is set - _disabledAutomaticTermination = YES; - [[NSProcessInfo processInfo] disableAutomaticTermination:SURemoteServiceLookupReason]; - } - return self; -} - -- (instancetype)initWithServiceName:(NSString *)serviceName -{ - self = [self init]; - if (self != nil) { - _serviceName = [serviceName copy]; - } - return self; -} - -- (void)dealloc -{ - [self enableAutomaticTermination]; -} - -- (void)enableAutomaticTermination -{ - if (self.disabledAutomaticTermination) { - [[NSProcessInfo processInfo] enableAutomaticTermination:SURemoteServiceLookupReason]; - self.disabledAutomaticTermination = NO; - } -} - -- (void)connectWithLookupCompletion:(void (^)(BOOL))lookupCompletionHandler -{ - dispatch_async(gMessageQueue, ^{ - NSMutableArray *existingMessagePorts = [gMessagePortsTable objectForKey:self.serviceName]; - if (existingMessagePorts != nil && existingMessagePorts.count > 0) { - self.messagePort = existingMessagePorts[0].messagePort; - - [existingMessagePorts addObject:self]; - - lookupCompletionHandler(YES); - } else { - CFMessagePortRef messagePort = CFMessagePortCreateRemote(kCFAllocatorDefault, (CFStringRef)self.serviceName); - if (messagePort == NULL) { - lookupCompletionHandler(NO); - [self enableAutomaticTermination]; - } else { - self.messagePort = messagePort; - - NSMutableArray *newMessagePorts = [[NSMutableArray alloc] init]; - [newMessagePorts addObject:self]; - [gMessagePortsTable setObject:newMessagePorts forKey:self.serviceName]; - - lookupCompletionHandler(YES); - } - } - }); -} - -- (void)setInvalidationHandler:(void (^)(void))invalidationHandler -{ - // We can disable automatic termination now because we will be protected by the invalidationHandler (if this is a XPC service) - [self enableAutomaticTermination]; - - dispatch_async(gMessageQueue, ^{ - if (self.messagePort != NULL) { - self.invalidationCallback = [invalidationHandler copy]; - - // Note: do not add messagePort to dispatch queue or run loop: it will complain that one shouldn't be added for remote ports - CFMessagePortSetInvalidationCallBack(self.messagePort, messageInvalidationCallback); - } - }); -} - -- (void)sendMessageWithIdentifier:(int32_t)identifier data:(NSData *)data expectingReply:(BOOL)expectingReply completion:(void (^)(BOOL success, NSData * _Nullable replyData))completionHandler -{ - dispatch_async(gMessageQueue, ^{ - SInt32 status = 0; - NSData *replyData = nil; - if (self.messagePort != NULL) { - CFDataRef dataRef = (__bridge CFDataRef)(data); - CFDataRef dataReceived = NULL; - status = CFMessagePortSendRequest(self.messagePort, identifier, dataRef, 0.2, 2.0, expectingReply ? kCFRunLoopDefaultMode : NULL, expectingReply ? &dataReceived : NULL); - if (expectingReply && status == kCFMessagePortSuccess) { - replyData = (NSData *)CFBridgingRelease(dataReceived); - } - } else { - status = kCFMessagePortIsInvalid; - } - completionHandler(status == kCFMessagePortSuccess, replyData); - }); -} - -- (void)sendMessageWithIdentifier:(int32_t)identifier data:(NSData *)data reply:(void (^)(BOOL success, NSData * _Nullable replyData))replyHandler -{ - [self sendMessageWithIdentifier:identifier data:data expectingReply:YES completion:replyHandler]; -} - -- (void)sendMessageWithIdentifier:(int32_t)identifier data:(NSData *)data completion:(void (^)(BOOL success))completionHandler -{ - [self sendMessageWithIdentifier:identifier data:data expectingReply:NO completion:^(BOOL success, NSData * _Nullable __unused replyData) { - completionHandler(success); - }]; -} - -- (void)invalidate -{ - dispatch_async(gMessageQueue, ^{ - self.invalidationCallback = nil; - - if (self.messagePort != NULL) { - NSMutableArray *messagePorts = [gMessagePortsTable objectForKey:self.serviceName]; - [messagePorts removeObject:self]; - - if (messagePorts.count == 0) { - [gMessagePortsTable removeObjectForKey:self.serviceName]; - - // Removing our callback is a better decision than waiting for it to be called at an unpredictable time later - CFMessagePortSetInvalidationCallBack(self.messagePort, NULL); - CFMessagePortInvalidate(self.messagePort); - CFRelease(self.messagePort); - self.messagePort = NULL; - } - } - }); -} - -static void messageInvalidationCallback(CFMessagePortRef messagePort, void * __unused info) -{ - @autoreleasepool { - NSString *serviceName = [(const NSString *)CFMessagePortGetName(messagePort) copy]; - - dispatch_async(gMessageQueue, ^{ - if (serviceName != nil) { - for (SURemoteMessagePort *remoteMessagePort in [gMessagePortsTable objectForKey:serviceName]) { - if (remoteMessagePort.invalidationCallback != nil) { - remoteMessagePort.invalidationCallback(); - remoteMessagePort.invalidationCallback = nil; - } - remoteMessagePort.messagePort = NULL; - } - [gMessagePortsTable removeObjectForKey:serviceName]; - } - - CFRelease(messagePort); - }); - } -} - -@end diff --git a/Sparkle/SURemoteMessagePortProtocol.h b/Sparkle/SURemoteMessagePortProtocol.h deleted file mode 100644 index 92351c3c..00000000 --- a/Sparkle/SURemoteMessagePortProtocol.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// SURemoteMessagePortProtocol.h -// Sparkle -// -// Created by Mayur Pawashe on 4/3/16. -// Copyright © 2016 Sparkle Project. All rights reserved. -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol SURemoteMessagePortProtocol - -- (void)setServiceName:(NSString *)serviceName; - -- (void)connectWithLookupCompletion:(void (^)(BOOL))lookupCompletionHandler; - -- (void)setInvalidationHandler:(void (^)(void))invalidationHandler; - -- (void)sendMessageWithIdentifier:(int32_t)identifier data:(NSData *)data completion:(void (^)(BOOL success))completionHandler; - -- (void)sendMessageWithIdentifier:(int32_t)identifier data:(NSData *)data reply:(void (^)(BOOL success, NSData * _Nullable replyData))replyHandler; - -- (void)invalidate; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Sparkle/SUSystemAuthorization.h b/Sparkle/SUSystemAuthorization.h new file mode 100644 index 00000000..a9f1a57e --- /dev/null +++ b/Sparkle/SUSystemAuthorization.h @@ -0,0 +1,19 @@ +// +// SUSystemAuthorization.h +// Sparkle +// +// Created by Mayur Pawashe on 7/11/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +// Must free authorization ref later +AuthorizationRef SUCreateAuthorization(BOOL * _Nullable grantedSystemPrivilege); + +BOOL SUGrantsSystemAuthorizationAccess(void); + +NS_ASSUME_NONNULL_END diff --git a/Sparkle/SUSystemAuthorization.m b/Sparkle/SUSystemAuthorization.m new file mode 100644 index 00000000..2f53ca24 --- /dev/null +++ b/Sparkle/SUSystemAuthorization.m @@ -0,0 +1,52 @@ +// +// SUSystemAuthorization.m +// Sparkle +// +// Created by Mayur Pawashe on 7/11/16. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +#import "SUSystemAuthorization.h" +#import + +AuthorizationRef SUCreateAuthorization(BOOL * _Nullable grantedSystemPrivilege) +{ + // This should almost always succeed, fail in unusual/rare cases + AuthorizationRef auth = NULL; + OSStatus createStatus = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &auth); + if (createStatus != errAuthorizationSuccess) { + auth = NULL; + if (grantedSystemPrivilege != NULL) { + *grantedSystemPrivilege = NO; + } + } else { + AuthorizationItem rightItems[] = { + { .name = kSMRightModifySystemDaemons, .valueLength = 0, .value = NULL, .flags = 0} + }; + + AuthorizationRights rights = { + .count = sizeof(rightItems) / sizeof(*rightItems), + .items = rightItems, + }; + + AuthorizationFlags flags = + (AuthorizationFlags)(kAuthorizationFlagExtendRights | kAuthorizationFlagPreAuthorize); + + // This will test if we can gain authorization for running utlities as root + OSStatus copyStatus = AuthorizationCopyRights(auth, &rights, kAuthorizationEmptyEnvironment, flags, NULL); + if (grantedSystemPrivilege != NULL) { + *grantedSystemPrivilege = (copyStatus == errAuthorizationSuccess); + } + } + return auth; +} + +BOOL SUGrantsSystemAuthorizationAccess(void) +{ + BOOL grantedSystemPrivilege = NO; + + AuthorizationRef auth = SUCreateAuthorization(&grantedSystemPrivilege); + AuthorizationFree(auth, kAuthorizationFlagDefaults); + + return grantedSystemPrivilege; +} diff --git a/Sparkle/SUUpdaterDelegate.h b/Sparkle/SUUpdaterDelegate.h index ff0f104b..8090d2a7 100644 --- a/Sparkle/SUUpdaterDelegate.h +++ b/Sparkle/SUUpdaterDelegate.h @@ -241,19 +241,19 @@ SU_EXPORT extern NSString *const SUUpdaterAppcastNotificationKey; - (NSString *)pathToRelaunchForUpdater:(SUUpdater *)updater; /*! - Returns whether or not the updater should inherit its parent's privileges during installation + Returns whether or not the updater should allow interaction with its installer - Use this to override the default behavior which is to not inherit privileges. + Use this to override the default behavior which is to allow interaction with the installer. - If privileges are inherited, then no authorization prompt will show up, and - the installation will succeed only if the process has sufficient privileges. + If interaction is allowed, then an authorization prompt may show up to the user if they do + not curently have sufficient privileges to perform the installation of the new update. - On the other hand, if privileges are not inherited (the default), the installer may - request an authorization prompt to obtain additional privileges. + On the other hand, if interaction is not allowed, then an installation may fail if the user does not + have sufficient privileges to perform the installation. \param updater The SUUpdater instance. */ -- (BOOL)updaterShouldInheritInstallPrivileges:(SUUpdater *)updater; +- (BOOL)updaterShouldAllowInstallerInteraction:(SUUpdater *)updater; /*! Returns the decryption password (if any) which is used to extract the update archive DMG. diff --git a/Sparkle/SUXPCLocalMessagePort.h b/Sparkle/SUXPCLocalMessagePort.h deleted file mode 100644 index bc4464a3..00000000 --- a/Sparkle/SUXPCLocalMessagePort.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// SUXPCLocalMessagePort.h -// Sparkle -// -// Created by Mayur Pawashe on 6/14/16. -// Copyright © 2016 Sparkle Project. All rights reserved. -// - -#import -#import "SULocalMessagePortProtocol.h" -#import "SULocalMessagePortDelegate.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface SUXPCLocalMessagePort : NSObject - -// Due to XPC reasons, this delegate is strongly referenced. Make sure to -invalidate when done with this instance. -- (instancetype)initWithDelegate:(id)delegate; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Sparkle/SUXPCLocalMessagePort.m b/Sparkle/SUXPCLocalMessagePort.m deleted file mode 100644 index a05ecc8c..00000000 --- a/Sparkle/SUXPCLocalMessagePort.m +++ /dev/null @@ -1,84 +0,0 @@ -// -// SUXPCLocalMessagePort.m -// Sparkle -// -// Created by Mayur Pawashe on 6/14/16. -// Copyright © 2016 Sparkle Project. All rights reserved. -// - -#import "SUXPCLocalMessagePort.h" -#import "SULog.h" - -@interface SUXPCLocalMessagePort () - -@property (nonatomic, readonly) NSXPCConnection *connection; -@property (nonatomic) id delegate; -@property (nonatomic, copy) void (^invalidationHandler)(void); - -@end - -@implementation SUXPCLocalMessagePort - -@synthesize connection = _connection; -@synthesize delegate = _delegate; -@synthesize invalidationHandler = _invalidationHandler; - -- (instancetype)initWithDelegate:(id)delegate -{ - self = [self init]; - if (self != nil) { - _connection = [[NSXPCConnection alloc] initWithServiceName:@LOCAL_MESSAGE_PORT_BUNDLE_ID]; - _connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SULocalMessagePortProtocol)]; - - __weak SUXPCLocalMessagePort *weakSelf = self; - _connection.invalidationHandler = ^{ - [weakSelf invokeInvalidation]; - }; - - _connection.interruptionHandler = ^{ - SULog(@"LocalMessagePort service interrupted"); - [weakSelf invokeInvalidation]; - [weakSelf.connection invalidate]; - }; - - _delegate = delegate; - - _connection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SULocalMessagePortDelegate)]; - _connection.exportedObject = _delegate; - - [_connection resume]; - } - return self; -} - -- (void)setServiceName:(NSString *)serviceName -{ - [self.connection.remoteObjectProxy setServiceName:serviceName]; -} - -- (void)invokeInvalidation -{ - if (self.invalidationHandler != nil) { - self.invalidationHandler(); - self.invalidationHandler = nil; - } - self.delegate = nil; -} - -- (void)setInvalidationCallback:(void (^)(void))invalidationCallback -{ - self.invalidationHandler = [invalidationCallback copy]; - - __weak SUXPCLocalMessagePort *weakSelf = self; - [self.connection.remoteObjectProxy setInvalidationCallback:^{ - [weakSelf invokeInvalidation]; - }]; -} - -- (void)invalidate -{ - [self.connection.remoteObjectProxy invalidate]; - [self.connection invalidate]; -} - -@end diff --git a/Sparkle/SUXPCRemoteMessagePort.h b/Sparkle/SUXPCRemoteMessagePort.h deleted file mode 100644 index 3e476b4c..00000000 --- a/Sparkle/SUXPCRemoteMessagePort.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// SUXPCRemoteMessagePort.h -// Sparkle -// -// Created by Mayur Pawashe on 4/3/16. -// Copyright © 2016 Sparkle Project. All rights reserved. -// - -#import -#import "SURemoteMessagePortProtocol.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface SUXPCRemoteMessagePort : NSObject - -- (instancetype)initWithServiceName:(NSString *)serviceName; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Sparkle/SUXPCRemoteMessagePort.m b/Sparkle/SUXPCRemoteMessagePort.m deleted file mode 100644 index e672cacb..00000000 --- a/Sparkle/SUXPCRemoteMessagePort.m +++ /dev/null @@ -1,99 +0,0 @@ -// -// SUXPCRemoteMessagePort.m -// Sparkle -// -// Created by Mayur Pawashe on 4/3/16. -// Copyright © 2016 Sparkle Project. All rights reserved. -// - -#import "SUXPCRemoteMessagePort.h" -#import "SURemoteMessagePort.h" -#import "SULog.h" - -@interface SUXPCRemoteMessagePort () - -@property (nonatomic, readonly) NSXPCConnection *connection; -@property (nonatomic, copy) void (^invalidationHandler)(void); - -@end - -@implementation SUXPCRemoteMessagePort - -@synthesize connection = _connection; -@synthesize invalidationHandler = _invalidationHandler; - -- (instancetype)initWithServiceName:(NSString *)serviceName -{ - self = [self init]; - if (self != nil) { - _connection = [[NSXPCConnection alloc] initWithServiceName:@REMOTE_MESSAGE_PORT_BUNDLE_ID]; - _connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SURemoteMessagePortProtocol)]; - - __weak SUXPCRemoteMessagePort *weakSelf = self; - _connection.invalidationHandler = ^{ - [weakSelf invokeInvalidation]; - }; - - _connection.interruptionHandler = ^{ - SULog(@"RemoteMessagePort service interrupted"); - [weakSelf invokeInvalidation]; - [weakSelf.connection invalidate]; - }; - - [_connection resume]; - - [self setServiceName:serviceName]; - } - return self; -} - -- (void)setServiceName:(NSString *)serviceName -{ - [self.connection.remoteObjectProxy setServiceName:serviceName]; -} - -- (void)connectWithLookupCompletion:(void (^)(BOOL))lookupCompletionHandler -{ - [self.connection.remoteObjectProxy connectWithLookupCompletion:^(BOOL success) { - lookupCompletionHandler(success); - if (!success) { - [self.connection invalidate]; - } - }]; -} - -- (void)invokeInvalidation -{ - if (self.invalidationHandler != nil) { - self.invalidationHandler(); - self.invalidationHandler = nil; - } -} - -- (void)setInvalidationHandler:(void (^)(void))invalidationHandler -{ - _invalidationHandler = [invalidationHandler copy]; - - __weak SUXPCRemoteMessagePort *weakSelf = self; - [self.connection.remoteObjectProxy setInvalidationHandler:^{ - [weakSelf invokeInvalidation]; - }]; -} - -- (void)sendMessageWithIdentifier:(int32_t)identifier data:(NSData *)data completion:(void (^)(BOOL success))completionHandler -{ - [self.connection.remoteObjectProxy sendMessageWithIdentifier:identifier data:data completion:completionHandler]; -} - -- (void)sendMessageWithIdentifier:(int32_t)identifier data:(NSData *)data reply:(void (^)(BOOL success, NSData * _Nullable replyData))replyHandler -{ - [self.connection.remoteObjectProxy sendMessageWithIdentifier:identifier data:data reply:replyHandler]; -} - -- (void)invalidate -{ - [self.connection.remoteObjectProxy invalidate]; - [self.connection invalidate]; -} - -@end diff --git a/Tests/SUInstallerTest.m b/Tests/SUInstallerTest.m index dcbefa78..8eee10c2 100644 --- a/Tests/SUInstallerTest.m +++ b/Tests/SUInstallerTest.m @@ -54,7 +54,7 @@ SUHost *host = [[SUHost alloc] initWithBundle:bundle]; NSError *installerError = nil; - id installer = [SUInstaller installerForHost:host updateDirectory:[path stringByDeletingLastPathComponent] inheritsPrivileges:YES versionComparator:[SUStandardVersionComparator standardVersionComparator] error:&installerError]; + id installer = [SUInstaller installerForHost:host updateDirectory:[path stringByDeletingLastPathComponent] allowingInteraction:NO versionComparator:[SUStandardVersionComparator standardVersionComparator] error:&installerError]; if (installer == nil) { XCTFail(@"Installer is nil with error: %@", installerError); diff --git a/sparkle-cli/SUCommandLineDriver.m b/sparkle-cli/SUCommandLineDriver.m index 2f4ab442..3695a226 100644 --- a/sparkle-cli/SUCommandLineDriver.m +++ b/sparkle-cli/SUCommandLineDriver.m @@ -64,11 +64,11 @@ void _SULogDisableStandardErrorStream(void); return self; } -- (BOOL)updaterShouldInheritInstallPrivileges:(SUUpdater *)__unused updater +- (BOOL)updaterShouldAllowInstallerInteraction:(SUUpdater *)__unused updater { // If the installation is interactive, we can show an authorization prompt for requesting additional privileges, // otherwise we should have the installer inherit the updater's privileges. - return !self.interactive; + return self.interactive; } // In case we find an update during probing, otherwise we leave this to the user driver