You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
3.3 KiB

  1. From 98056a89648f431759c5fa4ed87c6ea6ba0cdd3f Mon Sep 17 00:00:00 2001
  2. From: Nikias Bassen <nikias@gmx.li>
  3. Date: Thu, 10 Sep 2020 15:12:21 +0200
  4. Subject: [PATCH] debugserver: Fix service startup for iOS 14b4+
  5. ---
  6. include/libimobiledevice/debugserver.h | 1 +
  7. include/libimobiledevice/lockdown.h | 1 +
  8. src/debugserver.c | 11 +++++++++--
  9. src/lockdown.c | 5 ++++-
  10. 4 files changed, 15 insertions(+), 3 deletions(-)
  11. --- a/include/libimobiledevice/debugserver.h
  12. +++ b/include/libimobiledevice/debugserver.h
  13. @@ -31,6 +31,7 @@ extern "C" {
  14. #include <libimobiledevice/lockdown.h>
  15. #define DEBUGSERVER_SERVICE_NAME "com.apple.debugserver"
  16. +#define DEBUGSERVER_SECURE_SERVICE_NAME DEBUGSERVER_SERVICE_NAME ".DVTSecureSocketProxy"
  17. /** Error Codes */
  18. typedef enum {
  19. --- a/include/libimobiledevice/lockdown.h
  20. +++ b/include/libimobiledevice/lockdown.h
  21. @@ -96,6 +96,7 @@ typedef struct lockdownd_pair_record *lockdownd_pair_record_t;
  22. struct lockdownd_service_descriptor {
  23. uint16_t port;
  24. uint8_t ssl_enabled;
  25. + char* identifier;
  26. };
  27. typedef struct lockdownd_service_descriptor *lockdownd_service_descriptor_t;
  28. --- a/src/debugserver.c
  29. +++ b/src/debugserver.c
  30. @@ -80,7 +80,10 @@ LIBIMOBILEDEVICE_API debugserver_error_t debugserver_client_new(idevice_t device
  31. debug_info("Creating base service client failed. Error: %i", ret);
  32. return ret;
  33. }
  34. - service_disable_bypass_ssl(parent, 1);
  35. +
  36. + if (service->identifier && (strcmp(service->identifier, DEBUGSERVER_SECURE_SERVICE_NAME) != 0)) {
  37. + service_disable_bypass_ssl(parent, 1);
  38. + }
  39. debugserver_client_t client_loc = (debugserver_client_t) malloc(sizeof(struct debugserver_client_private));
  40. client_loc->parent = parent;
  41. @@ -95,7 +98,11 @@ LIBIMOBILEDEVICE_API debugserver_error_t debugserver_client_new(idevice_t device
  42. LIBIMOBILEDEVICE_API debugserver_error_t debugserver_client_start_service(idevice_t device, debugserver_client_t * client, const char* label)
  43. {
  44. debugserver_error_t err = DEBUGSERVER_E_UNKNOWN_ERROR;
  45. - service_client_factory_start_service(device, DEBUGSERVER_SERVICE_NAME, (void**)client, label, SERVICE_CONSTRUCTOR(debugserver_client_new), &err);
  46. + service_client_factory_start_service(device, DEBUGSERVER_SECURE_SERVICE_NAME, (void**)client, label, SERVICE_CONSTRUCTOR(debugserver_client_new), &err);
  47. + if (err != DEBUGSERVER_E_SUCCESS) {
  48. + err = DEBUGSERVER_E_UNKNOWN_ERROR;
  49. + service_client_factory_start_service(device, DEBUGSERVER_SERVICE_NAME, (void**)client, label, SERVICE_CONSTRUCTOR(debugserver_client_new), &err);
  50. + }
  51. return err;
  52. }
  53. --- a/src/lockdown.c
  54. +++ b/src/lockdown.c
  55. @@ -1307,6 +1307,7 @@ static lockdownd_error_t lockdownd_do_start_service(lockdownd_client_t client, c
  56. *service = (lockdownd_service_descriptor_t)malloc(sizeof(struct lockdownd_service_descriptor));
  57. (*service)->port = 0;
  58. (*service)->ssl_enabled = 0;
  59. + (*service)->identifier = strdup(identifier);
  60. /* read service port number */
  61. plist_t node = plist_dict_get_item(dict, "Port");
  62. @@ -1511,8 +1512,10 @@ LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_data_classes_free(char **classe
  63. LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_service_descriptor_free(lockdownd_service_descriptor_t service)
  64. {
  65. - if (service)
  66. + if (service) {
  67. + free(service->identifier);
  68. free(service);
  69. + }
  70. return LOCKDOWN_E_SUCCESS;
  71. }