diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/idevicerestore.c | 2 | ||||
-rw-r--r-- | src/img4.c | 19 | ||||
-rw-r--r-- | src/img4.h | 2 |
3 files changed, 19 insertions, 4 deletions
diff --git a/src/idevicerestore.c b/src/idevicerestore.c index fa25ff4..9805f65 100644 --- a/src/idevicerestore.c +++ b/src/idevicerestore.c @@ -2115,7 +2115,7 @@ int get_preboard_manifest(struct idevicerestore_client_t* client, plist_t build_ } plist_t local_manifest = NULL; - int res = img4_create_local_manifest(request, &local_manifest); + int res = img4_create_local_manifest(request, build_identity, &local_manifest); *manifest = local_manifest; @@ -615,7 +615,7 @@ static void _manifest_write_component(unsigned char **p, unsigned int *length, c *p += this_length + outer_length + inner_length; } -int img4_create_local_manifest(plist_t request, plist_t* manifest) +int img4_create_local_manifest(plist_t request, plist_t build_identity, plist_t* manifest) { if (!request || !manifest) { return -1; @@ -655,6 +655,11 @@ int img4_create_local_manifest(plist_t request, plist_t* manifest) /* create manifest properties set */ _manifest_write_key_value(&p, &length, "MANP", ASN1_SET | ASN1_CONSTRUCTED, tmp_, tmp_len); + plist_t component_manifest = NULL; + if (build_identity) { + component_manifest = plist_dict_get_item(build_identity, "Manifest"); + } + /* now write the components */ plist_dict_iter iter = NULL; plist_dict_new_iter(request, &iter); @@ -663,7 +668,17 @@ int img4_create_local_manifest(plist_t request, plist_t* manifest) do { plist_dict_next_item(request, iter, &key, &val); if (val && plist_get_node_type(val) == PLIST_DICT) { - const char *comp = _img4_get_component_tag(key); + const char *comp = NULL; + /* check if component has Img4PayloadType */ + if (component_manifest) { + plist_t img4_comp = plist_access_path(component_manifest, 3, key, "Info", "Img4PayloadType"); + if (img4_comp) { + comp = plist_get_string_ptr(img4_comp, NULL); + } + } + if (!comp) { + comp = _img4_get_component_tag(key); + } if (!comp) { error("ERROR: %s: Unhandled component '%s' - can't create manifest\n", __func__, key); free(iter); @@ -27,7 +27,7 @@ extern "C" { #endif int img4_stitch_component(const char* component_name, const unsigned char* component_data, unsigned int component_size, const unsigned char* blob, unsigned int blob_size, unsigned char** img4_data, unsigned int *img4_size); -int img4_create_local_manifest(plist_t request, plist_t* manifest); +int img4_create_local_manifest(plist_t request, plist_t build_identity, plist_t* manifest); #ifdef __cplusplus } |