summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2013-09-19 20:25:30 +0200
committerGravatar Martin Szulecki2013-09-19 20:25:30 +0200
commit5d044b6fd0f2b5fe2a0cee1b0d22efe3f61f32a4 (patch)
treebaa6115e69c32ed4d36490736eea30663d71c39a
parentb811fbb05b1a466a96c6987f299f3b4e09bfb7eb (diff)
downloadlibimobiledevice-5d044b6fd0f2b5fe2a0cee1b0d22efe3f61f32a4.tar.gz
libimobiledevice-5d044b6fd0f2b5fe2a0cee1b0d22efe3f61f32a4.tar.bz2
lockdown: Remove pairing code which is obsoleted by usbmuxd's preflight handler
-rw-r--r--src/lockdown.c53
1 files changed, 0 insertions, 53 deletions
diff --git a/src/lockdown.c b/src/lockdown.c
index a6f0318..f616d25 100644
--- a/src/lockdown.c
+++ b/src/lockdown.c
@@ -700,29 +700,6 @@ lockdownd_error_t lockdownd_client_new(idevice_t device, lockdownd_client_t *cli
700 return LOCKDOWN_E_SUCCESS; 700 return LOCKDOWN_E_SUCCESS;
701} 701}
702 702
703static lockdownd_error_t lockdownd_client_reconnect(idevice_t device, lockdownd_client_t *client, const char *label)
704{
705 lockdownd_error_t ret = LOCKDOWN_E_SUCCESS;
706 int attempts = 3;
707
708 /* free resources of lockownd_client */
709 ret = lockdownd_client_free_simple(*client);
710 *client = NULL;
711
712 /* try to reconnect */
713 do {
714 debug_info("reconnecting to udid %s, %d remaining attempts", device->udid, attempts);
715 ret = lockdownd_client_new(device, client, label);
716 if (ret == LOCKDOWN_E_SUCCESS) {
717 debug_info("reconnected to lockdownd with err %d", ret);
718 break;
719 }
720 sleep(1);
721 } while(attempts--);
722
723 return ret;
724}
725
726/** 703/**
727 * Creates a new lockdownd client for the device and starts initial handshake. 704 * Creates a new lockdownd client for the device and starts initial handshake.
728 * The handshake consists out of query_type, validate_pair, pair and 705 * The handshake consists out of query_type, validate_pair, pair and
@@ -747,10 +724,8 @@ lockdownd_error_t lockdownd_client_new_with_handshake(idevice_t device, lockdown
747 724
748 lockdownd_error_t ret = LOCKDOWN_E_SUCCESS; 725 lockdownd_error_t ret = LOCKDOWN_E_SUCCESS;
749 lockdownd_client_t client_loc = NULL; 726 lockdownd_client_t client_loc = NULL;
750 char *system_buid = NULL;
751 char *host_id = NULL; 727 char *host_id = NULL;
752 char *type = NULL; 728 char *type = NULL;
753 int product_version_major = 0;
754 729
755 ret = lockdownd_client_new(device, &client_loc, label); 730 ret = lockdownd_client_new(device, &client_loc, label);
756 if (LOCKDOWN_E_SUCCESS != ret) { 731 if (LOCKDOWN_E_SUCCESS != ret) {
@@ -770,24 +745,6 @@ lockdownd_error_t lockdownd_client_new_with_handshake(idevice_t device, lockdown
770 free(type); 745 free(type);
771 } 746 }
772 747
773 /* get product version */
774 plist_t product_version_node = NULL;
775 char* product_version = NULL;
776 lockdownd_get_value(client_loc, NULL, "ProductVersion", &product_version_node);
777 if (product_version_node && plist_get_node_type(product_version_node) == PLIST_STRING) {
778 plist_get_string_val(product_version_node, &product_version);
779 product_version_major = strtol(product_version, NULL, 10);
780 }
781
782 if (product_version_major >= 7) {
783 userpref_get_system_buid(&system_buid);
784
785 /* set our BUID for the trust dialog so the next pairing can succeed */
786 lockdownd_set_value(client_loc, NULL, "UntrustedHostBUID", plist_new_string(system_buid));
787 free(system_buid);
788 system_buid = NULL;
789 }
790
791 userpref_device_record_get_host_id(client_loc->udid, &host_id); 748 userpref_device_record_get_host_id(client_loc->udid, &host_id);
792 if (LOCKDOWN_E_SUCCESS == ret && !host_id) { 749 if (LOCKDOWN_E_SUCCESS == ret && !host_id) {
793 ret = LOCKDOWN_E_INVALID_CONF; 750 ret = LOCKDOWN_E_INVALID_CONF;
@@ -796,11 +753,6 @@ lockdownd_error_t lockdownd_client_new_with_handshake(idevice_t device, lockdown
796 if (LOCKDOWN_E_SUCCESS == ret && !userpref_has_device_record(client_loc->udid)) { 753 if (LOCKDOWN_E_SUCCESS == ret && !userpref_has_device_record(client_loc->udid)) {
797 /* attempt pairing */ 754 /* attempt pairing */
798 ret = lockdownd_pair(client_loc, NULL); 755 ret = lockdownd_pair(client_loc, NULL);
799
800 if (ret == LOCKDOWN_E_SUCCESS && product_version_major >= 7) {
801 /* the trust dialog was dissmissed, thus the device will reconnect after pairing */
802 lockdownd_client_reconnect(device, &client_loc, label);
803 }
804 } 756 }
805 757
806 /* in any case, we need to validate pairing to receive trusted host status */ 758 /* in any case, we need to validate pairing to receive trusted host status */
@@ -810,11 +762,6 @@ lockdownd_error_t lockdownd_client_new_with_handshake(idevice_t device, lockdown
810 if (LOCKDOWN_E_INVALID_HOST_ID == ret) { 762 if (LOCKDOWN_E_INVALID_HOST_ID == ret) {
811 ret = lockdownd_pair(client_loc, NULL); 763 ret = lockdownd_pair(client_loc, NULL);
812 764
813 if (ret == LOCKDOWN_E_SUCCESS && product_version_major >= 7) {
814 /* the trust dialog was dissmissed, thus the device will reconnect after pairing */
815 lockdownd_client_reconnect(device, &client_loc, label);
816 }
817
818 if (LOCKDOWN_E_SUCCESS == ret) { 765 if (LOCKDOWN_E_SUCCESS == ret) {
819 ret = lockdownd_validate_pair(client_loc, NULL); 766 ret = lockdownd_validate_pair(client_loc, NULL);
820 } else if (LOCKDOWN_E_PAIRING_DIALOG_PENDING == ret) { 767 } else if (LOCKDOWN_E_PAIRING_DIALOG_PENDING == ret) {