From 4514713b00a8bc3685f22c89d29963f10d46789e Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Thu, 19 Sep 2013 21:48:05 +0200 Subject: 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. --- src/preflight.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') 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) { -- cgit v1.1-32-gdbae