#include <netdb.h>
#include <arpa/inet.h>
+#include <lockdown.h>
#include <CoreFoundation/CoreFoundation.h>
#include <CoreServices/CoreServices.h>
#include <SystemConfiguration/SystemConfiguration.h>
CFStringRef Firmware_;
const char *Machine_;
-const char *SerialNumber_;
+CFStringRef UniqueID_;
void CfrsError(const char *name, CFReadStreamRef rs) {
CFStreamError se = CFReadStreamGetError(rs);
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"));
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();
}
#include <netdb.h>
#include <arpa/inet.h>
+#include <lockdown.h>
#include <CoreFoundation/CoreFoundation.h>
#include <CoreServices/CoreServices.h>
#include <SystemConfiguration/SystemConfiguration.h>
CFStringRef Firmware_;
const char *Machine_;
-const char *SerialNumber_;
+CFStringRef UniqueID_;
void CfrsError(const char *name, CFReadStreamRef rs) {
CFStreamError se = CFReadStreamGetError(rs);
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"));
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();
}
# 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)