remove control sockets on startup, as we don't have privileges on shutdown
This commit is contained in:
@@ -51,9 +51,6 @@
|
||||
#define PATH_BUF 256
|
||||
#define STROKE_THREADS 3
|
||||
|
||||
struct sockaddr_un socket_addr = { AF_UNIX, STROKE_SOCKET};
|
||||
|
||||
|
||||
typedef struct private_stroke_interface_t private_stroke_interface_t;
|
||||
|
||||
/**
|
||||
@@ -1676,7 +1673,6 @@ static void destroy(private_stroke_interface_t *this)
|
||||
{
|
||||
this->job->cancel(this->job);
|
||||
free(this);
|
||||
unlink(socket_addr.sun_path);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1684,6 +1680,7 @@ static void destroy(private_stroke_interface_t *this)
|
||||
*/
|
||||
interface_t *interface_create()
|
||||
{
|
||||
struct sockaddr_un socket_addr = { AF_UNIX, STROKE_SOCKET};
|
||||
private_stroke_interface_t *this = malloc_thing(private_stroke_interface_t);
|
||||
mode_t old;
|
||||
|
||||
@@ -1699,6 +1696,7 @@ interface_t *interface_create()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
unlink(socket_addr.sun_path);
|
||||
old = umask(~(S_IRWXU | S_IRWXG));
|
||||
if (bind(this->socket, (struct sockaddr *)&socket_addr, sizeof(socket_addr)) < 0)
|
||||
{
|
||||
|
||||
@@ -440,9 +440,6 @@ static job_requeue_t dispatch(private_xml_interface_t *this)
|
||||
return JOB_REQUEUE_DIRECT;
|
||||
}
|
||||
|
||||
/** XML unix socket */
|
||||
struct sockaddr_un unix_addr = { AF_UNIX, IPSEC_PIDDIR "/charon.xml"};
|
||||
|
||||
/**
|
||||
* Implementation of itnerface_t.destroy.
|
||||
*/
|
||||
@@ -450,7 +447,6 @@ static void destroy(private_xml_interface_t *this)
|
||||
{
|
||||
this->job->cancel(this->job);
|
||||
close(this->socket);
|
||||
unlink(unix_addr.sun_path);
|
||||
free(this);
|
||||
}
|
||||
|
||||
@@ -459,6 +455,7 @@ static void destroy(private_xml_interface_t *this)
|
||||
*/
|
||||
interface_t *interface_create()
|
||||
{
|
||||
struct sockaddr_un unix_addr = { AF_UNIX, IPSEC_PIDDIR "/charon.xml"};
|
||||
private_xml_interface_t *this = malloc_thing(private_xml_interface_t);
|
||||
mode_t old;
|
||||
|
||||
@@ -472,7 +469,8 @@ interface_t *interface_create()
|
||||
free(this);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
unlink(unix_addr.sun_path);
|
||||
old = umask(~(S_IRWXU | S_IRWXG));
|
||||
if (bind(this->socket, (struct sockaddr *)&unix_addr, sizeof(unix_addr)) < 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user