diff options
author | Martin Willi <martin@revosec.ch> | 2010-10-20 12:29:45 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2010-10-20 14:54:51 +0200 |
commit | 384b69d964fdaf47af8e2e3ce23ba4b330dbca95 (patch) | |
tree | b2c21f53d273f0f8ad9a15b27c63c13c6ac60645 /src/libcharon/plugins/ha | |
parent | a5477a6fa3564722c325603209b9fe58e7a8e2e6 (diff) | |
download | strongswan-384b69d964fdaf47af8e2e3ce23ba4b330dbca95.tar.bz2 strongswan-384b69d964fdaf47af8e2e3ce23ba4b330dbca95.tar.xz |
Set ownership/permissions of HA control socket
Diffstat (limited to 'src/libcharon/plugins/ha')
-rw-r--r-- | src/libcharon/plugins/ha/ha_ctl.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/libcharon/plugins/ha/ha_ctl.c b/src/libcharon/plugins/ha/ha_ctl.c index 1e9a5fd0e..980c0551a 100644 --- a/src/libcharon/plugins/ha/ha_ctl.c +++ b/src/libcharon/plugins/ha/ha_ctl.c @@ -114,6 +114,7 @@ METHOD(ha_ctl_t, destroy, void, ha_ctl_t *ha_ctl_create(ha_segments_t *segments, ha_cache_t *cache) { private_ha_ctl_t *this; + mode_t old; INIT(this, .public = { @@ -125,11 +126,18 @@ ha_ctl_t *ha_ctl_create(ha_segments_t *segments, ha_cache_t *cache) if (access(HA_FIFO, R_OK|W_OK) != 0) { - if (mkfifo(HA_FIFO, 600) != 0) + old = umask(~(S_IRWXU | S_IRWXG)); + if (mkfifo(HA_FIFO, S_IRUSR | S_IWUSR) != 0) { DBG1(DBG_CFG, "creating HA FIFO %s failed: %s", HA_FIFO, strerror(errno)); } + umask(old); + } + if (chown(HA_FIFO, charon->uid, charon->gid) != 0) + { + DBG1(DBG_CFG, "changing HA FIFO permissions failed: %s", + strerror(errno)); } this->job = callback_job_create((callback_job_cb_t)dispatch_fifo, |