From 35b47ceda9793906e4850abe574b233bb15442be Mon Sep 17 00:00:00 2001 From: David Beitey Date: Mon, 1 Feb 2016 22:44:56 +1000 Subject: [PATCH] Update theos version, work with Xcode SDK over theos headers, resolve deprecations --- .env | 3 ++ .gitmodules | 3 ++ Makefile | 8 ++--- NSTask.h | 73 ++++++++++++++++++++++++++++++++++++++ PassEntry.mm | 2 +- PassEntryViewController.mm | 2 +- PasswordsViewController.mm | 2 +- README.md | 6 ++++ modules/ldid | 1 + 9 files changed, 93 insertions(+), 7 deletions(-) create mode 100644 .env create mode 100644 NSTask.h create mode 160000 modules/ldid diff --git a/.env b/.env new file mode 100644 index 0000000..061e28e --- /dev/null +++ b/.env @@ -0,0 +1,3 @@ +export THEOS=$(pwd)/modules/theos +export PATH=$(pwd)/modules/ldid/out:$PATH + diff --git a/.gitmodules b/.gitmodules index 9d0ecfa..2ebe071 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "modules/theos"] path = modules/theos url = https://github.com/rpetrich/theos.git +[submodule "modules/ldid"] + path = modules/ldid + url = https://github.com/davidjb/ldid.git diff --git a/Makefile b/Makefile index aa0d848..033806e 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,14 @@ -ARCHS=armv7 armv7s +ARCHS=armv7 armv7s arm64 TARGET=iphone:latest -CFLAGS=-fobjc-arc -I modules/Valet -I modules/Valet/Valet -I modules/Valet/Other - -include $(THEOS)/makefiles/common.mk APPLICATION_NAME = pass pass_FILES = main.m passwordstoreApplication.mm PasswordsViewController.mm PassEntry.mm PassDataController.mm PassEntryViewController.mm modules/Valet/Valet/VALValet.m modules/Valet/Valet/VALSecureEnclaveValet.m pass_FRAMEWORKS = UIKit CoreGraphics Security +pass_CFLAGS=-fobjc-arc -I modules/Valet -I modules/Valet/Valet -I modules/Valet/Other + TARGET_CODESIGN_FLAGS = -Sent.xml +include modules/theos/makefiles/common.mk include $(THEOS_MAKE_PATH)/application.mk build-install: clean package install diff --git a/NSTask.h b/NSTask.h new file mode 100644 index 0000000..eab6b63 --- /dev/null +++ b/NSTask.h @@ -0,0 +1,73 @@ +/* NSTask.h + Copyright (c) 1996-2007, Apple Inc. All rights reserved. +*/ + +#import + +@class NSString, NSArray, NSDictionary; + +@interface NSTask : NSObject + +// Create an NSTask which can be run at a later time +// An NSTask can only be run once. Subsequent attempts to +// run an NSTask will raise. +// Upon task death a notification will be sent +// { Name = NSTaskDidTerminateNotification; object = task; } +// + +- (instancetype)init; + +// set parameters +// these methods can only be done before a launch +- (void)setLaunchPath:(NSString *)path; +- (void)setArguments:(NSArray *)arguments; +- (void)setEnvironment:(NSDictionary *)dict; + // if not set, use current +- (void)setCurrentDirectoryPath:(NSString *)path; + // if not set, use current + +// set standard I/O channels; may be either an NSFileHandle or an NSPipe +- (void)setStandardInput:(id)input; +- (void)setStandardOutput:(id)output; +- (void)setStandardError:(id)error; + +// get parameters +- (NSString *)launchPath; +- (NSArray *)arguments; +- (NSDictionary *)environment; +- (NSString *)currentDirectoryPath; + +// get standard I/O channels; could be either an NSFileHandle or an NSPipe +- (id)standardInput; +- (id)standardOutput; +- (id)standardError; + +// actions +- (void)launch; + +- (void)interrupt; // Not always possible. Sends SIGINT. +- (void)terminate; // Not always possible. Sends SIGTERM. + +- (BOOL)suspend; +- (BOOL)resume; + +// status +- (int)processIdentifier; +- (BOOL)isRunning; + +- (int)terminationStatus; + +@end + +@interface NSTask (NSTaskConveniences) + ++ (NSTask *)launchedTaskWithLaunchPath:(NSString *)path arguments:(NSArray *)arguments; + // convenience; create and launch + +- (void)waitUntilExit; + // poll the runLoop in defaultMode until task completes + +@end + +FOUNDATION_EXPORT NSString * const NSTaskDidTerminateNotification; + diff --git a/PassEntry.mm b/PassEntry.mm index ec31eba..6f26229 100644 --- a/PassEntry.mm +++ b/PassEntry.mm @@ -6,7 +6,7 @@ * Please see COPYING for more information */ #import "PassEntry.h" -#import +#import "NSTask.h" @implementation PassEntry diff --git a/PassEntryViewController.mm b/PassEntryViewController.mm index b741e77..c218772 100644 --- a/PassEntryViewController.mm +++ b/PassEntryViewController.mm @@ -28,7 +28,7 @@ - (void)viewDidLoad { // self.title = NSLocalizedString(@"Passwords", @"Password title"); self.backgroundTaskIdentifier = 0; - self.keychain = [[VALSecureEnclaveValet alloc] initWithIdentifier:@"Pass"]; + self.keychain = [[VALSecureEnclaveValet alloc] initWithIdentifier:@"Pass" accessControl:VALAccessControlUserPresence]; self.useTouchID = [[self.keychain class] supportsSecureEnclaveKeychainItems]; self.pasteboard = [UIPasteboard generalPasteboard]; diff --git a/PasswordsViewController.mm b/PasswordsViewController.mm index cb0e80a..f80e854 100644 --- a/PasswordsViewController.mm +++ b/PasswordsViewController.mm @@ -28,7 +28,7 @@ - (void)viewDidLoad { - (void)clearPassphrase { // TODO Refactor into shared function - VALSecureEnclaveValet *keychain = [[VALSecureEnclaveValet alloc] initWithIdentifier:@"Pass"]; + VALSecureEnclaveValet *keychain = [[VALSecureEnclaveValet alloc] initWithIdentifier:@"Pass" accessControl:VALAccessControlUserPresence]; [keychain removeObjectForKey:@"gpg-passphrase-touchid"]; UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Keychain cleared" message:@"Passphrase has been removed from the keychain" preferredStyle:UIAlertControllerStyleAlert]; diff --git a/README.md b/README.md index 9a6951f..5e1b0af 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,12 @@ Building ``` git clone --recursive https://github.com/davidjb/pass-ios.git cd pass-ios + + # ldid compilation only required first time + cd modules/ldid + ./make.sh + cd ../.. + source .env make make package diff --git a/modules/ldid b/modules/ldid new file mode 160000 index 0000000..b6a5263 --- /dev/null +++ b/modules/ldid @@ -0,0 +1 @@ +Subproject commit b6a526368c44d06d007f57224b9ae377bb1f6293