summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2012-09-20 21:50:42 +0200
committerGravatar Martin Szulecki2012-11-07 22:19:52 +0100
commitf4bdd1ce22061638240fb56ec73eb90c95c7dbcd (patch)
treee1d5b066d8c878d3cdcd26ebb6f8da0d226d4026
parentfde8acd97fc9179960b89e86c3850f7803a3d35c (diff)
downloadidevicerestore-f4bdd1ce22061638240fb56ec73eb90c95c7dbcd.tar.gz
idevicerestore-f4bdd1ce22061638240fb56ec73eb90c95c7dbcd.tar.bz2
client: Fix build number parsing for iOS 6
-rw-r--r--src/common.h1
-rw-r--r--src/dfu.c2
-rw-r--r--src/idevicerestore.c18
-rw-r--r--src/idevicerestore.h2
-rw-r--r--src/recovery.c4
5 files changed, 15 insertions, 12 deletions
diff --git a/src/common.h b/src/common.h
index 9a27262..611a006 100644
--- a/src/common.h
+++ b/src/common.h
@@ -81,6 +81,7 @@ struct idevicerestore_client_t {
struct idevicerestore_mode_t* mode;
char* version;
char* build;
+ int build_major;
char* restore_boot_args;
char* cache_dir;
idevicerestore_progress_cb_t progress_cb;
diff --git a/src/dfu.c b/src/dfu.c
index 1547430..4b2783d 100644
--- a/src/dfu.c
+++ b/src/dfu.c
@@ -263,7 +263,7 @@ int dfu_enter_recovery(struct idevicerestore_client_t* client, plist_t build_ide
return -1;
}
- if (client->build[0] > '8') {
+ if (client->build_major > 8) {
/* reconnect */
dfu_client_free(client);
sleep(2);
diff --git a/src/idevicerestore.c b/src/idevicerestore.c
index a5ea45d..a566e65 100644
--- a/src/idevicerestore.c
+++ b/src/idevicerestore.c
@@ -349,7 +349,7 @@ int idevicerestore_start(struct idevicerestore_client_t* client)
}
/* print iOS information from the manifest */
- build_manifest_get_version_information(buildmanifest, &client->version, &client->build);
+ build_manifest_get_version_information(buildmanifest, client);
info("Product Version: %s\n", client->version);
info("Product Build: %s\n", client->build);
@@ -756,7 +756,7 @@ int idevicerestore_start(struct idevicerestore_client_t* client)
}
idevicerestore_progress(client, RESTORE_STEP_PREPARE, 0.5);
- if (client->build[0] > '8') {
+ if (client->build_major > 8) {
// we need another tss request with nonce.
unsigned char* nonce = NULL;
int nonce_size = 0;
@@ -1415,7 +1415,7 @@ int get_shsh_blobs(struct idevicerestore_client_t* client, uint64_t ecid, unsign
plist_t response = NULL;
*tss = NULL;
- if ((client->build[0] <= '8') || (client->flags & FLAG_CUSTOM)) {
+ if ((client->build_major <= 8) || (client->flags & FLAG_CUSTOM)) {
error("checking for local shsh\n");
/* first check for local copy */
@@ -1612,24 +1612,26 @@ int build_manifest_check_compatibility(plist_t build_manifest, const char* produ
return res;
}
-void build_manifest_get_version_information(plist_t build_manifest, char** product_version, char** product_build) {
+void build_manifest_get_version_information(plist_t build_manifest, struct idevicerestore_client_t* client) {
plist_t node = NULL;
- *product_version = NULL;
- *product_build = NULL;
+ client->version = NULL;
+ client->build = NULL;
node = plist_dict_get_item(build_manifest, "ProductVersion");
if (!node || plist_get_node_type(node) != PLIST_STRING) {
error("ERROR: Unable to find ProductVersion node\n");
return;
}
- plist_get_string_val(node, product_version);
+ plist_get_string_val(node, &client->version);
node = plist_dict_get_item(build_manifest, "ProductBuildVersion");
if (!node || plist_get_node_type(node) != PLIST_STRING) {
error("ERROR: Unable to find ProductBuildVersion node\n");
return;
}
- plist_get_string_val(node, product_build);
+ plist_get_string_val(node, &client->build);
+
+ client->build_major = strtoul(client->build, NULL, 10);
}
void build_identity_print_information(plist_t build_identity) {
diff --git a/src/idevicerestore.h b/src/idevicerestore.h
index 65c605f..e193846 100644
--- a/src/idevicerestore.h
+++ b/src/idevicerestore.h
@@ -77,7 +77,7 @@ int get_bdid(struct idevicerestore_client_t* client, uint32_t* bdid);
int get_cpid(struct idevicerestore_client_t* client, uint32_t* cpid);
int get_shsh_blobs(struct idevicerestore_client_t* client, uint64_t ecid, unsigned char* nonce, int nonce_size, plist_t build_identity, plist_t* tss);
void fixup_tss(plist_t tss);
-void build_manifest_get_version_information(plist_t build_manifest, char** product_version, char** product_build);
+void build_manifest_get_version_information(plist_t build_manifest, struct idevicerestore_client_t* client);
plist_t build_manifest_get_build_identity(plist_t build_manifest, uint32_t identity);
int build_manifest_get_build_count(plist_t build_manifest);
void build_identity_print_information(plist_t build_identity);
diff --git a/src/recovery.c b/src/recovery.c
index 4d288e2..eebb4df 100644
--- a/src/recovery.c
+++ b/src/recovery.c
@@ -141,7 +141,7 @@ int recovery_enter_restore(struct idevicerestore_client_t* client, plist_t build
idevice_t device = NULL;
restored_client_t restore = NULL;
- if (client->build[0] >= '8') {
+ if (client->build_major >= 8) {
client->restore_boot_args = strdup("rd=md0 nand-enable-reformat=1 -progress");
}
@@ -153,7 +153,7 @@ int recovery_enter_restore(struct idevicerestore_client_t* client, plist_t build
}
}
- if ((client->build[0] > '8') && !(client->flags & FLAG_CUSTOM)) {
+ if ((client->build_major > 8) && !(client->flags & FLAG_CUSTOM)) {
/* send ApTicket */
if (recovery_send_ticket(client) < 0) {
error("ERROR: Unable to send APTicket\n");