Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Commit

Permalink
debugserver: Fix service startup for iOS 14b4+
Browse files Browse the repository at this point in the history
  • Loading branch information
nikias committed Sep 10, 2020
1 parent d857a83 commit 98056a8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions include/libimobiledevice/debugserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ extern "C" {
#include <libimobiledevice/lockdown.h>

#define DEBUGSERVER_SERVICE_NAME "com.apple.debugserver"
#define DEBUGSERVER_SECURE_SERVICE_NAME DEBUGSERVER_SERVICE_NAME ".DVTSecureSocketProxy"

/** Error Codes */
typedef enum {
Expand Down
1 change: 1 addition & 0 deletions include/libimobiledevice/lockdown.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ typedef struct lockdownd_pair_record *lockdownd_pair_record_t;
struct lockdownd_service_descriptor {
uint16_t port;
uint8_t ssl_enabled;
char* identifier;
};
typedef struct lockdownd_service_descriptor *lockdownd_service_descriptor_t;

Expand Down
11 changes: 9 additions & 2 deletions src/debugserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ LIBIMOBILEDEVICE_API debugserver_error_t debugserver_client_new(idevice_t device
debug_info("Creating base service client failed. Error: %i", ret);
return ret;
}
service_disable_bypass_ssl(parent, 1);

if (service->identifier && (strcmp(service->identifier, DEBUGSERVER_SECURE_SERVICE_NAME) != 0)) {
service_disable_bypass_ssl(parent, 1);
}

debugserver_client_t client_loc = (debugserver_client_t) malloc(sizeof(struct debugserver_client_private));
client_loc->parent = parent;
Expand All @@ -95,7 +98,11 @@ LIBIMOBILEDEVICE_API debugserver_error_t debugserver_client_new(idevice_t device
LIBIMOBILEDEVICE_API debugserver_error_t debugserver_client_start_service(idevice_t device, debugserver_client_t * client, const char* label)
{
debugserver_error_t err = DEBUGSERVER_E_UNKNOWN_ERROR;
service_client_factory_start_service(device, DEBUGSERVER_SERVICE_NAME, (void**)client, label, SERVICE_CONSTRUCTOR(debugserver_client_new), &err);
service_client_factory_start_service(device, DEBUGSERVER_SECURE_SERVICE_NAME, (void**)client, label, SERVICE_CONSTRUCTOR(debugserver_client_new), &err);
if (err != DEBUGSERVER_E_SUCCESS) {
err = DEBUGSERVER_E_UNKNOWN_ERROR;
service_client_factory_start_service(device, DEBUGSERVER_SERVICE_NAME, (void**)client, label, SERVICE_CONSTRUCTOR(debugserver_client_new), &err);
}
return err;
}

Expand Down
5 changes: 4 additions & 1 deletion src/lockdown.c
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,7 @@ static lockdownd_error_t lockdownd_do_start_service(lockdownd_client_t client, c
*service = (lockdownd_service_descriptor_t)malloc(sizeof(struct lockdownd_service_descriptor));
(*service)->port = 0;
(*service)->ssl_enabled = 0;
(*service)->identifier = strdup(identifier);

/* read service port number */
plist_t node = plist_dict_get_item(dict, "Port");
Expand Down Expand Up @@ -1511,8 +1512,10 @@ LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_data_classes_free(char **classe

LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_service_descriptor_free(lockdownd_service_descriptor_t service)
{
if (service)
if (service) {
free(service->identifier);
free(service);
}

return LOCKDOWN_E_SUCCESS;
}
Expand Down

0 comments on commit 98056a8

Please sign in to comment.