summaryrefslogtreecommitdiffstats
path: root/src/normal.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/normal.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/normal.c')
-rw-r--r--src/normal.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/normal.c b/src/normal.c
index 89f713b..7f570da 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -41,6 +41,7 @@ static int normal_idevice_new(struct idevicerestore_client_t* client, idevice_t*
idevice_t dev = NULL;
idevice_error_t device_error;
lockdownd_client_t lockdown = NULL;
+ plist_t node = NULL;
*device = NULL;
@@ -65,6 +66,10 @@ static int normal_idevice_new(struct idevicerestore_client_t* client, idevice_t*
return -1;
}
free(type);
+ if (lockdownd_get_value(lockdown, NULL, "UniqueChipID", &node) == LOCKDOWN_E_SUCCESS) {
+ plist_get_uint_val(node, &client->ecid);
+ plist_free(node);
+ }
lockdownd_client_free(lockdown);
lockdown = NULL;
@@ -107,7 +112,7 @@ static int normal_idevice_new(struct idevicerestore_client_t* client, idevice_t*
}
free(type);
- plist_t node = NULL;
+ node = NULL;
if ((lockdownd_get_value(lockdown, NULL, "UniqueChipID", &node) != LOCKDOWN_E_SUCCESS) || !node || (plist_get_node_type(node) != PLIST_UINT)){
if (node) {
plist_free(node);
@@ -362,19 +367,6 @@ int normal_is_image4_supported(struct idevicerestore_client_t* client)
return bval;
}
-int normal_get_ecid(struct idevicerestore_client_t* client, uint64_t* ecid)
-{
- plist_t unique_chip_node = normal_get_lockdown_value(client, NULL, "UniqueChipID");
- if (!unique_chip_node || plist_get_node_type(unique_chip_node) != PLIST_UINT) {
- error("ERROR: Unable to get ECID\n");
- return -1;
- }
- plist_get_uint_val(unique_chip_node, ecid);
- plist_free(unique_chip_node);
-
- return 0;
-}
-
int normal_get_preflight_info(struct idevicerestore_client_t* client, plist_t *preflight_info)
{
uint8_t has_telephony_capability = 0;