summaryrefslogtreecommitdiffstats
path: root/dev
diff options
context:
space:
mode:
Diffstat (limited to 'dev')
-rw-r--r--dev/afccheck.c2
-rw-r--r--dev/ideviceclient.c17
2 files changed, 6 insertions, 13 deletions
diff --git a/dev/afccheck.c b/dev/afccheck.c
index ead0ca0..d7ee7d1 100644
--- a/dev/afccheck.c
+++ b/dev/afccheck.c
@@ -111,7 +111,7 @@ int main(int argc, char *argv[])
111 return 1; 111 return 1;
112 } 112 }
113 113
114 if (LOCKDOWN_E_SUCCESS == lockdownd_start_service(client, "com.apple.afc", &service) && !service->port) { 114 if (LOCKDOWN_E_SUCCESS != lockdownd_start_service(client, "com.apple.afc", &service) || !service || !service->port) {
115 lockdownd_client_free(client); 115 lockdownd_client_free(client);
116 idevice_free(phone); 116 idevice_free(phone);
117 fprintf(stderr, "Something went wrong when starting AFC."); 117 fprintf(stderr, "Something went wrong when starting AFC.");
diff --git a/dev/ideviceclient.c b/dev/ideviceclient.c
index c8635d8..778f20e 100644
--- a/dev/ideviceclient.c
+++ b/dev/ideviceclient.c
@@ -49,7 +49,7 @@ static void perform_notification(idevice_t phone, lockdownd_client_t client, con
49 np_client_t np; 49 np_client_t np;
50 50
51 lockdownd_start_service(client, "com.apple.mobile.notification_proxy", &service); 51 lockdownd_start_service(client, "com.apple.mobile.notification_proxy", &service);
52 if (service->port) { 52 if (service && service->port) {
53 printf("::::::::::::::: np was started ::::::::::::\n"); 53 printf("::::::::::::::: np was started ::::::::::::\n");
54 np_client_new(phone, service, &np); 54 np_client_new(phone, service, &np);
55 if (np) { 55 if (np) {
@@ -109,15 +109,10 @@ int main(int argc, char *argv[])
109 109
110 lockdownd_start_service(client, "com.apple.afc", &service); 110 lockdownd_start_service(client, "com.apple.afc", &service);
111 111
112 if (service->port) { 112 if (service && service->port) {
113 afc_client_t afc = NULL; 113 afc_client_t afc = NULL;
114 afc_client_new(phone, service, &afc); 114 afc_client_new(phone, service, &afc);
115 115
116 if (service) {
117 lockdownd_service_descriptor_free(service);
118 service = NULL;
119 }
120
121 if (afc) { 116 if (afc) {
122 service->port = 0; 117 service->port = 0;
123 service->ssl_enabled = 0; 118 service->ssl_enabled = 0;
@@ -129,11 +124,6 @@ int main(int argc, char *argv[])
129 printf("ERROR: Notification proxy could not be started.\n"); 124 printf("ERROR: Notification proxy could not be started.\n");
130 } 125 }
131 126
132 if (service) {
133 lockdownd_service_descriptor_free(service);
134 service = NULL;
135 }
136
137 if (gnp) { 127 if (gnp) {
138 const char *nspec[5] = { 128 const char *nspec[5] = {
139 NP_SYNC_CANCEL_REQUEST, 129 NP_SYNC_CANCEL_REQUEST,
@@ -266,6 +256,9 @@ int main(int argc, char *argv[])
266 } 256 }
267 257
268 afc_client_free(afc); 258 afc_client_free(afc);
259
260 lockdownd_service_descriptor_free(service);
261 service = NULL;
269 } else { 262 } else {
270 printf("Start service failure.\n"); 263 printf("Start service failure.\n");
271 } 264 }