summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lockdown.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/lockdown.c b/src/lockdown.c
index df1f60f..f78a78d 100644
--- a/src/lockdown.c
+++ b/src/lockdown.c
@@ -1512,6 +1512,12 @@ lockdownd_error_t lockdownd_start_service(lockdownd_client_t client, const char
1512 if (!client || !identifier || !service) 1512 if (!client || !identifier || !service)
1513 return LOCKDOWN_E_INVALID_ARG; 1513 return LOCKDOWN_E_INVALID_ARG;
1514 1514
1515 if (*service) {
1516 // reset fields if service descriptor is reused
1517 (*service)->port = 0;
1518 (*service)->ssl_enabled = 0;
1519 }
1520
1515 char *host_id = NULL; 1521 char *host_id = NULL;
1516 userpref_get_host_id(&host_id); 1522 userpref_get_host_id(&host_id);
1517 if (!host_id) 1523 if (!host_id)
@@ -1547,13 +1553,13 @@ lockdownd_error_t lockdownd_start_service(lockdownd_client_t client, const char
1547 if (!dict) 1553 if (!dict)
1548 return LOCKDOWN_E_PLIST_ERROR; 1554 return LOCKDOWN_E_PLIST_ERROR;
1549 1555
1550 if (*service == NULL)
1551 *service = (lockdownd_service_descriptor_t)malloc(sizeof(struct lockdownd_service_descriptor));
1552 (*service)->port = 0;
1553 (*service)->ssl_enabled = 0;
1554
1555 ret = LOCKDOWN_E_UNKNOWN_ERROR; 1556 ret = LOCKDOWN_E_UNKNOWN_ERROR;
1556 if (lockdown_check_result(dict, "StartService") == RESULT_SUCCESS) { 1557 if (lockdown_check_result(dict, "StartService") == RESULT_SUCCESS) {
1558 if (*service == NULL)
1559 *service = (lockdownd_service_descriptor_t)malloc(sizeof(struct lockdownd_service_descriptor));
1560 (*service)->port = 0;
1561 (*service)->ssl_enabled = 0;
1562
1557 /* read service port number */ 1563 /* read service port number */
1558 plist_t node = plist_dict_get_item(dict, "Port"); 1564 plist_t node = plist_dict_get_item(dict, "Port");
1559 if (node && (plist_get_node_type(node) == PLIST_UINT)) { 1565 if (node && (plist_get_node_type(node) == PLIST_UINT)) {