diff options
Diffstat (limited to 'dev/ideviceclient.c')
| -rw-r--r-- | dev/ideviceclient.c | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/dev/ideviceclient.c b/dev/ideviceclient.c index d467ee8..c8635d8 100644 --- a/dev/ideviceclient.c +++ b/dev/ideviceclient.c | |||
| @@ -45,13 +45,13 @@ static void notifier(const char *notification, void *userdata) | |||
| 45 | 45 | ||
| 46 | static void perform_notification(idevice_t phone, lockdownd_client_t client, const char *notification) | 46 | static void perform_notification(idevice_t phone, lockdownd_client_t client, const char *notification) |
| 47 | { | 47 | { |
| 48 | uint16_t nport = 0; | 48 | lockdownd_service_descriptor_t service = NULL; |
| 49 | np_client_t np; | 49 | np_client_t np; |
| 50 | 50 | ||
| 51 | lockdownd_start_service(client, "com.apple.mobile.notification_proxy", &nport); | 51 | lockdownd_start_service(client, "com.apple.mobile.notification_proxy", &service); |
| 52 | if (nport) { | 52 | if (service->port) { |
| 53 | printf("::::::::::::::: np was started ::::::::::::\n"); | 53 | printf("::::::::::::::: np was started ::::::::::::\n"); |
| 54 | np_client_new(phone, nport, &np); | 54 | np_client_new(phone, service, &np); |
| 55 | if (np) { | 55 | if (np) { |
| 56 | printf("::::::::: PostNotification %s\n", notification); | 56 | printf("::::::::: PostNotification %s\n", notification); |
| 57 | np_post_notification(np, notification); | 57 | np_post_notification(np, notification); |
| @@ -60,13 +60,18 @@ static void perform_notification(idevice_t phone, lockdownd_client_t client, con | |||
| 60 | } else { | 60 | } else { |
| 61 | printf("::::::::::::::: np was NOT started ::::::::::::\n"); | 61 | printf("::::::::::::::: np was NOT started ::::::::::::\n"); |
| 62 | } | 62 | } |
| 63 | |||
| 64 | if (service) { | ||
| 65 | lockdownd_service_descriptor_free(service); | ||
| 66 | service = NULL; | ||
| 67 | } | ||
| 63 | } | 68 | } |
| 64 | 69 | ||
| 65 | int main(int argc, char *argv[]) | 70 | int main(int argc, char *argv[]) |
| 66 | { | 71 | { |
| 67 | unsigned int bytes = 0; | 72 | unsigned int bytes = 0; |
| 68 | uint16_t port = 0, i = 0; | 73 | uint16_t i = 0; |
| 69 | uint16_t npp; | 74 | lockdownd_service_descriptor_t service = NULL; |
| 70 | lockdownd_client_t client = NULL; | 75 | lockdownd_client_t client = NULL; |
| 71 | idevice_t phone = NULL; | 76 | idevice_t phone = NULL; |
| 72 | uint64_t lockfile = 0; | 77 | uint64_t lockfile = 0; |
| @@ -102,19 +107,33 @@ int main(int argc, char *argv[]) | |||
| 102 | free(nnn); | 107 | free(nnn); |
| 103 | } | 108 | } |
| 104 | 109 | ||
| 105 | lockdownd_start_service(client, "com.apple.afc", &port); | 110 | lockdownd_start_service(client, "com.apple.afc", &service); |
| 106 | 111 | ||
| 107 | if (port) { | 112 | if (service->port) { |
| 108 | afc_client_t afc = NULL; | 113 | afc_client_t afc = NULL; |
| 109 | afc_client_new(phone, port, &afc); | 114 | afc_client_new(phone, service, &afc); |
| 115 | |||
| 116 | if (service) { | ||
| 117 | lockdownd_service_descriptor_free(service); | ||
| 118 | service = NULL; | ||
| 119 | } | ||
| 120 | |||
| 110 | if (afc) { | 121 | if (afc) { |
| 111 | lockdownd_start_service(client, "com.apple.mobile.notification_proxy", &npp); | 122 | service->port = 0; |
| 112 | if (npp) { | 123 | service->ssl_enabled = 0; |
| 124 | lockdownd_start_service(client, "com.apple.mobile.notification_proxy", &service); | ||
| 125 | if (service->port) { | ||
| 113 | printf("Notification Proxy started.\n"); | 126 | printf("Notification Proxy started.\n"); |
| 114 | np_client_new(phone, npp, &gnp); | 127 | np_client_new(phone, service, &gnp); |
| 115 | } else { | 128 | } else { |
| 116 | printf("ERROR: Notification proxy could not be started.\n"); | 129 | printf("ERROR: Notification proxy could not be started.\n"); |
| 117 | } | 130 | } |
| 131 | |||
| 132 | if (service) { | ||
| 133 | lockdownd_service_descriptor_free(service); | ||
| 134 | service = NULL; | ||
| 135 | } | ||
| 136 | |||
| 118 | if (gnp) { | 137 | if (gnp) { |
| 119 | const char *nspec[5] = { | 138 | const char *nspec[5] = { |
| 120 | NP_SYNC_CANCEL_REQUEST, | 139 | NP_SYNC_CANCEL_REQUEST, |
