summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2010-01-08 14:37:51 +0100
committerGravatar Martin Szulecki2010-01-08 14:37:51 +0100
commit7ff00ff9dc3039f811e6b2ac234958acc0a02d78 (patch)
tree37bde18512001aa0b36892485582399573587405 /src
parente87f65f1b17186c6246fce26cdbd05d087ec28b9 (diff)
downloadlibimobiledevice-7ff00ff9dc3039f811e6b2ac234958acc0a02d78.tar.gz
libimobiledevice-7ff00ff9dc3039f811e6b2ac234958acc0a02d78.tar.bz2
Implement lockdown unpair request
Diffstat (limited to 'src')
-rw-r--r--src/lockdown.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/lockdown.c b/src/lockdown.c
index 6616e72..c27cd59 100644
--- a/src/lockdown.c
+++ b/src/lockdown.c
@@ -813,10 +813,16 @@ static lockdownd_error_t lockdownd_do_pair(lockdownd_client_t client, char *host
plist_free(dict);
dict = NULL;
- /* store public key in config if pairing succeeded */
+ /* if pairing succeeded */
if (ret == LOCKDOWN_E_SUCCESS) {
log_dbg_msg(DBGMASK_LOCKDOWND, "%s: %s success\n", __func__, verb);
- userpref_set_device_public_key(client->uuid, public_key);
+ if (!strcmp("Unpair", verb)) {
+ /* remove public key from config */
+ userpref_remove_device_public_key(client->uuid);
+ } else {
+ /* store public key in config */
+ userpref_set_device_public_key(client->uuid, public_key);
+ }
} else {
log_dbg_msg(DBGMASK_LOCKDOWND, "%s: %s failure\n", __func__, verb);
}
@@ -857,6 +863,21 @@ lockdownd_error_t lockdownd_validate_pair(lockdownd_client_t client, char *host_
return lockdownd_do_pair(client, host_id, "ValidatePair");
}
+/**
+ * Unpairs the device with the given HostID and removes the pairing records
+ * from the device and host.
+ *
+ * @param client The lockdown client to pair with.
+ * @param host_id The HostID to use for unpairing. If NULL is passed, then
+ * the HostID of the current machine is used.
+ *
+ * @return an error code (LOCKDOWN_E_SUCCESS on success)
+ */
+lockdownd_error_t lockdownd_unpair(lockdownd_client_t client, char *host_id)
+{
+ return lockdownd_do_pair(client, host_id, "Unpair");
+}
+
/**
* Tells the device to immediately enter recovery mode.
*