diff options
author | Nikias Bassen | 2024-03-08 12:23:03 +0100 |
---|---|---|
committer | Nikias Bassen | 2024-03-08 12:23:03 +0100 |
commit | fdbf383a52111014f7e41fde0f1e8ee209679412 (patch) | |
tree | 63b6ce54ac8a17e36e0302d4288c20297dbdb05c /src | |
parent | cba2d5e0a918184c0145e371eb3dd9e4ae52cd7b (diff) | |
download | idevicerestore-fdbf383a52111014f7e41fde0f1e8ee209679412.tar.gz idevicerestore-fdbf383a52111014f7e41fde0f1e8ee209679412.tar.bz2 |
Make sure to extract the build manifest before doing restore mode checks
Otherwise we could set tss_enabled to 0 but the extraction would re-enable it.
Diffstat (limited to 'src')
-rw-r--r-- | src/idevicerestore.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/idevicerestore.c b/src/idevicerestore.c index 064c503..af5dbf3 100644 --- a/src/idevicerestore.c +++ b/src/idevicerestore.c @@ -642,6 +642,21 @@ int idevicerestore_start(struct idevicerestore_client_t* client) return 0; } + // extract buildmanifest + if (client->flags & FLAG_CUSTOM) { + info("Extracting Restore.plist from IPSW\n"); + if (ipsw_extract_restore_plist(client->ipsw, &client->build_manifest) < 0) { + error("ERROR: Unable to extract Restore.plist from %s. Firmware file might be corrupt.\n", client->ipsw->path); + return -1; + } + } else { + info("Extracting BuildManifest from IPSW\n"); + if (ipsw_extract_build_manifest(client->ipsw, &client->build_manifest, &tss_enabled) < 0) { + error("ERROR: Unable to extract BuildManifest from %s. Firmware file might be corrupt.\n", client->ipsw->path); + return -1; + } + } + if (client->mode == MODE_RESTORE) { if (client->flags & FLAG_ALLOW_RESTORE_MODE) { tss_enabled = 0; @@ -668,20 +683,6 @@ int idevicerestore_start(struct idevicerestore_client_t* client) } } - // extract buildmanifest - if (client->flags & FLAG_CUSTOM) { - info("Extracting Restore.plist from IPSW\n"); - if (ipsw_extract_restore_plist(client->ipsw, &client->build_manifest) < 0) { - error("ERROR: Unable to extract Restore.plist from %s. Firmware file might be corrupt.\n", client->ipsw->path); - return -1; - } - } else { - info("Extracting BuildManifest from IPSW\n"); - if (ipsw_extract_build_manifest(client->ipsw, &client->build_manifest, &tss_enabled) < 0) { - error("ERROR: Unable to extract BuildManifest from %s. Firmware file might be corrupt.\n", client->ipsw->path); - return -1; - } - } idevicerestore_progress(client, RESTORE_STEP_DETECT, 0.8); /* check if device type is supported by the given build manifest */ |