From 6b99c8d9cff7b3e8ae8f3204b99e7ea40f791349 Mon Sep 17 00:00:00 2001 From: Yves-Alexis Perez Date: Sun, 25 Aug 2013 15:37:26 +0200 Subject: Imported Upstream version 5.1.0 --- src/charon-nm/charon-nm.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'src/charon-nm/charon-nm.c') diff --git a/src/charon-nm/charon-nm.c b/src/charon-nm/charon-nm.c index 61f2937ce..9ce6dbaeb 100644 --- a/src/charon-nm/charon-nm.c +++ b/src/charon-nm/charon-nm.c @@ -28,6 +28,17 @@ #include +/** + * 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 */ @@ -121,18 +132,20 @@ static void segv_handler(int signal) */ static bool lookup_uid_gid() { -#ifdef IPSEC_USER - if (!charon->caps->resolve_uid(charon->caps, IPSEC_USER)) + char *name; + + name = lib->settings->get_str(lib->settings, "charon-nm.user", + IPSEC_USER); + if (name && !lib->caps->resolve_uid(lib->caps, name)) { return FALSE; } -#endif -#ifdef IPSEC_GROUP - if (!charon->caps->resolve_gid(charon->caps, IPSEC_GROUP)) + name = lib->settings->get_str(lib->settings, "charon-nm.group", + IPSEC_GROUP); + if (name && !lib->caps->resolve_gid(lib->caps, name)) { return FALSE; } -#endif return TRUE; } @@ -212,8 +225,9 @@ int main(int argc, char *argv[]) DBG1(DBG_DMN, "initialization failed - aborting charon-nm"); goto deinit; } + lib->plugins->status(lib->plugins, LEVEL_CTRL); - if (!charon->caps->drop(charon->caps)) + if (!lib->caps->drop(lib->caps)) { DBG1(DBG_DMN, "capability dropping failed - aborting charon-nm"); goto deinit; -- cgit v1.2.3