From e1c4c756df5f5015979b292969e4fd6415a157bb Mon Sep 17 00:00:00 2001 From: Aaron Burghardt Date: Wed, 25 Sep 2013 16:14:09 -0400 Subject: Fall back to ‘RestoreKernelCaches’ if ‘KernelCachesByTarget’ not in Restore.plist. Signed-off-by: Martin Szulecki --- src/idevicerestore.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/idevicerestore.c b/src/idevicerestore.c index 34ee350..224dc10 100644 --- a/src/idevicerestore.c +++ b/src/idevicerestore.c @@ -449,23 +449,27 @@ int idevicerestore_start(struct idevicerestore_client_t* client) plist_dict_insert_item(manifest, "iBEC", comp); // add kernel cache + plist_t kdict = NULL; + node = plist_dict_get_item(buildmanifest, "KernelCachesByTarget"); if (node && (plist_get_node_type(node) == PLIST_DICT)) { char tt[4]; strncpy(tt, lcmodel, 3); tt[3] = 0; - plist_t kdict = plist_dict_get_item(node, tt); - if (kdict && (plist_get_node_type(kdict) == PLIST_DICT)) { - plist_t kc = plist_dict_get_item(kdict, "Release"); - if (kc && (plist_get_node_type(kc) == PLIST_STRING)) { - inf = plist_new_dict(); - plist_dict_insert_item(inf, "Path", plist_copy(kc)); - comp = plist_new_dict(); - plist_dict_insert_item(comp, "Info", inf); - plist_dict_insert_item(manifest, "KernelCache", comp); - plist_dict_insert_item(manifest, "RestoreKernelCache", plist_copy(comp)); - - } + kdict = plist_dict_get_item(node, tt); + } else { + // Populated in older iOS IPSWs + kdict = plist_dict_get_item(buildmanifest, "RestoreKernelCaches"); + } + if (kdict && (plist_get_node_type(kdict) == PLIST_DICT)) { + plist_t kc = plist_dict_get_item(kdict, "Release"); + if (kc && (plist_get_node_type(kc) == PLIST_STRING)) { + inf = plist_new_dict(); + plist_dict_insert_item(inf, "Path", plist_copy(kc)); + comp = plist_new_dict(); + plist_dict_insert_item(comp, "Info", inf); + plist_dict_insert_item(manifest, "KernelCache", comp); + plist_dict_insert_item(manifest, "RestoreKernelCache", plist_copy(comp)); } } -- cgit v1.1-32-gdbae