summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2022-06-28 11:53:57 +0200
committerGravatar Nikias Bassen2022-06-28 11:53:57 +0200
commit6bc672c4dc56f8b741e4357c70eb17670121d5a9 (patch)
tree0172e5d1c363c8af0a13beb477631a6635712481
parente667b49a4a6d7059c1ae8243961f764551f91a85 (diff)
downloadidevicerestore-6bc672c4dc56f8b741e4357c70eb17670121d5a9.tar.gz
idevicerestore-6bc672c4dc56f8b741e4357c70eb17670121d5a9.tar.bz2
Make sure to exactly match the passed variant when using --variant
-rw-r--r--src/idevicerestore.c14
-rw-r--r--src/idevicerestore.h2
-rw-r--r--src/restore.c2
3 files changed, 9 insertions, 9 deletions
diff --git a/src/idevicerestore.c b/src/idevicerestore.c
index ac628ca..23c48d5 100644
--- a/src/idevicerestore.c
+++ b/src/idevicerestore.c
@@ -835,11 +835,11 @@ int idevicerestore_start(struct idevicerestore_client_t* client)
plist_dict_set_item(build_identity, "Manifest", manifest);
}
} else if (client->restore_variant) {
- build_identity = build_manifest_get_build_identity_for_model_with_variant(client->build_manifest, client->device->hardware_model, client->restore_variant);
+ build_identity = build_manifest_get_build_identity_for_model_with_variant(client->build_manifest, client->device->hardware_model, client->restore_variant, 1);
} else if (client->flags & FLAG_ERASE) {
- build_identity = build_manifest_get_build_identity_for_model_with_variant(client->build_manifest, client->device->hardware_model, RESTORE_VARIANT_ERASE_INSTALL);
+ build_identity = build_manifest_get_build_identity_for_model_with_variant(client->build_manifest, client->device->hardware_model, RESTORE_VARIANT_ERASE_INSTALL, 0);
} else {
- build_identity = build_manifest_get_build_identity_for_model_with_variant(client->build_manifest, client->device->hardware_model, RESTORE_VARIANT_UPGRADE_INSTALL);
+ build_identity = build_manifest_get_build_identity_for_model_with_variant(client->build_manifest, client->device->hardware_model, RESTORE_VARIANT_UPGRADE_INSTALL, 0);
if (!build_identity) {
build_identity = build_manifest_get_build_identity_for_model(client->build_manifest, client->device->hardware_model);
}
@@ -849,7 +849,7 @@ int idevicerestore_start(struct idevicerestore_client_t* client)
return -1;
}
- client->macos_variant = build_manifest_get_build_identity_for_model_with_variant(client->build_manifest, client->device->hardware_model, RESTORE_VARIANT_MACOS_RECOVERY_OS);
+ client->macos_variant = build_manifest_get_build_identity_for_model_with_variant(client->build_manifest, client->device->hardware_model, RESTORE_VARIANT_MACOS_RECOVERY_OS, 1);
/* print information about current build identity */
build_identity_print_information(build_identity);
@@ -1932,7 +1932,7 @@ int get_sep_nonce(struct idevicerestore_client_t* client, unsigned char** nonce,
return 0;
}
-plist_t build_manifest_get_build_identity_for_model_with_variant(plist_t build_manifest, const char *hardware_model, const char *variant)
+plist_t build_manifest_get_build_identity_for_model_with_variant(plist_t build_manifest, const char *hardware_model, const char *variant, int exact)
{
plist_t build_identities_array = plist_dict_get_item(build_manifest, "BuildIdentities");
if (!build_identities_array || plist_get_node_type(build_identities_array) != PLIST_ARRAY) {
@@ -1966,7 +1966,7 @@ plist_t build_manifest_get_build_identity_for_model_with_variant(plist_t build_m
str = plist_get_string_ptr(rvariant, NULL);
if (strcmp(str, variant) != 0) {
/* if it's not a full match, let's try a partial match, but ignore "*Research*" */
- if (strstr(str, variant) && !strstr(str, "Research")) {
+ if (!exact && strstr(str, variant) && !strstr(str, "Research")) {
return ident;
}
continue;
@@ -1983,7 +1983,7 @@ plist_t build_manifest_get_build_identity_for_model_with_variant(plist_t build_m
plist_t build_manifest_get_build_identity_for_model(plist_t build_manifest, const char *hardware_model)
{
- return build_manifest_get_build_identity_for_model_with_variant(build_manifest, hardware_model, NULL);
+ return build_manifest_get_build_identity_for_model_with_variant(build_manifest, hardware_model, NULL, 0);
}
int get_preboard_manifest(struct idevicerestore_client_t* client, plist_t build_identity, plist_t* manifest)
diff --git a/src/idevicerestore.h b/src/idevicerestore.h
index 6f54b3e..8a5736f 100644
--- a/src/idevicerestore.h
+++ b/src/idevicerestore.h
@@ -105,7 +105,7 @@ int build_manifest_get_identity_count(plist_t build_manifest);
int build_manifest_check_compatibility(plist_t build_manifest, const char* product);
void build_manifest_get_version_information(plist_t build_manifest, struct idevicerestore_client_t* client);
plist_t build_manifest_get_build_identity_for_model(plist_t build_manifest, const char *hardware_model);
-plist_t build_manifest_get_build_identity_for_model_with_variant(plist_t build_manifest, const char *hardware_model, const char *variant);
+plist_t build_manifest_get_build_identity_for_model_with_variant(plist_t build_manifest, const char *hardware_model, const char *variant, int exact);
int build_manifest_get_build_count(plist_t build_manifest);
void build_identity_print_information(plist_t build_identity);
int build_identity_check_components_in_ipsw(plist_t build_identity, const char* ipsw);
diff --git a/src/restore.c b/src/restore.c
index 61edad4..7f7e903 100644
--- a/src/restore.c
+++ b/src/restore.c
@@ -3261,7 +3261,7 @@ plist_t restore_get_build_identity(struct idevicerestore_client_t* client, uint8
plist_t build_identity = build_manifest_get_build_identity_for_model_with_variant(
client->build_manifest,
client->device->hardware_model,
- variant);
+ variant, 0);
plist_t unique_id_node = plist_dict_get_item(client->build_manifest, "UniqueBuildID");
debug_plist(unique_id_node);