aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/library.c
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2014-07-17 17:47:42 +0200
committerMartin Willi <martin@revosec.ch>2014-09-22 13:40:39 +0200
commit9e783f6e89c8f95af3924d0243ddc206e7446fe9 (patch)
tree300105de7b1042326084b66b24c3542535f25e57 /src/libstrongswan/library.c
parent0bf2abf182b325d4ce20e0fe41a32e501772ee04 (diff)
downloadstrongswan-9e783f6e89c8f95af3924d0243ddc206e7446fe9.tar.bz2
strongswan-9e783f6e89c8f95af3924d0243ddc206e7446fe9.tar.xz
library: Store the used root strongswan.conf configuration
Diffstat (limited to 'src/libstrongswan/library.c')
-rw-r--r--src/libstrongswan/library.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libstrongswan/library.c b/src/libstrongswan/library.c
index 4d2b3eb68..715f5bc43 100644
--- a/src/libstrongswan/library.c
+++ b/src/libstrongswan/library.c
@@ -29,6 +29,10 @@
#define CHECKSUM_LIBRARY IPSEC_LIB_DIR"/libchecksum.so"
+#ifndef STRONGSWAN_CONF
+#define STRONGSWAN_CONF NULL
+#endif
+
typedef struct private_library_t private_library_t;
/**
@@ -149,6 +153,7 @@ void library_deinit()
utils_deinit();
threads_deinit();
+ free(this->public.conf);
free((void*)this->public.ns);
free(this);
lib = NULL;
@@ -258,6 +263,7 @@ bool library_init(char *settings, const char *namespace)
.get = _get,
.set = _set,
.ns = strdup(namespace ?: "libstrongswan"),
+ .conf = strdupnull(settings ?: STRONGSWAN_CONF),
},
.ref = 1,
);
@@ -304,13 +310,7 @@ bool library_init(char *settings, const char *namespace)
this->objects = hashtable_create((hashtable_hash_t)hash,
(hashtable_equals_t)equals, 4);
-#ifdef STRONGSWAN_CONF
- if (!settings)
- {
- settings = STRONGSWAN_CONF;
- }
-#endif
- this->public.settings = settings_create(settings);
+ this->public.settings = settings_create(this->public.conf);
/* all namespace settings may fall back to libstrongswan */
lib->settings->add_fallback(lib->settings, lib->ns, "libstrongswan");