summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/ideviceprovision.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/tools/ideviceprovision.c b/tools/ideviceprovision.c
index 4915c05..77c27dc 100644
--- a/tools/ideviceprovision.c
+++ b/tools/ideviceprovision.c
@@ -3,7 +3,7 @@
3 * Simple utility to install, get, or remove provisioning profiles 3 * Simple utility to install, get, or remove provisioning profiles
4 * to/from idevices 4 * to/from idevices
5 * 5 *
6 * Copyright (c) 2012 Nikias Bassen, All Rights Reserved. 6 * Copyright (c) 2012-2016 Nikias Bassen, All Rights Reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
@@ -390,6 +390,28 @@ int main(int argc, char *argv[])
390 return -1; 390 return -1;
391 } 391 }
392 392
393 plist_t pver = NULL;
394 char *pver_s = NULL;
395 lockdownd_get_value(client, NULL, "ProductVersion", &pver);
396 if (pver && plist_get_node_type(pver) == PLIST_STRING) {
397 plist_get_string_val(pver, &pver_s);
398 }
399 plist_free(pver);
400 int product_version_major = 0;
401 int product_version_minor = 0;
402 int product_version_patch = 0;
403 if (pver_s) {
404 sscanf(pver_s, "%d.%d.%d", &product_version_major, &product_version_minor, &product_version_patch);
405 free(pver_s);
406 }
407 if (product_version_major == 0) {
408 fprintf(stderr, "ERROR: Could not determine the device's ProductVersion\n");
409 lockdownd_client_free(client);
410 idevice_free(device);
411 return -1;
412 }
413 int product_version = ((product_version_major & 0xFF) << 16) | ((product_version_minor & 0xFF) << 8) | (product_version_patch & 0xFF);
414
393 if (LOCKDOWN_E_SUCCESS != lockdownd_start_service(client, "com.apple.misagent", &service)) { 415 if (LOCKDOWN_E_SUCCESS != lockdownd_start_service(client, "com.apple.misagent", &service)) {
394 fprintf(stderr, "Could not start service \"com.apple.misagent\"\n"); 416 fprintf(stderr, "Could not start service \"com.apple.misagent\"\n");
395 lockdownd_client_free(client); 417 lockdownd_client_free(client);
@@ -437,7 +459,13 @@ int main(int argc, char *argv[])
437 case OP_COPY: 459 case OP_COPY:
438 { 460 {
439 plist_t profiles = NULL; 461 plist_t profiles = NULL;
440 if (misagent_copy(mis, &profiles) == MISAGENT_E_SUCCESS) { 462 misagent_error_t merr;
463 if (product_version < 0x090300) {
464 merr = misagent_copy(mis, &profiles);
465 } else {
466 merr = misagent_copy_all(mis, &profiles);
467 }
468 if (merr == MISAGENT_E_SUCCESS) {
441 uint32_t num_profiles = plist_array_get_size(profiles); 469 uint32_t num_profiles = plist_array_get_size(profiles);
442 printf("Device has %d provisioning %s installed:\n", num_profiles, (num_profiles == 1) ? "profile" : "profiles"); 470 printf("Device has %d provisioning %s installed:\n", num_profiles, (num_profiles == 1) ? "profile" : "profiles");
443 uint32_t j; 471 uint32_t j;