aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcharon/plugins/smp/smp.c
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2013-06-25 17:17:40 +0200
committerTobias Brunner <tobias@strongswan.org>2013-06-25 17:17:40 +0200
commit9da5a2ed1e72d1b68feefd5811a089d0881dd87d (patch)
tree2eeb8375e6ffb24321e1d7e3a4ba06183bf9eaec /src/libcharon/plugins/smp/smp.c
parenta65024264379bacc2733282f2b59b8c14e3897c0 (diff)
parentac2ffde4ae8ceaddeab8b6f740804536033153e6 (diff)
downloadstrongswan-9da5a2ed1e72d1b68feefd5811a089d0881dd87d.tar.bz2
strongswan-9da5a2ed1e72d1b68feefd5811a089d0881dd87d.tar.xz
Merge branch 'check-caps'
Plugins may now ensure the process has all the required capabilities. Some minor changes to UID/GID handling are also included.
Diffstat (limited to 'src/libcharon/plugins/smp/smp.c')
-rw-r--r--src/libcharon/plugins/smp/smp.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libcharon/plugins/smp/smp.c b/src/libcharon/plugins/smp/smp.c
index ad5029d1c..d13b82216 100644
--- a/src/libcharon/plugins/smp/smp.c
+++ b/src/libcharon/plugins/smp/smp.c
@@ -739,6 +739,12 @@ plugin_t *smp_plugin_create()
private_smp_t *this;
mode_t old;
+ if (!lib->caps->keep(lib->caps, CAP_CHOWN))
+ { /* required to chown(2) control socket */
+ DBG1(DBG_CFG, "smp plugin requires CAP_CHOWN capability");
+ return NULL;
+ }
+
INIT(this,
.public = {
.plugin = {
@@ -768,8 +774,8 @@ plugin_t *smp_plugin_create()
return NULL;
}
umask(old);
- if (chown(unix_addr.sun_path, charon->caps->get_uid(charon->caps),
- charon->caps->get_gid(charon->caps)) != 0)
+ if (chown(unix_addr.sun_path, lib->caps->get_uid(lib->caps),
+ lib->caps->get_gid(lib->caps)) != 0)
{
DBG1(DBG_CFG, "changing XML socket permissions failed: %s", strerror(errno));
}