]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
pass NULL to library_init() to load settings from default file
authorMartin Willi <martin@strongswan.org>
Tue, 8 Sep 2009 18:01:13 +0000 (20:01 +0200)
committerMartin Willi <martin@strongswan.org>
Thu, 10 Sep 2009 16:52:42 +0000 (18:52 +0200)
22 files changed:
scripts/Makefile.am
scripts/dh_speed.c
scripts/pubkey_speed.c
src/charon/Makefile.am
src/charon/daemon.c
src/charon/plugins/sql/Makefile.am
src/charon/plugins/sql/pool.c
src/libstrongswan/Makefile.am
src/libstrongswan/settings.c
src/libstrongswan/settings.h
src/manager/Makefile.am
src/manager/main.c
src/medsrv/Makefile.am
src/medsrv/main.c
src/openac/Makefile.am
src/openac/openac.c
src/pki/Makefile.am
src/pki/pki.c
src/pluto/Makefile.am
src/pluto/plutomain.c
src/scepclient/Makefile.am
src/scepclient/scepclient.c

index 8a70d79e26b13a5a81bd64f0b950cb0eca547978..24e3cd164f6ba08b8860bc75e69db7667e23d44f 100644 (file)
@@ -1,7 +1,6 @@
 INCLUDES = -I$(top_srcdir)/src/libstrongswan
 AM_CFLAGS = \
--DPLUGINS="\"${libstrongswan_plugins}\"" \
--DSTRONGSWAN_CONF=\"${strongswan_conf}\"
+-DPLUGINS="\"${libstrongswan_plugins}\""
 
 noinst_PROGRAMS = bin2array bin2sql id2sql key2keyid keyid2sql \
        thread_analysis dh_speed pubkey_speed
index 80a1d2d300d5dd2444f53b9c669a0f09cd0fd50e..b85bf1ad8129ec6dcd6836b916c09e477a3567e7 100644 (file)
@@ -101,7 +101,7 @@ int main(int argc, char *argv[])
                usage();
        }
 
-       library_init(STRONGSWAN_CONF);
+       library_init(NULL);
        lib->plugins->load(lib->plugins, NULL, argv[1]);
        atexit(library_deinit);
 
index b51de09619ed9f1dd2c9129a581f90b69cade7a3..e6c668832e34a25a1cb1b6afe7b0b4e87da3b449 100644 (file)
@@ -59,7 +59,7 @@ int main(int argc, char *argv[])
                usage();
        }
 
-       library_init(STRONGSWAN_CONF);
+       library_init(NULL);
        lib->plugins->load(lib->plugins, NULL, argv[1]);
        atexit(library_deinit);
 
index 54fc7646760f671b1321a73286349bd361061d03..525b201906142ea446c93afbbdb78f5bacc6dc9d 100644 (file)
@@ -105,8 +105,7 @@ credentials/credential_set.h
 INCLUDES = -I${linux_headers} -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/charon
 AM_CFLAGS = -rdynamic \
   -DIPSEC_DIR=\"${ipsecdir}\" \
-  -DIPSEC_PIDDIR=\"${piddir}\" \
-  -DSTRONGSWAN_CONF=\"${strongswan_conf}\"
+  -DIPSEC_PIDDIR=\"${piddir}\"
 charon_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la -lpthread -lm $(DLLIB) $(SOCKLIB)
 
 # compile options
index 258043032c0298dc56269b789e6f4d39fab63f62..a1ec3adefdd3896cf8ae695857881624d36d92ed 100644 (file)
@@ -684,7 +684,7 @@ int main(int argc, char *argv[])
        dbg = dbg_stderr;
 
        /* initialize library */
-       if (!library_init(STRONGSWAN_CONF))
+       if (!library_init(NULL))
        {
                library_deinit();
                exit(SS_RC_LIBSTRONGSWAN_INTEGRITY);
index bbbc5a2e5fffc408f3fd5fcb92c6cef5ffd6e4e8..c6a382c4e780b689a2f9b7daa33710527e24729f 100644 (file)
@@ -2,7 +2,6 @@
 INCLUDES = -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/charon
 
 AM_CFLAGS = -rdynamic \
-  -DSTRONGSWAN_CONF=\"${strongswan_conf}\" \
   -DPLUGINS=\""${libstrongswan_plugins}\""
 
 plugin_LTLIBRARIES = libstrongswan-sql.la
index d59c4c8114720ebdaffa5feb5b0e726d790d17b3..55d82dac7bf3f2649839209afddcd7047bd047e6 100644 (file)
@@ -624,7 +624,7 @@ int main(int argc, char *argv[])
        atexit(library_deinit);
 
        /* initialize library */
-       if (!library_init(STRONGSWAN_CONF))
+       if (!library_init(NULL))
        {
                exit(SS_RC_LIBSTRONGSWAN_INTEGRITY);
        }
index ebf7e4e9a070104b3d47d66efbb10f8883ea800c..7cba9fe9e9799522dca0f6d9285b7eef7ec38a98 100644 (file)
@@ -54,7 +54,8 @@ libstrongswan_la_LIBADD = -lpthread $(DLLIB) $(BTLIB) $(SOCKLIB) $(RTLIB)
 INCLUDES = -I$(top_srcdir)/src/libstrongswan
 AM_CFLAGS = \
 -DIPSEC_DIR=\"${ipsecdir}\" \
--DPLUGINDIR=\"${plugindir}\"
+-DPLUGINDIR=\"${plugindir}\" \
+-DSTRONGSWAN_CONF=\"${strongswan_conf}\"
 
 if USE_LEAK_DETECTIVE
   AM_CFLAGS += -DLEAK_DETECTIVE
index b502c028ad1fd83bf7133db8b7fd0ba3b4de6011..d0937dd52b6c19d41df96a1c9aadf5d492c02c0c 100644 (file)
@@ -484,8 +484,12 @@ static void destroy(private_settings_t *this)
  */
 settings_t *settings_create(char *file)
 {
-       private_settings_t *this = malloc_thing(private_settings_t);
+       private_settings_t *this;
+       char *pos;
+       FILE *fd;
+       int len;
 
+       this = malloc_thing(private_settings_t);
        this->public.get_str = (char*(*)(settings_t*, char *key, char* def, ...))get_str;
        this->public.get_int = (int(*)(settings_t*, char *key, int def, ...))get_int;
        this->public.get_time = (u_int32_t(*)(settings_t*, char *key, u_int32_t def, ...))get_time;
@@ -496,39 +500,35 @@ settings_t *settings_create(char *file)
        this->top = NULL;
        this->text = NULL;
 
-       if (file)
+       if (file == NULL)
        {
-               FILE *fd;
-               int len;
-               char *pos;
-
-               fd = fopen(file, "r");
-               if (fd == NULL)
-               {
-                       DBG1("'%s' does not exist or is not readable", file);
-                       return &this->public;
-               }
-               fseek(fd, 0, SEEK_END);
-               len = ftell(fd);
-               rewind(fd);
-               this->text = malloc(len + 1);
-               this->text[len] = '\0';
-               if (fread(this->text, 1, len, fd) != len)
-               {
-                       free(this->text);
-                       this->text = NULL;
-                       return &this->public;
-               }
-               fclose(fd);
+               file = STRONGSWAN_CONF;
+       }
+       fd = fopen(file, "r");
+       if (fd == NULL)
+       {
+               DBG1("'%s' does not exist or is not readable", file);
+               return &this->public;
+       }
+       fseek(fd, 0, SEEK_END);
+       len = ftell(fd);
+       rewind(fd);
+       this->text = malloc(len + 1);
+       this->text[len] = '\0';
+       if (fread(this->text, 1, len, fd) != len)
+       {
+               free(this->text);
+               this->text = NULL;
+               return &this->public;
+       }
+       fclose(fd);
 
-               pos = this->text;
-               this->top = parse_section(&pos, NULL);
-               if (this->top == NULL)
-               {
-                       free(this->text);
-                       this->text = NULL;
-                       return &this->public;
-               }
+       pos = this->text;
+       this->top = parse_section(&pos, NULL);
+       if (this->top == NULL)
+       {
+               free(this->text);
+               this->text = NULL;
        }
        return &this->public;
 }
index e10158f0b5e8d3617f2c295635e89634eec27595..7a28225d39ecd775ea6255b61c699adb8f985eec 100644 (file)
@@ -110,7 +110,10 @@ struct settings_t {
 };
 
 /**
- * Load setings from a file.
+ * Load settings from a file.
+ *
+ * @param file                 file to read settings from, NULL for default
+ * @return                             settings object
  */
 settings_t *settings_create(char *file);
 
index b5948c0a8e6ea29d255c00fc8d2712a99a4d5b0d..e6c31e9b48396a4a4cfe59e31b028951de735307 100644 (file)
@@ -14,7 +14,6 @@ manager_fcgi_LDADD = $(top_builddir)/src/libfast/libfast.la ${xml_LIBS}
 
 INCLUDES = -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/libfast ${xml_CFLAGS}
 AM_CFLAGS = -rdynamic \
-  -DSTRONGSWAN_CONF=\"${strongswan_conf}\" \
   -DIPSECDIR=\"${ipsecdir}\" \
   -DIPSEC_PIDDIR=\"${piddir}\" \
   -DPLUGINS=\""${libstrongswan_plugins}\""
index 990beda4dc90a489d72f9a861cce547464d0b5d7..1f5c451132cfad6dd2ae2b1dfb202c20889ae217 100644 (file)
@@ -34,7 +34,7 @@ int main (int arc, char *argv[])
        bool debug;
        int threads, timeout;
 
-       library_init(STRONGSWAN_CONF);
+       library_init(NULL);
        if (!lib->plugins->load(lib->plugins, NULL,
                        lib->settings->get_str(lib->settings, "manager.load", PLUGINS)))
        {
index be9360bca86f8d3e2b5c20390066937557d31a27..9f5c9e2f75c45b2983fa8da8b2ab9b636e26a580 100644 (file)
@@ -11,7 +11,6 @@ medsrv_fcgi_LDADD = $(top_builddir)/src/libfast/libfast.la
 
 INCLUDES = -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/libfast
 AM_CFLAGS = -rdynamic \
-  -DSTRONGSWAN_CONF=\"${strongswan_conf}\" \
   -DIPSECDIR=\"${ipsecdir}\" \
   -DIPSEC_PIDDIR=\"${piddir}\" \
   -DPLUGINS=\""${libstrongswan_plugins}\""
index 15d1f7fb81686adb99d3f5db14ff5332e4684892..1f43a7e1745aec139dd4beca642321da9a09c16c 100644 (file)
@@ -33,7 +33,7 @@ int main(int arc, char *argv[])
        char *uri;
        int timeout, threads;
 
-       library_init(STRONGSWAN_CONF);
+       library_init(NULL);
        if (!lib->plugins->load(lib->plugins, NULL,
                        lib->settings->get_str(lib->settings, "medsrv.load", PLUGINS)))
        {
index e36b623ba2672551500a64f69a865f3d62c5fd95..ca62382583e439368dbe6804ca86ee650c2c90be 100644 (file)
@@ -5,7 +5,6 @@ dist_man_MANS = openac.8
 INCLUDES = -I$(top_srcdir)/src/libstrongswan
 AM_CFLAGS = \
   -DIPSEC_CONFDIR=\"${sysconfdir}\" \
-  -DSTRONGSWAN_CONF=\"${strongswan_conf}\" \
   -DPLUGINS=\""${libstrongswan_plugins}\""
 openac_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la
 
index de95643af263c940246b4b78dc7b14385f4a2c5b..f63676bbc216093d2e7695d1accadd08387354da 100755 (executable)
@@ -221,7 +221,7 @@ int main(int argc, char **argv)
 
        /* initialize library */
        atexit(library_deinit);
-       if (!library_init(STRONGSWAN_CONF))
+       if (!library_init(NULL))
        {
                exit(SS_RC_LIBSTRONGSWAN_INTEGRITY);
        }
index 7eb579502d91c8c943444c0001f0e70d3141ece3..8bd32e69f600f07a7b13ff9c9cf2de9259fa9295 100644 (file)
@@ -7,5 +7,4 @@ pki_SOURCES = pki.c pki.h command.c command.h \
 pki_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la
 INCLUDES = -I$(top_srcdir)/src/libstrongswan
 AM_CFLAGS = \
-       -DPLUGINS=\""${libstrongswan_plugins}\"" \
-       -DSTRONGSWAN_CONF=\"${strongswan_conf}\"
+       -DPLUGINS=\""${libstrongswan_plugins}\""
index aa873a49e83d4e31485407c38a82347f76fe31d3..c1a070292e5ed8a8e3ca12abeb88ace8ea3b9686 100644 (file)
@@ -79,7 +79,7 @@ hash_algorithm_t get_digest(char *name)
 int main(int argc, char *argv[])
 {
        atexit(library_deinit);
-       if (!library_init(STRONGSWAN_CONF))
+       if (!library_init(NULL))
        {
                exit(SS_RC_LIBSTRONGSWAN_INTEGRITY);
        }
index 77d366b36ab20fb8b1c3aeb1e5d88e4adc78a00b..a51f3055bec700c099a5794706ccb8a86d2e25f7 100644 (file)
@@ -69,7 +69,6 @@ AM_CFLAGS = \
 -DIPSEC_PIDDIR=\"${piddir}\" \
 -DSHARED_SECRETS_FILE=\"${confdir}/ipsec.secrets\" \
 -DPLUGINS=\""${pluto_plugins}\"" \
--DSTRONGSWAN_CONF=\"${strongswan_conf}\" \
 -DPKCS11_DEFAULT_LIB=\"${default_pkcs11}\" \
 -DKERNEL26_SUPPORT -DKERNEL26_HAS_KAME_DUPLICATES \
 -DPLUTO -DKLIPS -DDEBUG
index 18e8228dfe6166a629c08dcda7f590fd927366d4..78afeacb6b3c46a5cf79cae84ac51534feb0d83c 100644 (file)
@@ -261,7 +261,7 @@ int main(int argc, char **argv)
 #endif /* CAPABILITIES */
 
        /* initialize library and optionsfrom */
-       if (!library_init(STRONGSWAN_CONF))
+       if (!library_init(NULL))
        {
                library_deinit();
                exit(SS_RC_LIBSTRONGSWAN_INTEGRITY);
index 8a2837d5fa607a382ba968a2fe3b96a3bb3eb2e4..88481fa15af2a73f57378f1335a004ef40722822 100644 (file)
@@ -18,7 +18,6 @@ INCLUDES = \
 AM_CFLAGS = \
 -DIPSEC_CONFDIR=\"${sysconfdir}\" \
 -DPLUGINS=\""${pluto_plugins}\"" \
--DSTRONGSWAN_CONF=\"${strongswan_conf}\" \
 -DDEBUG -DNO_PLUTO
 
 LIBSTRONGSWANBUILDDIR=$(top_builddir)/src/libstrongswan
index 4b9c02e36b604c47cc682137c644c1dac7602b57..34b98547e776db4d1c81121f31dbddac75059779 100644 (file)
@@ -387,7 +387,7 @@ int main(int argc, char **argv)
        log_to_stderr     = TRUE;
 
        /* initialize library */
-       if (!library_init(STRONGSWAN_CONF))
+       if (!library_init(NULL))
        {
                library_deinit();
                exit(SS_RC_LIBSTRONGSWAN_INTEGRITY);