From 87316dac37433852d112e964668e5f0fcf6ca8e6 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Wed, 15 Jan 2014 04:21:14 +0100 Subject: put device in recovery mode _after_ extracting the root filesystem Since we can grab tss records in normal mode and these depend on nonce values that are valid only for the first reboot, we should not extract the filesystem after putting the device into recovery mode. If the filesystem extraction takes longer (e.g. on a network filesystem) the recovery mode device might reboot while the file system is still extracting. In that case the TSS record that has been grabbed in normal mode would be invalid. --- src/idevicerestore.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/idevicerestore.c b/src/idevicerestore.c index ef547eb..a08d319 100644 --- a/src/idevicerestore.c +++ b/src/idevicerestore.c @@ -647,18 +647,6 @@ int idevicerestore_start(struct idevicerestore_client_t* client) } idevicerestore_progress(client, RESTORE_STEP_PREPARE, 0.1); - // if the device is in normal mode, place device into recovery mode - if (client->mode->index == MODE_NORMAL) { - info("Entering recovery mode...\n"); - if (normal_enter_recovery(client) < 0) { - error("ERROR: Unable to place device into recovery mode from %s mode\n", client->mode->string); - if (client->tss) - plist_free(client->tss); - plist_free(buildmanifest); - return -5; - } - } - // Get filesystem name from build identity char* fsname = NULL; if (build_identity_get_component_path(build_identity, "OS", &fsname) < 0) { @@ -753,6 +741,18 @@ int idevicerestore_start(struct idevicerestore_client_t* client) } } + // if the device is in normal mode, place device into recovery mode + if (client->mode->index == MODE_NORMAL) { + info("Entering recovery mode...\n"); + if (normal_enter_recovery(client) < 0) { + error("ERROR: Unable to place device into recovery mode from %s mode\n", client->mode->string); + if (client->tss) + plist_free(client->tss); + plist_free(buildmanifest); + return -5; + } + } + idevicerestore_progress(client, RESTORE_STEP_PREPARE, 0.3); // if the device is in DFU mode, place device into recovery mode -- cgit v1.1-32-gdbae