summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ideviceinstaller.c54
1 files changed, 39 insertions, 15 deletions
diff --git a/src/ideviceinstaller.c b/src/ideviceinstaller.c
index 7682536..51fbe7b 100644
--- a/src/ideviceinstaller.c
+++ b/src/ideviceinstaller.c
@@ -388,7 +388,11 @@ int main(int argc, char **argv)
388 instproxy_client_t ipc = NULL; 388 instproxy_client_t ipc = NULL;
389 np_client_t np = NULL; 389 np_client_t np = NULL;
390 afc_client_t afc = NULL; 390 afc_client_t afc = NULL;
391 uint16_t port = 0; 391#ifdef HAVE_LIBIMOBILEDEVICE_1_1_5
392 lockdownd_service_descriptor_t service = NULL;
393#else
394 uint16_t service = 0;
395#endif
392 int res = 0; 396 int res = 0;
393 397
394 parse_opts(argc, argv); 398 parse_opts(argc, argv);
@@ -408,13 +412,13 @@ int main(int argc, char **argv)
408 412
409 if ((lockdownd_start_service 413 if ((lockdownd_start_service
410 (client, "com.apple.mobile.notification_proxy", 414 (client, "com.apple.mobile.notification_proxy",
411 &port) != LOCKDOWN_E_SUCCESS) || !port) { 415 &service) != LOCKDOWN_E_SUCCESS) || !service) {
412 fprintf(stderr, 416 fprintf(stderr,
413 "Could not start com.apple.mobile.notification_proxy!\n"); 417 "Could not start com.apple.mobile.notification_proxy!\n");
414 goto leave_cleanup; 418 goto leave_cleanup;
415 } 419 }
416 420
417 if (np_client_new(phone, port, &np) != NP_E_SUCCESS) { 421 if (np_client_new(phone, service, &np) != NP_E_SUCCESS) {
418 fprintf(stderr, "Could not connect to notification_proxy!\n"); 422 fprintf(stderr, "Could not connect to notification_proxy!\n");
419 goto leave_cleanup; 423 goto leave_cleanup;
420 } 424 }
@@ -430,16 +434,22 @@ int main(int argc, char **argv)
430 np_observe_notifications(np, noties); 434 np_observe_notifications(np, noties);
431 435
432run_again: 436run_again:
433 port = 0; 437#ifdef HAVE_LIBIMOBILEDEVICE_1_1_5
434 if ((lockdownd_start_service 438 if (service) {
435 (client, "com.apple.mobile.installation_proxy", 439 lockdownd_service_descriptor_free(service);
436 &port) != LOCKDOWN_E_SUCCESS) || !port) { 440 }
441 service = NULL;
442#else
443 service = 0;
444#endif
445 if ((lockdownd_start_service(client, "com.apple.mobile.installation_proxy",
446 &service) != LOCKDOWN_E_SUCCESS) || !service) {
437 fprintf(stderr, 447 fprintf(stderr,
438 "Could not start com.apple.mobile.installation_proxy!\n"); 448 "Could not start com.apple.mobile.installation_proxy!\n");
439 goto leave_cleanup; 449 goto leave_cleanup;
440 } 450 }
441 451
442 if (instproxy_client_new(phone, port, &ipc) != INSTPROXY_E_SUCCESS) { 452 if (instproxy_client_new(phone, service, &ipc) != INSTPROXY_E_SUCCESS) {
443 fprintf(stderr, "Could not connect to installation_proxy!\n"); 453 fprintf(stderr, "Could not connect to installation_proxy!\n");
444 goto leave_cleanup; 454 goto leave_cleanup;
445 } 455 }
@@ -554,9 +564,16 @@ run_again:
554 uint64_t af = 0; 564 uint64_t af = 0;
555 char buf[8192]; 565 char buf[8192];
556 566
557 port = 0; 567#ifdef HAVE_LIBIMOBILEDEVICE_1_1_5
558 if ((lockdownd_start_service(client, "com.apple.afc", &port) != 568 if (service) {
559 LOCKDOWN_E_SUCCESS) || !port) { 569 lockdownd_service_descriptor_free(service);
570 }
571 service = NULL;
572#else
573 service = 0;
574#endif
575 if ((lockdownd_start_service(client, "com.apple.afc", &service) !=
576 LOCKDOWN_E_SUCCESS) || !service) {
560 fprintf(stderr, "Could not start com.apple.afc!\n"); 577 fprintf(stderr, "Could not start com.apple.afc!\n");
561 goto leave_cleanup; 578 goto leave_cleanup;
562 } 579 }
@@ -564,7 +581,7 @@ run_again:
564 lockdownd_client_free(client); 581 lockdownd_client_free(client);
565 client = NULL; 582 client = NULL;
566 583
567 if (afc_client_new(phone, port, &afc) != INSTPROXY_E_SUCCESS) { 584 if (afc_client_new(phone, service, &afc) != INSTPROXY_E_SUCCESS) {
568 fprintf(stderr, "Could not connect to AFC!\n"); 585 fprintf(stderr, "Could not connect to AFC!\n");
569 goto leave_cleanup; 586 goto leave_cleanup;
570 } 587 }
@@ -1013,8 +1030,15 @@ run_again:
1013 goto leave_cleanup; 1030 goto leave_cleanup;
1014 } 1031 }
1015 1032
1016 port = 0; 1033#ifdef HAVE_LIBIMOBILEDEVICE_1_1_5
1017 if ((lockdownd_start_service(client, "com.apple.afc", &port) != LOCKDOWN_E_SUCCESS) || !port) { 1034 if (service) {
1035 lockdownd_service_descriptor_free(service);
1036 }
1037 service = NULL;
1038#else
1039 service = 0;
1040#endif
1041 if ((lockdownd_start_service(client, "com.apple.afc", &service) != LOCKDOWN_E_SUCCESS) || !service) {
1018 fprintf(stderr, "Could not start com.apple.afc!\n"); 1042 fprintf(stderr, "Could not start com.apple.afc!\n");
1019 free(copy_path); 1043 free(copy_path);
1020 goto leave_cleanup; 1044 goto leave_cleanup;
@@ -1023,7 +1047,7 @@ run_again:
1023 lockdownd_client_free(client); 1047 lockdownd_client_free(client);
1024 client = NULL; 1048 client = NULL;
1025 1049
1026 if (afc_client_new(phone, port, &afc) != INSTPROXY_E_SUCCESS) { 1050 if (afc_client_new(phone, service, &afc) != INSTPROXY_E_SUCCESS) {
1027 fprintf(stderr, "Could not connect to AFC!\n"); 1051 fprintf(stderr, "Could not connect to AFC!\n");
1028 goto leave_cleanup; 1052 goto leave_cleanup;
1029 } 1053 }