diff options
| author | 2010-01-25 23:36:24 +0100 | |
|---|---|---|
| committer | 2010-01-26 02:03:59 +0100 | |
| commit | 57c883b7fe84d513c836270f681a9bf5a907de3e (patch) | |
| tree | f5530ab58af30a3de437250520a602037c0cff90 | |
| parent | 762bf3d1589e2285945eb4eff1d79afbe0fc46c6 (diff) | |
| download | libimobiledevice-57c883b7fe84d513c836270f681a9bf5a907de3e.tar.gz libimobiledevice-57c883b7fe84d513c836270f681a9bf5a907de3e.tar.bz2 | |
Auto-pair devices within lockdownd_client_new_with_handshake()
This brings back the automatic pairing feature if not yet paired.
| -rw-r--r-- | src/lockdown.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/lockdown.c b/src/lockdown.c index 792dd33..108b558 100644 --- a/src/lockdown.c +++ b/src/lockdown.c | |||
| @@ -661,6 +661,14 @@ lockdownd_error_t lockdownd_client_new_with_handshake(iphone_device_t device, lo | |||
| 661 | /* in any case, we need to validate pairing to receive trusted host status */ | 661 | /* in any case, we need to validate pairing to receive trusted host status */ |
| 662 | ret = lockdownd_validate_pair(client_loc, NULL); | 662 | ret = lockdownd_validate_pair(client_loc, NULL); |
| 663 | 663 | ||
| 664 | /* if not paired yet, let's do it now */ | ||
| 665 | if (LOCKDOWN_E_INVALID_HOST_ID == ret) { | ||
| 666 | ret = lockdownd_pair(client_loc, NULL); | ||
| 667 | if (LOCKDOWN_E_SUCCESS == ret) { | ||
| 668 | ret = lockdownd_validate_pair(client_loc, NULL); | ||
| 669 | } | ||
| 670 | } | ||
| 671 | |||
| 664 | if (LOCKDOWN_E_SUCCESS == ret) { | 672 | if (LOCKDOWN_E_SUCCESS == ret) { |
| 665 | ret = lockdownd_start_session(client_loc, host_id, NULL, NULL); | 673 | ret = lockdownd_start_session(client_loc, host_id, NULL, NULL); |
| 666 | if (LOCKDOWN_E_SUCCESS != ret) { | 674 | if (LOCKDOWN_E_SUCCESS != ret) { |
| @@ -825,11 +833,16 @@ static lockdownd_error_t lockdownd_do_pair(lockdownd_client_t client, lockdownd_ | |||
| 825 | if (error_node) { | 833 | if (error_node) { |
| 826 | char *value = NULL; | 834 | char *value = NULL; |
| 827 | plist_get_string_val(error_node, &value); | 835 | plist_get_string_val(error_node, &value); |
| 828 | /* the first pairing fails if the device is password protected */ | 836 | if (value) { |
| 829 | if (value && !strcmp(value, "PasswordProtected")) { | 837 | /* the first pairing fails if the device is password protected */ |
| 830 | ret = LOCKDOWN_E_PASSWORD_PROTECTED; | 838 | if (!strcmp(value, "PasswordProtected")) { |
| 839 | ret = LOCKDOWN_E_PASSWORD_PROTECTED; | ||
| 840 | } else if (!strcmp(value, "InvalidHostID")) { | ||
| 841 | ret = LOCKDOWN_E_INVALID_HOST_ID; | ||
| 842 | } | ||
| 831 | free(value); | 843 | free(value); |
| 832 | } | 844 | } |
| 845 | |||
| 833 | plist_free(error_node); | 846 | plist_free(error_node); |
| 834 | error_node = NULL; | 847 | error_node = NULL; |
| 835 | } | 848 | } |
