summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/afc.c2
-rw-r--r--src/device_link_service.c2
-rw-r--r--src/diagnostics_relay.c2
-rw-r--r--src/file_relay.c2
-rw-r--r--src/heartbeat.c6
-rw-r--r--src/house_arrest.c3
-rw-r--r--src/installation_proxy.c8
-rw-r--r--src/misagent.c3
-rw-r--r--src/mobile_image_mounter.c8
-rw-r--r--src/mobilebackup.c5
-rw-r--r--src/mobilebackup2.c2
-rw-r--r--src/mobilesync.c2
-rw-r--r--src/notification_proxy.c8
-rw-r--r--src/property_list_service.c2
-rw-r--r--src/sbservices.c3
-rw-r--r--src/screenshotr.c2
-rw-r--r--src/service.c4
-rw-r--r--src/webinspector.c6
18 files changed, 27 insertions, 43 deletions
diff --git a/src/afc.c b/src/afc.c
index d61032d..c281e2c 100644
--- a/src/afc.c
+++ b/src/afc.c
@@ -123,7 +123,7 @@ afc_error_t afc_client_new_with_service_client(service_client_t service_client,
123 */ 123 */
124afc_error_t afc_client_new(idevice_t device, lockdownd_service_descriptor_t service, afc_client_t * client) 124afc_error_t afc_client_new(idevice_t device, lockdownd_service_descriptor_t service, afc_client_t * client)
125{ 125{
126 if (!device || service->port == 0) 126 if (!device || !service || service->port == 0)
127 return AFC_E_INVALID_ARG; 127 return AFC_E_INVALID_ARG;
128 128
129 service_client_t parent = NULL; 129 service_client_t parent = NULL;
diff --git a/src/device_link_service.c b/src/device_link_service.c
index ac89211..2608b9f 100644
--- a/src/device_link_service.c
+++ b/src/device_link_service.c
@@ -84,7 +84,7 @@ static int device_link_service_get_message(plist_t dl_msg, char **message)
84 */ 84 */
85device_link_service_error_t device_link_service_client_new(idevice_t device, lockdownd_service_descriptor_t service, device_link_service_client_t *client) 85device_link_service_error_t device_link_service_client_new(idevice_t device, lockdownd_service_descriptor_t service, device_link_service_client_t *client)
86{ 86{
87 if (!device || service->port == 0 || !client || *client) { 87 if (!device || !service || service->port == 0 || !client || *client) {
88 return DEVICE_LINK_SERVICE_E_INVALID_ARG; 88 return DEVICE_LINK_SERVICE_E_INVALID_ARG;
89 } 89 }
90 90
diff --git a/src/diagnostics_relay.c b/src/diagnostics_relay.c
index 3469ae4..506b901 100644
--- a/src/diagnostics_relay.c
+++ b/src/diagnostics_relay.c
@@ -83,7 +83,7 @@ static int diagnostics_relay_check_result(plist_t dict)
83 */ 83 */
84diagnostics_relay_error_t diagnostics_relay_client_new(idevice_t device, lockdownd_service_descriptor_t service, diagnostics_relay_client_t *client) 84diagnostics_relay_error_t diagnostics_relay_client_new(idevice_t device, lockdownd_service_descriptor_t service, diagnostics_relay_client_t *client)
85{ 85{
86 if (!device || service->port == 0 || !client || *client) { 86 if (!device || !service || service->port == 0 || !client || *client) {
87 return DIAGNOSTICS_RELAY_E_INVALID_ARG; 87 return DIAGNOSTICS_RELAY_E_INVALID_ARG;
88 } 88 }
89 89
diff --git a/src/file_relay.c b/src/file_relay.c
index 39382fb..b1adb4f 100644
--- a/src/file_relay.c
+++ b/src/file_relay.c
@@ -38,7 +38,7 @@
38 */ 38 */
39file_relay_error_t file_relay_client_new(idevice_t device, lockdownd_service_descriptor_t service, file_relay_client_t *client) 39file_relay_error_t file_relay_client_new(idevice_t device, lockdownd_service_descriptor_t service, file_relay_client_t *client)
40{ 40{
41 if (!device || service->port == 0 || !client || *client) { 41 if (!device || !service || service->port == 0 || !client || *client) {
42 return FILE_RELAY_E_INVALID_ARG; 42 return FILE_RELAY_E_INVALID_ARG;
43 } 43 }
44 44
diff --git a/src/heartbeat.c b/src/heartbeat.c
index 0f8d2f3..cee852e 100644
--- a/src/heartbeat.c
+++ b/src/heartbeat.c
@@ -74,13 +74,13 @@ heartbeat_error_t heartbeat_client_new(idevice_t device, lockdownd_service_descr
74{ 74{
75 *client = NULL; 75 *client = NULL;
76 76
77 debug_info("Creating heartbeat_client, port = %d.", service->port); 77 if (!device || !service || service->port == 0 || !client || *client) {
78
79 if (!device || service->port == 0 || !client || *client) {
80 debug_info("Incorrect parameter passed to heartbeat_client_new."); 78 debug_info("Incorrect parameter passed to heartbeat_client_new.");
81 return HEARTBEAT_E_INVALID_ARG; 79 return HEARTBEAT_E_INVALID_ARG;
82 } 80 }
83 81
82 debug_info("Creating heartbeat_client, port = %d.", service->port);
83
84 property_list_service_client_t plclient = NULL; 84 property_list_service_client_t plclient = NULL;
85 heartbeat_error_t ret = heartbeat_error(property_list_service_client_new(device, service, &plclient)); 85 heartbeat_error_t ret = heartbeat_error(property_list_service_client_new(device, service, &plclient));
86 if (ret != HEARTBEAT_E_SUCCESS) { 86 if (ret != HEARTBEAT_E_SUCCESS) {
diff --git a/src/house_arrest.c b/src/house_arrest.c
index b3dbbf8..5dfd1b6 100644
--- a/src/house_arrest.c
+++ b/src/house_arrest.c
@@ -68,9 +68,6 @@ static house_arrest_error_t house_arrest_error(property_list_service_error_t err
68 */ 68 */
69house_arrest_error_t house_arrest_client_new(idevice_t device, lockdownd_service_descriptor_t service, house_arrest_client_t *client) 69house_arrest_error_t house_arrest_client_new(idevice_t device, lockdownd_service_descriptor_t service, house_arrest_client_t *client)
70{ 70{
71 if (!device)
72 return HOUSE_ARREST_E_INVALID_ARG;
73
74 property_list_service_client_t plistclient = NULL; 71 property_list_service_client_t plistclient = NULL;
75 house_arrest_error_t err = house_arrest_error(property_list_service_client_new(device, service, &plistclient)); 72 house_arrest_error_t err = house_arrest_error(property_list_service_client_new(device, service, &plistclient));
76 if (err != HOUSE_ARREST_E_SUCCESS) { 73 if (err != HOUSE_ARREST_E_SUCCESS) {
diff --git a/src/installation_proxy.c b/src/installation_proxy.c
index eacab9d..d4c1750 100644
--- a/src/installation_proxy.c
+++ b/src/installation_proxy.c
@@ -104,12 +104,10 @@ static instproxy_error_t instproxy_error(property_list_service_error_t err)
104 */ 104 */
105instproxy_error_t instproxy_client_new(idevice_t device, lockdownd_service_descriptor_t service, instproxy_client_t *client) 105instproxy_error_t instproxy_client_new(idevice_t device, lockdownd_service_descriptor_t service, instproxy_client_t *client)
106{ 106{
107 if (!device)
108 return INSTPROXY_E_INVALID_ARG;
109
110 property_list_service_client_t plistclient = NULL; 107 property_list_service_client_t plistclient = NULL;
111 if (property_list_service_client_new(device, service, &plistclient) != PROPERTY_LIST_SERVICE_E_SUCCESS) { 108 instproxy_error_t err = instproxy_error(property_list_service_client_new(device, service, &plistclient));
112 return INSTPROXY_E_CONN_FAILED; 109 if (err != INSTPROXY_E_SUCCESS) {
110 return err;
113 } 111 }
114 112
115 instproxy_client_t client_loc = (instproxy_client_t) malloc(sizeof(struct instproxy_client_private)); 113 instproxy_client_t client_loc = (instproxy_client_t) malloc(sizeof(struct instproxy_client_private));
diff --git a/src/misagent.c b/src/misagent.c
index cb84188..1bc4519 100644
--- a/src/misagent.c
+++ b/src/misagent.c
@@ -100,9 +100,6 @@ static misagent_error_t misagent_check_result(plist_t response, int* status_code
100 */ 100 */
101misagent_error_t misagent_client_new(idevice_t device, lockdownd_service_descriptor_t service, misagent_client_t *client) 101misagent_error_t misagent_client_new(idevice_t device, lockdownd_service_descriptor_t service, misagent_client_t *client)
102{ 102{
103 if (!device)
104 return MISAGENT_E_INVALID_ARG;
105
106 property_list_service_client_t plistclient = NULL; 103 property_list_service_client_t plistclient = NULL;
107 misagent_error_t err = misagent_error(property_list_service_client_new(device, service, &plistclient)); 104 misagent_error_t err = misagent_error(property_list_service_client_new(device, service, &plistclient));
108 if (err != MISAGENT_E_SUCCESS) { 105 if (err != MISAGENT_E_SUCCESS) {
diff --git a/src/mobile_image_mounter.c b/src/mobile_image_mounter.c
index 3e31ef4..1d608db 100644
--- a/src/mobile_image_mounter.c
+++ b/src/mobile_image_mounter.c
@@ -98,12 +98,10 @@ static mobile_image_mounter_error_t mobile_image_mounter_error(property_list_ser
98 */ 98 */
99mobile_image_mounter_error_t mobile_image_mounter_new(idevice_t device, lockdownd_service_descriptor_t service, mobile_image_mounter_client_t *client) 99mobile_image_mounter_error_t mobile_image_mounter_new(idevice_t device, lockdownd_service_descriptor_t service, mobile_image_mounter_client_t *client)
100{ 100{
101 if (!device)
102 return MOBILE_IMAGE_MOUNTER_E_INVALID_ARG;
103
104 property_list_service_client_t plistclient = NULL; 101 property_list_service_client_t plistclient = NULL;
105 if (property_list_service_client_new(device, service, &plistclient) != PROPERTY_LIST_SERVICE_E_SUCCESS) { 102 mobile_image_mounter_error_t err = mobile_image_mounter_error(property_list_service_client_new(device, service, &plistclient));
106 return MOBILE_IMAGE_MOUNTER_E_CONN_FAILED; 103 if (err != MOBILE_IMAGE_MOUNTER_E_SUCCESS) {
104 return err;
107 } 105 }
108 106
109 mobile_image_mounter_client_t client_loc = (mobile_image_mounter_client_t) malloc(sizeof(struct mobile_image_mounter_client_private)); 107 mobile_image_mounter_client_t client_loc = (mobile_image_mounter_client_t) malloc(sizeof(struct mobile_image_mounter_client_private));
diff --git a/src/mobilebackup.c b/src/mobilebackup.c
index ab4dec0..aae4b06 100644
--- a/src/mobilebackup.c
+++ b/src/mobilebackup.c
@@ -72,10 +72,9 @@ static mobilebackup_error_t mobilebackup_error(device_link_service_error_t err)
72 * or more parameters are invalid, or DEVICE_LINK_SERVICE_E_BAD_VERSION if 72 * or more parameters are invalid, or DEVICE_LINK_SERVICE_E_BAD_VERSION if
73 * the mobilebackup version on the device is newer. 73 * the mobilebackup version on the device is newer.
74 */ 74 */
75mobilebackup_error_t mobilebackup_client_new(idevice_t device, lockdownd_service_descriptor_t service, 75mobilebackup_error_t mobilebackup_client_new(idevice_t device, lockdownd_service_descriptor_t service, mobilebackup_client_t * client)
76 mobilebackup_client_t * client)
77{ 76{
78 if (!device || service->port == 0 || !client || *client) 77 if (!device || !service || service->port == 0 || !client || *client)
79 return MOBILEBACKUP_E_INVALID_ARG; 78 return MOBILEBACKUP_E_INVALID_ARG;
80 79
81 device_link_service_client_t dlclient = NULL; 80 device_link_service_client_t dlclient = NULL;
diff --git a/src/mobilebackup2.c b/src/mobilebackup2.c
index 15ba469..6356376 100644
--- a/src/mobilebackup2.c
+++ b/src/mobilebackup2.c
@@ -76,7 +76,7 @@ static mobilebackup2_error_t mobilebackup2_error(device_link_service_error_t err
76mobilebackup2_error_t mobilebackup2_client_new(idevice_t device, lockdownd_service_descriptor_t service, 76mobilebackup2_error_t mobilebackup2_client_new(idevice_t device, lockdownd_service_descriptor_t service,
77 mobilebackup2_client_t * client) 77 mobilebackup2_client_t * client)
78{ 78{
79 if (!device || service->port == 0 || !client || *client) 79 if (!device || !service || service->port == 0 || !client || *client)
80 return MOBILEBACKUP2_E_INVALID_ARG; 80 return MOBILEBACKUP2_E_INVALID_ARG;
81 81
82 device_link_service_client_t dlclient = NULL; 82 device_link_service_client_t dlclient = NULL;
diff --git a/src/mobilesync.c b/src/mobilesync.c
index 4fe24b2..af70ea4 100644
--- a/src/mobilesync.c
+++ b/src/mobilesync.c
@@ -81,7 +81,7 @@ static mobilesync_error_t mobilesync_error(device_link_service_error_t err)
81mobilesync_error_t mobilesync_client_new(idevice_t device, lockdownd_service_descriptor_t service, 81mobilesync_error_t mobilesync_client_new(idevice_t device, lockdownd_service_descriptor_t service,
82 mobilesync_client_t * client) 82 mobilesync_client_t * client)
83{ 83{
84 if (!device || service->port == 0 || !client || *client) 84 if (!device || !service || service->port == 0 || !client || *client)
85 return MOBILESYNC_E_INVALID_ARG; 85 return MOBILESYNC_E_INVALID_ARG;
86 86
87 device_link_service_client_t dlclient = NULL; 87 device_link_service_client_t dlclient = NULL;
diff --git a/src/notification_proxy.c b/src/notification_proxy.c
index 8fb9ad0..5b293f8 100644
--- a/src/notification_proxy.c
+++ b/src/notification_proxy.c
@@ -108,12 +108,10 @@ static np_error_t np_error(property_list_service_error_t err)
108 */ 108 */
109np_error_t np_client_new(idevice_t device, lockdownd_service_descriptor_t service, np_client_t *client) 109np_error_t np_client_new(idevice_t device, lockdownd_service_descriptor_t service, np_client_t *client)
110{ 110{
111 if (!device)
112 return NP_E_INVALID_ARG;
113
114 property_list_service_client_t plistclient = NULL; 111 property_list_service_client_t plistclient = NULL;
115 if (property_list_service_client_new(device, service, &plistclient) != PROPERTY_LIST_SERVICE_E_SUCCESS) { 112 np_error_t err = np_error(property_list_service_client_new(device, service, &plistclient));
116 return NP_E_CONN_FAILED; 113 if (err != NP_E_SUCCESS) {
114 return err;
117 } 115 }
118 116
119 np_client_t client_loc = (np_client_t) malloc(sizeof(struct np_client_private)); 117 np_client_t client_loc = (np_client_t) malloc(sizeof(struct np_client_private));
diff --git a/src/property_list_service.c b/src/property_list_service.c
index 025a9bc..941f37e 100644
--- a/src/property_list_service.c
+++ b/src/property_list_service.c
@@ -68,7 +68,7 @@ static property_list_service_error_t service_to_property_list_service_error(serv
68 */ 68 */
69property_list_service_error_t property_list_service_client_new(idevice_t device, lockdownd_service_descriptor_t service, property_list_service_client_t *client) 69property_list_service_error_t property_list_service_client_new(idevice_t device, lockdownd_service_descriptor_t service, property_list_service_client_t *client)
70{ 70{
71 if (!device || (service->port == 0) || !client || *client) 71 if (!device || !service || service->port == 0 || !client || *client)
72 return PROPERTY_LIST_SERVICE_E_INVALID_ARG; 72 return PROPERTY_LIST_SERVICE_E_INVALID_ARG;
73 73
74 service_client_t parent = NULL; 74 service_client_t parent = NULL;
diff --git a/src/sbservices.c b/src/sbservices.c
index 6b1a4d1..00f2862 100644
--- a/src/sbservices.c
+++ b/src/sbservices.c
@@ -97,9 +97,6 @@ static sbservices_error_t sbservices_error(property_list_service_error_t err)
97 */ 97 */
98sbservices_error_t sbservices_client_new(idevice_t device, lockdownd_service_descriptor_t service, sbservices_client_t *client) 98sbservices_error_t sbservices_client_new(idevice_t device, lockdownd_service_descriptor_t service, sbservices_client_t *client)
99{ 99{
100 if (!device)
101 return SBSERVICES_E_INVALID_ARG;
102
103 property_list_service_client_t plistclient = NULL; 100 property_list_service_client_t plistclient = NULL;
104 sbservices_error_t err = sbservices_error(property_list_service_client_new(device, service, &plistclient)); 101 sbservices_error_t err = sbservices_error(property_list_service_client_new(device, service, &plistclient));
105 if (err != SBSERVICES_E_SUCCESS) { 102 if (err != SBSERVICES_E_SUCCESS) {
diff --git a/src/screenshotr.c b/src/screenshotr.c
index e2bc979..b538232 100644
--- a/src/screenshotr.c
+++ b/src/screenshotr.c
@@ -76,7 +76,7 @@ static screenshotr_error_t screenshotr_error(device_link_service_error_t err)
76screenshotr_error_t screenshotr_client_new(idevice_t device, lockdownd_service_descriptor_t service, 76screenshotr_error_t screenshotr_client_new(idevice_t device, lockdownd_service_descriptor_t service,
77 screenshotr_client_t * client) 77 screenshotr_client_t * client)
78{ 78{
79 if (!device || service->port == 0 || !client || *client) 79 if (!device || !service || service->port == 0 || !client || *client)
80 return SCREENSHOTR_E_INVALID_ARG; 80 return SCREENSHOTR_E_INVALID_ARG;
81 81
82 device_link_service_client_t dlclient = NULL; 82 device_link_service_client_t dlclient = NULL;
diff --git a/src/service.c b/src/service.c
index 959c9fb..abd1696 100644
--- a/src/service.c
+++ b/src/service.c
@@ -66,7 +66,7 @@ static service_error_t idevice_to_service_error(idevice_error_t err)
66 */ 66 */
67service_error_t service_client_new(idevice_t device, lockdownd_service_descriptor_t service, service_client_t *client) 67service_error_t service_client_new(idevice_t device, lockdownd_service_descriptor_t service, service_client_t *client)
68{ 68{
69 if (!device || (service->port == 0) || !client || *client) 69 if (!device || !service || service->port == 0 || !client || *client)
70 return SERVICE_E_INVALID_ARG; 70 return SERVICE_E_INVALID_ARG;
71 71
72 /* Attempt connection */ 72 /* Attempt connection */
@@ -117,7 +117,7 @@ service_error_t service_client_factory_start_service(idevice_t device, const cha
117 lockdownd_start_service(lckd, service_name, &service); 117 lockdownd_start_service(lckd, service_name, &service);
118 lockdownd_client_free(lckd); 118 lockdownd_client_free(lckd);
119 119
120 if (service->port <= 0) { 120 if (!service || service->port == 0) {
121 debug_info("Could not start service %s!", service_name); 121 debug_info("Could not start service %s!", service_name);
122 return SERVICE_E_START_SERVICE_ERROR; 122 return SERVICE_E_START_SERVICE_ERROR;
123 } 123 }
diff --git a/src/webinspector.c b/src/webinspector.c
index fea26d4..aef6d6f 100644
--- a/src/webinspector.c
+++ b/src/webinspector.c
@@ -74,13 +74,13 @@ webinspector_error_t webinspector_client_new(idevice_t device, lockdownd_service
74{ 74{
75 *client = NULL; 75 *client = NULL;
76 76
77 debug_info("Creating webinspector_client, port = %d.", service->port); 77 if (!device || !service || service->port == 0 || !client || *client) {
78
79 if (!device || service->port == 0 || !client || *client) {
80 debug_info("Incorrect parameter passed to webinspector_client_new."); 78 debug_info("Incorrect parameter passed to webinspector_client_new.");
81 return WEBINSPECTOR_E_INVALID_ARG; 79 return WEBINSPECTOR_E_INVALID_ARG;
82 } 80 }
83 81
82 debug_info("Creating webinspector_client, port = %d.", service->port);
83
84 property_list_service_client_t plclient = NULL; 84 property_list_service_client_t plclient = NULL;
85 webinspector_error_t ret = webinspector_error(property_list_service_client_new(device, service, &plclient)); 85 webinspector_error_t ret = webinspector_error(property_list_service_client_new(device, service, &plclient));
86 if (ret != WEBINSPECTOR_E_SUCCESS) { 86 if (ret != WEBINSPECTOR_E_SUCCESS) {