diff options
| -rw-r--r-- | include/libiphone/lockdown.h | 1 | ||||
| -rw-r--r-- | src/lockdown.c | 18 |
2 files changed, 17 insertions, 2 deletions
diff --git a/include/libiphone/lockdown.h b/include/libiphone/lockdown.h index f076cf2..459fbbd 100644 --- a/include/libiphone/lockdown.h +++ b/include/libiphone/lockdown.h | |||
| @@ -45,6 +45,7 @@ extern "C" { | |||
| 45 | #define LOCKDOWN_E_REMOVE_VALUE_PROHIBITED -11 | 45 | #define LOCKDOWN_E_REMOVE_VALUE_PROHIBITED -11 |
| 46 | #define LOCKDOWN_E_MUX_ERROR -12 | 46 | #define LOCKDOWN_E_MUX_ERROR -12 |
| 47 | #define LOCKDOWN_E_ACTIVATION_FAILED -13 | 47 | #define LOCKDOWN_E_ACTIVATION_FAILED -13 |
| 48 | #define LOCKDOWN_E_PASSWORD_PROTECTED -14 | ||
| 48 | 49 | ||
| 49 | #define LOCKDOWN_E_UNKNOWN_ERROR -256 | 50 | #define LOCKDOWN_E_UNKNOWN_ERROR -256 |
| 50 | 51 | ||
diff --git a/src/lockdown.c b/src/lockdown.c index 6ddd7c0..1b33830 100644 --- a/src/lockdown.c +++ b/src/lockdown.c | |||
| @@ -810,8 +810,6 @@ static lockdownd_error_t lockdownd_do_pair(lockdownd_client_t client, char *host | |||
| 810 | if (lockdown_check_result(dict, verb) != RESULT_SUCCESS) { | 810 | if (lockdown_check_result(dict, verb) != RESULT_SUCCESS) { |
| 811 | ret = LOCKDOWN_E_PAIRING_FAILED; | 811 | ret = LOCKDOWN_E_PAIRING_FAILED; |
| 812 | } | 812 | } |
| 813 | plist_free(dict); | ||
| 814 | dict = NULL; | ||
| 815 | 813 | ||
| 816 | /* if pairing succeeded */ | 814 | /* if pairing succeeded */ |
| 817 | if (ret == LOCKDOWN_E_SUCCESS) { | 815 | if (ret == LOCKDOWN_E_SUCCESS) { |
| @@ -825,7 +823,23 @@ static lockdownd_error_t lockdownd_do_pair(lockdownd_client_t client, char *host | |||
| 825 | } | 823 | } |
| 826 | } else { | 824 | } else { |
| 827 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: %s failure\n", __func__, verb); | 825 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: %s failure\n", __func__, verb); |
| 826 | plist_t error_node = NULL; | ||
| 827 | /* verify error condition */ | ||
| 828 | error_node = plist_dict_get_item(dict, "Error"); | ||
| 829 | if (error_node) { | ||
| 830 | char *value = NULL; | ||
| 831 | plist_get_string_val(error_node, &value); | ||
| 832 | /* the first pairing fails if the device is password protected */ | ||
| 833 | if (value && !strcmp(value, "PasswordProtected")) { | ||
| 834 | ret = LOCKDOWN_E_PASSWORD_PROTECTED; | ||
| 835 | free(value); | ||
| 836 | } | ||
| 837 | plist_free(error_node); | ||
| 838 | error_node = NULL; | ||
| 839 | } | ||
| 828 | } | 840 | } |
| 841 | plist_free(dict); | ||
| 842 | dict = NULL; | ||
| 829 | free(public_key.data); | 843 | free(public_key.data); |
| 830 | return ret; | 844 | return ret; |
| 831 | } | 845 | } |
