pass NULL to library_init() to load settings from default file
This commit is contained in:
+1
-2
@@ -1,7 +1,6 @@
|
|||||||
INCLUDES = -I$(top_srcdir)/src/libstrongswan
|
INCLUDES = -I$(top_srcdir)/src/libstrongswan
|
||||||
AM_CFLAGS = \
|
AM_CFLAGS = \
|
||||||
-DPLUGINS="\"${libstrongswan_plugins}\"" \
|
-DPLUGINS="\"${libstrongswan_plugins}\""
|
||||||
-DSTRONGSWAN_CONF=\"${strongswan_conf}\"
|
|
||||||
|
|
||||||
noinst_PROGRAMS = bin2array bin2sql id2sql key2keyid keyid2sql \
|
noinst_PROGRAMS = bin2array bin2sql id2sql key2keyid keyid2sql \
|
||||||
thread_analysis dh_speed pubkey_speed
|
thread_analysis dh_speed pubkey_speed
|
||||||
|
|||||||
+1
-1
@@ -101,7 +101,7 @@ int main(int argc, char *argv[])
|
|||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
|
|
||||||
library_init(STRONGSWAN_CONF);
|
library_init(NULL);
|
||||||
lib->plugins->load(lib->plugins, NULL, argv[1]);
|
lib->plugins->load(lib->plugins, NULL, argv[1]);
|
||||||
atexit(library_deinit);
|
atexit(library_deinit);
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ int main(int argc, char *argv[])
|
|||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
|
|
||||||
library_init(STRONGSWAN_CONF);
|
library_init(NULL);
|
||||||
lib->plugins->load(lib->plugins, NULL, argv[1]);
|
lib->plugins->load(lib->plugins, NULL, argv[1]);
|
||||||
atexit(library_deinit);
|
atexit(library_deinit);
|
||||||
|
|
||||||
|
|||||||
@@ -105,8 +105,7 @@ credentials/credential_set.h
|
|||||||
INCLUDES = -I${linux_headers} -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/charon
|
INCLUDES = -I${linux_headers} -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/charon
|
||||||
AM_CFLAGS = -rdynamic \
|
AM_CFLAGS = -rdynamic \
|
||||||
-DIPSEC_DIR=\"${ipsecdir}\" \
|
-DIPSEC_DIR=\"${ipsecdir}\" \
|
||||||
-DIPSEC_PIDDIR=\"${piddir}\" \
|
-DIPSEC_PIDDIR=\"${piddir}\"
|
||||||
-DSTRONGSWAN_CONF=\"${strongswan_conf}\"
|
|
||||||
charon_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la -lpthread -lm $(DLLIB) $(SOCKLIB)
|
charon_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la -lpthread -lm $(DLLIB) $(SOCKLIB)
|
||||||
|
|
||||||
# compile options
|
# compile options
|
||||||
|
|||||||
+1
-1
@@ -684,7 +684,7 @@ int main(int argc, char *argv[])
|
|||||||
dbg = dbg_stderr;
|
dbg = dbg_stderr;
|
||||||
|
|
||||||
/* initialize library */
|
/* initialize library */
|
||||||
if (!library_init(STRONGSWAN_CONF))
|
if (!library_init(NULL))
|
||||||
{
|
{
|
||||||
library_deinit();
|
library_deinit();
|
||||||
exit(SS_RC_LIBSTRONGSWAN_INTEGRITY);
|
exit(SS_RC_LIBSTRONGSWAN_INTEGRITY);
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
INCLUDES = -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/charon
|
INCLUDES = -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/charon
|
||||||
|
|
||||||
AM_CFLAGS = -rdynamic \
|
AM_CFLAGS = -rdynamic \
|
||||||
-DSTRONGSWAN_CONF=\"${strongswan_conf}\" \
|
|
||||||
-DPLUGINS=\""${libstrongswan_plugins}\""
|
-DPLUGINS=\""${libstrongswan_plugins}\""
|
||||||
|
|
||||||
plugin_LTLIBRARIES = libstrongswan-sql.la
|
plugin_LTLIBRARIES = libstrongswan-sql.la
|
||||||
|
|||||||
@@ -624,7 +624,7 @@ int main(int argc, char *argv[])
|
|||||||
atexit(library_deinit);
|
atexit(library_deinit);
|
||||||
|
|
||||||
/* initialize library */
|
/* initialize library */
|
||||||
if (!library_init(STRONGSWAN_CONF))
|
if (!library_init(NULL))
|
||||||
{
|
{
|
||||||
exit(SS_RC_LIBSTRONGSWAN_INTEGRITY);
|
exit(SS_RC_LIBSTRONGSWAN_INTEGRITY);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,8 @@ libstrongswan_la_LIBADD = -lpthread $(DLLIB) $(BTLIB) $(SOCKLIB) $(RTLIB)
|
|||||||
INCLUDES = -I$(top_srcdir)/src/libstrongswan
|
INCLUDES = -I$(top_srcdir)/src/libstrongswan
|
||||||
AM_CFLAGS = \
|
AM_CFLAGS = \
|
||||||
-DIPSEC_DIR=\"${ipsecdir}\" \
|
-DIPSEC_DIR=\"${ipsecdir}\" \
|
||||||
-DPLUGINDIR=\"${plugindir}\"
|
-DPLUGINDIR=\"${plugindir}\" \
|
||||||
|
-DSTRONGSWAN_CONF=\"${strongswan_conf}\"
|
||||||
|
|
||||||
if USE_LEAK_DETECTIVE
|
if USE_LEAK_DETECTIVE
|
||||||
AM_CFLAGS += -DLEAK_DETECTIVE
|
AM_CFLAGS += -DLEAK_DETECTIVE
|
||||||
|
|||||||
@@ -484,8 +484,12 @@ static void destroy(private_settings_t *this)
|
|||||||
*/
|
*/
|
||||||
settings_t *settings_create(char *file)
|
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_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_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;
|
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->top = NULL;
|
||||||
this->text = NULL;
|
this->text = NULL;
|
||||||
|
|
||||||
if (file)
|
if (file == NULL)
|
||||||
{
|
{
|
||||||
FILE *fd;
|
file = STRONGSWAN_CONF;
|
||||||
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);
|
||||||
|
|
||||||
fd = fopen(file, "r");
|
pos = this->text;
|
||||||
if (fd == NULL)
|
this->top = parse_section(&pos, NULL);
|
||||||
{
|
if (this->top == NULL)
|
||||||
DBG1("'%s' does not exist or is not readable", file);
|
{
|
||||||
return &this->public;
|
free(this->text);
|
||||||
}
|
this->text = NULL;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return &this->public;
|
return &this->public;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
settings_t *settings_create(char *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}
|
INCLUDES = -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/libfast ${xml_CFLAGS}
|
||||||
AM_CFLAGS = -rdynamic \
|
AM_CFLAGS = -rdynamic \
|
||||||
-DSTRONGSWAN_CONF=\"${strongswan_conf}\" \
|
|
||||||
-DIPSECDIR=\"${ipsecdir}\" \
|
-DIPSECDIR=\"${ipsecdir}\" \
|
||||||
-DIPSEC_PIDDIR=\"${piddir}\" \
|
-DIPSEC_PIDDIR=\"${piddir}\" \
|
||||||
-DPLUGINS=\""${libstrongswan_plugins}\""
|
-DPLUGINS=\""${libstrongswan_plugins}\""
|
||||||
|
|||||||
+1
-1
@@ -34,7 +34,7 @@ int main (int arc, char *argv[])
|
|||||||
bool debug;
|
bool debug;
|
||||||
int threads, timeout;
|
int threads, timeout;
|
||||||
|
|
||||||
library_init(STRONGSWAN_CONF);
|
library_init(NULL);
|
||||||
if (!lib->plugins->load(lib->plugins, NULL,
|
if (!lib->plugins->load(lib->plugins, NULL,
|
||||||
lib->settings->get_str(lib->settings, "manager.load", PLUGINS)))
|
lib->settings->get_str(lib->settings, "manager.load", PLUGINS)))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ medsrv_fcgi_LDADD = $(top_builddir)/src/libfast/libfast.la
|
|||||||
|
|
||||||
INCLUDES = -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/libfast
|
INCLUDES = -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/libfast
|
||||||
AM_CFLAGS = -rdynamic \
|
AM_CFLAGS = -rdynamic \
|
||||||
-DSTRONGSWAN_CONF=\"${strongswan_conf}\" \
|
|
||||||
-DIPSECDIR=\"${ipsecdir}\" \
|
-DIPSECDIR=\"${ipsecdir}\" \
|
||||||
-DIPSEC_PIDDIR=\"${piddir}\" \
|
-DIPSEC_PIDDIR=\"${piddir}\" \
|
||||||
-DPLUGINS=\""${libstrongswan_plugins}\""
|
-DPLUGINS=\""${libstrongswan_plugins}\""
|
||||||
|
|||||||
+1
-1
@@ -33,7 +33,7 @@ int main(int arc, char *argv[])
|
|||||||
char *uri;
|
char *uri;
|
||||||
int timeout, threads;
|
int timeout, threads;
|
||||||
|
|
||||||
library_init(STRONGSWAN_CONF);
|
library_init(NULL);
|
||||||
if (!lib->plugins->load(lib->plugins, NULL,
|
if (!lib->plugins->load(lib->plugins, NULL,
|
||||||
lib->settings->get_str(lib->settings, "medsrv.load", PLUGINS)))
|
lib->settings->get_str(lib->settings, "medsrv.load", PLUGINS)))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ dist_man_MANS = openac.8
|
|||||||
INCLUDES = -I$(top_srcdir)/src/libstrongswan
|
INCLUDES = -I$(top_srcdir)/src/libstrongswan
|
||||||
AM_CFLAGS = \
|
AM_CFLAGS = \
|
||||||
-DIPSEC_CONFDIR=\"${sysconfdir}\" \
|
-DIPSEC_CONFDIR=\"${sysconfdir}\" \
|
||||||
-DSTRONGSWAN_CONF=\"${strongswan_conf}\" \
|
|
||||||
-DPLUGINS=\""${libstrongswan_plugins}\""
|
-DPLUGINS=\""${libstrongswan_plugins}\""
|
||||||
openac_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la
|
openac_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -221,7 +221,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
/* initialize library */
|
/* initialize library */
|
||||||
atexit(library_deinit);
|
atexit(library_deinit);
|
||||||
if (!library_init(STRONGSWAN_CONF))
|
if (!library_init(NULL))
|
||||||
{
|
{
|
||||||
exit(SS_RC_LIBSTRONGSWAN_INTEGRITY);
|
exit(SS_RC_LIBSTRONGSWAN_INTEGRITY);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -7,5 +7,4 @@ pki_SOURCES = pki.c pki.h command.c command.h \
|
|||||||
pki_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la
|
pki_LDADD = $(top_builddir)/src/libstrongswan/libstrongswan.la
|
||||||
INCLUDES = -I$(top_srcdir)/src/libstrongswan
|
INCLUDES = -I$(top_srcdir)/src/libstrongswan
|
||||||
AM_CFLAGS = \
|
AM_CFLAGS = \
|
||||||
-DPLUGINS=\""${libstrongswan_plugins}\"" \
|
-DPLUGINS=\""${libstrongswan_plugins}\""
|
||||||
-DSTRONGSWAN_CONF=\"${strongswan_conf}\"
|
|
||||||
|
|||||||
+1
-1
@@ -79,7 +79,7 @@ hash_algorithm_t get_digest(char *name)
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
atexit(library_deinit);
|
atexit(library_deinit);
|
||||||
if (!library_init(STRONGSWAN_CONF))
|
if (!library_init(NULL))
|
||||||
{
|
{
|
||||||
exit(SS_RC_LIBSTRONGSWAN_INTEGRITY);
|
exit(SS_RC_LIBSTRONGSWAN_INTEGRITY);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ AM_CFLAGS = \
|
|||||||
-DIPSEC_PIDDIR=\"${piddir}\" \
|
-DIPSEC_PIDDIR=\"${piddir}\" \
|
||||||
-DSHARED_SECRETS_FILE=\"${confdir}/ipsec.secrets\" \
|
-DSHARED_SECRETS_FILE=\"${confdir}/ipsec.secrets\" \
|
||||||
-DPLUGINS=\""${pluto_plugins}\"" \
|
-DPLUGINS=\""${pluto_plugins}\"" \
|
||||||
-DSTRONGSWAN_CONF=\"${strongswan_conf}\" \
|
|
||||||
-DPKCS11_DEFAULT_LIB=\"${default_pkcs11}\" \
|
-DPKCS11_DEFAULT_LIB=\"${default_pkcs11}\" \
|
||||||
-DKERNEL26_SUPPORT -DKERNEL26_HAS_KAME_DUPLICATES \
|
-DKERNEL26_SUPPORT -DKERNEL26_HAS_KAME_DUPLICATES \
|
||||||
-DPLUTO -DKLIPS -DDEBUG
|
-DPLUTO -DKLIPS -DDEBUG
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ int main(int argc, char **argv)
|
|||||||
#endif /* CAPABILITIES */
|
#endif /* CAPABILITIES */
|
||||||
|
|
||||||
/* initialize library and optionsfrom */
|
/* initialize library and optionsfrom */
|
||||||
if (!library_init(STRONGSWAN_CONF))
|
if (!library_init(NULL))
|
||||||
{
|
{
|
||||||
library_deinit();
|
library_deinit();
|
||||||
exit(SS_RC_LIBSTRONGSWAN_INTEGRITY);
|
exit(SS_RC_LIBSTRONGSWAN_INTEGRITY);
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ INCLUDES = \
|
|||||||
AM_CFLAGS = \
|
AM_CFLAGS = \
|
||||||
-DIPSEC_CONFDIR=\"${sysconfdir}\" \
|
-DIPSEC_CONFDIR=\"${sysconfdir}\" \
|
||||||
-DPLUGINS=\""${pluto_plugins}\"" \
|
-DPLUGINS=\""${pluto_plugins}\"" \
|
||||||
-DSTRONGSWAN_CONF=\"${strongswan_conf}\" \
|
|
||||||
-DDEBUG -DNO_PLUTO
|
-DDEBUG -DNO_PLUTO
|
||||||
|
|
||||||
LIBSTRONGSWANBUILDDIR=$(top_builddir)/src/libstrongswan
|
LIBSTRONGSWANBUILDDIR=$(top_builddir)/src/libstrongswan
|
||||||
|
|||||||
@@ -387,7 +387,7 @@ int main(int argc, char **argv)
|
|||||||
log_to_stderr = TRUE;
|
log_to_stderr = TRUE;
|
||||||
|
|
||||||
/* initialize library */
|
/* initialize library */
|
||||||
if (!library_init(STRONGSWAN_CONF))
|
if (!library_init(NULL))
|
||||||
{
|
{
|
||||||
library_deinit();
|
library_deinit();
|
||||||
exit(SS_RC_LIBSTRONGSWAN_INTEGRITY);
|
exit(SS_RC_LIBSTRONGSWAN_INTEGRITY);
|
||||||
|
|||||||
Reference in New Issue
Block a user