summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2014-05-16 15:02:52 +0200
committerGravatar Martin Szulecki2014-05-16 15:02:52 +0200
commit4533d9e4571da67e1a442581cbc2bef7e4e2338d (patch)
tree805a5e7c3a5a0abe9fe249f71360f2ddb579a6d1
parent9d16f65017b7c0a93a83f793c1998d8c39a3bc5e (diff)
downloadidevicerestore-4533d9e4571da67e1a442581cbc2bef7e4e2338d.tar.gz
idevicerestore-4533d9e4571da67e1a442581cbc2bef7e4e2338d.tar.bz2
Add build_identity_has_component() helper
-rw-r--r--src/idevicerestore.c14
-rw-r--r--src/idevicerestore.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/src/idevicerestore.c b/src/idevicerestore.c
index 1e7cd6f..7f545ed 100644
--- a/src/idevicerestore.c
+++ b/src/idevicerestore.c
@@ -1739,6 +1739,20 @@ void build_identity_print_information(plist_t build_identity) {
node = NULL;
}
+int build_identity_has_component(plist_t build_identity, const char* component) {
+ plist_t manifest_node = plist_dict_get_item(build_identity, "Manifest");
+ if (!manifest_node || plist_get_node_type(manifest_node) != PLIST_DICT) {
+ return -1;
+ }
+
+ plist_t component_node = plist_dict_get_item(manifest_node, component);
+ if (!component_node || plist_get_node_type(component_node) != PLIST_DICT) {
+ return -1;
+ }
+
+ return 0;
+}
+
int build_identity_get_component_path(plist_t build_identity, const char* component, char** path) {
char* filename = NULL;
diff --git a/src/idevicerestore.h b/src/idevicerestore.h
index b6ca084..4b5ed5d 100644
--- a/src/idevicerestore.h
+++ b/src/idevicerestore.h
@@ -86,6 +86,7 @@ void build_manifest_get_version_information(plist_t build_manifest, struct idevi
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);
+int build_identity_has_component(plist_t build_identity, const char* component);
int build_identity_get_component_path(plist_t build_identity, const char* component, char** path);
int ipsw_extract_filesystem(const char* ipsw, plist_t build_identity, char** filesystem);
int extract_component(const char* ipsw, const char* path, unsigned char** component_data, unsigned int* component_size);