From 852de310fad25eb1f95d73e33131d7964096ca71 Mon Sep 17 00:00:00 2001 From: tihmstar Date: Sun, 2 Oct 2016 22:06:30 +0200 Subject: [PATCH] fixed bug where -w would try to restore --- futurerestore/futurerestore.cpp | 9 +++++++-- futurerestore/main.cpp | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/futurerestore/futurerestore.cpp b/futurerestore/futurerestore.cpp index 621cc201..7c978a21 100644 --- a/futurerestore/futurerestore.cpp +++ b/futurerestore/futurerestore.cpp @@ -170,6 +170,7 @@ void futurerestore::waitForNonce(){ void futurerestore::loadAPTicket(const char *apticketPath){ if (_apticket) plist_free(_apticket), _apticket = NULL; FILE *f = fopen(apticketPath,"rb"); + if (!f) reterror(-9, "failed to load apticket at %s\n",apticketPath); fseek(f, 0, SEEK_END); size_t fSize = ftell(f); @@ -265,24 +266,28 @@ int futurerestore::doRestore(const char *ipsw, bool noerase){ sepbuildmanifest = loadPlistFromFile(_sepManifestPath); sep_build_identity = build_manifest_get_build_identity_for_model_with_restore_behavior(sepbuildmanifest, client->device->hardware_model, "Erase"); + if (!sep_build_identity) sep_build_identity = build_manifest_get_build_identity_for_model_with_restore_behavior(sepbuildmanifest, client->device->hardware_model, "Update"); if (sep_build_identity == NULL) { reterror(-5,"ERROR: Unable to find any build identities for sep\n"); } basebandbuildmanifest = loadPlistFromFile(_basebandManifestPath); bb_build_identity = build_manifest_get_build_identity_for_model_with_restore_behavior(basebandbuildmanifest, client->device->hardware_model, "Erase"); + if (!bb_build_identity) bb_build_identity = build_manifest_get_build_identity_for_model_with_restore_behavior(basebandbuildmanifest, client->device->hardware_model, "Update"); if (bb_build_identity == NULL) { reterror(-5,"ERROR: Unable to find any build identities for baseband\n"); } plist_t bb_manifest = plist_dict_get_item(bb_build_identity, "Manifest"); - plist_t bb_baseband = plist_copy(plist_dict_get_item(bb_manifest, "BasebandFirmware")); - plist_t manifest = plist_dict_get_item(build_identity, "Manifest"); + plist_t sep_manifest = plist_dict_get_item(sep_build_identity, "Manifest"); + plist_t sep_sep = plist_copy(plist_dict_get_item(sep_manifest, "SEP")); + plist_t manifest = plist_dict_get_item(build_identity, "Manifest"); plist_dict_set_item(manifest, "BasebandFirmware", bb_baseband); + plist_dict_set_item(manifest, "SEP", sep_sep); client->bbfwtmp = (char*)_basebandPath; diff --git a/futurerestore/main.cpp b/futurerestore/main.cpp index 6d5f4e42..b7d8e326 100644 --- a/futurerestore/main.cpp +++ b/futurerestore/main.cpp @@ -129,9 +129,9 @@ int main(int argc, const char * argv[]) { if (apticketPath) client.loadAPTicket(apticketPath); - if (!(apticketPath && ipsw) + if (!((apticketPath && ipsw) && ((basebandPath && basebandManifestPath) || (flags & FLAG_LATEST_BASEBAND)) - && ((sepPath && sepManifestPath) || (flags & FLAG_LATEST_SEP)) ) { + && ((sepPath && sepManifestPath) || (flags & FLAG_LATEST_SEP)))) { if (!(flags & FLAG_WAIT) || ipsw){ error("missing argument\n"); cmd_help();