summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Joshua Hill2010-06-21 04:50:40 -0400
committerGravatar Joshua Hill2010-06-21 04:50:40 -0400
commit7edbc8417b760179337b507a6d957882b71dde2e (patch)
tree71b5ab4d386c212bc903f6d73faf56e9368cce1e
parent930f4b350474435e011b9dca18424dd1c42ea353 (diff)
downloadidevicerestore-7edbc8417b760179337b507a6d957882b71dde2e.tar.gz
idevicerestore-7edbc8417b760179337b507a6d957882b71dde2e.tar.bz2
Fixed a few more compile errors, everything should compile fine now, but i'm not sure if it will run yet
-rw-r--r--src/idevicerestore.c69
-rw-r--r--src/idevicerestore.h1
-rw-r--r--src/normal.c6
-rw-r--r--src/normal.h2
4 files changed, 7 insertions, 71 deletions
diff --git a/src/idevicerestore.c b/src/idevicerestore.c
index 606062c..3e346fc 100644
--- a/src/idevicerestore.c
+++ b/src/idevicerestore.c
@@ -59,33 +59,6 @@ void usage(int argc, char* argv[]) {
printf("\n");
}
-int get_build_count(plist_t buildmanifest) {
- // fetch build identities array from BuildManifest
- plist_t build_identities_array = plist_dict_get_item(buildmanifest, "BuildIdentities");
- if (!build_identities_array || plist_get_node_type(build_identities_array) != PLIST_ARRAY) {
- error("ERROR: Unable to find build identities node\n");
- return -1;
- }
-
- // check and make sure this identity exists in buildmanifest
- return plist_array_get_size(build_identities_array);
-}
-
-const char* get_build_name(plist_t build_identity, int identity) {
- plist_t manifest_node = plist_dict_get_item(build_identity, "Manifest");
- if (!manifest_node || plist_get_node_type(manifest_node) != PLIST_DICT) {
- error("ERROR: Unable to find restore manifest\n");
- return NULL;
- }
-
- plist_t filesystem_info_node = plist_dict_get_item(manifest_node, "Info");
- if (!filesystem_info_node || plist_get_node_type(filesystem_info_node) != PLIST_DICT) {
- error("ERROR: Unable to find filesystem info node\n");
- return NULL;
- }
- return NULL;
-}
-
int main(int argc, char* argv[]) {
int opt = 0;
int optindex = 0;
@@ -223,46 +196,6 @@ int main(int argc, char* argv[]) {
}
}
- // devices are listed in order from oldest to newest
- // devices that come after iPod2g require personalized firmwares
- plist_t tss_request = NULL;
- if (client->device->index > DEVICE_IPOD2G) {
- info("Creating TSS request\n");
- // fetch the device's ECID for the TSS request
- if (get_ecid(client, &ecid) < 0 || ecid == 0) {
- error("ERROR: Unable to find device ECID\n");
- return -1;
- }
- debug("Found ECID %llu\n", ecid);
-
- // fetch the SHSH blobs for this build identity
- if (get_shsh_blobs(client, ecid, build_identity, &tss) < 0) {
- // this might fail if the TSS server doesn't have the saved blobs for the
- // update identity, so go ahead and try again with the restore identity
- if (client->flags & FLAG_ERASE > 0) {
- info("Unable to fetch SHSH blobs for upgrade, retrying with full restore\n");
- build_identity = get_build_identity(client, buildmanifest, 0);
- if (build_identity == NULL) {
- error("ERROR: Unable to find restore identity\n");
- plist_free(buildmanifest);
- return -1;
- }
-
- if (get_shsh_blobs(client, ecid, build_identity, &tss) < 0) {
- // if this fails then no SHSH blobs have been saved for this firmware
- error("ERROR: Unable to fetch SHSH blobs for this firmware\n");
- plist_free(buildmanifest);
- return -1;
- }
-
- } else {
- error("ERROR: Unable to fetch SHSH blobs for this firmware\n");
- plist_free(buildmanifest);
- return -1;
- }
- }
- }
-
// Extract filesystem from IPSW and return its name
char* filesystem = NULL;
if (extract_filesystem(client, ipsw, build_identity, &filesystem) < 0) {
@@ -629,8 +562,10 @@ const char* get_build_name(plist_t build_identity, int identity) {
error("ERROR: Unable to find filesystem info node\n");
return NULL;
}
+ return NULL;
}
+
int extract_filesystem(struct idevicerestore_client_t* client, const char* ipsw, plist_t build_identity, char** filesystem) {
char* filename = NULL;
diff --git a/src/idevicerestore.h b/src/idevicerestore.h
index 1fadf15..d3d89a0 100644
--- a/src/idevicerestore.h
+++ b/src/idevicerestore.h
@@ -34,6 +34,7 @@ extern "C" {
void usage(int argc, char* argv[]);
int check_mode(struct idevicerestore_client_t* client);
int check_device(struct idevicerestore_client_t* client);
+int get_build_count(plist_t buildmanifest);
const char* get_build_name(plist_t build_identity, int identity);
int get_ecid(struct idevicerestore_client_t* client, uint64_t* ecid);
int get_bdid(struct idevicerestore_client_t* client, uint32_t* bdid);
diff --git a/src/normal.c b/src/normal.c
index 29f3911..c9a1b45 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -225,7 +225,7 @@ int normal_check_device(const char* uuid) {
return idevicerestore_devices[i].index;
}
-int normal_enter_recovery(const char* uuid) {
+int normal_enter_recovery(struct idevicerestore_client_t* client) {
idevice_t device = NULL;
irecv_client_t recovery = NULL;
lockdownd_client_t lockdown = NULL;
@@ -233,7 +233,7 @@ int normal_enter_recovery(const char* uuid) {
idevice_error_t device_error = IDEVICE_E_SUCCESS;
lockdownd_error_t lockdown_error = LOCKDOWN_E_SUCCESS;
- device_error = idevice_new(&device, uuid);
+ device_error = idevice_new(&device, client->uuid);
if (device_error != IDEVICE_E_SUCCESS) {
error("ERROR: Unable to find device\n");
return -1;
@@ -259,7 +259,7 @@ int normal_enter_recovery(const char* uuid) {
lockdown = NULL;
device = NULL;
- if (recovery_open_with_timeout(&recovery) < 0) {
+ if (recovery_open_with_timeout(client) < 0) {
error("ERROR: Unable to enter recovery mode\n");
return -1;
}
diff --git a/src/normal.h b/src/normal.h
index 836d495..e86bf14 100644
--- a/src/normal.h
+++ b/src/normal.h
@@ -43,7 +43,7 @@ int normal_check_device(const char* uuid);
int normal_client_new(struct idevicerestore_client_t* client);
void normal_client_free(struct idevicerestore_client_t* client);
int normal_open_with_timeout(struct idevicerestore_client_t* client);
-int normal_enter_recovery(const char* uuid);
+int normal_enter_recovery(struct idevicerestore_client_t* client);
int normal_get_cpid(const char* uuid, uint32_t* cpid);
int normal_get_bdid(const char* uuid, uint32_t* cpid);
int normal_get_ecid(const char* uuid, uint64_t* ecid);