summaryrefslogtreecommitdiffstats
path: root/src/restore.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2022-06-20 14:14:43 +0200
committerGravatar Nikias Bassen2022-06-20 14:14:43 +0200
commitaa25a29e1cf7bc81450a85fdc3320c48c2d95afb (patch)
treef35ca55518affa72cf50e26ae032d3fb4da79ff8 /src/restore.c
parentf6c3d53006733e1f5bae4b073d4e7f19cefd0870 (diff)
downloadidevicerestore-aa25a29e1cf7bc81450a85fdc3320c48c2d95afb.tar.gz
idevicerestore-aa25a29e1cf7bc81450a85fdc3320c48c2d95afb.tar.bz2
Remove more serial number checks, and get ECID early on in all modes
Some devices seem to not have a serial number, usually in restore mode, which will cause the restore operation to fail since we specifically check for it. An earlier commit already removed the actual comparison in favor of comparing the ECID, but some checks would still result in restore failures as it can't retrieve the serial number on said devices at all. This commit also makes sure to get the ECID in all modes as early as possible and removes all the helper functions for it since they are not needed anymore.
Diffstat (limited to 'src/restore.c')
-rw-r--r--src/restore.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/restore.c b/src/restore.c
index 76194bf..c58f46a 100644
--- a/src/restore.c
+++ b/src/restore.c
@@ -278,18 +278,12 @@ irecv_device_t restore_get_irecv_device(struct idevicerestore_client_t* client)
}
if (client->srnm == NULL) {
- restore_error = restored_get_value(restore, "SerialNumber", &node);
- if (restore_error != RESTORE_E_SUCCESS || !node || plist_get_node_type(node) != PLIST_STRING) {
- error("ERROR: Unable to get SerialNumber from restored\n");
- restored_client_free(restore);
- idevice_free(device);
- return NULL;
+ if (restored_get_value(restore, "SerialNumber", &node) == RESTORE_E_SUCCESS) {
+ plist_get_string_val(node, &client->srnm);
+ info("INFO: device serial number is %s\n", client->srnm);
+ plist_free(node);
+ node = NULL;
}
-
- plist_get_string_val(node, &client->srnm);
- info("INFO: device serial number is %s\n", client->srnm);
- plist_free(node);
- node = NULL;
}
restore_error = restored_get_value(restore, "HardwareModel", &node);
@@ -450,17 +444,17 @@ int restore_open_with_timeout(struct idevicerestore_client_t* client)
restored_error_t restore_error = RESTORE_E_SUCCESS;
// no context exists so bail
- if(client == NULL) {
+ if (client == NULL) {
return -1;
}
- if(client->srnm == NULL) {
- error("ERROR: no SerialNumber in client data!\n");
+ if (client->ecid == 0) {
+ error("ERROR: no ECID in client data!\n");
return -1;
}
// create our restore client if it doesn't yet exist
- if(client->restore == NULL) {
+ if (client->restore == NULL) {
client->restore = (struct restore_client_t*) malloc(sizeof(struct restore_client_t));
if(client->restore == NULL) {
error("ERROR: Out of memory\n");