diff options
author | Nikias Bassen | 2019-10-04 03:14:04 +0200 |
---|---|---|
committer | Nikias Bassen | 2019-10-04 03:14:04 +0200 |
commit | c41226df521de464a89f3d027f3e67d13d10d96f (patch) | |
tree | 585c80e88a56f35c022f85a759b9e775bad11733 /src | |
parent | 1afa7350f9da03365f3b8f98dcb763b396e52723 (diff) | |
download | usbmuxd-c41226df521de464a89f3d027f3e67d13d10d96f.tar.gz usbmuxd-c41226df521de464a89f3d027f3e67d13d10d96f.tar.bz2 |
preflight: Let insecure notification proxy terminate when pairing is done
Diffstat (limited to 'src')
-rw-r--r-- | src/preflight.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/preflight.c b/src/preflight.c index 15429c0..f46786e 100644 --- a/src/preflight.c +++ b/src/preflight.c @@ -59,6 +59,7 @@ struct cb_data { idevice_t dev; np_client_t np; int is_device_connected; + int is_finished; }; static void lockdownd_set_untrusted_host_buid(lockdownd_client_t lockdown) @@ -97,6 +98,7 @@ static void np_callback(const char* notification, void* userdata) lerr = lockdownd_client_new(dev, &lockdown, "usbmuxd"); if (lerr != LOCKDOWN_E_SUCCESS) { usbmuxd_log(LL_ERROR, "%s: ERROR: Could not connect to lockdownd on device %s, lockdown error %d", __func__, _dev->udid, lerr); + cbdata->is_finished = 1; return; } @@ -104,10 +106,11 @@ static void np_callback(const char* notification, void* userdata) if (lerr != LOCKDOWN_E_SUCCESS) { usbmuxd_log(LL_ERROR, "%s: ERROR: Pair failed for device %s, lockdown error %d", __func__, _dev->udid, lerr); lockdownd_client_free(lockdown); + cbdata->is_finished = 1; return; } lockdownd_client_free(lockdown); - // device will reconnect by itself at this point. + cbdata->is_finished = 1; } else if (strcmp(notification, "com.apple.mobile.lockdown.request_host_buid") == 0) { lerr = lockdownd_client_new(cbdata->dev, &lockdown, "usbmuxd"); @@ -255,6 +258,7 @@ retry: cbdata.dev = dev; cbdata.np = np; cbdata.is_device_connected = 1; + cbdata.is_finished = 0; np_set_notify_callback(np, np_callback, (void*)&cbdata); device_set_preflight_cb_data(info->id, (void*)&cbdata); @@ -273,7 +277,7 @@ retry: /* make device visible anyways */ client_device_add(info); - while (cbdata.np && cbdata.is_device_connected == 1) { + while (cbdata.np && cbdata.is_device_connected && !cbdata.is_finished) { sleep(1); } device_set_preflight_cb_data(info->id, NULL); |