From: Jay Freeman (saurik) Date: Sun, 14 Sep 2008 22:47:28 +0000 (+0000) Subject: Finalized 2.1 Cydia. X-Git-Url: https://git.saurik.com/apt-legacy.git/commitdiff_plain/4db9327121d7ec181af05bd587175a77ce255e4e?ds=sidebyside Finalized 2.1 Cydia. M cfnetwork.diff git-svn-id: http://svn.telesphoreo.org/trunk@475 514c082c-b64e-11dc-b46d-3d985efe055d --- diff --git a/methods/http.cc b/methods/http.cc index b512c5c..aa6f516 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -50,6 +50,7 @@ extern "C" { #include #include +#include #include #include #include @@ -63,7 +64,7 @@ using namespace std; CFStringRef Firmware_; const char *Machine_; -const char *SerialNumber_; +CFStringRef UniqueID_; void CfrsError(const char *name, CFReadStreamRef rs) { CFStreamError se = CFReadStreamGetError(rs); @@ -1163,9 +1164,8 @@ int HttpMethod::Loop() CFHTTPMessageSetHeaderFieldValue(hm, CFSTR("X-Machine"), sr); CFRelease(sr); - sr = CFStringCreateWithCString(kCFAllocatorDefault, SerialNumber_, se); - CFHTTPMessageSetHeaderFieldValue(hm, CFSTR("X-Serial-Number"), sr); - CFRelease(sr); + if (UniqueID_ != NULL) + CFHTTPMessageSetHeaderFieldValue(hm, CFSTR("X-Unique-ID"), UniqueID_); CFHTTPMessageSetHeaderFieldValue(hm, CFSTR("User-Agent"), CFSTR("Telesphoreo APT-HTTP/1.0.98")); @@ -1413,15 +1413,10 @@ int main() CFRelease(plist); } - if (CFMutableDictionaryRef dict = IOServiceMatching("IOPlatformExpertDevice")) - if (io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, dict)) { - if (CFTypeRef serial = IORegistryEntryCreateCFProperty(service, CFSTR(kIOPlatformSerialNumberKey), kCFAllocatorDefault, 0)) { - SerialNumber_ = strdup(CFStringGetCStringPtr((CFStringRef) serial, CFStringGetSystemEncoding())); - CFRelease(serial); - } - - IOObjectRelease(service); - } + if (void *lockdown = lockdown_connect()) { + UniqueID_ = lockdown_copy_value(lockdown, NULL, kLockdownUniqueDeviceIDKey); + lockdown_disconnect(lockdown); + } return Mth.Loop(); } diff --git a/methods/http.cc.orig b/methods/http.cc.orig index 75930ca..e56ec17 100644 --- a/methods/http.cc.orig +++ b/methods/http.cc.orig @@ -46,6 +46,7 @@ #include #include +#include #include #include #include @@ -59,7 +60,7 @@ using namespace std; CFStringRef Firmware_; const char *Machine_; -const char *SerialNumber_; +CFStringRef UniqueID_; void CfrsError(const char *name, CFReadStreamRef rs) { CFStreamError se = CFReadStreamGetError(rs); @@ -1159,9 +1160,8 @@ int HttpMethod::Loop() CFHTTPMessageSetHeaderFieldValue(hm, CFSTR("X-Machine"), sr); CFRelease(sr); - sr = CFStringCreateWithCString(kCFAllocatorDefault, SerialNumber_, se); - CFHTTPMessageSetHeaderFieldValue(hm, CFSTR("X-Serial-Number"), sr); - CFRelease(sr); + if (UniqueID_ != NULL) + CFHTTPMessageSetHeaderFieldValue(hm, CFSTR("X-Unique-ID"), UniqueID_); CFHTTPMessageSetHeaderFieldValue(hm, CFSTR("User-Agent"), CFSTR("Telesphoreo APT-HTTP/1.0.98")); @@ -1400,15 +1400,10 @@ int main() CFRelease(plist); } - if (CFMutableDictionaryRef dict = IOServiceMatching("IOPlatformExpertDevice")) - if (io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, dict)) { - if (CFTypeRef serial = IORegistryEntryCreateCFProperty(service, CFSTR(kIOPlatformSerialNumberKey), kCFAllocatorDefault, 0)) { - SerialNumber_ = strdup(CFStringGetCStringPtr((CFStringRef) serial, CFStringGetSystemEncoding())); - CFRelease(serial); - } - - IOObjectRelease(service); - } + if (void *lockdown = lockdown_connect()) { + UniqueID_ = lockdown_copy_value(lockdown, NULL, kLockdownUniqueDeviceIDKey); + lockdown_disconnect(lockdown); + } return Mth.Loop(); } diff --git a/methods/makefile b/methods/makefile index 4d02404..4ca3cf8 100644 --- a/methods/makefile +++ b/methods/makefile @@ -47,7 +47,7 @@ include $(PROGRAM_H) # The http method PROGRAM=http -SLIBS = -lapt-pkg $(SOCKETLIBS) -framework CoreFoundation -framework CFNetwork -framework SystemConfiguration -framework IOKit +SLIBS = -lapt-pkg $(SOCKETLIBS) -framework CoreFoundation -framework CFNetwork -framework SystemConfiguration -framework IOKit -llockdown LIB_MAKES = apt-pkg/makefile SOURCE = http.cc rfc2553emu.cc connect.cc include $(PROGRAM_H)