aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/charon/Makefile.am3
-rw-r--r--src/charon/daemon.c2
-rw-r--r--src/charon/plugins/sql/Makefile.am1
-rw-r--r--src/charon/plugins/sql/pool.c2
-rw-r--r--src/libstrongswan/Makefile.am3
-rw-r--r--src/libstrongswan/settings.c64
-rw-r--r--src/libstrongswan/settings.h5
-rw-r--r--src/manager/Makefile.am1
-rw-r--r--src/manager/main.c2
-rw-r--r--src/medsrv/Makefile.am1
-rw-r--r--src/medsrv/main.c2
-rw-r--r--src/openac/Makefile.am1
-rwxr-xr-xsrc/openac/openac.c2
-rw-r--r--src/pki/Makefile.am3
-rw-r--r--src/pki/pki.c2
-rw-r--r--src/pluto/Makefile.am1
-rw-r--r--src/pluto/plutomain.c2
-rw-r--r--src/scepclient/Makefile.am1
-rw-r--r--src/scepclient/scepclient.c2
19 files changed, 48 insertions, 52 deletions
diff --git a/src/charon/Makefile.am b/src/charon/Makefile.am
index 54fc76467..525b20190 100644
--- a/src/charon/Makefile.am
+++ b/src/charon/Makefile.am
@@ -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
diff --git a/src/charon/daemon.c b/src/charon/daemon.c
index 258043032..a1ec3adef 100644
--- a/src/charon/daemon.c
+++ b/src/charon/daemon.c
@@ -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);
diff --git a/src/charon/plugins/sql/Makefile.am b/src/charon/plugins/sql/Makefile.am
index bbbc5a2e5..c6a382c4e 100644
--- a/src/charon/plugins/sql/Makefile.am
+++ b/src/charon/plugins/sql/Makefile.am
@@ -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
diff --git a/src/charon/plugins/sql/pool.c b/src/charon/plugins/sql/pool.c
index d59c4c811..55d82dac7 100644
--- a/src/charon/plugins/sql/pool.c
+++ b/src/charon/plugins/sql/pool.c
@@ -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);
}
diff --git a/src/libstrongswan/Makefile.am b/src/libstrongswan/Makefile.am
index ebf7e4e9a..7cba9fe9e 100644
--- a/src/libstrongswan/Makefile.am
+++ b/src/libstrongswan/Makefile.am
@@ -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
diff --git a/src/libstrongswan/settings.c b/src/libstrongswan/settings.c
index b502c028a..d0937dd52 100644
--- a/src/libstrongswan/settings.c
+++ b/src/libstrongswan/settings.c
@@ -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;
}
diff --git a/src/libstrongswan/settings.h b/src/libstrongswan/settings.h
index e10158f0b..7a28225d3 100644
--- a/src/libstrongswan/settings.h
+++ b/src/libstrongswan/settings.h
@@ -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);
diff --git a/src/manager/Makefile.am b/src/manager/Makefile.am
index b5948c0a8..e6c31e9b4 100644
--- a/src/manager/Makefile.am
+++ b/src/manager/Makefile.am
@@ -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}\""
diff --git a/src/manager/main.c b/src/manager/main.c
index 990beda4d..1f5c45113 100644
--- a/src/manager/main.c
+++ b/src/manager/main.c
@@ -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)))
{
diff --git a/src/medsrv/Makefile.am b/src/medsrv/Makefile.am
index be9360bca..9f5c9e2f7 100644
--- a/src/medsrv/Makefile.am
+++ b/src/medsrv/Makefile.am
@@ -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}\""
diff --git a/src/medsrv/main.c b/src/medsrv/main.c
index 15d1f7fb8..1f43a7e17 100644
--- a/src/medsrv/main.c
+++ b/src/medsrv/main.c
@@ -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)))
{
diff --git a/src/openac/Makefile.am b/src/openac/Makefile.am
index e36b623ba..ca6238258 100644
--- a/src/openac/Makefile.am
+++ b/src/openac/Makefile.am
@@ -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
diff --git a/src/openac/openac.c b/src/openac/openac.c
index de95643af..f63676bbc 100755
--- a/src/openac/openac.c
+++ b/src/openac/openac.c
@@ -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);
}
diff --git a/src/pki/Makefile.am b/src/pki/Makefile.am
index 7eb579502..8bd32e69f 100644
--- a/src/pki/Makefile.am
+++ b/src/pki/Makefile.am
@@ -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}\""
diff --git a/src/pki/pki.c b/src/pki/pki.c
index aa873a49e..c1a070292 100644
--- a/src/pki/pki.c
+++ b/src/pki/pki.c
@@ -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);
}
diff --git a/src/pluto/Makefile.am b/src/pluto/Makefile.am
index 77d366b36..a51f3055b 100644
--- a/src/pluto/Makefile.am
+++ b/src/pluto/Makefile.am
@@ -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
diff --git a/src/pluto/plutomain.c b/src/pluto/plutomain.c
index 18e8228df..78afeacb6 100644
--- a/src/pluto/plutomain.c
+++ b/src/pluto/plutomain.c
@@ -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);
diff --git a/src/scepclient/Makefile.am b/src/scepclient/Makefile.am
index 8a2837d5f..88481fa15 100644
--- a/src/scepclient/Makefile.am
+++ b/src/scepclient/Makefile.am
@@ -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
diff --git a/src/scepclient/scepclient.c b/src/scepclient/scepclient.c
index 4b9c02e36..34b98547e 100644
--- a/src/scepclient/scepclient.c
+++ b/src/scepclient/scepclient.c
@@ -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);