summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2010-05-28 17:48:20 +0200
committerGravatar Martin Szulecki2010-06-06 16:21:46 +0200
commitd546183bcb1ddb44903f061be1bc3bf3343e83e8 (patch)
tree850fbd858082d83c26b72d4d23141acc652481a0
parentccde701fe43f738b62f31a02c611ef7bfa057285 (diff)
downloadlibimobiledevice-d546183bcb1ddb44903f061be1bc3bf3343e83e8.tar.gz
libimobiledevice-d546183bcb1ddb44903f061be1bc3bf3343e83e8.tar.bz2
Add special handling for unpair request; probably a bug in the iPhone OS
-rw-r--r--src/lockdown.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/lockdown.c b/src/lockdown.c
index 97df6da..341fbde 100644
--- a/src/lockdown.c
+++ b/src/lockdown.c
@@ -49,7 +49,8 @@ const ASN1_ARRAY_TYPE pkcs1_asn1_tab[] = {
* plist to a previously sent request.
*
* @param dict The plist to evaluate.
- * @param query_match Name of the request to match.
+ * @param query_match Name of the request to match or NULL if no match is
+ * required.
*
* @return RESULT_SUCCESS when the result is 'Success',
* RESULT_FAILURE when the result is 'Failure',
@@ -71,7 +72,7 @@ static int lockdown_check_result(plist_t dict, const char *query_match)
if (!query_value) {
return ret;
}
- if (strcmp(query_value, query_match) != 0) {
+ if (query_match && (strcmp(query_value, query_match) != 0)) {
free(query_value);
return ret;
}
@@ -879,8 +880,16 @@ static lockdownd_error_t lockdownd_do_pair(lockdownd_client_t client, lockdownd_
if (ret != LOCKDOWN_E_SUCCESS)
return ret;
- if (lockdown_check_result(dict, verb) != RESULT_SUCCESS) {
- ret = LOCKDOWN_E_PAIRING_FAILED;
+ if (strcmp(verb, "Unpair") == 0) {
+ /* workaround for Unpair giving back ValidatePair,
+ * seems to be a bug in the device's fw */
+ if (lockdown_check_result(dict, NULL) != RESULT_SUCCESS) {
+ ret = LOCKDOWN_E_PAIRING_FAILED;
+ }
+ } else {
+ if (lockdown_check_result(dict, verb) != RESULT_SUCCESS) {
+ ret = LOCKDOWN_E_PAIRING_FAILED;
+ }
}
/* if pairing succeeded */