summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/idevice.c1
-rw-r--r--src/idevice.h1
-rw-r--r--src/lockdown.c37
3 files changed, 27 insertions, 12 deletions
diff --git a/src/idevice.c b/src/idevice.c
index 21b10ba..ead9b86 100644
--- a/src/idevice.c
+++ b/src/idevice.c
@@ -256,6 +256,7 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_new(idevice_t * device, const char
dev->udid = strdup(muxdev.udid);
dev->conn_type = CONNECTION_USBMUXD;
dev->conn_data = (void*)(long)muxdev.handle;
+ dev->version = 0;
*device = dev;
return IDEVICE_E_SUCCESS;
}
diff --git a/src/idevice.h b/src/idevice.h
index 1354cc0..e46a7e5 100644
--- a/src/idevice.h
+++ b/src/idevice.h
@@ -76,6 +76,7 @@ struct idevice_private {
char *udid;
enum connection_type conn_type;
void *conn_data;
+ int version;
};
#endif
diff --git a/src/lockdown.c b/src/lockdown.c
index 5251737..071697d 100644
--- a/src/lockdown.c
+++ b/src/lockdown.c
@@ -707,6 +707,19 @@ LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_client_new_with_handshake(idevi
}
free(type);
+ if (device->version == 0) {
+ plist_t p_version = NULL;
+ if (lockdownd_get_value(client_loc, NULL, "ProductVersion", &p_version) == LOCKDOWN_E_SUCCESS) {
+ int vers[3] = {0, 0, 0};
+ char *s_version = NULL;
+ plist_get_string_val(p_version, &s_version);
+ if (s_version && sscanf(s_version, "%d.%d.%d", &vers[0], &vers[1], &vers[2]) >= 2) {
+ device->version = ((vers[0] & 0xFF) << 16) | ((vers[1] & 0xFF) << 8) | (vers[2] & 0xFF);
+ }
+ free(s_version);
+ }
+ }
+
userpref_read_pair_record(client_loc->udid, &pair_record);
if (pair_record) {
pair_record_get_host_id(pair_record, &host_id);
@@ -723,18 +736,18 @@ LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_client_new_with_handshake(idevi
plist_free(pair_record);
pair_record = NULL;
- /* in any case, we need to validate pairing to receive trusted host status */
- ret = lockdownd_validate_pair(client_loc, NULL);
-
- /* if not paired yet, let's do it now */
- if (LOCKDOWN_E_INVALID_HOST_ID == ret) {
- free(host_id);
- host_id = NULL;
- ret = lockdownd_pair(client_loc, NULL);
- if (LOCKDOWN_E_SUCCESS == ret) {
- ret = lockdownd_validate_pair(client_loc, NULL);
- } else if (LOCKDOWN_E_PAIRING_DIALOG_RESPONSE_PENDING == ret) {
- debug_info("Device shows the pairing dialog.");
+ if (device->version < 0x070000) {
+ /* for older devices, we need to validate pairing to receive trusted host status */
+ ret = lockdownd_validate_pair(client_loc, NULL);
+
+ /* if not paired yet, let's do it now */
+ if (LOCKDOWN_E_INVALID_HOST_ID == ret) {
+ free(host_id);
+ host_id = NULL;
+ ret = lockdownd_pair(client_loc, NULL);
+ if (LOCKDOWN_E_SUCCESS == ret) {
+ ret = lockdownd_validate_pair(client_loc, NULL);
+ }
}
}