Skip to content

Commit

Permalink
preflight: Assume old iOS version if retrieval of ProductVersion fails
Browse files Browse the repository at this point in the history
Some older devices (e.g. iOS 2.x) wouldn't allow querying the iOS version
if the device is not paired. In this case we just assume an old version
instead of erroring out, and this way the device will be made available.
  • Loading branch information
nikias committed Oct 4, 2022
1 parent 7f24e9a commit 12e24e4
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/preflight.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,18 +214,19 @@ static void* preflight_worker_handle_device_add(void* userdata)

lerr = lockdownd_get_value(lockdown, NULL, "ProductVersion", &value);
if (lerr != LOCKDOWN_E_SUCCESS) {
usbmuxd_log(LL_ERROR, "%s: ERROR: Could not get ProductVersion from device %s, lockdown error %d", __func__, _dev->udid, lerr);
goto leave;
}

if (value && plist_get_node_type(value) == PLIST_STRING) {
plist_get_string_val(value, &version_str);
}
plist_free(value);
usbmuxd_log(LL_WARNING, "%s: Could not get ProductVersion from device %s, lockdown error %d", __func__, _dev->udid, lerr);
/* assume old iOS version */
version_str = strdup("1.0");
} else {
if (value && plist_get_node_type(value) == PLIST_STRING) {
plist_get_string_val(value, &version_str);
}
plist_free(value);

if (!version_str) {
usbmuxd_log(LL_ERROR, "%s: Could not get ProductVersion string from device %s handle %d", __func__, _dev->udid, (int)(long)_dev->conn_data);
goto leave;
if (!version_str) {
usbmuxd_log(LL_ERROR, "%s: Could not get ProductVersion string from device %s handle %d", __func__, _dev->udid, (int)(long)_dev->conn_data);
goto leave;
}
}

lerr = lockdownd_get_value(lockdown, NULL, "DeviceClass", &value);
Expand Down

0 comments on commit 12e24e4

Please sign in to comment.