diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lockdown.c | 25 |
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 | |||
| 813 | plist_free(dict); | 813 | plist_free(dict); |
| 814 | dict = NULL; | 814 | dict = NULL; |
| 815 | 815 | ||
| 816 | /* store public key in config if pairing succeeded */ | 816 | /* if pairing succeeded */ |
| 817 | if (ret == LOCKDOWN_E_SUCCESS) { | 817 | if (ret == LOCKDOWN_E_SUCCESS) { |
| 818 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: %s success\n", __func__, verb); | 818 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: %s success\n", __func__, verb); |
| 819 | userpref_set_device_public_key(client->uuid, public_key); | 819 | if (!strcmp("Unpair", verb)) { |
| 820 | /* remove public key from config */ | ||
| 821 | userpref_remove_device_public_key(client->uuid); | ||
| 822 | } else { | ||
| 823 | /* store public key in config */ | ||
| 824 | userpref_set_device_public_key(client->uuid, public_key); | ||
| 825 | } | ||
| 820 | } else { | 826 | } else { |
| 821 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: %s failure\n", __func__, verb); | 827 | log_dbg_msg(DBGMASK_LOCKDOWND, "%s: %s failure\n", __func__, verb); |
| 822 | } | 828 | } |
| @@ -857,6 +863,21 @@ lockdownd_error_t lockdownd_validate_pair(lockdownd_client_t client, char *host_ | |||
| 857 | return lockdownd_do_pair(client, host_id, "ValidatePair"); | 863 | return lockdownd_do_pair(client, host_id, "ValidatePair"); |
| 858 | } | 864 | } |
| 859 | 865 | ||
| 866 | /** | ||
| 867 | * Unpairs the device with the given HostID and removes the pairing records | ||
| 868 | * from the device and host. | ||
| 869 | * | ||
| 870 | * @param client The lockdown client to pair with. | ||
| 871 | * @param host_id The HostID to use for unpairing. If NULL is passed, then | ||
| 872 | * the HostID of the current machine is used. | ||
| 873 | * | ||
| 874 | * @return an error code (LOCKDOWN_E_SUCCESS on success) | ||
| 875 | */ | ||
| 876 | lockdownd_error_t lockdownd_unpair(lockdownd_client_t client, char *host_id) | ||
| 877 | { | ||
| 878 | return lockdownd_do_pair(client, host_id, "Unpair"); | ||
| 879 | } | ||
| 880 | |||
| 860 | /** | 881 | /** |
| 861 | * Tells the device to immediately enter recovery mode. | 882 | * Tells the device to immediately enter recovery mode. |
| 862 | * | 883 | * |
