--- /dev/null
+/* AFC2 - the original definition of "jailbreak"
+ * Copyright (C) 2014 Jay Freeman (saurik)
+*/
+
+/* GNU General Public License, Version 3 {{{ */
+/*
+ * Cydia is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * Cydia is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Cydia. If not, see <http://www.gnu.org/licenses/>.
+**/
+/* }}} */
+
+#include <CydiaSubstrate/CydiaSubstrate.h>
+#include <CoreFoundation/CoreFoundation.h>
+#include <Foundation/Foundation.h>
+
+%hook CFPropertyListRef CFPropertyListCreateWithData(CFAllocatorRef allocator, CFDataRef data, CFOptionFlags options, CFPropertyListFormat *format, CFErrorRef *error) {
+ CFPropertyListRef list(%original(allocator, data, options, format, error));
+ NSDictionary *dict((NSDictionary *) list);
+
+ if ([dict objectForKey:@"com.apple.afc"] != nil) {
+ NSMutableDictionary *copy([dict mutableCopy]);
+ CFRelease(list);
+ list = (CFPropertyListRef) copy;
+
+ [copy setObject:@{
+ @"AllowUnactivatedService": @true,
+ @"Label": @"com.apple.afc2",
+ @"ProgramArguments": @[@"/usr/libexec/afc2d", @"-S", @"-L", @"-d", @"/"],
+ } forKey:@"com.apple.afc2"];
+ }
+
+ return list;
+}
+
+MSInitialize {
+ MSHookFunction(&CFPropertyListCreateWithData, MSHake(CFPropertyListCreateWithData));
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>Filter</key>
+ <dict>
+ <key>CoreFoundationVersion</key>
+ <array>
+ <real>1000</real>
+ </array>
+ <key>Executables</key>
+ <array>
+ <string>lockdownd</string>
+ </array>
+ </dict>
+</dict>
+</plist>
Architecture: iphoneos-arm
Version: ${ver}
Pre-Depends: dpkg (>= 1.14.25-8)
+Depends: firmware (<< 8.0) | mobilesubstrate
Conflicts: us.scw.afctwoadd, net.angelxwind.afc2ios70, afc2.25pp, afc2.25pp7, afc2.91, app.taig.afc2
Replaces: us.scw.afctwoadd, net.angelxwind.afc2ios70, afc2.25pp, afc2.25pp7, afc2.91, app.taig.afc2
Provides: us.scw.afctwoadd, net.angelxwind.afc2ios70, afc2.25pp, afc2.25pp7, afc2.91, app.taig.afc2
return 1;
}
- NSString *path(@"/System/Library/Lockdown/Services.plist");
- NSMutableDictionary *services([NSMutableDictionary dictionaryWithContentsOfFile:path]);
+ if (kCFCoreFoundationVersionNumber < 1000) {
+ NSString *path(@"/System/Library/Lockdown/Services.plist");
- [services setObject:@{
- @"AllowUnactivatedService": @true,
- @"Label": @"com.apple.afc2",
- @"ProgramArguments": @[@"/usr/libexec/afc2d", @"-S", @"-L", @"-d", @"/"],
- } forKey:@"com.apple.afc2"];
+ NSMutableDictionary *services([NSMutableDictionary dictionaryWithContentsOfFile:path]);
+ if (services == nil) {
+ fprintf(stderr, "cannot read Services.plist\n");
+ return 1;
+ }
+
+ [services setObject:@{
+ @"AllowUnactivatedService": @true,
+ @"Label": @"com.apple.afc2",
+ @"ProgramArguments": @[@"/usr/libexec/afc2d", @"-S", @"-L", @"-d", @"/"],
+ } forKey:@"com.apple.afc2"];
+
+ if (![services writeToFile:path atomically:YES]) {
+ fprintf(stderr, "cannot write Services.plist\n");
+ return 1;
+ }
+ }
- [services writeToFile:path atomically:YES];
system("/bin/launchctl stop com.apple.mobile.lockdown");
[pool release];
-
return 0;
}
ver=$(git describe --tags --dirty="+" --match="v*" "${flags[@]}" | sed -e 's@-\([^-]*\)-\([^-]*\)$@+\1.\2@;s@^v@@;s@%@~@g')
sudo rm -rf _
mkdir -p _/DEBIAN
+ms=_/Library/MobileSubstrate/DynamicLibraries
+mkdir -p "${ms}"
+cp -a afc2dService.plist "${ms}"
+plutil -convert binary1 "${ms}"/afc2dService.plist
+cycc -i2.0 -o"${ms}"/afc2dService.dylib -s afc2dService.mm -- -framework Foundation
cycc -i2.0 -o_/DEBIAN/extrainst_ -- extrainst.mm -lz -framework Foundation
cycc -i2.0 -o_/DEBIAN/postrm -- postrm.mm -lz -framework Foundation
sed -e 's/\${ver}/'"${ver}"'/' control.in >_/DEBIAN/control