summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/idevice.c1
-rw-r--r--src/idevice.h8
-rw-r--r--src/lockdown.c26
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)
363 device->udid = strdup(muxdev->udid); 363 device->udid = strdup(muxdev->udid);
364 device->mux_id = muxdev->handle; 364 device->mux_id = muxdev->handle;
365 device->version = 0; 365 device->version = 0;
366 device->device_class = 0;
366 switch (muxdev->conn_type) { 367 switch (muxdev->conn_type) {
367 case CONNECTION_TYPE_USB: 368 case CONNECTION_TYPE_USB:
368 device->conn_type = CONNECTION_USBMUXD; 369 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 @@
52 52
53#define DEVICE_VERSION(maj, min, patch) (((maj & 0xFF) << 16) | ((min & 0xFF) << 8) | (patch & 0xFF)) 53#define DEVICE_VERSION(maj, min, patch) (((maj & 0xFF) << 16) | ((min & 0xFF) << 8) | (patch & 0xFF))
54 54
55#define DEVICE_CLASS_IPHONE 1
56#define DEVICE_CLASS_IPAD 2
57#define DEVICE_CLASS_IPOD 3
58#define DEVICE_CLASS_APPLETV 4
59#define DEVICE_CLASS_WATCH 5
60#define DEVICE_CLASS_UNKNOWN 255
61
55struct ssl_data_private { 62struct ssl_data_private {
56#if defined(HAVE_OPENSSL) 63#if defined(HAVE_OPENSSL)
57 SSL *session; 64 SSL *session;
@@ -89,6 +96,7 @@ struct idevice_private {
89 enum idevice_connection_type conn_type; 96 enum idevice_connection_type conn_type;
90 void *conn_data; 97 void *conn_data;
91 int version; 98 int version;
99 int device_class;
92}; 100};
93 101
94#endif 102#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
696 } 696 }
697 plist_free(p_version); 697 plist_free(p_version);
698 } 698 }
699 if (device->device_class == 0) {
700 plist_t p_device_class = NULL;
701 if (lockdownd_get_value(client_loc, NULL, "DeviceClass", &p_device_class) == LOCKDOWN_E_SUCCESS) {
702 char* s_device_class = NULL;
703 plist_get_string_val(p_device_class, &s_device_class);
704 if (s_device_class != NULL) {
705 if (!strcmp(s_device_class, "iPhone")) {
706 device->device_class = DEVICE_CLASS_IPHONE;
707 } else if (!strcmp(s_device_class, "iPad")) {
708 device->device_class = DEVICE_CLASS_IPAD;
709 } else if (!strcmp(s_device_class, "iPod")) {
710 device->device_class = DEVICE_CLASS_IPOD;
711 } else if (!strcmp(s_device_class, "Watch")) {
712 device->device_class = DEVICE_CLASS_WATCH;
713 } else if (!strcmp(s_device_class, "AppleTV")) {
714 device->device_class = DEVICE_CLASS_APPLETV;
715 } else {
716 device->device_class = DEVICE_CLASS_UNKNOWN;
717 }
718 free(s_device_class);
719 }
720 }
721 plist_free(p_device_class);
722 }
699 723
700 userpref_error_t uerr = userpref_read_pair_record(client_loc->udid, &pair_record); 724 userpref_error_t uerr = userpref_read_pair_record(client_loc->udid, &pair_record);
701 if (uerr == USERPREF_E_READ_ERROR) { 725 if (uerr == USERPREF_E_READ_ERROR) {
@@ -720,7 +744,7 @@ LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_client_new_with_handshake(idevi
720 plist_free(pair_record); 744 plist_free(pair_record);
721 pair_record = NULL; 745 pair_record = NULL;
722 746
723 if (device->version < DEVICE_VERSION(7,0,0)) { 747 if (device->version < DEVICE_VERSION(7,0,0) && device->device_class != DEVICE_CLASS_WATCH) {
724 /* for older devices, we need to validate pairing to receive trusted host status */ 748 /* for older devices, we need to validate pairing to receive trusted host status */
725 ret = lockdownd_validate_pair(client_loc, NULL); 749 ret = lockdownd_validate_pair(client_loc, NULL);
726 750