From fcc1bb855efb6860417ed827d3b50feba24a9a8b Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Tue, 26 Feb 2013 03:20:56 +0100 Subject: Refactor port number use into service descriptor to enable SSL for services This is a major change which breaks API but is required in order to support SSL communication for services as used by network connections. --- tools/idevicediagnostics.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'tools/idevicediagnostics.c') diff --git a/tools/idevicediagnostics.c b/tools/idevicediagnostics.c index 10dab77..410d054 100644 --- a/tools/idevicediagnostics.c +++ b/tools/idevicediagnostics.c @@ -57,7 +57,7 @@ int main(int argc, char **argv) lockdownd_client_t lockdown_client = NULL; diagnostics_relay_client_t diagnostics_client = NULL; lockdownd_error_t ret = LOCKDOWN_E_UNKNOWN_ERROR; - uint16_t port = 0; + lockdownd_service_descriptor_t service = NULL; int result = -1; int i; const char *udid = NULL; @@ -173,23 +173,23 @@ int main(int argc, char **argv) goto cleanup; } - if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(device, &lockdown_client, NULL)) { + if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(device, &lockdown_client, "idevicediagnostics")) { idevice_free(device); printf("Unable to connect to lockdownd.\n"); goto cleanup; } /* attempt to use newer diagnostics service available on iOS 5 and later */ - ret = lockdownd_start_service(lockdown_client, "com.apple.mobile.diagnostics_relay", &port); + ret = lockdownd_start_service(lockdown_client, "com.apple.mobile.diagnostics_relay", &service); if (ret != LOCKDOWN_E_SUCCESS) { /* attempt to use older diagnostics service */ - ret = lockdownd_start_service(lockdown_client, "com.apple.iosdiagnostics.relay", &port); + ret = lockdownd_start_service(lockdown_client, "com.apple.iosdiagnostics.relay", &service); } lockdownd_client_free(lockdown_client); - if ((ret == LOCKDOWN_E_SUCCESS) && (port > 0)) { - if (diagnostics_relay_client_new(device, port, &diagnostics_client) != DIAGNOSTICS_RELAY_E_SUCCESS) { + if ((ret == LOCKDOWN_E_SUCCESS) && (service->port > 0)) { + if (diagnostics_relay_client_new(device, service, &diagnostics_client) != DIAGNOSTICS_RELAY_E_SUCCESS) { printf("Could not connect to diagnostics_relay!\n"); result = -1; } else { @@ -258,6 +258,11 @@ int main(int argc, char **argv) printf("Could not start diagnostics service!\n"); } + if (service) { + lockdownd_service_descriptor_free(service); + service = NULL; + } + idevice_free(device); cleanup: -- cgit v1.1-32-gdbae