summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lockdown.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lockdown.c b/src/lockdown.c
index 1edb99b..32389c9 100644
--- a/src/lockdown.c
+++ b/src/lockdown.c
@@ -643,16 +643,19 @@ lockdownd_error_t lockdownd_client_new(idevice_t device, lockdownd_client_t *cli
643 643
644 client_loc->label = label ? strdup(label) : NULL; 644 client_loc->label = label ? strdup(label) : NULL;
645 645
646 int is_lockdownd = 0;
646 if (lockdownd_query_type(client_loc, &type) != LOCKDOWN_E_SUCCESS) { 647 if (lockdownd_query_type(client_loc, &type) != LOCKDOWN_E_SUCCESS) {
647 debug_info("QueryType failed in the lockdownd client."); 648 debug_info("QueryType failed in the lockdownd client.");
648 } else if (strcmp("com.apple.mobile.lockdown", type) != 0) { 649 } else if (!strcmp("com.apple.mobile.lockdown", type)) {
649 debug_info("Warning QueryType request returned \"%s\".", type); 650 is_lockdownd = 1;
651 } else {
652 debug_info("QueryType request returned \"%s\"", type);
650 } 653 }
651 free(type); 654 free(type);
652 655
653 *client = client_loc; 656 *client = client_loc;
654 657
655 if (device->version == 0) { 658 if (is_lockdownd && device->version == 0) {
656 plist_t p_version = NULL; 659 plist_t p_version = NULL;
657 if (lockdownd_get_value(client_loc, NULL, "ProductVersion", &p_version) == LOCKDOWN_E_SUCCESS) { 660 if (lockdownd_get_value(client_loc, NULL, "ProductVersion", &p_version) == LOCKDOWN_E_SUCCESS) {
658 int vers[3] = {0, 0, 0}; 661 int vers[3] = {0, 0, 0};
@@ -665,7 +668,7 @@ lockdownd_error_t lockdownd_client_new(idevice_t device, lockdownd_client_t *cli
665 } 668 }
666 plist_free(p_version); 669 plist_free(p_version);
667 } 670 }
668 if (device->device_class == 0) { 671 if (is_lockdownd && device->device_class == 0) {
669 plist_t p_device_class = NULL; 672 plist_t p_device_class = NULL;
670 if (lockdownd_get_value(client_loc, NULL, "DeviceClass", &p_device_class) == LOCKDOWN_E_SUCCESS) { 673 if (lockdownd_get_value(client_loc, NULL, "DeviceClass", &p_device_class) == LOCKDOWN_E_SUCCESS) {
671 char* s_device_class = NULL; 674 char* s_device_class = NULL;