summaryrefslogtreecommitdiffstats
path: root/src/restore.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/restore.c')
-rw-r--r--src/restore.c60
1 files changed, 45 insertions, 15 deletions
diff --git a/src/restore.c b/src/restore.c
index a62886d..5c6011f 100644
--- a/src/restore.c
+++ b/src/restore.c
@@ -2687,7 +2687,7 @@ static plist_t restore_get_se_firmware_data(struct idevicerestore_client_t* clie
return response;
}
-static plist_t restore_get_savage_firmware_data(struct idevicerestore_client_t* client, plist_t p_info)
+static plist_t restore_get_savage_firmware_data(struct idevicerestore_client_t* client, plist_t p_info, plist_t arguments)
{
char *comp_name = NULL;
char *comp_path = NULL;
@@ -2704,6 +2704,12 @@ static plist_t restore_get_savage_firmware_data(struct idevicerestore_client_t*
return NULL;
}
+ plist_t device_generated_request = plist_dict_get_item(arguments, "DeviceGeneratedRequest");
+ if (device_generated_request && !PLIST_IS_DICT(device_generated_request)) {
+ error("ERROR: %s: DeviceGeneratedRequest has invalid type!\n", __func__);
+ return NULL;
+ }
+
/* create Savage request */
request = tss_request_new(NULL);
if (request == NULL) {
@@ -2720,7 +2726,7 @@ static plist_t restore_get_savage_firmware_data(struct idevicerestore_client_t*
plist_dict_merge(&parameters, p_info);
/* add required tags for Savage TSS request */
- tss_request_add_savage_tags(request, parameters, NULL, &comp_name);
+ tss_request_add_savage_tags(request, parameters, device_generated_request, &comp_name);
plist_free(parameters);
@@ -2783,7 +2789,7 @@ static plist_t restore_get_savage_firmware_data(struct idevicerestore_client_t*
return response;
}
-static plist_t restore_get_yonkers_firmware_data(struct idevicerestore_client_t* client, plist_t p_info)
+static plist_t restore_get_yonkers_firmware_data(struct idevicerestore_client_t* client, plist_t p_info, plist_t arguments)
{
char *comp_name = NULL;
char *comp_path = NULL;
@@ -2799,6 +2805,12 @@ static plist_t restore_get_yonkers_firmware_data(struct idevicerestore_client_t*
return NULL;
}
+ plist_t device_generated_request = plist_dict_get_item(arguments, "DeviceGeneratedRequest");
+ if (device_generated_request && !PLIST_IS_DICT(device_generated_request)) {
+ error("ERROR: %s: DeviceGeneratedRequest has invalid type!\n", __func__);
+ return NULL;
+ }
+
/* create Yonkers request */
request = tss_request_new(NULL);
if (request == NULL) {
@@ -2817,7 +2829,7 @@ static plist_t restore_get_yonkers_firmware_data(struct idevicerestore_client_t*
plist_dict_merge(&parameters, p_info);
/* add required tags for Yonkers TSS request */
- tss_request_add_yonkers_tags(request, parameters, NULL, &comp_name);
+ tss_request_add_yonkers_tags(request, parameters, device_generated_request, &comp_name);
plist_free(parameters);
@@ -3024,7 +3036,7 @@ static plist_t restore_get_rose_firmware_data(struct idevicerestore_client_t* cl
return response;
}
-static plist_t restore_get_veridian_firmware_data(struct idevicerestore_client_t* client, plist_t p_info)
+static plist_t restore_get_veridian_firmware_data(struct idevicerestore_client_t* client, plist_t p_info, plist_t arguments)
{
char *comp_name = "BMU,FirmwareMap";
char *comp_path = NULL;
@@ -3040,6 +3052,12 @@ static plist_t restore_get_veridian_firmware_data(struct idevicerestore_client_t
return NULL;
}
+ plist_t device_generated_request = plist_dict_get_item(arguments, "DeviceGeneratedRequest");
+ if (device_generated_request && !PLIST_IS_DICT(device_generated_request)) {
+ error("ERROR: %s: DeviceGeneratedRequest has invalid type!\n", __func__);
+ return NULL;
+ }
+
/* create Veridian request */
request = tss_request_new(NULL);
if (request == NULL) {
@@ -3057,7 +3075,7 @@ static plist_t restore_get_veridian_firmware_data(struct idevicerestore_client_t
plist_dict_merge(&parameters, p_info);
/* add required tags for Veridian TSS request */
- tss_request_add_veridian_tags(request, parameters, NULL);
+ tss_request_add_veridian_tags(request, parameters, device_generated_request);
plist_free(parameters);
@@ -3180,7 +3198,7 @@ static plist_t restore_get_generic_firmware_data(struct idevicerestore_client_t*
return response;
}
-static plist_t restore_get_tcon_firmware_data(struct idevicerestore_client_t* client, plist_t p_info)
+static plist_t restore_get_tcon_firmware_data(struct idevicerestore_client_t* client, plist_t p_info, plist_t arguments)
{
char *comp_name = "Baobab,TCON";
char *comp_path = NULL;
@@ -3196,6 +3214,12 @@ static plist_t restore_get_tcon_firmware_data(struct idevicerestore_client_t* cl
return NULL;
}
+ plist_t device_generated_request = plist_dict_get_item(arguments, "DeviceGeneratedRequest");
+ if (device_generated_request && !PLIST_IS_DICT(device_generated_request)) {
+ error("ERROR: %s: DeviceGeneratedRequest has invalid type!\n", __func__);
+ return NULL;
+ }
+
/* create Baobab request */
request = tss_request_new(NULL);
if (request == NULL) {
@@ -3213,7 +3237,7 @@ static plist_t restore_get_tcon_firmware_data(struct idevicerestore_client_t* cl
plist_dict_merge(&parameters, p_info);
/* add required tags for Baobab TSS request */
- tss_request_add_tcon_tags(request, parameters, NULL);
+ tss_request_add_tcon_tags(request, parameters, device_generated_request);
plist_free(parameters);
@@ -3254,7 +3278,7 @@ static plist_t restore_get_tcon_firmware_data(struct idevicerestore_client_t* cl
return response;
}
-static plist_t restore_get_timer_firmware_data(struct idevicerestore_client_t* client, plist_t p_info)
+static plist_t restore_get_timer_firmware_data(struct idevicerestore_client_t* client, plist_t p_info, plist_t arguments)
{
char comp_name[64];
char *comp_path = NULL;
@@ -3275,6 +3299,12 @@ static plist_t restore_get_timer_firmware_data(struct idevicerestore_client_t* c
return NULL;
}
+ plist_t device_generated_request = plist_dict_get_item(arguments, "DeviceGeneratedRequest");
+ if (device_generated_request && !PLIST_IS_DICT(device_generated_request)) {
+ error("ERROR: %s: DeviceGeneratedRequest has invalid type!\n", __func__);
+ return NULL;
+ }
+
/* create Timer request */
request = tss_request_new(NULL);
if (request == NULL) {
@@ -3345,7 +3375,7 @@ static plist_t restore_get_timer_firmware_data(struct idevicerestore_client_t* c
}
/* add required tags for Timer TSS request */
- tss_request_add_timer_tags(request, parameters, NULL);
+ tss_request_add_timer_tags(request, parameters, device_generated_request);
plist_free(parameters);
@@ -3642,9 +3672,9 @@ static int restore_send_firmware_updater_data(struct idevicerestore_client_t* cl
plist_t p_info2 = plist_dict_get_item(p_info, "YonkersDeviceInfo");
if (p_info2 && plist_get_node_type(p_info2) == PLIST_DICT) {
fwtype = "Yonkers";
- fwdict = restore_get_yonkers_firmware_data(client, p_info2);
+ fwdict = restore_get_yonkers_firmware_data(client, p_info2, arguments);
} else {
- fwdict = restore_get_savage_firmware_data(client, p_info);
+ fwdict = restore_get_savage_firmware_data(client, p_info, arguments);
}
if (fwdict == NULL) {
error("ERROR: %s: Couldn't get %s firmware data\n", __func__, fwtype);
@@ -3657,13 +3687,13 @@ static int restore_send_firmware_updater_data(struct idevicerestore_client_t* cl
goto error_out;
}
} else if (strcmp(s_updater_name, "T200") == 0) {
- fwdict = restore_get_veridian_firmware_data(client, p_info);
+ fwdict = restore_get_veridian_firmware_data(client, p_info, arguments);
if (fwdict == NULL) {
error("ERROR: %s: Couldn't get Veridian firmware data\n", __func__);
goto error_out;
}
} else if (strcmp(s_updater_name, "AppleTCON") == 0) {
- fwdict = restore_get_tcon_firmware_data(client, p_info);
+ fwdict = restore_get_tcon_firmware_data(client, p_info, arguments);
if (fwdict == NULL) {
error("ERROR: %s: Couldn't get AppleTCON firmware data\n", __func__);
goto error_out;
@@ -3675,7 +3705,7 @@ static int restore_send_firmware_updater_data(struct idevicerestore_client_t* cl
goto error_out;
}
} else if (strcmp(s_updater_name, "AppleTypeCRetimer") == 0) {
- fwdict = restore_get_timer_firmware_data(client, p_info);
+ fwdict = restore_get_timer_firmware_data(client, p_info, arguments);
if (fwdict == NULL) {
error("ERROR: %s: Couldn't get AppleTypeCRetimer firmware data\n", __func__);
goto error_out;