Store the name of the daemon that initialized libhydra to load daemon-specific settings.
This commit is contained in:
+1
-1
@@ -289,7 +289,7 @@ int main(int argc, char *argv[])
|
|||||||
exit(SS_RC_DAEMON_INTEGRITY);
|
exit(SS_RC_DAEMON_INTEGRITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!libhydra_init())
|
if (!libhydra_init("charon"))
|
||||||
{
|
{
|
||||||
dbg_stderr(1, "initialization failed - aborting charon");
|
dbg_stderr(1, "initialization failed - aborting charon");
|
||||||
libhydra_deinit();
|
libhydra_deinit();
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ void libhydra_deinit()
|
|||||||
{
|
{
|
||||||
private_hydra_t *this = (private_hydra_t*)hydra;
|
private_hydra_t *this = (private_hydra_t*)hydra;
|
||||||
this->public.attributes->destroy(this->public.attributes);
|
this->public.attributes->destroy(this->public.attributes);
|
||||||
|
free((void*)this->public.daemon);
|
||||||
free(this);
|
free(this);
|
||||||
hydra = NULL;
|
hydra = NULL;
|
||||||
}
|
}
|
||||||
@@ -49,13 +50,14 @@ void libhydra_deinit()
|
|||||||
/**
|
/**
|
||||||
* Described in header.
|
* Described in header.
|
||||||
*/
|
*/
|
||||||
bool libhydra_init()
|
bool libhydra_init(const char *daemon)
|
||||||
{
|
{
|
||||||
private_hydra_t *this;
|
private_hydra_t *this;
|
||||||
|
|
||||||
INIT(this,
|
INIT(this,
|
||||||
.public = {
|
.public = {
|
||||||
.attributes = attribute_manager_create(),
|
.attributes = attribute_manager_create(),
|
||||||
|
.daemon = strdup(daemon ?: "libhydra"),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
hydra = &this->public;
|
hydra = &this->public;
|
||||||
|
|||||||
@@ -44,6 +44,11 @@ struct hydra_t {
|
|||||||
* manager for payload attributes
|
* manager for payload attributes
|
||||||
*/
|
*/
|
||||||
attribute_manager_t *attributes;
|
attribute_manager_t *attributes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name of the daemon that initialized the library
|
||||||
|
*/
|
||||||
|
const char *daemon;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,9 +61,12 @@ extern hydra_t *hydra;
|
|||||||
/**
|
/**
|
||||||
* Initialize libhydra.
|
* Initialize libhydra.
|
||||||
*
|
*
|
||||||
|
* The daemon's name is used to load daemon-specific settings.
|
||||||
|
*
|
||||||
|
* @param daemon name of the daemon that initializes the library
|
||||||
* @return FALSE if integrity check failed
|
* @return FALSE if integrity check failed
|
||||||
*/
|
*/
|
||||||
bool libhydra_init();
|
bool libhydra_init(const char *daemon);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deinitialize libhydra.
|
* Deinitialize libhydra.
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ int main(int argc, char **argv)
|
|||||||
library_deinit();
|
library_deinit();
|
||||||
exit(SS_RC_DAEMON_INTEGRITY);
|
exit(SS_RC_DAEMON_INTEGRITY);
|
||||||
}
|
}
|
||||||
if (!libhydra_init())
|
if (!libhydra_init("pluto"))
|
||||||
{
|
{
|
||||||
libhydra_deinit();
|
libhydra_deinit();
|
||||||
library_deinit();
|
library_deinit();
|
||||||
|
|||||||
Reference in New Issue
Block a user