summaryrefslogtreecommitdiffstats
path: root/src/lockdown.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lockdown.c')
-rw-r--r--src/lockdown.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/lockdown.c b/src/lockdown.c
index d91a066..ab49a6a 100644
--- a/src/lockdown.c
+++ b/src/lockdown.c
@@ -54,7 +54,8 @@ const ASN1_ARRAY_TYPE pkcs1_asn1_tab[] = {
54 * plist to a previously sent request. 54 * plist to a previously sent request.
55 * 55 *
56 * @param dict The plist to evaluate. 56 * @param dict The plist to evaluate.
57 * @param query_match Name of the request to match. 57 * @param query_match Name of the request to match or NULL if no match is
58 * required.
58 * 59 *
59 * @return RESULT_SUCCESS when the result is 'Success', 60 * @return RESULT_SUCCESS when the result is 'Success',
60 * RESULT_FAILURE when the result is 'Failure', 61 * RESULT_FAILURE when the result is 'Failure',
@@ -76,7 +77,7 @@ static int lockdown_check_result(plist_t dict, const char *query_match)
76 if (!query_value) { 77 if (!query_value) {
77 return ret; 78 return ret;
78 } 79 }
79 if (strcmp(query_value, query_match) != 0) { 80 if (query_match && (strcmp(query_value, query_match) != 0)) {
80 free(query_value); 81 free(query_value);
81 return ret; 82 return ret;
82 } 83 }
@@ -876,8 +877,16 @@ static lockdownd_error_t lockdownd_do_pair(lockdownd_client_t client, lockdownd_
876 if (ret != LOCKDOWN_E_SUCCESS) 877 if (ret != LOCKDOWN_E_SUCCESS)
877 return ret; 878 return ret;
878 879
879 if (lockdown_check_result(dict, verb) != RESULT_SUCCESS) { 880 if (strcmp(verb, "Unpair") == 0) {
880 ret = LOCKDOWN_E_PAIRING_FAILED; 881 /* workaround for Unpair giving back ValidatePair,
882 * seems to be a bug in the device's fw */
883 if (lockdown_check_result(dict, NULL) != RESULT_SUCCESS) {
884 ret = LOCKDOWN_E_PAIRING_FAILED;
885 }
886 } else {
887 if (lockdown_check_result(dict, verb) != RESULT_SUCCESS) {
888 ret = LOCKDOWN_E_PAIRING_FAILED;
889 }
881 } 890 }
882 891
883 /* if pairing succeeded */ 892 /* if pairing succeeded */