diff options
author | Martin Szulecki | 2012-07-17 17:19:23 +0200 |
---|---|---|
committer | Nikias Bassen | 2012-07-17 17:19:23 +0200 |
commit | 777f8107ed312c6fdebfd962e9e4deb44ca3a821 (patch) | |
tree | 67f88041f3e3eca476c3c1e8c301c02340e5b8cc /src | |
parent | ed2e60d42999a9f06042804bef8eeb45365ac996 (diff) | |
download | idevicerestore-777f8107ed312c6fdebfd962e9e4deb44ca3a821.tar.gz idevicerestore-777f8107ed312c6fdebfd962e9e4deb44ca3a821.tar.bz2 |
restore: Always remove all files except .mdn and .fls from bbfw archives
This fixes restore on CDMA devices which had issues with obsolete .hex files.
Diffstat (limited to 'src')
-rw-r--r-- | src/restore.c | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/src/restore.c b/src/restore.c index fbd88a9..04e0e78 100644 --- a/src/restore.c +++ b/src/restore.c @@ -1002,26 +1002,37 @@ static int restore_sign_bbfw(const char* bbfwtmp, plist_t bbtss, const char* bb_ } free(iter); - if (!bb_nonce) { - // remove everything but required signed files - int i; - int j; - int skip = 0; - int numf = zip_get_num_files(za); - for (i = 0; i < numf; i++) { - skip = 0; - for (j = 0; j < signed_file_count; j++) { - if (i == signed_file_idxs[j]) { + // remove everything but required files + int i; + int j; + int skip = 0; + int numf = zip_get_num_files(za); + for (i = 0; i < numf; i++) { + skip = 0; + // check for signed file index + for (j = 0; j < signed_file_count; j++) { + if (i == signed_file_idxs[j]) { + skip = 1; + break; + } + } + // check for anything but .mbn and .fls if bb_nonce is set + if (bb_nonce && !skip) { + char* fn = zip_get_name(za, i, 0); + if (fn) { + char* ext = strrchr(fn, '.'); + if (strcmp(ext, ".fls") == 0 || strcmp(ext, ".mbn") == 0) { skip = 1; - break; } } - if (skip) { - continue; - } - zip_delete(za, i); } - } else { + if (skip) { + continue; + } + zip_delete(za, i); + } + + if (bb_nonce) { if (is_fls) { // add BBTicket to file ebl.fls zindex = zip_name_locate(za, "ebl.fls", 0); |