summaryrefslogtreecommitdiffstats
path: root/src/preflight.c
diff options
context:
space:
mode:
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) {