diff options
| author | 2013-02-26 03:20:56 +0100 | |
|---|---|---|
| committer | 2013-02-26 03:20:56 +0100 | |
| commit | fcc1bb855efb6860417ed827d3b50feba24a9a8b (patch) | |
| tree | 47d3c7d6a985dc647f7962329014c8116d657cc9 /tools/idevicediagnostics.c | |
| parent | 3b54aac30447bc02fafd721a63a752968628e7e0 (diff) | |
| download | libimobiledevice-fcc1bb855efb6860417ed827d3b50feba24a9a8b.tar.gz libimobiledevice-fcc1bb855efb6860417ed827d3b50feba24a9a8b.tar.bz2 | |
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.
Diffstat (limited to 'tools/idevicediagnostics.c')
| -rw-r--r-- | tools/idevicediagnostics.c | 17 |
1 files changed, 11 insertions, 6 deletions
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) | |||
| 57 | lockdownd_client_t lockdown_client = NULL; | 57 | lockdownd_client_t lockdown_client = NULL; |
| 58 | diagnostics_relay_client_t diagnostics_client = NULL; | 58 | diagnostics_relay_client_t diagnostics_client = NULL; |
| 59 | lockdownd_error_t ret = LOCKDOWN_E_UNKNOWN_ERROR; | 59 | lockdownd_error_t ret = LOCKDOWN_E_UNKNOWN_ERROR; |
| 60 | uint16_t port = 0; | 60 | lockdownd_service_descriptor_t service = NULL; |
| 61 | int result = -1; | 61 | int result = -1; |
| 62 | int i; | 62 | int i; |
| 63 | const char *udid = NULL; | 63 | const char *udid = NULL; |
| @@ -173,23 +173,23 @@ int main(int argc, char **argv) | |||
| 173 | goto cleanup; | 173 | goto cleanup; |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(device, &lockdown_client, NULL)) { | 176 | if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(device, &lockdown_client, "idevicediagnostics")) { |
| 177 | idevice_free(device); | 177 | idevice_free(device); |
| 178 | printf("Unable to connect to lockdownd.\n"); | 178 | printf("Unable to connect to lockdownd.\n"); |
| 179 | goto cleanup; | 179 | goto cleanup; |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | /* attempt to use newer diagnostics service available on iOS 5 and later */ | 182 | /* attempt to use newer diagnostics service available on iOS 5 and later */ |
| 183 | ret = lockdownd_start_service(lockdown_client, "com.apple.mobile.diagnostics_relay", &port); | 183 | ret = lockdownd_start_service(lockdown_client, "com.apple.mobile.diagnostics_relay", &service); |
| 184 | if (ret != LOCKDOWN_E_SUCCESS) { | 184 | if (ret != LOCKDOWN_E_SUCCESS) { |
| 185 | /* attempt to use older diagnostics service */ | 185 | /* attempt to use older diagnostics service */ |
| 186 | ret = lockdownd_start_service(lockdown_client, "com.apple.iosdiagnostics.relay", &port); | 186 | ret = lockdownd_start_service(lockdown_client, "com.apple.iosdiagnostics.relay", &service); |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | lockdownd_client_free(lockdown_client); | 189 | lockdownd_client_free(lockdown_client); |
| 190 | 190 | ||
| 191 | if ((ret == LOCKDOWN_E_SUCCESS) && (port > 0)) { | 191 | if ((ret == LOCKDOWN_E_SUCCESS) && (service->port > 0)) { |
| 192 | if (diagnostics_relay_client_new(device, port, &diagnostics_client) != DIAGNOSTICS_RELAY_E_SUCCESS) { | 192 | if (diagnostics_relay_client_new(device, service, &diagnostics_client) != DIAGNOSTICS_RELAY_E_SUCCESS) { |
| 193 | printf("Could not connect to diagnostics_relay!\n"); | 193 | printf("Could not connect to diagnostics_relay!\n"); |
| 194 | result = -1; | 194 | result = -1; |
| 195 | } else { | 195 | } else { |
| @@ -258,6 +258,11 @@ int main(int argc, char **argv) | |||
| 258 | printf("Could not start diagnostics service!\n"); | 258 | printf("Could not start diagnostics service!\n"); |
| 259 | } | 259 | } |
| 260 | 260 | ||
| 261 | if (service) { | ||
| 262 | lockdownd_service_descriptor_free(service); | ||
| 263 | service = NULL; | ||
| 264 | } | ||
| 265 | |||
| 261 | idevice_free(device); | 266 | idevice_free(device); |
| 262 | 267 | ||
| 263 | cleanup: | 268 | cleanup: |
