summaryrefslogtreecommitdiffstats
path: root/src/idevicerestore.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2014-01-15 04:21:14 +0100
committerGravatar Nikias Bassen2014-01-15 04:21:14 +0100
commit87316dac37433852d112e964668e5f0fcf6ca8e6 (patch)
tree8298414751ff7c012672d223f8cd4485bfefae1c /src/idevicerestore.c
parent12020a32d9d2379f710e03cf615b9cf1bc0a8289 (diff)
downloadidevicerestore-87316dac37433852d112e964668e5f0fcf6ca8e6.tar.gz
idevicerestore-87316dac37433852d112e964668e5f0fcf6ca8e6.tar.bz2
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.
Diffstat (limited to 'src/idevicerestore.c')
-rw-r--r--src/idevicerestore.c24
1 files 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