library: Store the used root strongswan.conf configuration
This commit is contained in:
@@ -29,6 +29,10 @@
|
|||||||
|
|
||||||
#define CHECKSUM_LIBRARY IPSEC_LIB_DIR"/libchecksum.so"
|
#define CHECKSUM_LIBRARY IPSEC_LIB_DIR"/libchecksum.so"
|
||||||
|
|
||||||
|
#ifndef STRONGSWAN_CONF
|
||||||
|
#define STRONGSWAN_CONF NULL
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct private_library_t private_library_t;
|
typedef struct private_library_t private_library_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -149,6 +153,7 @@ void library_deinit()
|
|||||||
utils_deinit();
|
utils_deinit();
|
||||||
threads_deinit();
|
threads_deinit();
|
||||||
|
|
||||||
|
free(this->public.conf);
|
||||||
free((void*)this->public.ns);
|
free((void*)this->public.ns);
|
||||||
free(this);
|
free(this);
|
||||||
lib = NULL;
|
lib = NULL;
|
||||||
@@ -258,6 +263,7 @@ bool library_init(char *settings, const char *namespace)
|
|||||||
.get = _get,
|
.get = _get,
|
||||||
.set = _set,
|
.set = _set,
|
||||||
.ns = strdup(namespace ?: "libstrongswan"),
|
.ns = strdup(namespace ?: "libstrongswan"),
|
||||||
|
.conf = strdupnull(settings ?: STRONGSWAN_CONF),
|
||||||
},
|
},
|
||||||
.ref = 1,
|
.ref = 1,
|
||||||
);
|
);
|
||||||
@@ -304,13 +310,7 @@ 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
|
this->public.settings = settings_create(this->public.conf);
|
||||||
if (!settings)
|
|
||||||
{
|
|
||||||
settings = STRONGSWAN_CONF;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
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");
|
||||||
|
|
||||||
|
|||||||
@@ -146,6 +146,11 @@ struct library_t {
|
|||||||
*/
|
*/
|
||||||
const char *ns;
|
const char *ns;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main configuration file passed to library_init(), the default, or NULL
|
||||||
|
*/
|
||||||
|
char *conf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Printf hook registering facility
|
* Printf hook registering facility
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user