diff options
| author | Tobias Brunner <tobias@strongswan.org> | 2015-03-13 14:33:13 +0100 |
|---|---|---|
| committer | Tobias Brunner <tobias@strongswan.org> | 2015-03-13 14:34:53 +0100 |
| commit | f3c8332220f5be450199b909d4823cc1627bf47d (patch) | |
| tree | e5c0f9584d2c072d3f9053de55ea2ba377dc1e1b /src | |
| parent | c4b63322112715c60bdd780275569aa416b5fb79 (diff) | |
| download | strongswan-f3c83322.tar.bz2 strongswan-f3c83322.tar.xz | |
charon-systemd: Add support to configure user and group via strongswan.conf
Fixes #887.
Diffstat (limited to 'src')
| -rw-r--r-- | src/charon-systemd/charon-systemd.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/charon-systemd/charon-systemd.c b/src/charon-systemd/charon-systemd.c index 4a2136fc9..aeb67d410 100644 --- a/src/charon-systemd/charon-systemd.c +++ b/src/charon-systemd/charon-systemd.c @@ -40,6 +40,17 @@ #include <threading/rwlock.h> /** + * Default user and group + */ +#ifndef IPSEC_USER +#define IPSEC_USER NULL +#endif + +#ifndef IPSEC_GROUP +#define IPSEC_GROUP NULL +#endif + +/** * hook in library for debugging messages */ extern void (*dbg) (debug_t group, level_t level, char *fmt, ...); @@ -268,18 +279,20 @@ static int run() */ static bool lookup_uid_gid() { -#ifdef IPSEC_USER - if (!lib->caps->resolve_uid(lib->caps, IPSEC_USER)) + char *name + + name = lib->settings->get_str(lib->settings, "%s.user", IPSEC_USER, + lib->ns); + if (name && !lib->caps->resolve_uid(lib->caps, name)) { return FALSE; } -#endif /* IPSEC_USER */ -#ifdef IPSEC_GROUP - if (!lib->caps->resolve_gid(lib->caps, IPSEC_GROUP)) + name = lib->settings->get_str(lib->settings, "%s.group", IPSEC_GROUP, + lib->ns); + if (name && !lib->caps->resolve_gid(lib->caps, name)) { return FALSE; } -#endif /* IPSEC_GROUP */ return TRUE; } |
