summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2025-06-12 12:59:53 +0200
committerGravatar Nikias Bassen2025-06-12 12:59:53 +0200
commit3bf294f149594b61aaa6dace57628c924af2f501 (patch)
tree132f6ae0e97ae0ce06224528d77caac2f14c430d
parentd3aec6dd14f81b75f212632da66a510c75c6b9e8 (diff)
downloadlibimobiledevice-3bf294f149594b61aaa6dace57628c924af2f501.tar.gz
libimobiledevice-3bf294f149594b61aaa6dace57628c924af2f501.tar.bz2
lockdown: Only query ProductVersion and DeviceClass if we are talking to lockdownd
In restore mode these requests fail so we need to make sure we are actually talking to lockdownd
-rw-r--r--src/lockdown.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lockdown.c b/src/lockdown.c
index 1edb99b..32389c9 100644
--- a/src/lockdown.c
+++ b/src/lockdown.c
@@ -643,16 +643,19 @@ lockdownd_error_t lockdownd_client_new(idevice_t device, lockdownd_client_t *cli
client_loc->label = label ? strdup(label) : NULL;
+ int is_lockdownd = 0;
if (lockdownd_query_type(client_loc, &type) != LOCKDOWN_E_SUCCESS) {
debug_info("QueryType failed in the lockdownd client.");
- } else if (strcmp("com.apple.mobile.lockdown", type) != 0) {
- debug_info("Warning QueryType request returned \"%s\".", type);
+ } else if (!strcmp("com.apple.mobile.lockdown", type)) {
+ is_lockdownd = 1;
+ } else {
+ debug_info("QueryType request returned \"%s\"", type);
}
free(type);
*client = client_loc;
- if (device->version == 0) {
+ if (is_lockdownd && device->version == 0) {
plist_t p_version = NULL;
if (lockdownd_get_value(client_loc, NULL, "ProductVersion", &p_version) == LOCKDOWN_E_SUCCESS) {
int vers[3] = {0, 0, 0};
@@ -665,7 +668,7 @@ lockdownd_error_t lockdownd_client_new(idevice_t device, lockdownd_client_t *cli
}
plist_free(p_version);
}
- if (device->device_class == 0) {
+ if (is_lockdownd && device->device_class == 0) {
plist_t p_device_class = NULL;
if (lockdownd_get_value(client_loc, NULL, "DeviceClass", &p_device_class) == LOCKDOWN_E_SUCCESS) {
char* s_device_class = NULL;