summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2022-04-10 12:12:10 +0200
committerGravatar Nikias Bassen2022-04-10 12:12:10 +0200
commit2eb8865b0fcbe9908a64e9b8b396a83ab0c28c2d (patch)
tree2ee6d8c702599beff6cf9eee969c21953b051a9b /src
parent190473b75b1f0f142cf878f79d19ae53e0cf8146 (diff)
downloadidevicerestore-2eb8865b0fcbe9908a64e9b8b396a83ab0c28c2d.tar.gz
idevicerestore-2eb8865b0fcbe9908a64e9b8b396a83ab0c28c2d.tar.bz2
Fix build identity selection for beta (developer) firmware
Diffstat (limited to 'src')
-rw-r--r--src/idevicerestore.c23
-rw-r--r--src/idevicerestore.h4
-rw-r--r--src/restore.c4
3 files changed, 14 insertions, 17 deletions
diff --git a/src/idevicerestore.c b/src/idevicerestore.c
index f0dc8ad..c6403d3 100644
--- a/src/idevicerestore.c
+++ b/src/idevicerestore.c
@@ -816,20 +816,20 @@ int idevicerestore_start(struct idevicerestore_client_t* client)
// add info
inf = plist_new_dict();
plist_dict_set_item(inf, "RestoreBehavior", plist_new_string((client->flags & FLAG_ERASE) ? "Erase" : "Update"));
- plist_dict_set_item(inf, "Variant", plist_new_string((client->flags & FLAG_ERASE) ? RESTORE_VARIANT_CUSTOMER_ERASE : RESTORE_VARIANT_CUSTOMER_UPGRADE));
+ plist_dict_set_item(inf, "Variant", plist_new_string((client->flags & FLAG_ERASE) ? "Customer " RESTORE_VARIANT_ERASE_INSTALL : "Customer " RESTORE_VARIANT_UPGRADE_INSTALL));
plist_dict_set_item(build_identity, "Info", inf);
// finally add manifest
plist_dict_set_item(build_identity, "Manifest", manifest);
}
} 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_CUSTOMER_ERASE);
+ build_identity = build_manifest_get_build_identity_for_model_with_variant(client->build_manifest, client->device->hardware_model, RESTORE_VARIANT_ERASE_INSTALL);
if (build_identity == NULL) {
error("ERROR: Unable to find any build identities\n");
return -1;
}
} else {
- build_identity = build_manifest_get_build_identity_for_model_with_variant(client->build_manifest, client->device->hardware_model, RESTORE_VARIANT_CUSTOMER_UPGRADE);
+ build_identity = build_manifest_get_build_identity_for_model_with_variant(client->build_manifest, client->device->hardware_model, RESTORE_VARIANT_UPGRADE_INSTALL);
if (!build_identity) {
build_identity = build_manifest_get_build_identity_for_model(client->build_manifest, client->device->hardware_model);
}
@@ -1978,28 +1978,25 @@ plist_t build_manifest_get_build_identity_for_model_with_variant(plist_t build_m
if (!devclass || plist_get_node_type(devclass) != PLIST_STRING) {
continue;
}
- char *str = NULL;
- plist_get_string_val(devclass, &str);
+ const char *str = plist_get_string_ptr(devclass, NULL);
if (strcasecmp(str, hardware_model) != 0) {
- free(str);
continue;
}
- free(str);
- str = NULL;
if (variant) {
plist_t rvariant = plist_dict_get_item(info_dict, "Variant");
if (!rvariant || plist_get_node_type(rvariant) != PLIST_STRING) {
continue;
}
- plist_get_string_val(rvariant, &str);
- if (strcasecmp(str, variant) != 0) {
- free(str);
+ 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 */
+ if (strstr(str, variant)) {
+ return plist_copy(ident);
+ }
continue;
} else {
- free(str);
return plist_copy(ident);
}
- free(str);
} else {
return plist_copy(ident);
}
diff --git a/src/idevicerestore.h b/src/idevicerestore.h
index f9ab18f..6f54b3e 100644
--- a/src/idevicerestore.h
+++ b/src/idevicerestore.h
@@ -47,8 +47,8 @@ extern "C" {
#define FLAG_NO_RESTORE (1 << 11)
#define FLAG_IGNORE_ERRORS (1 << 12)
-#define RESTORE_VARIANT_CUSTOMER_ERASE "Customer Erase Install (IPSW)"
-#define RESTORE_VARIANT_CUSTOMER_UPGRADE "Customer Upgrade Install (IPSW)"
+#define RESTORE_VARIANT_ERASE_INSTALL "Erase Install (IPSW)"
+#define RESTORE_VARIANT_UPGRADE_INSTALL "Upgrade Install (IPSW)"
#define RESTORE_VARIANT_MACOS_RECOVERY_OS "macOS Customer"
struct idevicerestore_client_t;
diff --git a/src/restore.c b/src/restore.c
index d2611a5..78315cf 100644
--- a/src/restore.c
+++ b/src/restore.c
@@ -3142,9 +3142,9 @@ plist_t restore_get_build_identity(struct idevicerestore_client_t* client, uint8
if (is_recover_os)
variant = RESTORE_VARIANT_MACOS_RECOVERY_OS;
else if (client->flags & FLAG_ERASE)
- variant = RESTORE_VARIANT_CUSTOMER_ERASE;
+ variant = RESTORE_VARIANT_ERASE_INSTALL;
else
- variant = RESTORE_VARIANT_CUSTOMER_UPGRADE;
+ variant = RESTORE_VARIANT_UPGRADE_INSTALL;
plist_t build_identity = build_manifest_get_build_identity_for_model_with_variant(
client->build_manifest,