From 40fa8a1822b5994ae388755c9ad6d73cf3adbeac Mon Sep 17 00:00:00 2001 From: BALATON Zoltan Date: Wed, 22 Oct 2014 22:48:11 +0200 Subject: restore: Handle FDRTrustData request messages Only send an empty reply but this seems to be enough to restore devices that already have valid data. --- src/restore.c | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/src/restore.c b/src/restore.c index 7e23bd2..3fb20a9 100644 --- a/src/restore.c +++ b/src/restore.c @@ -1550,7 +1550,33 @@ leave: return res; } -int restore_handle_data_request_msg(struct idevicerestore_client_t* client, idevice_t device, restored_client_t restore, plist_t message, plist_t build_identity, const char* filesystem) { +int restore_send_fdr_trust_data(restored_client_t restore, idevice_t device) +{ + restored_error_t restore_error; + plist_t dict; + + info("About to send FDR Trust data...\n"); + + // FIXME: What should we send here? + /* Sending an empty dict makes it continue with FDR + * and this is what iTunes seems to be doing too */ + dict = plist_new_dict(); + + info("Sending FDR Trust data now...\n"); + restore_error = restored_send(restore, dict); + plist_free(dict); + if (restore_error != RESTORE_E_SUCCESS) { + error("ERROR: During sending FDR Trust data (%d)\n", restore_error); + return -1; + } + + info("Done sending FDR Trust Data\n"); + + return 0; +} + +int restore_handle_data_request_msg(struct idevicerestore_client_t* client, idevice_t device, restored_client_t restore, plist_t message, plist_t build_identity, const char* filesystem) +{ char* type = NULL; plist_t node = NULL; @@ -1600,8 +1626,16 @@ int restore_handle_data_request_msg(struct idevicerestore_client_t* client, idev error("ERROR: Unable to send baseband data\n"); return -1; } + } + + else if (!strcmp(type, "FDRTrustData")) { + if(restore_send_fdr_trust_data(restore, device) < 0) { + error("ERROR: Unable to send FDR Trust data\n"); + return -1; + } + } - } else { + else { // Unknown DataType!! error("Unknown data request '%s' received\n", type); if (idevicerestore_debug) -- cgit v1.1-32-gdbae