summaryrefslogtreecommitdiffstats
path: root/src/preflight.c
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2013-09-19 21:48:05 +0200
committerGravatar Martin Szulecki2013-09-19 21:48:05 +0200
commit4514713b00a8bc3685f22c89d29963f10d46789e (patch)
tree5b049b409d00cc363f483c9f072e518e5ec51911 /src/preflight.c
parent7de9ac3ed900701fd2fafb2e0c006b56f18672d7 (diff)
downloadusbmuxd-4514713b00a8bc3685f22c89d29963f10d46789e.tar.gz
usbmuxd-4514713b00a8bc3685f22c89d29963f10d46789e.tar.bz2
preflight: Trigger new trust dialog if user denied pairing before
This changes allows to replug a device to trigger a new trust dialog if the user did deny the pairing before.
Diffstat (limited to 'src/preflight.c')
-rw-r--r--src/preflight.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/preflight.c b/src/preflight.c
index 17748c6..30a2217 100644
--- a/src/preflight.c
+++ b/src/preflight.c
@@ -137,6 +137,7 @@ static void* preflight_worker_handle_device_add(void* userdata)
goto leave;
}
+ int is_device_paired = 0;
char *host_id = NULL;
userpref_device_record_get_host_id(dev->udid, &host_id);
lerr = lockdownd_start_session(lockdown, host_id, NULL, NULL);
@@ -150,6 +151,8 @@ static void* preflight_worker_handle_device_add(void* userdata)
usbmuxd_log(LL_INFO, "%s: StartSession failed on device %s, lockdown error %d", __func__, _dev->udid, lerr);
if (lerr == LOCKDOWN_E_INVALID_HOST_ID) {
usbmuxd_log(LL_INFO, "%s: Device %s is not paired with this host.", __func__, _dev->udid);
+ } else {
+ is_device_paired = 1;
}
plist_t value = NULL;
@@ -173,6 +176,11 @@ static void* preflight_worker_handle_device_add(void* userdata)
set_untrusted_host_buid(lockdown);
+ /* if not paired, trigger the trust dialog to make sure it appears */
+ if (!is_device_paired) {
+ lockdownd_pair(lockdown, NULL);
+ }
+
lockdownd_service_descriptor_t service = NULL;
lerr = lockdownd_start_service(lockdown, "com.apple.mobile.insecure_notification_proxy", &service);
if (lerr != LOCKDOWN_E_SUCCESS) {