From 39f6c99ba98427363713fc9f37adc6ffb16adf8c Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Sat, 22 Mar 2014 13:52:28 +0100 Subject: Use "plist_dict_set_item" instead of deprecated "plist_dict_insert_item" --- src/asr.c | 18 +++++------ src/common.c | 2 +- src/idevicerestore.c | 76 ++++++++++++++++++++++---------------------- src/restore.c | 90 ++++++++++++++++++++++++++-------------------------- src/tss.c | 84 ++++++++++++++++++++++++------------------------ 5 files changed, 135 insertions(+), 135 deletions(-) diff --git a/src/asr.c b/src/asr.c index 77a8b86..4269563 100644 --- a/src/asr.c +++ b/src/asr.c @@ -212,19 +212,19 @@ int asr_perform_validation(asr_client_t asr, const char* filesystem) { fseek(file, 0, SEEK_SET); payload_info = plist_new_dict(); - plist_dict_insert_item(payload_info, "Port", plist_new_uint(1)); - plist_dict_insert_item(payload_info, "Size", plist_new_uint(length)); + plist_dict_set_item(payload_info, "Port", plist_new_uint(1)); + plist_dict_set_item(payload_info, "Size", plist_new_uint(length)); packet_info = plist_new_dict(); if (asr->checksum_chunks) { - plist_dict_insert_item(packet_info, "Checksum Chunk Size", plist_new_uint(ASR_CHECKSUM_CHUNK_SIZE)); + plist_dict_set_item(packet_info, "Checksum Chunk Size", plist_new_uint(ASR_CHECKSUM_CHUNK_SIZE)); } - plist_dict_insert_item(packet_info, "FEC Slice Stride", plist_new_uint(ASR_FEC_SLICE_STRIDE)); - plist_dict_insert_item(packet_info, "Packet Payload Size", plist_new_uint(ASR_PAYLOAD_PACKET_SIZE)); - plist_dict_insert_item(packet_info, "Packets Per FEC", plist_new_uint(ASR_PACKETS_PER_FEC)); - plist_dict_insert_item(packet_info, "Payload", payload_info); - plist_dict_insert_item(packet_info, "Stream ID", plist_new_uint(ASR_STREAM_ID)); - plist_dict_insert_item(packet_info, "Version", plist_new_uint(ASR_VERSION)); + plist_dict_set_item(packet_info, "FEC Slice Stride", plist_new_uint(ASR_FEC_SLICE_STRIDE)); + plist_dict_set_item(packet_info, "Packet Payload Size", plist_new_uint(ASR_PAYLOAD_PACKET_SIZE)); + plist_dict_set_item(packet_info, "Packets Per FEC", plist_new_uint(ASR_PACKETS_PER_FEC)); + plist_dict_set_item(packet_info, "Payload", payload_info); + plist_dict_set_item(packet_info, "Stream ID", plist_new_uint(ASR_STREAM_ID)); + plist_dict_set_item(packet_info, "Version", plist_new_uint(ASR_VERSION)); if (asr_send(asr, packet_info)) { error("ERROR: Unable to sent packet information to ASR\n"); diff --git a/src/common.c b/src/common.c index 426b96f..7646361 100644 --- a/src/common.c +++ b/src/common.c @@ -279,7 +279,7 @@ void plist_dict_merge(plist_t* dictionary, plist_t node) if (plist_dict_get_item(*dictionary, key) != NULL) plist_dict_remove_item(*dictionary, key); - plist_dict_insert_item(*dictionary, key, plist_copy(subnode)); + plist_dict_set_item(*dictionary, key, plist_copy(subnode)); if (key) { free(key); key = NULL; diff --git a/src/idevicerestore.c b/src/idevicerestore.c index 6b7fb04..0c53948 100644 --- a/src/idevicerestore.c +++ b/src/idevicerestore.c @@ -432,14 +432,14 @@ int idevicerestore_start(struct idevicerestore_client_t* client) strcpy(tmpstr, p_all_flash); strcat(tmpstr, "/"); strcat(tmpstr, files[x]); - plist_dict_insert_item(inf, "Path", plist_new_string(tmpstr)); + plist_dict_set_item(inf, "Path", plist_new_string(tmpstr)); comp = plist_new_dict(); - plist_dict_insert_item(comp, "Info", inf); + plist_dict_set_item(comp, "Info", inf); const char* compname = get_component_name(files[x]); if (compname) { - plist_dict_insert_item(manifest, compname, comp); + plist_dict_set_item(manifest, compname, comp); if (!strncmp(files[x], "DeviceTree", 10)) { - plist_dict_insert_item(manifest, "RestoreDeviceTree", plist_copy(comp)); + plist_dict_set_item(manifest, "RestoreDeviceTree", plist_copy(comp)); } } else { error("WARNING: unhandled component %s\n", files[x]); @@ -452,18 +452,18 @@ int idevicerestore_start(struct idevicerestore_client_t* client) // add iBSS sprintf(tmpstr, "Firmware/dfu/iBSS.%s.%s.dfu", lcmodel, "RELEASE"); inf = plist_new_dict(); - plist_dict_insert_item(inf, "Path", plist_new_string(tmpstr)); + plist_dict_set_item(inf, "Path", plist_new_string(tmpstr)); comp = plist_new_dict(); - plist_dict_insert_item(comp, "Info", inf); - plist_dict_insert_item(manifest, "iBSS", comp); + plist_dict_set_item(comp, "Info", inf); + plist_dict_set_item(manifest, "iBSS", comp); // add iBEC sprintf(tmpstr, "Firmware/dfu/iBEC.%s.%s.dfu", lcmodel, "RELEASE"); inf = plist_new_dict(); - plist_dict_insert_item(inf, "Path", plist_new_string(tmpstr)); + plist_dict_set_item(inf, "Path", plist_new_string(tmpstr)); comp = plist_new_dict(); - plist_dict_insert_item(comp, "Info", inf); - plist_dict_insert_item(manifest, "iBEC", comp); + plist_dict_set_item(comp, "Info", inf); + plist_dict_set_item(manifest, "iBEC", comp); // add kernel cache plist_t kdict = NULL; @@ -482,11 +482,11 @@ int idevicerestore_start(struct idevicerestore_client_t* client) 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)); + plist_dict_set_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)); + plist_dict_set_item(comp, "Info", inf); + plist_dict_set_item(manifest, "KernelCache", comp); + plist_dict_set_item(manifest, "RestoreKernelCache", plist_copy(comp)); } } @@ -502,10 +502,10 @@ int idevicerestore_start(struct idevicerestore_client_t* client) } if (rd && (plist_get_node_type(rd) == PLIST_STRING)) { inf = plist_new_dict(); - plist_dict_insert_item(inf, "Path", plist_copy(rd)); + plist_dict_set_item(inf, "Path", plist_copy(rd)); comp = plist_new_dict(); - plist_dict_insert_item(comp, "Info", inf); - plist_dict_insert_item(manifest, "RestoreRamDisk", comp); + plist_dict_set_item(comp, "Info", inf); + plist_dict_set_item(manifest, "RestoreRamDisk", comp); } } @@ -519,20 +519,20 @@ int idevicerestore_start(struct idevicerestore_client_t* client) error("ERROR: missing filesystem in Restore.plist\n"); } else { inf = plist_new_dict(); - plist_dict_insert_item(inf, "Path", plist_copy(os)); + plist_dict_set_item(inf, "Path", plist_copy(os)); comp = plist_new_dict(); - plist_dict_insert_item(comp, "Info", inf); - plist_dict_insert_item(manifest, "OS", comp); + plist_dict_set_item(comp, "Info", inf); + plist_dict_set_item(manifest, "OS", comp); } // add info inf = plist_new_dict(); - plist_dict_insert_item(inf, "RestoreBehavior", plist_new_string((client->flags & FLAG_ERASE) ? "Erase" : "Update")); - plist_dict_insert_item(inf, "Variant", plist_new_string((client->flags & FLAG_ERASE) ? "Customer Erase Install (IPSW)" : "Customer Upgrade Install (IPSW)")); - plist_dict_insert_item(build_identity, "Info", inf); + plist_dict_set_item(inf, "RestoreBehavior", plist_new_string((client->flags & FLAG_ERASE) ? "Erase" : "Update")); + plist_dict_set_item(inf, "Variant", plist_new_string((client->flags & FLAG_ERASE) ? "Customer Erase Install (IPSW)" : "Customer Upgrade Install (IPSW)")); + plist_dict_set_item(build_identity, "Info", inf); // finally add manifest - plist_dict_insert_item(build_identity, "Manifest", manifest); + plist_dict_set_item(build_identity, "Manifest", manifest); } } else if (client->flags & FLAG_ERASE) { build_identity = build_manifest_get_build_identity(buildmanifest, 0); @@ -1431,24 +1431,24 @@ int get_tss_response(struct idevicerestore_client_t* client, plist_t build_ident /* populate parameters */ plist_t parameters = plist_new_dict(); - plist_dict_insert_item(parameters, "ApECID", plist_new_uint(client->ecid)); + plist_dict_set_item(parameters, "ApECID", plist_new_uint(client->ecid)); if (client->nonce) { - plist_dict_insert_item(parameters, "ApNonce", plist_new_data((const char*)client->nonce, client->nonce_size)); + plist_dict_set_item(parameters, "ApNonce", plist_new_data((const char*)client->nonce, client->nonce_size)); } unsigned char* sep_nonce = NULL; int sep_nonce_size = 0; get_sep_nonce(client, &sep_nonce, &sep_nonce_size); if (sep_nonce) { - plist_dict_insert_item(parameters, "ApSepNonce", plist_new_data((const char*)sep_nonce, sep_nonce_size)); + plist_dict_set_item(parameters, "ApSepNonce", plist_new_data((const char*)sep_nonce, sep_nonce_size)); } - plist_dict_insert_item(parameters, "ApProductionMode", plist_new_bool(1)); + plist_dict_set_item(parameters, "ApProductionMode", plist_new_bool(1)); if (client->image4supported) { - plist_dict_insert_item(parameters, "ApSecurityMode", plist_new_bool(1)); - plist_dict_insert_item(parameters, "ApSupportsImg4", plist_new_bool(1)); + plist_dict_set_item(parameters, "ApSecurityMode", plist_new_bool(1)); + plist_dict_set_item(parameters, "ApSupportsImg4", plist_new_bool(1)); } else { - plist_dict_insert_item(parameters, "ApSupportsImg4", plist_new_bool(0)); + plist_dict_set_item(parameters, "ApSupportsImg4", plist_new_bool(0)); } tss_parameters_add_from_manifest(parameters, build_identity); @@ -1503,19 +1503,19 @@ int get_tss_response(struct idevicerestore_client_t* client, plist_t build_ident plist_t node; node = plist_dict_get_item(pinfo, "Nonce"); if (node) { - plist_dict_insert_item(parameters, "BbNonce", plist_copy(node)); + plist_dict_set_item(parameters, "BbNonce", plist_copy(node)); } node = plist_dict_get_item(pinfo, "ChipID"); if (node) { - plist_dict_insert_item(parameters, "BbChipID", plist_copy(node)); + plist_dict_set_item(parameters, "BbChipID", plist_copy(node)); } node = plist_dict_get_item(pinfo, "CertID"); if (node) { - plist_dict_insert_item(parameters, "BbGoldCertId", plist_copy(node)); + plist_dict_set_item(parameters, "BbGoldCertId", plist_copy(node)); } node = plist_dict_get_item(pinfo, "ChipSerialNo"); if (node) { - plist_dict_insert_item(parameters, "BbSNUM", plist_copy(node)); + plist_dict_set_item(parameters, "BbSNUM", plist_copy(node)); } /* add baseband parameters */ @@ -1552,7 +1552,7 @@ void fixup_tss(plist_t tss) node2 = plist_dict_get_item(tss, "AppleLogo"); if (node2 && (plist_get_node_type(node2) == PLIST_DICT)) { plist_dict_remove_item(tss, "RestoreLogo"); - plist_dict_insert_item(tss, "RestoreLogo", plist_copy(node2)); + plist_dict_set_item(tss, "RestoreLogo", plist_copy(node2)); } } node = plist_dict_get_item(tss, "RestoreDeviceTree"); @@ -1560,7 +1560,7 @@ void fixup_tss(plist_t tss) node2 = plist_dict_get_item(tss, "DeviceTree"); if (node2 && (plist_get_node_type(node2) == PLIST_DICT)) { plist_dict_remove_item(tss, "RestoreDeviceTree"); - plist_dict_insert_item(tss, "RestoreDeviceTree", plist_copy(node2)); + plist_dict_set_item(tss, "RestoreDeviceTree", plist_copy(node2)); } } node = plist_dict_get_item(tss, "RestoreKernelCache"); @@ -1568,7 +1568,7 @@ void fixup_tss(plist_t tss) node2 = plist_dict_get_item(tss, "KernelCache"); if (node2 && (plist_get_node_type(node2) == PLIST_DICT)) { plist_dict_remove_item(tss, "RestoreKernelCache"); - plist_dict_insert_item(tss, "RestoreKernelCache", plist_copy(node2)); + plist_dict_set_item(tss, "RestoreKernelCache", plist_copy(node2)); } } } diff --git a/src/restore.c b/src/restore.c index adf4c8c..f60bec1 100644 --- a/src/restore.c +++ b/src/restore.c @@ -743,7 +743,7 @@ int restore_send_root_ticket(restored_client_t restore, struct idevicerestore_cl dict = plist_new_dict(); if (data && (len > 0)) { - plist_dict_insert_item(dict, "RootTicketData", plist_new_data((char*)data, len)); + plist_dict_set_item(dict, "RootTicketData", plist_new_data((char*)data, len)); } else { info("NOTE: not sending RootTicketData (no data present)\n"); } @@ -807,7 +807,7 @@ int restore_send_kernelcache(restored_client_t restore, struct idevicerestore_cl dict = plist_new_dict(); blob = plist_new_data((char*)data, size); - plist_dict_insert_item(dict, "KernelCacheFile", blob); + plist_dict_set_item(dict, "KernelCacheFile", blob); info("Sending KernelCache now...\n"); restore_error = restored_send(restore, dict); @@ -900,7 +900,7 @@ int restore_send_nor(restored_client_t restore, struct idevicerestore_client_t* component_size = 0; dict = plist_new_dict(); - plist_dict_insert_item(dict, "LlbImageData", plist_new_data((char*)llb_data, (uint64_t) llb_size)); + plist_dict_set_item(dict, "LlbImageData", plist_new_data((char*)llb_data, (uint64_t) llb_size)); if (llb_data) free(llb_data); @@ -948,7 +948,7 @@ int restore_send_nor(restored_client_t restore, struct idevicerestore_client_t* nor_size = 0; filename = strtok(NULL, "\r\n"); } - plist_dict_insert_item(dict, "NorImageData", norimage_array); + plist_dict_set_item(dict, "NorImageData", norimage_array); unsigned char* personalized_data = NULL; unsigned int personalized_size = 0; @@ -972,7 +972,7 @@ int restore_send_nor(restored_client_t restore, struct idevicerestore_client_t* component_data = NULL; component_size = 0; - plist_dict_insert_item(dict, "RestoreSEPImageData", plist_new_data((char*)personalized_data, (uint64_t) personalized_size)); + plist_dict_set_item(dict, "RestoreSEPImageData", plist_new_data((char*)personalized_data, (uint64_t) personalized_size)); free(personalized_data); personalized_data = NULL; personalized_size = 0; @@ -997,7 +997,7 @@ int restore_send_nor(restored_client_t restore, struct idevicerestore_client_t* component_data = NULL; component_size = 0; - plist_dict_insert_item(dict, "SEPImageData", plist_new_data((char*)personalized_data, (uint64_t) personalized_size)); + plist_dict_set_item(dict, "SEPImageData", plist_new_data((char*)personalized_data, (uint64_t) personalized_size)); free(personalized_data); personalized_data = NULL; personalized_size = 0; @@ -1431,13 +1431,13 @@ int restore_send_baseband_data(restored_client_t restore, struct idevicerestore_ if ((bb_nonce == NULL) || (client->restore->bbtss == NULL)) { /* populate parameters */ plist_t parameters = plist_new_dict(); - plist_dict_insert_item(parameters, "ApECID", plist_new_uint(client->ecid)); + plist_dict_set_item(parameters, "ApECID", plist_new_uint(client->ecid)); if (bb_nonce) { - plist_dict_insert_item(parameters, "BbNonce", plist_new_data((const char*)bb_nonce, bb_nonce_size)); + plist_dict_set_item(parameters, "BbNonce", plist_new_data((const char*)bb_nonce, bb_nonce_size)); } - plist_dict_insert_item(parameters, "BbChipID", plist_new_uint(bb_chip_id)); - plist_dict_insert_item(parameters, "BbGoldCertId", plist_new_uint(bb_cert_id)); - plist_dict_insert_item(parameters, "BbSNUM", plist_new_data((const char*)bb_snum, bb_snum_size)); + plist_dict_set_item(parameters, "BbChipID", plist_new_uint(bb_chip_id)); + plist_dict_set_item(parameters, "BbGoldCertId", plist_new_uint(bb_cert_id)); + plist_dict_set_item(parameters, "BbSNUM", plist_new_data((const char*)bb_snum, bb_snum_size)); tss_parameters_add_from_manifest(parameters, build_identity); @@ -1518,7 +1518,7 @@ int restore_send_baseband_data(restored_client_t restore, struct idevicerestore_ // send file dict = plist_new_dict(); - plist_dict_insert_item(dict, "BasebandData", plist_new_data(buffer, (uint64_t)sz)); + plist_dict_set_item(dict, "BasebandData", plist_new_data(buffer, (uint64_t)sz)); free(buffer); buffer = NULL; @@ -1704,8 +1704,8 @@ int restore_device(struct idevicerestore_client_t* client, plist_t build_identit plist_t opts = plist_new_dict(); // FIXME: required? - //plist_dict_insert_item(opts, "AuthInstallRestoreBehavior", plist_new_string("Erase")); - plist_dict_insert_item(opts, "AutoBootDelay", plist_new_uint(0)); + //plist_dict_set_item(opts, "AuthInstallRestoreBehavior", plist_new_string("Erase")); + plist_dict_set_item(opts, "AutoBootDelay", plist_new_uint(0)); if (client->preflight_info) { plist_t node; @@ -1714,68 +1714,68 @@ int restore_device(struct idevicerestore_client_t* client, plist_t build_identit plist_dict_remove_item(bbus, "FusingStatus"); plist_dict_remove_item(bbus, "PkHash"); - plist_dict_insert_item(opts, "BBUpdaterState", bbus); + plist_dict_set_item(opts, "BBUpdaterState", bbus); node = plist_dict_get_item(client->preflight_info, "Nonce"); if (node) { - plist_dict_insert_item(opts, "BasebandNonce", plist_copy(node)); + plist_dict_set_item(opts, "BasebandNonce", plist_copy(node)); } } // FIXME: new on iOS 5 ? - plist_dict_insert_item(opts, "BootImageType", plist_new_string("UserOrInternal")); + plist_dict_set_item(opts, "BootImageType", plist_new_string("UserOrInternal")); // FIXME: required? - //plist_dict_insert_item(opts, "BootImageFile", plist_new_string("018-7923-347.dmg")); - plist_dict_insert_item(opts, "CreateFilesystemPartitions", plist_new_bool(1)); - plist_dict_insert_item(opts, "DFUFileType", plist_new_string("RELEASE")); - plist_dict_insert_item(opts, "DataImage", plist_new_bool(0)); + //plist_dict_set_item(opts, "BootImageFile", plist_new_string("018-7923-347.dmg")); + plist_dict_set_item(opts, "CreateFilesystemPartitions", plist_new_bool(1)); + plist_dict_set_item(opts, "DFUFileType", plist_new_string("RELEASE")); + plist_dict_set_item(opts, "DataImage", plist_new_bool(0)); // FIXME: not required for iOS 5? - //plist_dict_insert_item(opts, "DeviceTreeFile", plist_new_string("DeviceTree.k48ap.img3")); - plist_dict_insert_item(opts, "FirmwareDirectory", plist_new_string(".")); + //plist_dict_set_item(opts, "DeviceTreeFile", plist_new_string("DeviceTree.k48ap.img3")); + plist_dict_set_item(opts, "FirmwareDirectory", plist_new_string(".")); // FIXME: usable if false? (-x parameter) - plist_dict_insert_item(opts, "FlashNOR", plist_new_bool(1)); + plist_dict_set_item(opts, "FlashNOR", plist_new_bool(1)); // FIXME: not required for iOS 5? - //plist_dict_insert_item(opts, "KernelCacheFile", plist_new_string("kernelcache.release.k48")); + //plist_dict_set_item(opts, "KernelCacheFile", plist_new_string("kernelcache.release.k48")); // FIXME: new on iOS 5 ? - plist_dict_insert_item(opts, "KernelCacheType", plist_new_string("Release")); + plist_dict_set_item(opts, "KernelCacheType", plist_new_string("Release")); // FIXME: not required for iOS 5? - //plist_dict_insert_item(opts, "NORImagePath", plist_new_string(".")); + //plist_dict_set_item(opts, "NORImagePath", plist_new_string(".")); // FIXME: new on iOS 5 ? - plist_dict_insert_item(opts, "NORImageType", plist_new_string("production")); + plist_dict_set_item(opts, "NORImageType", plist_new_string("production")); // FIXME: not required for iOS 5? - //plist_dict_insert_item(opts, "PersonalizedRestoreBundlePath", plist_new_string("/tmp/Per2.tmp")); + //plist_dict_set_item(opts, "PersonalizedRestoreBundlePath", plist_new_string("/tmp/Per2.tmp")); if (client->restore_boot_args) { - plist_dict_insert_item(opts, "RestoreBootArgs", plist_new_string(client->restore_boot_args)); + plist_dict_set_item(opts, "RestoreBootArgs", plist_new_string(client->restore_boot_args)); } - plist_dict_insert_item(opts, "RestoreBundlePath", plist_new_string("/tmp/Per2.tmp")); - plist_dict_insert_item(opts, "RootToInstall", plist_new_bool(0)); + plist_dict_set_item(opts, "RestoreBundlePath", plist_new_string("/tmp/Per2.tmp")); + plist_dict_set_item(opts, "RootToInstall", plist_new_bool(0)); // FIXME: not required for iOS 5? - //plist_dict_insert_item(opts, "SourceRestoreBundlePath", plist_new_string("/tmp")); - plist_dict_insert_item(opts, "SystemImage", plist_new_bool(1)); + //plist_dict_set_item(opts, "SourceRestoreBundlePath", plist_new_string("/tmp")); + plist_dict_set_item(opts, "SystemImage", plist_new_bool(1)); plist_t spp = plist_new_dict(); { - plist_dict_insert_item(spp, "128", plist_new_uint(1280)); - plist_dict_insert_item(spp, "16", plist_new_uint(160)); - plist_dict_insert_item(spp, "32", plist_new_uint(320)); - plist_dict_insert_item(spp, "64", plist_new_uint(640)); - plist_dict_insert_item(spp, "8", plist_new_uint(80)); + plist_dict_set_item(spp, "128", plist_new_uint(1280)); + plist_dict_set_item(spp, "16", plist_new_uint(160)); + plist_dict_set_item(spp, "32", plist_new_uint(320)); + plist_dict_set_item(spp, "64", plist_new_uint(640)); + plist_dict_set_item(spp, "8", plist_new_uint(80)); } // FIXME: new on iOS 5 ? - plist_dict_insert_item(opts, "SystemImageType", plist_new_string("User")); + plist_dict_set_item(opts, "SystemImageType", plist_new_string("User")); - plist_dict_insert_item(opts, "SystemPartitionPadding", spp); + plist_dict_set_item(opts, "SystemPartitionPadding", spp); char* guid = generate_guid(); if (guid) { - plist_dict_insert_item(opts, "UUID", plist_new_string(guid)); + plist_dict_set_item(opts, "UUID", plist_new_string(guid)); free(guid); } // FIXME: does this have any effect actually? - plist_dict_insert_item(opts, "UpdateBaseband", plist_new_bool(0)); + plist_dict_set_item(opts, "UpdateBaseband", plist_new_bool(0)); // FIXME: not required for iOS 5? - //plist_dict_insert_item(opts, "UserLocale", plist_new_string("en_US")); + //plist_dict_set_item(opts, "UserLocale", plist_new_string("en_US")); /* this is mandatory on iOS 7+ to allow restore from normal mode */ - plist_dict_insert_item(opts, "PersonalizedDuringPreflight", plist_new_bool(1)); + plist_dict_set_item(opts, "PersonalizedDuringPreflight", plist_new_bool(1)); // start the restore process restore_error = restored_start_restore(restore, opts, client->restore->protocol_version); diff --git a/src/tss.c b/src/tss.c index 8de6fb3..99c4538 100644 --- a/src/tss.c +++ b/src/tss.c @@ -56,8 +56,8 @@ plist_t tss_request_new(plist_t overrides) { plist_t request = plist_new_dict(); - plist_dict_insert_item(request, "@Locality", plist_new_string("en_US")); - plist_dict_insert_item(request, "@HostPlatformInfo", + plist_dict_set_item(request, "@Locality", plist_new_string("en_US")); + plist_dict_set_item(request, "@HostPlatformInfo", #ifdef WIN32 plist_new_string("windows") #else @@ -65,10 +65,10 @@ plist_t tss_request_new(plist_t overrides) { #endif ); - plist_dict_insert_item(request, "@VersionInfo", plist_new_string(TSS_CLIENT_VERSION_STRING)); + plist_dict_set_item(request, "@VersionInfo", plist_new_string(TSS_CLIENT_VERSION_STRING)); char* guid = generate_guid(); if (guid) { - plist_dict_insert_item(request, "@UUID", plist_new_string(guid)); + plist_dict_set_item(request, "@UUID", plist_new_string(guid)); free(guid); } @@ -91,7 +91,7 @@ int tss_parameters_add_from_manifest(plist_t parameters, plist_t build_identity) error("ERROR: Unable to find UniqueBuildID node\n"); return -1; } - plist_dict_insert_item(parameters, "UniqueBuildID", plist_copy(node)); + plist_dict_set_item(parameters, "UniqueBuildID", plist_copy(node)); node = NULL; /* ApChipID */ @@ -103,7 +103,7 @@ int tss_parameters_add_from_manifest(plist_t parameters, plist_t build_identity) } plist_get_string_val(node, &string); sscanf(string, "%x", &chip_id); - plist_dict_insert_item(parameters, "ApChipID", plist_new_uint(chip_id)); + plist_dict_set_item(parameters, "ApChipID", plist_new_uint(chip_id)); free(string); string = NULL; node = NULL; @@ -117,7 +117,7 @@ int tss_parameters_add_from_manifest(plist_t parameters, plist_t build_identity) } plist_get_string_val(node, &string); sscanf(string, "%x", &board_id); - plist_dict_insert_item(parameters, "ApBoardID", plist_new_uint(board_id)); + plist_dict_set_item(parameters, "ApBoardID", plist_new_uint(board_id)); free(string); string = NULL; node = NULL; @@ -131,7 +131,7 @@ int tss_parameters_add_from_manifest(plist_t parameters, plist_t build_identity) } plist_get_string_val(node, &string); sscanf(string, "%x", &security_domain); - plist_dict_insert_item(parameters, "ApSecurityDomain", plist_new_uint(security_domain)); + plist_dict_set_item(parameters, "ApSecurityDomain", plist_new_uint(security_domain)); free(string); string = NULL; node = NULL; @@ -143,7 +143,7 @@ int tss_parameters_add_from_manifest(plist_t parameters, plist_t build_identity) if (node && plist_get_node_type(node) == PLIST_STRING) { plist_get_string_val(node, &bb_chip_id_string); sscanf(bb_chip_id_string, "%x", &bb_chip_id); - plist_dict_insert_item(parameters, "BbChipID", plist_new_uint(bb_chip_id)); + plist_dict_set_item(parameters, "BbChipID", plist_new_uint(bb_chip_id)); } else { error("WARNING: Unable to find BbChipID node\n"); } @@ -152,7 +152,7 @@ int tss_parameters_add_from_manifest(plist_t parameters, plist_t build_identity) /* BbProvisioningManifestKeyHash */ node = plist_dict_get_item(build_identity, "BbProvisioningManifestKeyHash"); if (node && plist_get_node_type(node) == PLIST_DATA) { - plist_dict_insert_item(parameters, "BbProvisioningManifestKeyHash", plist_copy(node)); + plist_dict_set_item(parameters, "BbProvisioningManifestKeyHash", plist_copy(node)); } else { debug("NOTE: Unable to find BbProvisioningManifestKeyHash node\n"); } @@ -161,7 +161,7 @@ int tss_parameters_add_from_manifest(plist_t parameters, plist_t build_identity) /* BbActivationManifestKeyHash - Used by Qualcomm MDM6610 */ node = plist_dict_get_item(build_identity, "BbActivationManifestKeyHash"); if (node && plist_get_node_type(node) == PLIST_DATA) { - plist_dict_insert_item(parameters, "BbActivationManifestKeyHash", plist_copy(node)); + plist_dict_set_item(parameters, "BbActivationManifestKeyHash", plist_copy(node)); } else { debug("NOTE: Unable to find BbActivationManifestKeyHash node\n"); } @@ -169,7 +169,7 @@ int tss_parameters_add_from_manifest(plist_t parameters, plist_t build_identity) node = plist_dict_get_item(build_identity, "BbCalibrationManifestKeyHash"); if (node && plist_get_node_type(node) == PLIST_DATA) { - plist_dict_insert_item(parameters, "BbCalibrationManifestKeyHash", plist_copy(node)); + plist_dict_set_item(parameters, "BbCalibrationManifestKeyHash", plist_copy(node)); } else { debug("NOTE: Unable to find BbCalibrationManifestKeyHash node\n"); } @@ -178,7 +178,7 @@ int tss_parameters_add_from_manifest(plist_t parameters, plist_t build_identity) /* BbFactoryActivationManifestKeyHash */ node = plist_dict_get_item(build_identity, "BbFactoryActivationManifestKeyHash"); if (node && plist_get_node_type(node) == PLIST_DATA) { - plist_dict_insert_item(parameters, "BbFactoryActivationManifestKeyHash", plist_copy(node)); + plist_dict_set_item(parameters, "BbFactoryActivationManifestKeyHash", plist_copy(node)); } else { debug("NOTE: Unable to find BbFactoryActivationManifestKeyHash node\n"); } @@ -187,7 +187,7 @@ int tss_parameters_add_from_manifest(plist_t parameters, plist_t build_identity) /* BbSkeyId - Used by XMM 6180/GSM */ node = plist_dict_get_item(build_identity, "BbSkeyId"); if (node && plist_get_node_type(node) == PLIST_DATA) { - plist_dict_insert_item(parameters, "BbSkeyId", plist_copy(node)); + plist_dict_set_item(parameters, "BbSkeyId", plist_copy(node)); } else { error("WARNING: Unable to find BbSkeyId node\n"); } @@ -199,7 +199,7 @@ int tss_parameters_add_from_manifest(plist_t parameters, plist_t build_identity) error("ERROR: Unable to find Manifest node\n"); return -1; } - plist_dict_insert_item(parameters, "Manifest", plist_copy(node)); + plist_dict_set_item(parameters, "Manifest", plist_copy(node)); return 0; } @@ -218,7 +218,7 @@ int tss_request_add_ap_img4_tags(plist_t request, plist_t parameters) { error("ERROR: Unable to find required ApECID in parameters\n"); return -1; } - plist_dict_insert_item(request, "ApECID", plist_copy(node)); + plist_dict_set_item(request, "ApECID", plist_copy(node)); node = NULL; /* ApNonce */ @@ -227,10 +227,10 @@ int tss_request_add_ap_img4_tags(plist_t request, plist_t parameters) { error("ERROR: Unable to find required ApNonce in parameters\n"); return -1; } - plist_dict_insert_item(request, "ApNonce", plist_copy(node)); + plist_dict_set_item(request, "ApNonce", plist_copy(node)); node = NULL; - plist_dict_insert_item(request, "@ApImg4Ticket", plist_new_bool(1)); + plist_dict_set_item(request, "@ApImg4Ticket", plist_new_bool(1)); /* ApSecurityMode */ node = plist_dict_get_item(request, "ApSecurityMode"); @@ -241,7 +241,7 @@ int tss_request_add_ap_img4_tags(plist_t request, plist_t parameters) { error("ERROR: Unable to find required ApSecurityMode in parameters\n"); return -1; } - plist_dict_insert_item(request, "ApSecurityMode", plist_copy(node)); + plist_dict_set_item(request, "ApSecurityMode", plist_copy(node)); node = NULL; } @@ -253,7 +253,7 @@ int tss_request_add_ap_img4_tags(plist_t request, plist_t parameters) { error("ERROR: Unable to find required ApProductionMode in parameters\n"); return -1; } - plist_dict_insert_item(request, "ApProductionMode", plist_copy(node)); + plist_dict_set_item(request, "ApProductionMode", plist_copy(node)); node = NULL; } @@ -263,7 +263,7 @@ int tss_request_add_ap_img4_tags(plist_t request, plist_t parameters) { error("ERROR: Unable to find required ApSepNonce in parameters\n"); return -1; } - plist_dict_insert_item(request, "SepNonce", plist_copy(node)); + plist_dict_set_item(request, "SepNonce", plist_copy(node)); node = NULL; return 0; @@ -284,12 +284,12 @@ int tss_request_add_ap_img3_tags(plist_t request, plist_t parameters) { error("ERROR: Unable to find required ApNonce in parameters\n"); return -1; } - plist_dict_insert_item(request, "ApNonce", plist_copy(node)); + plist_dict_set_item(request, "ApNonce", plist_copy(node)); node = NULL; } /* @APTicket */ - plist_dict_insert_item(request, "@APTicket", plist_new_bool(1)); + plist_dict_set_item(request, "@APTicket", plist_new_bool(1)); /* ApECID */ node = plist_dict_get_item(parameters, "ApECID"); @@ -297,7 +297,7 @@ int tss_request_add_ap_img3_tags(plist_t request, plist_t parameters) { error("ERROR: Unable to find required ApECID in parameters\n"); return -1; } - plist_dict_insert_item(request, "ApECID", plist_copy(node)); + plist_dict_set_item(request, "ApECID", plist_copy(node)); node = NULL; /* ApBoardID */ @@ -330,7 +330,7 @@ int tss_request_add_ap_img3_tags(plist_t request, plist_t parameters) { error("ERROR: Unable to find required ApProductionMode in parameters\n"); return -1; } - plist_dict_insert_item(request, "ApProductionMode", plist_copy(node)); + plist_dict_set_item(request, "ApProductionMode", plist_copy(node)); node = NULL; return 0; @@ -342,28 +342,28 @@ int tss_request_add_common_tags(plist_t request, plist_t parameters, plist_t ove /* UniqueBuildID */ node = plist_dict_get_item(parameters, "UniqueBuildID"); if (node) { - plist_dict_insert_item(request, "UniqueBuildID", plist_copy(node)); + plist_dict_set_item(request, "UniqueBuildID", plist_copy(node)); } node = NULL; /* ApChipID */ node = plist_dict_get_item(parameters, "ApChipID"); if (node) { - plist_dict_insert_item(request, "ApChipID", plist_copy(node)); + plist_dict_set_item(request, "ApChipID", plist_copy(node)); } node = NULL; /* ApBoardID */ node = plist_dict_get_item(parameters, "ApBoardID"); if (node) { - plist_dict_insert_item(request, "ApBoardID", plist_copy(node)); + plist_dict_set_item(request, "ApBoardID", plist_copy(node)); } node = NULL; /* ApSecurityDomain */ node = plist_dict_get_item(parameters, "ApSecurityDomain"); if (node) { - plist_dict_insert_item(request, "ApSecurityDomain", plist_copy(node)); + plist_dict_set_item(request, "ApSecurityDomain", plist_copy(node)); } node = NULL; @@ -445,7 +445,7 @@ static void tss_entry_apply_restore_request_rules(plist_t tss_entry, plist_t par plist_dict_remove_item(tss_entry, key); } debug("DEBUG: Adding action %s to TSS entry\n", key); - plist_dict_insert_item(tss_entry, key, plist_new_bool(1)); + plist_dict_set_item(tss_entry, key, plist_new_bool(1)); } free(key); } @@ -500,7 +500,7 @@ int tss_request_add_ap_tags(plist_t request, plist_t parameters, plist_t overrid } /* finally add entry to request */ - plist_dict_insert_item(request, key, tss_entry); + plist_dict_set_item(request, key, tss_entry); free(key); } @@ -520,53 +520,53 @@ int tss_request_add_baseband_tags(plist_t request, plist_t parameters, plist_t o /* BbChipID */ node = plist_dict_get_item(parameters, "BbChipID"); if (node) { - plist_dict_insert_item(request, "BbChipID", plist_copy(node)); + plist_dict_set_item(request, "BbChipID", plist_copy(node)); } node = NULL; /* BbProvisioningManifestKeyHash */ node = plist_dict_get_item(parameters, "BbProvisioningManifestKeyHash"); if (node) { - plist_dict_insert_item(request, "BbProvisioningManifestKeyHash", plist_copy(node)); + plist_dict_set_item(request, "BbProvisioningManifestKeyHash", plist_copy(node)); } node = NULL; /* BbActivationManifestKeyHash - Used by Qualcomm MDM6610 */ node = plist_dict_get_item(parameters, "BbActivationManifestKeyHash"); if (node) { - plist_dict_insert_item(request, "BbActivationManifestKeyHash", plist_copy(node)); + plist_dict_set_item(request, "BbActivationManifestKeyHash", plist_copy(node)); } node = NULL; node = plist_dict_get_item(parameters, "BbCalibrationManifestKeyHash"); if (node) { - plist_dict_insert_item(request, "BbCalibrationManifestKeyHash", plist_copy(node)); + plist_dict_set_item(request, "BbCalibrationManifestKeyHash", plist_copy(node)); } node = NULL; /* BbFactoryActivationManifestKeyHash */ node = plist_dict_get_item(parameters, "BbFactoryActivationManifestKeyHash"); if (node) { - plist_dict_insert_item(request, "BbFactoryActivationManifestKeyHash", plist_copy(node)); + plist_dict_set_item(request, "BbFactoryActivationManifestKeyHash", plist_copy(node)); } node = NULL; /* BbSkeyId - Used by XMM 6180/GSM */ node = plist_dict_get_item(parameters, "BbSkeyId"); if (node) { - plist_dict_insert_item(request, "BbSkeyId", plist_copy(node)); + plist_dict_set_item(request, "BbSkeyId", plist_copy(node)); } node = NULL; /* BbNonce */ node = plist_dict_get_item(parameters, "BbNonce"); if (node) { - plist_dict_insert_item(request, "BbNonce", plist_copy(node)); + plist_dict_set_item(request, "BbNonce", plist_copy(node)); } node = NULL; /* @BBTicket */ - plist_dict_insert_item(request, "@BBTicket", plist_new_bool(1)); + plist_dict_set_item(request, "@BBTicket", plist_new_bool(1)); /* BbGoldCertId */ node = plist_dict_get_item(parameters, "BbGoldCertId"); @@ -574,7 +574,7 @@ int tss_request_add_baseband_tags(plist_t request, plist_t parameters, plist_t o error("ERROR: Unable to find required BbGoldCertId in parameters\n"); return -1; } - plist_dict_insert_item(request, "BbGoldCertId", plist_copy(node)); + plist_dict_set_item(request, "BbGoldCertId", plist_copy(node)); node = NULL; /* BbSNUM */ @@ -583,7 +583,7 @@ int tss_request_add_baseband_tags(plist_t request, plist_t parameters, plist_t o error("ERROR: Unable to find required BbSNUM in parameters\n"); return -1; } - plist_dict_insert_item(request, "BbSNUM", plist_copy(node)); + plist_dict_set_item(request, "BbSNUM", plist_copy(node)); node = NULL; /* BasebandFirmware */ @@ -597,7 +597,7 @@ int tss_request_add_baseband_tags(plist_t request, plist_t parameters, plist_t o if (plist_dict_get_item(bbfwdict, "Info")) { plist_dict_remove_item(bbfwdict, "Info"); } - plist_dict_insert_item(request, "BasebandFirmware", bbfwdict); + plist_dict_set_item(request, "BasebandFirmware", bbfwdict); /* apply overrides */ if (overrides) { -- cgit v1.1-32-gdbae