diff options
Diffstat (limited to 'src/lockdown.c')
| -rw-r--r-- | src/lockdown.c | 18 |
1 files changed, 16 insertions, 2 deletions
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 | } |
