aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2014-05-14 16:05:02 +0200
committerTobias Brunner <tobias@strongswan.org>2014-05-15 11:28:10 +0200
commit4b670a20a9ee0ac5efd806ff804e75fe00509826 (patch)
treecaec3a95b3990471e64a40c346b01d8a166359af
parentda45f9e994f61324a058def37fbafd5cce75b5f3 (diff)
downloadstrongswan-4b670a20.tar.bz2
strongswan-4b670a20.tar.xz
settings: strongswan.conf must be loaded explicitly
-rw-r--r--src/charon-cmd/charon-cmd.c5
-rw-r--r--src/charon/charon.c5
-rw-r--r--src/libstrongswan/library.c7
-rw-r--r--src/libstrongswan/settings/settings.c8
-rw-r--r--src/libstrongswan/settings/settings.h4
5 files changed, 20 insertions, 9 deletions
diff --git a/src/charon-cmd/charon-cmd.c b/src/charon-cmd/charon-cmd.c
index a70d314af..b41cf467c 100644
--- a/src/charon-cmd/charon-cmd.c
+++ b/src/charon-cmd/charon-cmd.c
@@ -126,12 +126,15 @@ static int run()
{
DBG1(DBG_DMN, "signal of type SIGHUP received. Reloading "
"configuration");
- if (lib->settings->load_files(lib->settings, NULL, FALSE))
+#ifdef STRONGSWAN_CONF
+ if (lib->settings->load_files(lib->settings, STRONGSWAN_CONF,
+ FALSE))
{
charon->load_loggers(charon, levels, TRUE);
lib->plugins->reload(lib->plugins, NULL);
}
else
+#endif
{
DBG1(DBG_DMN, "reloading config failed, keeping old");
}
diff --git a/src/charon/charon.c b/src/charon/charon.c
index 089ac4570..a82aa4256 100644
--- a/src/charon/charon.c
+++ b/src/charon/charon.c
@@ -122,12 +122,15 @@ static void run()
{
DBG1(DBG_DMN, "signal of type SIGHUP received. Reloading "
"configuration");
- if (lib->settings->load_files(lib->settings, NULL, FALSE))
+#ifdef STRONGSWAN_CONF
+ if (lib->settings->load_files(lib->settings, STRONGSWAN_CONF,
+ FALSE))
{
charon->load_loggers(charon, levels, !use_syslog);
lib->plugins->reload(lib->plugins, NULL);
}
else
+#endif
{
DBG1(DBG_DMN, "reloading config failed, keeping old");
}
diff --git a/src/libstrongswan/library.c b/src/libstrongswan/library.c
index c5bb4cd93..f152a8c1f 100644
--- a/src/libstrongswan/library.c
+++ b/src/libstrongswan/library.c
@@ -298,6 +298,13 @@ 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);
/* all namespace settings may fall back to libstrongswan */
lib->settings->add_fallback(lib->settings, lib->ns, "libstrongswan");
diff --git a/src/libstrongswan/settings/settings.c b/src/libstrongswan/settings/settings.c
index e467d8821..6c69782ec 100644
--- a/src/libstrongswan/settings/settings.c
+++ b/src/libstrongswan/settings/settings.c
@@ -839,13 +839,9 @@ static bool load_files_internal(private_settings_t *this, section_t *parent,
{
section_t *section;
- if (pattern == NULL)
- {
-#ifdef STRONGSWAN_CONF
- pattern = STRONGSWAN_CONF;
-#else
+ if (pattern == NULL || !pattern[0])
+ { /* TODO: Clear parent if merge is FALSE? */
return FALSE;
-#endif
}
section = settings_section_create(NULL);
diff --git a/src/libstrongswan/settings/settings.h b/src/libstrongswan/settings/settings.h
index 23f3a8ead..3b87c8feb 100644
--- a/src/libstrongswan/settings/settings.h
+++ b/src/libstrongswan/settings/settings.h
@@ -343,7 +343,9 @@ struct settings_t {
/**
* Load settings from a file.
*
- * @param file file to read settings from, NULL for default
+ * @note If parsing the file fails the object is still created.
+ *
+ * @param file optional file to read settings from
* @return settings object
*/
settings_t *settings_create(char *file);