]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
settings: strongswan.conf must be loaded explicitly
authorTobias Brunner <tobias@strongswan.org>
Wed, 14 May 2014 14:05:02 +0000 (16:05 +0200)
committerTobias Brunner <tobias@strongswan.org>
Thu, 15 May 2014 09:28:10 +0000 (11:28 +0200)
src/charon-cmd/charon-cmd.c
src/charon/charon.c
src/libstrongswan/library.c
src/libstrongswan/settings/settings.c
src/libstrongswan/settings/settings.h

index a70d314af81cc7ec88585e772d1fae10e50e5421..b41cf467c9c6d3e0f3fc15e70c512eb56a3c1a75 100644 (file)
@@ -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");
                                }
index 089ac4570e9974c9924954b2e30b722e06093a40..a82aa425612cb060f00bff542882c6b231a53329 100644 (file)
@@ -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");
                                }
index c5bb4cd93ee6fa098e480fd75f1919cd15f4c380..f152a8c1f4562ec6fb15ae997e22436abf4ebf6b 100644 (file)
@@ -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");
index e467d88214ea20cd7a23fbfc476c9f873727fcc4..6c69782ec342c8417e2118c75702d5ddc122224d 100644 (file)
@@ -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);
index 23f3a8eada27f6f2dfe4b0997d1e176ba666b8c3..3b87c8febe6b52859548dbd3e5e5973e1af2b296 100644 (file)
@@ -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);