From 1bd49022fa3f288a1a039655c02a1dafc89bcdb8 Mon Sep 17 00:00:00 2001 From: opa334 Date: Tue, 28 Nov 2023 02:58:01 +0100 Subject: [PATCH] Back to Security.framework on iOS 16+, apparently ldid signed binaries don't work on 16+ --- RootHelper/main.m | 18 +++++++++--------- TrollStore/TSApplicationsManager.m | 10 +++++----- TrollStore/TSSceneDelegate.m | 4 ++-- TrollStore/TSSettingsListController.m | 8 ++++---- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/RootHelper/main.m b/RootHelper/main.m index 66bbec4..61e0275 100644 --- a/RootHelper/main.m +++ b/RootHelper/main.m @@ -478,11 +478,11 @@ int signApp(NSString* appPath) #else int signAdhoc(NSString *filePath, NSDictionary *entitlements) { - //if (@available(iOS 15, *)) { - // return codesign_sign_adhoc(filePath.fileSystemRepresentation, true, entitlements); - //} + if (@available(iOS 16, *)) { + return codesign_sign_adhoc(filePath.fileSystemRepresentation, true, entitlements); + } // If iOS 14 is so great, how come there is no iOS 14 2????? - //else { + else { if(!isLdidInstalled()) return 173; NSString *entitlementsPath = nil; @@ -519,7 +519,7 @@ int signAdhoc(NSString *filePath, NSDictionary *entitlements) { return 175; } - //} + } } int signApp(NSString* appPath) @@ -1051,7 +1051,7 @@ int installTrollStore(NSString* pathToTar) NSString* tmpTrollStorePath = [tmpPayloadPath stringByAppendingPathComponent:@"TrollStore.app"]; if(![[NSFileManager defaultManager] fileExistsAtPath:tmpTrollStorePath]) return 1; - //if (@available(iOS 15, *)) {} else { + if (@available(iOS 16, *)) {} else { // Transfer existing ldid installation if it exists // But only if the to-be-installed version of TrollStore is 1.5.0 or above // This is to make it possible to downgrade to older versions still @@ -1084,7 +1084,7 @@ int installTrollStore(NSString* pathToTar) } } } - //} + } // Merge existing URL scheme settings value if(!getTSURLSchemeState(nil)) @@ -1367,12 +1367,12 @@ int MAIN_NAME(int argc, char *argv[], char *envp[]) } else if([cmd isEqualToString:@"install-ldid"]) { - //if (@available(iOS 15, *)) {} else { + if (@available(iOS 16, *)) {} else { if(args.count < 3) return -3; NSString* ldidPath = args[1]; NSString* ldidVersion = args[2]; installLdid(ldidPath, ldidVersion); - //} + } } else if([cmd isEqualToString:@"refresh"]) { diff --git a/TrollStore/TSApplicationsManager.m b/TrollStore/TSApplicationsManager.m index dbe8934..5050756 100644 --- a/TrollStore/TSApplicationsManager.m +++ b/TrollStore/TSApplicationsManager.m @@ -54,12 +54,12 @@ extern NSUserDefaults* trollStoreUserDefaults(); errorDescription = @"The app's main executable does not exist."; break; case 175: { - //if (@available(iOS 15, *)) { - // errorDescription = @"Failed to sign the app."; - //} - //else { + if (@available(iOS 16, *)) { + errorDescription = @"Failed to sign the app."; + } + else { errorDescription = @"Failed to sign the app. ldid returned a non zero status code."; - //} + } } break; case 176: diff --git a/TrollStore/TSSceneDelegate.m b/TrollStore/TSSceneDelegate.m index a3cd8ac..102d499 100644 --- a/TrollStore/TSSceneDelegate.m +++ b/TrollStore/TSSceneDelegate.m @@ -76,7 +76,7 @@ // or if it's the one from an old TrollStore version that's no longer supported - (void)handleLdidCheck { - //if (@available(iOS 15, *)) {} else { + if (@available(iOS 16, *)) {} else { NSString* tsAppPath = [NSBundle mainBundle].bundlePath; NSString* ldidPath = [tsAppPath stringByAppendingPathComponent:@"ldid"]; @@ -86,7 +86,7 @@ { [TSInstallationController installLdid]; } - //} + } } - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions { diff --git a/TrollStore/TSSettingsListController.m b/TrollStore/TSSettingsListController.m index 2c65f43..8618610 100644 --- a/TrollStore/TSSettingsListController.m +++ b/TrollStore/TSSettingsListController.m @@ -34,7 +34,7 @@ extern NSUserDefaults* trollStoreUserDefaults(void); } }); - //if (@available(iOS 15, *)) {} else { + if (@available(iOS 16, *)) {} else { fetchLatestLdidVersion(^(NSString* latestVersion) { NSString* ldidVersionPath = [NSBundle.mainBundle.bundlePath stringByAppendingPathComponent:@"ldid.version"]; @@ -54,7 +54,7 @@ extern NSUserDefaults* trollStoreUserDefaults(void); }); } }); - //} + } } - (NSMutableArray*)specifiers @@ -113,7 +113,7 @@ extern NSUserDefaults* trollStoreUserDefaults(void); [_specifiers addObject:rebuildIconCacheSpecifier]; - //if (@available(iOS 15, *)) { } else { + if (@available(iOS 16, *)) { } else { NSString* ldidPath = [NSBundle.mainBundle.bundlePath stringByAppendingPathComponent:@"ldid"]; NSString* ldidVersionPath = [NSBundle.mainBundle.bundlePath stringByAppendingPathComponent:@"ldid.version"]; BOOL ldidInstalled = [[NSFileManager defaultManager] fileExistsAtPath:ldidPath]; @@ -188,7 +188,7 @@ extern NSUserDefaults* trollStoreUserDefaults(void); installLdidSpecifier.buttonAction = @selector(installOrUpdateLdidPressed); [_specifiers addObject:installLdidSpecifier]; } - //} + } PSSpecifier* persistenceGroupSpecifier = [PSSpecifier emptyGroupSpecifier]; persistenceGroupSpecifier.name = @"Persistence";