summaryrefslogtreecommitdiff
path: root/src/libstrongswan/library.c
diff options
context:
space:
mode:
authorRomain Francoise <rfrancoise@debian.org>2014-10-21 19:28:38 +0200
committerRomain Francoise <rfrancoise@debian.org>2014-10-21 19:28:38 +0200
commit2b8de74ff4c334c25e89988c4a401b24b5bcf03d (patch)
tree10fb49ca94bfd0c8b8a583412281abfc0186836e /src/libstrongswan/library.c
parent81c63b0eed39432878f78727f60a1e7499645199 (diff)
downloadvyos-strongswan-2b8de74ff4c334c25e89988c4a401b24b5bcf03d.tar.gz
vyos-strongswan-2b8de74ff4c334c25e89988c4a401b24b5bcf03d.zip
Import upstream release 5.2.1
Diffstat (limited to 'src/libstrongswan/library.c')
-rw-r--r--src/libstrongswan/library.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/libstrongswan/library.c b/src/libstrongswan/library.c
index e3ad16411..dc73ccc68 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 ?: (getenv("STRONGSWAN_CONF") ?: 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");
@@ -351,5 +351,7 @@ bool library_init(char *settings, const char *namespace)
#endif /* INTEGRITY_TEST */
}
+ diffie_hellman_init();
+
return !this->integrity_failed;
}