summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2013-11-20 21:36:36 +0100
committerGravatar Nikias Bassen2013-11-20 21:36:36 +0100
commit17ecc7b0a4f8d9eececd5317bbed30ce09c5ec85 (patch)
tree30d1279b405c76c156b15c8658da7b1b62a05837
parentaef47cf31d21a2225931c17ce0d7bbcd10200204 (diff)
downloadidevicerestore-17ecc7b0a4f8d9eececd5317bbed30ce09c5ec85.tar.gz
idevicerestore-17ecc7b0a4f8d9eececd5317bbed30ce09c5ec85.tar.bz2
normal: add normal_get_preflight_info helper function
-rw-r--r--src/normal.c42
-rw-r--r--src/normal.h1
2 files changed, 43 insertions, 0 deletions
diff --git a/src/normal.c b/src/normal.c
index 8fa64a4..89bc912 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -478,3 +478,45 @@ int normal_get_ecid(struct idevicerestore_client_t* client, uint64_t* ecid) {
device = NULL;
return 0;
}
+
+int normal_get_preflight_info(struct idevicerestore_client_t* client, plist_t *preflight_info) {
+ idevice_t device = NULL;
+ plist_t node = NULL;
+ lockdownd_client_t lockdown = NULL;
+ idevice_error_t device_error = IDEVICE_E_SUCCESS;
+ lockdownd_error_t lockdown_error = IDEVICE_E_SUCCESS;
+
+ device_error = idevice_new(&device, client->udid);
+ if (device_error != IDEVICE_E_SUCCESS) {
+ return -1;
+ }
+
+ lockdown_error = lockdownd_client_new(device, &lockdown, "idevicerestore");
+ if (lockdown_error != LOCKDOWN_E_SUCCESS) {
+ error("ERROR: Unable to connect to lockdownd\n");
+ idevice_free(device);
+ return -1;
+ }
+
+ lockdown_error = lockdownd_get_value(lockdown, NULL, "FirmwarePreflightInfo", &node);
+ if (lockdown_error != LOCKDOWN_E_SUCCESS) {
+ debug("ERROR: Unable to get FirmwarePreflightInfo from lockdownd\n");
+ lockdownd_client_free(lockdown);
+ idevice_free(device);
+ return -1;
+ }
+
+ if (!node || plist_get_node_type(node) != PLIST_DICT) {
+ error("ERROR: Unable to get FirmwarePreflightInfo\n");
+ lockdownd_client_free(lockdown);
+ idevice_free(device);
+ return -1;
+ }
+ *preflight_info = node;
+
+ lockdownd_client_free(lockdown);
+ idevice_free(device);
+ lockdown = NULL;
+ device = NULL;
+ return 0;
+}
diff --git a/src/normal.h b/src/normal.h
index abc4fe1..691f2d9 100644
--- a/src/normal.h
+++ b/src/normal.h
@@ -50,6 +50,7 @@ int normal_get_ecid(struct idevicerestore_client_t* client, uint64_t* ecid);
int normal_is_image4_supported(struct idevicerestore_client_t* client);
int normal_get_ap_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size);
int normal_get_sep_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size);
+int normal_get_preflight_info(struct idevicerestore_client_t* client, plist_t *preflight_info);
#ifdef __cplusplus
}