diff options
author | Tobias Brunner <tobias@strongswan.org> | 2013-02-05 17:48:12 +0100 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2013-06-25 17:16:33 +0200 |
commit | 68b7448eabfb740faa91efe8a43b848adf019a90 (patch) | |
tree | 817073a0d6600d2b77cee032c5d0d831070716a0 /src/charon/charon.c | |
parent | 5e80e387bd7b2872bcd39bd8d37037002f10d959 (diff) | |
download | strongswan-68b7448eabfb740faa91efe8a43b848adf019a90.tar.bz2 strongswan-68b7448eabfb740faa91efe8a43b848adf019a90.tar.xz |
capabilities: Make the user and group charon(-nm) changes to configurable
Diffstat (limited to 'src/charon/charon.c')
-rw-r--r-- | src/charon/charon.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/charon/charon.c b/src/charon/charon.c index 8a8d0122c..340f852cd 100644 --- a/src/charon/charon.c +++ b/src/charon/charon.c @@ -44,6 +44,17 @@ #define PID_FILE IPSEC_PIDDIR "/charon.pid" /** + * Default user and group + */ +#ifndef IPSEC_USER +#define IPSEC_USER NULL +#endif + +#ifndef IPSEC_GROUP +#define IPSEC_GROUP NULL +#endif + +/** * Global reference to PID file (required to truncate, if undeletable) */ static FILE *pidfile = NULL; @@ -148,18 +159,18 @@ static void 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, "charon.user", IPSEC_USER); + if (name && !lib->caps->resolve_uid(lib->caps, name)) { return FALSE; } -#endif -#ifdef IPSEC_GROUP - if (!lib->caps->resolve_gid(lib->caps, IPSEC_GROUP)) + name = lib->settings->get_str(lib->settings, "charon.group", IPSEC_GROUP); + if (name && !lib->caps->resolve_gid(lib->caps, name)) { return FALSE; } -#endif #ifdef ANDROID lib->caps->set_uid(lib->caps, AID_VPN); #endif |