Skip to content

Commit

Permalink
Prevent output of a few error messages that are actually not critical
Browse files Browse the repository at this point in the history
  • Loading branch information
FunkyM committed Nov 30, 2014
1 parent c52cbc1 commit 14a1c08
Showing 1 changed file with 59 additions and 34 deletions.
93 changes: 59 additions & 34 deletions src/activation.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,9 @@ IDEVICE_ACTIVATION_API idevice_activation_error_t idevice_activation_request_new

IDEVICE_ACTIVATION_API idevice_activation_error_t idevice_activation_request_new_from_lockdownd(idevice_activation_client_type_t client_type, lockdownd_client_t lockdown, idevice_activation_request** request)
{
uint8_t has_telephony_capability = 0;
uint8_t has_mobile_equipment_id = 0;

// check arguments
if (!lockdown) {
return IDEVICE_ACTIVATION_E_INTERNAL_ERROR;
Expand All @@ -601,7 +604,8 @@ IDEVICE_ACTIVATION_API idevice_activation_error_t idevice_activation_request_new

// add AppleSerialNumber
if ((lockdownd_get_value(lockdown, NULL, "SerialNumber", &node) != LOCKDOWN_E_SUCCESS) || !node || (plist_get_node_type(node) != PLIST_STRING)) {
fprintf(stderr, "%s: Unable to get SerialNumber from lockdownd\n", __func__);
if (debug_level > 0)
fprintf(stderr, "%s: Unable to get SerialNumber from lockdownd\n", __func__);
plist_free(fields);
return IDEVICE_ACTIVATION_E_INCOMPLETE_INFO;
} else {
Expand All @@ -612,48 +616,69 @@ IDEVICE_ACTIVATION_API idevice_activation_error_t idevice_activation_request_new
node = NULL;
}

// add IMEI
if ((lockdownd_get_value(lockdown, NULL, "InternationalMobileEquipmentIdentity", &node) != LOCKDOWN_E_SUCCESS) || !node || (plist_get_node_type(node) != PLIST_STRING)) {
fprintf(stderr, "%s: Unable to get IMEI from lockdownd\n", __func__);
// check if device has telephone capability
if ((lockdownd_get_value(lockdown, NULL, "TelephonyCapability", &node) != LOCKDOWN_E_SUCCESS) || !node || (plist_get_node_type(node) != PLIST_BOOLEAN)) {
has_telephony_capability = 0;
} else {
plist_dict_set_item(fields, "IMEI", plist_copy(node));
plist_get_bool_val(node, &has_telephony_capability);
}
if (node) {
plist_free(node);
node = NULL;
}

// add MEID
if ((lockdownd_get_value(lockdown, NULL, "MobileEquipmentIdentifier", &node) != LOCKDOWN_E_SUCCESS) || !node || (plist_get_node_type(node) != PLIST_STRING)) {
fprintf(stderr, "%s: Unable to get MEID from lockdownd\n", __func__);
} else {
plist_dict_set_item(fields, "MEID", plist_copy(node));
}
if (node) {
plist_free(node);
node = NULL;
}
if (has_telephony_capability) {
// add IMEI
if ((lockdownd_get_value(lockdown, NULL, "InternationalMobileEquipmentIdentity", &node) != LOCKDOWN_E_SUCCESS) || !node || (plist_get_node_type(node) != PLIST_STRING)) {
has_mobile_equipment_id = 0;
} else {
plist_dict_set_item(fields, "IMEI", plist_copy(node));
has_mobile_equipment_id = 1;
}
if (node) {
plist_free(node);
node = NULL;
}

// add IMSI
if ((lockdownd_get_value(lockdown, NULL, "InternationalMobileSubscriberIdentity", &node) != LOCKDOWN_E_SUCCESS) || !node || (plist_get_node_type(node) != PLIST_STRING)) {
fprintf(stderr, "%s: Unable to get IMSI from lockdownd\n", __func__);
} else {
plist_dict_set_item(fields, "IMSI", plist_copy(node));
}
if (node) {
plist_free(node);
node = NULL;
}
// add MEID
if ((lockdownd_get_value(lockdown, NULL, "MobileEquipmentIdentifier", &node) != LOCKDOWN_E_SUCCESS) || !node || (plist_get_node_type(node) != PLIST_STRING)) {
if (debug_level > 0)
fprintf(stderr, "%s: Unable to get MEID from lockdownd\n", __func__);
if (!has_mobile_equipment_id) {
plist_free(fields);
return IDEVICE_ACTIVATION_E_INCOMPLETE_INFO;
}
} else {
plist_dict_set_item(fields, "MEID", plist_copy(node));
}
if (node) {
plist_free(node);
node = NULL;
}

// add ICCID
if ((lockdownd_get_value(lockdown, NULL, "IntegratedCircuitCardIdentity", &node) != LOCKDOWN_E_SUCCESS) || !node || (plist_get_node_type(node) != PLIST_STRING)) {
fprintf(stderr, "%s: Unable to get ICCID from lockdownd\n", __func__);
} else {
plist_dict_set_item(fields, "ICCID", plist_copy(node));
}
if (node) {
plist_free(node);
node = NULL;
// add IMSI
if ((lockdownd_get_value(lockdown, NULL, "InternationalMobileSubscriberIdentity", &node) != LOCKDOWN_E_SUCCESS) || !node || (plist_get_node_type(node) != PLIST_STRING)) {
if (debug_level > 0)
fprintf(stderr, "%s: Unable to get IMSI from lockdownd\n", __func__);
} else {
plist_dict_set_item(fields, "IMSI", plist_copy(node));
}
if (node) {
plist_free(node);
node = NULL;
}

// add ICCID
if ((lockdownd_get_value(lockdown, NULL, "IntegratedCircuitCardIdentity", &node) != LOCKDOWN_E_SUCCESS) || !node || (plist_get_node_type(node) != PLIST_STRING)) {
if (debug_level > 0)
fprintf(stderr, "%s: Unable to get ICCID from lockdownd\n", __func__);
} else {
plist_dict_set_item(fields, "ICCID", plist_copy(node));
}
if (node) {
plist_free(node);
node = NULL;
}
}

// add activation-info
Expand Down

0 comments on commit 14a1c08

Please sign in to comment.