summaryrefslogtreecommitdiffstats
path: root/tools/idevicedebugserverproxy.c
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2013-02-26 03:20:56 +0100
committerGravatar Martin Szulecki2013-02-26 03:20:56 +0100
commitfcc1bb855efb6860417ed827d3b50feba24a9a8b (patch)
tree47d3c7d6a985dc647f7962329014c8116d657cc9 /tools/idevicedebugserverproxy.c
parent3b54aac30447bc02fafd721a63a752968628e7e0 (diff)
downloadlibimobiledevice-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/idevicedebugserverproxy.c')
-rw-r--r--tools/idevicedebugserverproxy.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/tools/idevicedebugserverproxy.c b/tools/idevicedebugserverproxy.c
index 3253e6a..32438ad 100644
--- a/tools/idevicedebugserverproxy.c
+++ b/tools/idevicedebugserverproxy.c
@@ -228,7 +228,7 @@ int main(int argc, char *argv[])
228 idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR; 228 idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR;
229 thread_t th; 229 thread_t th;
230 const char* udid = NULL; 230 const char* udid = NULL;
231 uint16_t port = 0; 231 lockdownd_service_descriptor_t service = NULL;
232 uint16_t local_port = 0; 232 uint16_t local_port = 0;
233 int result = EXIT_SUCCESS; 233 int result = EXIT_SUCCESS;
234 int i; 234 int i;
@@ -297,14 +297,14 @@ int main(int argc, char *argv[])
297 goto leave_cleanup; 297 goto leave_cleanup;
298 } 298 }
299 299
300 if ((lockdownd_start_service(lockdown, "com.apple.debugserver", &port) != LOCKDOWN_E_SUCCESS) || !port) { 300 if ((lockdownd_start_service(lockdown, "com.apple.debugserver", &service) != LOCKDOWN_E_SUCCESS) || !service->port) {
301 fprintf(stderr, "Could not start com.apple.debugserver!\nPlease make sure to mount the developer disk image first.\n"); 301 fprintf(stderr, "Could not start com.apple.debugserver!\nPlease make sure to mount the developer disk image first.\n");
302 result = EXIT_FAILURE; 302 result = EXIT_FAILURE;
303 goto leave_cleanup; 303 goto leave_cleanup;
304 } 304 }
305 305
306 if (idevice_connect(device, port, &connection) != IDEVICE_E_SUCCESS) { 306 if (idevice_connect(device, service->port, &connection) != IDEVICE_E_SUCCESS) {
307 fprintf(stderr, "Connection to debugserver port %d failed!\n", (int)port); 307 fprintf(stderr, "Connection to debugserver port %d failed!\n", (int)service->port);
308 result = EXIT_FAILURE; 308 result = EXIT_FAILURE;
309 goto leave_cleanup; 309 goto leave_cleanup;
310 } 310 }
@@ -320,7 +320,12 @@ int main(int argc, char *argv[])
320 320
321 socket_info.device_connection = connection; 321 socket_info.device_connection = connection;
322 socket_info.local_port = local_port; 322 socket_info.local_port = local_port;
323 socket_info.remote_port = port; 323 socket_info.remote_port = service->port;
324
325 if (service) {
326 lockdownd_service_descriptor_free(service);
327 service = NULL;
328 }
324 329
325 /* create local socket */ 330 /* create local socket */
326 socket_info.server_fd = socket_create(socket_info.local_port); 331 socket_info.server_fd = socket_create(socket_info.local_port);