settings: strongswan.conf must be loaded explicitly

This commit is contained in:
Tobias Brunner
2014-05-15 11:28:10 +02:00
parent da45f9e994
commit 4b670a20a9
5 changed files with 20 additions and 9 deletions
+4 -1
View File
@@ -126,12 +126,15 @@ static int run()
{ {
DBG1(DBG_DMN, "signal of type SIGHUP received. Reloading " DBG1(DBG_DMN, "signal of type SIGHUP received. Reloading "
"configuration"); "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); charon->load_loggers(charon, levels, TRUE);
lib->plugins->reload(lib->plugins, NULL); lib->plugins->reload(lib->plugins, NULL);
} }
else else
#endif
{ {
DBG1(DBG_DMN, "reloading config failed, keeping old"); DBG1(DBG_DMN, "reloading config failed, keeping old");
} }
+4 -1
View File
@@ -122,12 +122,15 @@ static void run()
{ {
DBG1(DBG_DMN, "signal of type SIGHUP received. Reloading " DBG1(DBG_DMN, "signal of type SIGHUP received. Reloading "
"configuration"); "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); charon->load_loggers(charon, levels, !use_syslog);
lib->plugins->reload(lib->plugins, NULL); lib->plugins->reload(lib->plugins, NULL);
} }
else else
#endif
{ {
DBG1(DBG_DMN, "reloading config failed, keeping old"); DBG1(DBG_DMN, "reloading config failed, keeping old");
} }
+7
View File
@@ -298,6 +298,13 @@ bool library_init(char *settings, const char *namespace)
this->objects = hashtable_create((hashtable_hash_t)hash, this->objects = hashtable_create((hashtable_hash_t)hash,
(hashtable_equals_t)equals, 4); (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(settings);
/* all namespace settings may fall back to libstrongswan */ /* all namespace settings may fall back to libstrongswan */
lib->settings->add_fallback(lib->settings, lib->ns, "libstrongswan"); lib->settings->add_fallback(lib->settings, lib->ns, "libstrongswan");
+2 -6
View File
@@ -839,13 +839,9 @@ static bool load_files_internal(private_settings_t *this, section_t *parent,
{ {
section_t *section; section_t *section;
if (pattern == NULL) if (pattern == NULL || !pattern[0])
{ { /* TODO: Clear parent if merge is FALSE? */
#ifdef STRONGSWAN_CONF
pattern = STRONGSWAN_CONF;
#else
return FALSE; return FALSE;
#endif
} }
section = settings_section_create(NULL); section = settings_section_create(NULL);
+3 -1
View File
@@ -343,7 +343,9 @@ struct settings_t {
/** /**
* Load settings from a file. * 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 * @return settings object
*/ */
settings_t *settings_create(char *file); settings_t *settings_create(char *file);