diff options
| -rw-r--r-- | src/service.c | 4 | ||||
| -rw-r--r-- | tools/idevicebackup.c | 14 | ||||
| -rw-r--r-- | tools/idevicebackup2.c | 2 | ||||
| -rw-r--r-- | tools/idevicecrashreport.c | 9 | ||||
| -rw-r--r-- | tools/idevicediagnostics.c | 9 | ||||
| -rw-r--r-- | tools/idevicenotificationproxy.c | 2 | ||||
| -rw-r--r-- | tools/ideviceprovision.c | 7 | ||||
| -rw-r--r-- | tools/idevicescreenshot.c | 6 | ||||
| -rw-r--r-- | tools/idevicesetlocation.c | 5 |
9 files changed, 36 insertions, 22 deletions
diff --git a/src/service.c b/src/service.c index 88132d2..db529bb 100644 --- a/src/service.c +++ b/src/service.c | |||
| @@ -91,11 +91,11 @@ LIBIMOBILEDEVICE_API service_error_t service_client_factory_start_service(idevic | |||
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | lockdownd_service_descriptor_t service = NULL; | 93 | lockdownd_service_descriptor_t service = NULL; |
| 94 | lockdownd_start_service(lckd, service_name, &service); | 94 | lockdownd_error_t lerr = lockdownd_start_service(lckd, service_name, &service); |
| 95 | lockdownd_client_free(lckd); | 95 | lockdownd_client_free(lckd); |
| 96 | 96 | ||
| 97 | if (!service || service->port == 0) { | 97 | if (!service || service->port == 0) { |
| 98 | debug_info("Could not start service %s!", service_name); | 98 | debug_info("Could not start service %s: %s", service_name, lockdownd_strerror(lerr)); |
| 99 | return SERVICE_E_START_SERVICE_ERROR; | 99 | return SERVICE_E_START_SERVICE_ERROR; |
| 100 | } | 100 | } |
| 101 | 101 | ||
diff --git a/tools/idevicebackup.c b/tools/idevicebackup.c index 42f020d..1759f50 100644 --- a/tools/idevicebackup.c +++ b/tools/idevicebackup.c | |||
| @@ -598,15 +598,15 @@ static void do_post_notification(const char *notification) | |||
| 598 | } | 598 | } |
| 599 | } | 599 | } |
| 600 | 600 | ||
| 601 | lockdownd_start_service(client, NP_SERVICE_NAME, &service); | 601 | lockdownd_error_t ldret = lockdownd_start_service(client, NP_SERVICE_NAME, &service); |
| 602 | if (service && service->port) { | 602 | if (ldret == LOCKDOWN_E_SUCCESS) { |
| 603 | np_client_new(device, service, &np); | 603 | np_client_new(device, service, &np); |
| 604 | if (np) { | 604 | if (np) { |
| 605 | np_post_notification(np, notification); | 605 | np_post_notification(np, notification); |
| 606 | np_client_free(np); | 606 | np_client_free(np); |
| 607 | } | 607 | } |
| 608 | } else { | 608 | } else { |
| 609 | printf("Could not start %s\n", NP_SERVICE_NAME); | 609 | printf("Could not start %s: %s\n", NP_SERVICE_NAME, lockdownd_strerror(ldret)); |
| 610 | } | 610 | } |
| 611 | 611 | ||
| 612 | if (service) { | 612 | if (service) { |
| @@ -826,7 +826,7 @@ int main(int argc, char *argv[]) | |||
| 826 | }; | 826 | }; |
| 827 | np_observe_notifications(np, noties); | 827 | np_observe_notifications(np, noties); |
| 828 | } else { | 828 | } else { |
| 829 | printf("ERROR: Could not start service %s.\n", NP_SERVICE_NAME); | 829 | printf("ERROR: Could not start service %s: %s\n", NP_SERVICE_NAME, lockdownd_strerror(ldret)); |
| 830 | } | 830 | } |
| 831 | 831 | ||
| 832 | afc_client_t afc = NULL; | 832 | afc_client_t afc = NULL; |
| @@ -834,9 +834,11 @@ int main(int argc, char *argv[]) | |||
| 834 | /* start AFC, we need this for the lock file */ | 834 | /* start AFC, we need this for the lock file */ |
| 835 | service->port = 0; | 835 | service->port = 0; |
| 836 | service->ssl_enabled = 0; | 836 | service->ssl_enabled = 0; |
| 837 | ldret = lockdownd_start_service(client, "com.apple.afc", &service); | 837 | ldret = lockdownd_start_service(client, AFC_SERVICE_NAME, &service); |
| 838 | if ((ldret == LOCKDOWN_E_SUCCESS) && service->port) { | 838 | if ((ldret == LOCKDOWN_E_SUCCESS) && service->port) { |
| 839 | afc_client_new(device, service, &afc); | 839 | afc_client_new(device, service, &afc); |
| 840 | } else { | ||
| 841 | printf("ERROR: Could not start service %s: %s\n", AFC_SERVICE_NAME, lockdownd_strerror(ldret)); | ||
| 840 | } | 842 | } |
| 841 | } | 843 | } |
| 842 | 844 | ||
| @@ -1588,7 +1590,7 @@ files_out: | |||
| 1588 | if (manifest_path) | 1590 | if (manifest_path) |
| 1589 | free(manifest_path); | 1591 | free(manifest_path); |
| 1590 | } else { | 1592 | } else { |
| 1591 | printf("ERROR: Could not start service %s.\n", MOBILEBACKUP_SERVICE_NAME); | 1593 | printf("ERROR: Could not start service %s: %s\n", MOBILEBACKUP_SERVICE_NAME, lockdownd_strerror(ldret)); |
| 1592 | lockdownd_client_free(client); | 1594 | lockdownd_client_free(client); |
| 1593 | client = NULL; | 1595 | client = NULL; |
| 1594 | } | 1596 | } |
diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c index eff05ee..b024721 100644 --- a/tools/idevicebackup2.c +++ b/tools/idevicebackup2.c | |||
| @@ -639,7 +639,7 @@ static void do_post_notification(idevice_t device, const char *notification) | |||
| 639 | } | 639 | } |
| 640 | 640 | ||
| 641 | lockdownd_error_t ldret = lockdownd_start_service(lockdown, NP_SERVICE_NAME, &service); | 641 | lockdownd_error_t ldret = lockdownd_start_service(lockdown, NP_SERVICE_NAME, &service); |
| 642 | if (service && service->port) { | 642 | if (ldret == LOCKDOWN_E_SUCCESS) { |
| 643 | np_client_new(device, service, &np); | 643 | np_client_new(device, service, &np); |
| 644 | if (np) { | 644 | if (np) { |
| 645 | np_post_notification(np, notification); | 645 | np_post_notification(np, notification); |
diff --git a/tools/idevicecrashreport.c b/tools/idevicecrashreport.c index 4d3b686..7df8dd9 100644 --- a/tools/idevicecrashreport.c +++ b/tools/idevicecrashreport.c | |||
| @@ -47,6 +47,9 @@ | |||
| 47 | #define S_IFSOCK S_IFREG | 47 | #define S_IFSOCK S_IFREG |
| 48 | #endif | 48 | #endif |
| 49 | 49 | ||
| 50 | #define CRASH_REPORT_MOVER_SERVICE "com.apple.crashreportmover" | ||
| 51 | #define CRASH_REPORT_COPY_MOBILE_SERVICE "com.apple.crashreportcopymobile" | ||
| 52 | |||
| 50 | const char* target_directory = NULL; | 53 | const char* target_directory = NULL; |
| 51 | static int extract_raw_crash_reports = 0; | 54 | static int extract_raw_crash_reports = 0; |
| 52 | static int keep_crash_reports = 0; | 55 | static int keep_crash_reports = 0; |
| @@ -422,8 +425,9 @@ int main(int argc, char* argv[]) | |||
| 422 | 425 | ||
| 423 | /* start crash log mover service */ | 426 | /* start crash log mover service */ |
| 424 | lockdownd_service_descriptor_t service = NULL; | 427 | lockdownd_service_descriptor_t service = NULL; |
| 425 | lockdownd_error = lockdownd_start_service(lockdownd, "com.apple.crashreportmover", &service); | 428 | lockdownd_error = lockdownd_start_service(lockdownd, CRASH_REPORT_MOVER_SERVICE, &service); |
| 426 | if (lockdownd_error != LOCKDOWN_E_SUCCESS) { | 429 | if (lockdownd_error != LOCKDOWN_E_SUCCESS) { |
| 430 | fprintf(stderr, "ERROR: Could not start service %s: %s\n", CRASH_REPORT_MOVER_SERVICE, lockdownd_strerror(lockdownd_error)); | ||
| 427 | lockdownd_client_free(lockdownd); | 431 | lockdownd_client_free(lockdownd); |
| 428 | idevice_free(device); | 432 | idevice_free(device); |
| 429 | return -1; | 433 | return -1; |
| @@ -465,8 +469,9 @@ int main(int argc, char* argv[]) | |||
| 465 | return -1; | 469 | return -1; |
| 466 | } | 470 | } |
| 467 | 471 | ||
| 468 | lockdownd_error = lockdownd_start_service(lockdownd, "com.apple.crashreportcopymobile", &service); | 472 | lockdownd_error = lockdownd_start_service(lockdownd, CRASH_REPORT_COPY_MOBILE_SERVICE, &service); |
| 469 | if (lockdownd_error != LOCKDOWN_E_SUCCESS) { | 473 | if (lockdownd_error != LOCKDOWN_E_SUCCESS) { |
| 474 | fprintf(stderr, "ERROR: Could not start service %s: %s\n", CRASH_REPORT_COPY_MOBILE_SERVICE, lockdownd_strerror(lockdownd_error)); | ||
| 470 | lockdownd_client_free(lockdownd); | 475 | lockdownd_client_free(lockdownd); |
| 471 | idevice_free(device); | 476 | idevice_free(device); |
| 472 | return -1; | 477 | return -1; |
diff --git a/tools/idevicediagnostics.c b/tools/idevicediagnostics.c index 0e3e66e..66ed589 100644 --- a/tools/idevicediagnostics.c +++ b/tools/idevicediagnostics.c | |||
| @@ -213,13 +213,18 @@ int main(int argc, char **argv) | |||
| 213 | 213 | ||
| 214 | /* attempt to use newer diagnostics service available on iOS 5 and later */ | 214 | /* attempt to use newer diagnostics service available on iOS 5 and later */ |
| 215 | ret = lockdownd_start_service(lockdown_client, "com.apple.mobile.diagnostics_relay", &service); | 215 | ret = lockdownd_start_service(lockdown_client, "com.apple.mobile.diagnostics_relay", &service); |
| 216 | if (ret != LOCKDOWN_E_SUCCESS) { | 216 | if (ret == LOCKDOWN_E_INVALID_SERVICE) { |
| 217 | /* attempt to use older diagnostics service */ | 217 | /* attempt to use older diagnostics service */ |
| 218 | ret = lockdownd_start_service(lockdown_client, "com.apple.iosdiagnostics.relay", &service); | 218 | ret = lockdownd_start_service(lockdown_client, "com.apple.iosdiagnostics.relay", &service); |
| 219 | } | 219 | } |
| 220 | |||
| 221 | lockdownd_client_free(lockdown_client); | 220 | lockdownd_client_free(lockdown_client); |
| 222 | 221 | ||
| 222 | if (ret != LOCKDOWN_E_SUCCESS) { | ||
| 223 | idevice_free(device); | ||
| 224 | printf("ERROR: Could not start diagnostics relay service: %s\n", lockdownd_strerror(ret)); | ||
| 225 | goto cleanup; | ||
| 226 | } | ||
| 227 | |||
| 223 | result = EXIT_FAILURE; | 228 | result = EXIT_FAILURE; |
| 224 | 229 | ||
| 225 | if ((ret == LOCKDOWN_E_SUCCESS) && service && (service->port > 0)) { | 230 | if ((ret == LOCKDOWN_E_SUCCESS) && service && (service->port > 0)) { |
diff --git a/tools/idevicenotificationproxy.c b/tools/idevicenotificationproxy.c index cfc9260..00bcba8 100644 --- a/tools/idevicenotificationproxy.c +++ b/tools/idevicenotificationproxy.c | |||
| @@ -250,7 +250,7 @@ int main(int argc, char *argv[]) | |||
| 250 | } | 250 | } |
| 251 | } | 251 | } |
| 252 | } else { | 252 | } else { |
| 253 | printf("Could not start notification_proxy service on device.\n"); | 253 | printf("ERROR: Could not start service %s: %s\n", NP_SERVICE_NAME, lockdownd_strerror(ret)); |
| 254 | } | 254 | } |
| 255 | 255 | ||
| 256 | if (service) { | 256 | if (service) { |
diff --git a/tools/ideviceprovision.c b/tools/ideviceprovision.c index 36c69b0..1dee899 100644 --- a/tools/ideviceprovision.c +++ b/tools/ideviceprovision.c | |||
| @@ -481,8 +481,9 @@ int main(int argc, char *argv[]) | |||
| 481 | } | 481 | } |
| 482 | int product_version = ((product_version_major & 0xFF) << 16) | ((product_version_minor & 0xFF) << 8) | (product_version_patch & 0xFF); | 482 | int product_version = ((product_version_major & 0xFF) << 16) | ((product_version_minor & 0xFF) << 8) | (product_version_patch & 0xFF); |
| 483 | 483 | ||
| 484 | if (LOCKDOWN_E_SUCCESS != lockdownd_start_service(client, "com.apple.misagent", &service)) { | 484 | lockdownd_error_t lerr = lockdownd_start_service(client, MISAGENT_SERVICE_NAME, &service); |
| 485 | fprintf(stderr, "Could not start service \"com.apple.misagent\"\n"); | 485 | if (lerr != LOCKDOWN_E_SUCCESS) { |
| 486 | fprintf(stderr, "Could not start service %s: %s\n", MISAGENT_SERVICE_NAME, lockdownd_strerror(lerr)); | ||
| 486 | lockdownd_client_free(client); | 487 | lockdownd_client_free(client); |
| 487 | idevice_free(device); | 488 | idevice_free(device); |
| 488 | return -1; | 489 | return -1; |
| @@ -492,7 +493,7 @@ int main(int argc, char *argv[]) | |||
| 492 | 493 | ||
| 493 | misagent_client_t mis = NULL; | 494 | misagent_client_t mis = NULL; |
| 494 | if (misagent_client_new(device, service, &mis) != MISAGENT_E_SUCCESS) { | 495 | if (misagent_client_new(device, service, &mis) != MISAGENT_E_SUCCESS) { |
| 495 | fprintf(stderr, "Could not connect to \"com.apple.misagent\" on device\n"); | 496 | fprintf(stderr, "Could not connect to %s on device\n", MISAGENT_SERVICE_NAME); |
| 496 | if (service) | 497 | if (service) |
| 497 | lockdownd_service_descriptor_free(service); | 498 | lockdownd_service_descriptor_free(service); |
| 498 | lockdownd_client_free(client); | 499 | lockdownd_client_free(client); |
diff --git a/tools/idevicescreenshot.c b/tools/idevicescreenshot.c index 62bb4a3..9b1ffa3 100644 --- a/tools/idevicescreenshot.c +++ b/tools/idevicescreenshot.c | |||
| @@ -110,9 +110,9 @@ int main(int argc, char **argv) | |||
| 110 | return -1; | 110 | return -1; |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | lockdownd_start_service(lckd, "com.apple.mobile.screenshotr", &service); | 113 | lockdownd_error_t lerr = lockdownd_start_service(lckd, SCREENSHOTR_SERVICE_NAME, &service); |
| 114 | lockdownd_client_free(lckd); | 114 | lockdownd_client_free(lckd); |
| 115 | if (service && service->port > 0) { | 115 | if (lerr == LOCKDOWN_E_SUCCESS) { |
| 116 | if (screenshotr_client_new(device, service, &shotr) != SCREENSHOTR_E_SUCCESS) { | 116 | if (screenshotr_client_new(device, service, &shotr) != SCREENSHOTR_E_SUCCESS) { |
| 117 | printf("Could not connect to screenshotr!\n"); | 117 | printf("Could not connect to screenshotr!\n"); |
| 118 | } else { | 118 | } else { |
| @@ -142,7 +142,7 @@ int main(int argc, char **argv) | |||
| 142 | screenshotr_client_free(shotr); | 142 | screenshotr_client_free(shotr); |
| 143 | } | 143 | } |
| 144 | } else { | 144 | } else { |
| 145 | printf("Could not start screenshotr service! Remember that you have to mount the Developer disk image on your device if you want to use the screenshotr service.\n"); | 145 | printf("Could not start screenshotr service: %s\nRemember that you have to mount the Developer disk image on your device if you want to use the screenshotr service.\n", lockdownd_strerror(lerr)); |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | if (service) | 148 | if (service) |
diff --git a/tools/idevicesetlocation.c b/tools/idevicesetlocation.c index 412b47c..6237a1a 100644 --- a/tools/idevicesetlocation.c +++ b/tools/idevicesetlocation.c | |||
| @@ -141,10 +141,11 @@ int main(int argc, char **argv) | |||
| 141 | lockdownd_client_new_with_handshake(device, &lockdown, TOOL_NAME); | 141 | lockdownd_client_new_with_handshake(device, &lockdown, TOOL_NAME); |
| 142 | 142 | ||
| 143 | lockdownd_service_descriptor_t svc = NULL; | 143 | lockdownd_service_descriptor_t svc = NULL; |
| 144 | if (lockdownd_start_service(lockdown, DT_SIMULATELOCATION_SERVICE, &svc) != LOCKDOWN_E_SUCCESS) { | 144 | lockdownd_error_t lerr = lockdownd_start_service(lockdown, DT_SIMULATELOCATION_SERVICE, &svc); |
| 145 | if (lerr != LOCKDOWN_E_SUCCESS) { | ||
| 145 | lockdownd_client_free(lockdown); | 146 | lockdownd_client_free(lockdown); |
| 146 | idevice_free(device); | 147 | idevice_free(device); |
| 147 | printf("ERROR: Could not start the simulatelocation service. Make sure a developer disk image is mounted!\n"); | 148 | printf("ERROR: Could not start the simulatelocation service: %s\nMake sure a developer disk image is mounted!\n", lockdownd_strerror(lerr)); |
| 148 | return -1; | 149 | return -1; |
| 149 | } | 150 | } |
| 150 | lockdownd_client_free(lockdown); | 151 | lockdownd_client_free(lockdown); |
