diff options
-rw-r--r-- | src/idevice.c | 1 | ||||
-rw-r--r-- | src/idevice.h | 8 | ||||
-rw-r--r-- | src/lockdown.c | 26 |
3 files changed, 34 insertions, 1 deletions
diff --git a/src/idevice.c b/src/idevice.c index 08a8b31..9d20709 100644 --- a/src/idevice.c +++ b/src/idevice.c @@ -363,6 +363,7 @@ static idevice_t idevice_from_mux_device(usbmuxd_device_info_t *muxdev) device->udid = strdup(muxdev->udid); device->mux_id = muxdev->handle; device->version = 0; + device->device_class = 0; switch (muxdev->conn_type) { case CONNECTION_TYPE_USB: device->conn_type = CONNECTION_USBMUXD; diff --git a/src/idevice.h b/src/idevice.h index 7a8f4ce..2509e48 100644 --- a/src/idevice.h +++ b/src/idevice.h @@ -52,6 +52,13 @@ #define DEVICE_VERSION(maj, min, patch) (((maj & 0xFF) << 16) | ((min & 0xFF) << 8) | (patch & 0xFF)) +#define DEVICE_CLASS_IPHONE 1 +#define DEVICE_CLASS_IPAD 2 +#define DEVICE_CLASS_IPOD 3 +#define DEVICE_CLASS_APPLETV 4 +#define DEVICE_CLASS_WATCH 5 +#define DEVICE_CLASS_UNKNOWN 255 + struct ssl_data_private { #if defined(HAVE_OPENSSL) SSL *session; @@ -89,6 +96,7 @@ struct idevice_private { enum idevice_connection_type conn_type; void *conn_data; int version; + int device_class; }; #endif diff --git a/src/lockdown.c b/src/lockdown.c index 159f741..2cacc71 100644 --- a/src/lockdown.c +++ b/src/lockdown.c @@ -696,6 +696,30 @@ LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_client_new_with_handshake(idevi } plist_free(p_version); } + if (device->device_class == 0) { + plist_t p_device_class = NULL; + if (lockdownd_get_value(client_loc, NULL, "DeviceClass", &p_device_class) == LOCKDOWN_E_SUCCESS) { + char* s_device_class = NULL; + plist_get_string_val(p_device_class, &s_device_class); + if (s_device_class != NULL) { + if (!strcmp(s_device_class, "iPhone")) { + device->device_class = DEVICE_CLASS_IPHONE; + } else if (!strcmp(s_device_class, "iPad")) { + device->device_class = DEVICE_CLASS_IPAD; + } else if (!strcmp(s_device_class, "iPod")) { + device->device_class = DEVICE_CLASS_IPOD; + } else if (!strcmp(s_device_class, "Watch")) { + device->device_class = DEVICE_CLASS_WATCH; + } else if (!strcmp(s_device_class, "AppleTV")) { + device->device_class = DEVICE_CLASS_APPLETV; + } else { + device->device_class = DEVICE_CLASS_UNKNOWN; + } + free(s_device_class); + } + } + plist_free(p_device_class); + } userpref_error_t uerr = userpref_read_pair_record(client_loc->udid, &pair_record); if (uerr == USERPREF_E_READ_ERROR) { @@ -720,7 +744,7 @@ LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_client_new_with_handshake(idevi plist_free(pair_record); pair_record = NULL; - if (device->version < DEVICE_VERSION(7,0,0)) { + if (device->version < DEVICE_VERSION(7,0,0) && device->device_class != DEVICE_CLASS_WATCH) { /* for older devices, we need to validate pairing to receive trusted host status */ ret = lockdownd_validate_pair(client_loc, NULL); |