libimcv: Move settings to <ns>.imcv and <ns>.plugins with fallback
This commit is contained in:
parent
4576f7f960
commit
1ec3476398
|
@ -134,6 +134,10 @@ bool libimcv_init(bool is_imv)
|
|||
}
|
||||
ref_get(&libstrongswan_ref);
|
||||
|
||||
lib->settings->add_fallback(lib->settings, "%s.imcv", "libimcv", lib->ns);
|
||||
lib->settings->add_fallback(lib->settings, "%s.plugins", "libimcv.plugins",
|
||||
lib->ns);
|
||||
|
||||
if (libimcv_ref == 0)
|
||||
{
|
||||
char *uri, *script;
|
||||
|
@ -149,9 +153,10 @@ bool libimcv_init(bool is_imv)
|
|||
if (is_imv)
|
||||
{
|
||||
uri = lib->settings->get_str(lib->settings,
|
||||
"libimcv.database", NULL);
|
||||
"%s.imcv.database", NULL, lib->ns);
|
||||
script = lib->settings->get_str(lib->settings,
|
||||
"libimcv.policy_script", IMCV_DEFAULT_POLICY_SCRIPT);
|
||||
"%s.imcv.policy_script", IMCV_DEFAULT_POLICY_SCRIPT,
|
||||
lib->ns);
|
||||
if (uri)
|
||||
{
|
||||
imcv_db = imv_database_create(uri, script);
|
||||
|
|
|
@ -208,8 +208,8 @@ METHOD(imv_msg_t, send_assessment, TNC_Result,
|
|||
}
|
||||
|
||||
/* Send an IETF Assessment Result attribute if enabled */
|
||||
if (lib->settings->get_bool(lib->settings, "libimcv.assessment_result",
|
||||
TRUE))
|
||||
if (lib->settings->get_bool(lib->settings, "%s.imcv.assessment_result",
|
||||
TRUE, lib->ns))
|
||||
{
|
||||
this->state->get_recommendation(this->state, &rec, &eval);
|
||||
attr = ietf_attr_assess_result_create(eval);
|
||||
|
|
|
@ -328,7 +328,12 @@ int main(int argc, char *argv[])
|
|||
session_id = atoi(tnc_session_id);
|
||||
|
||||
/* attach IMV database */
|
||||
uri = lib->settings->get_str(lib->settings, "libimcv.database", NULL);
|
||||
uri = lib->settings->get_str(lib->settings,
|
||||
"imv_policy_manager.database",
|
||||
lib->settings->get_str(lib->settings,
|
||||
"charon.imcv.database",
|
||||
lib->settings->get_str(lib->settings,
|
||||
"libimcv.database", NULL)));
|
||||
if (!uri)
|
||||
{
|
||||
fprintf(stderr, "database uri not defined.\n");
|
||||
|
|
|
@ -560,9 +560,9 @@ os_info_t *os_info_create(void)
|
|||
|
||||
/* As an option OS name and OS version can be configured manually */
|
||||
name.ptr = lib->settings->get_str(lib->settings,
|
||||
"libimcv.os_info.name", NULL);
|
||||
"%s.imcv.os_info.name", NULL, lib->ns);
|
||||
version.ptr = lib->settings->get_str(lib->settings,
|
||||
"libimcv.os_info.version", NULL);
|
||||
"%s.imcv.os_info.version", NULL, lib->ns);
|
||||
if (name.ptr && version.ptr)
|
||||
{
|
||||
name.len = strlen(name.ptr);
|
||||
|
|
|
@ -387,7 +387,7 @@ TNC_Result TNC_IMC_BeginHandshake(TNC_IMCID imc_id,
|
|||
return TNC_RESULT_FATAL;
|
||||
}
|
||||
if (lib->settings->get_bool(lib->settings,
|
||||
"libimcv.plugins.imc-os.push_info", TRUE))
|
||||
"%s.plugins.imc-os.push_info", TRUE, lib->ns))
|
||||
{
|
||||
out_msg = imc_msg_create(imc_os, state, connection_id, imc_id,
|
||||
TNC_IMVID_ANY, msg_types[0]);
|
||||
|
|
|
@ -274,7 +274,7 @@ TNC_Result TNC_IMC_BeginHandshake(TNC_IMCID imc_id,
|
|||
return TNC_RESULT_FATAL;
|
||||
}
|
||||
if (lib->settings->get_bool(lib->settings,
|
||||
"libimcv.plugins.imc-scanner.push_info", TRUE))
|
||||
"%s.plugins.imc-scanner.push_info", TRUE, lib->ns))
|
||||
{
|
||||
out_msg = imc_msg_create(imc_scanner, state, connection_id, imc_id,
|
||||
TNC_IMVID_ANY, msg_types[0]);
|
||||
|
|
|
@ -91,11 +91,11 @@ TNC_Result TNC_IMC_NotifyConnectionChange(TNC_IMCID imc_id,
|
|||
{
|
||||
case TNC_CONNECTION_STATE_CREATE:
|
||||
command = lib->settings->get_str(lib->settings,
|
||||
"libimcv.plugins.imc-test.command", "none");
|
||||
"%s.plugins.imc-test.command", "none", lib->ns);
|
||||
dummy_size = lib->settings->get_int(lib->settings,
|
||||
"libimcv.plugins.imc-test.dummy_size", 0);
|
||||
"%s.plugins.imc-test.dummy_size", 0, lib->ns);
|
||||
retry = lib->settings->get_bool(lib->settings,
|
||||
"libimcv.plugins.imc-test.retry", FALSE);
|
||||
"%s.plugins.imc-test.retry", FALSE, lib->ns);
|
||||
state = imc_test_state_create(connection_id, command, dummy_size,
|
||||
retry);
|
||||
|
||||
|
@ -107,7 +107,7 @@ TNC_Result TNC_IMC_NotifyConnectionChange(TNC_IMCID imc_id,
|
|||
|
||||
/* Optionally reserve additional IMC IDs */
|
||||
additional_ids = lib->settings->get_int(lib->settings,
|
||||
"libimcv.plugins.imc-test.additional_ids", 0);
|
||||
"%s.plugins.imc-test.additional_ids", 0, lib->ns);
|
||||
imc_test->reserve_additional_ids(imc_test, additional_ids -
|
||||
imc_test->count_additional_ids(imc_test));
|
||||
|
||||
|
@ -127,8 +127,8 @@ TNC_Result TNC_IMC_NotifyConnectionChange(TNC_IMCID imc_id,
|
|||
if (!test_state->is_first_handshake(test_state))
|
||||
{
|
||||
command = lib->settings->get_str(lib->settings,
|
||||
"libimcv.plugins.imc-test.retry_command",
|
||||
test_state->get_command(test_state));
|
||||
"%s.plugins.imc-test.retry_command",
|
||||
test_state->get_command(test_state), lib->ns);
|
||||
test_state->set_command(test_state, command);
|
||||
}
|
||||
|
||||
|
|
|
@ -494,7 +494,7 @@ METHOD(imv_state_t, get_remediation_instructions, bool,
|
|||
|
||||
*string = this->remediation_string->get_encoding(this->remediation_string);
|
||||
*uri = lib->settings->get_str(lib->settings,
|
||||
"libimcv.plugins.imv-os.remediation_uri", NULL);
|
||||
"%s.plugins.imv-os.remediation_uri", NULL, lib->ns);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -314,7 +314,7 @@ METHOD(imv_state_t, get_remediation_instructions, bool,
|
|||
this->violating_ports);
|
||||
*string = this->remediation_string->get_encoding(this->remediation_string);
|
||||
*uri = lib->settings->get_str(lib->settings,
|
||||
"libimcv.plugins.imv-scanner.remediation_uri", NULL);
|
||||
"%s.plugins.imv-scanner.remediation_uri", NULL, lib->ns);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ static TNC_Result receive_msg(private_imv_test_agent_t *this, imv_state_t *state
|
|||
|
||||
/* add any new IMC and set its number of rounds */
|
||||
rounds = lib->settings->get_int(lib->settings,
|
||||
"libimcv.plugins.imv-test.rounds", 0);
|
||||
"%s.plugins.imv-test.rounds", 0, lib->ns);
|
||||
test_state = (imv_test_state_t*)state;
|
||||
test_state->add_imc(test_state, in_msg->get_src_id(in_msg), rounds);
|
||||
|
||||
|
@ -178,7 +178,7 @@ static TNC_Result receive_msg(private_imv_test_agent_t *this, imv_state_t *state
|
|||
if (result != TNC_RESULT_SUCCESS)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return this->agent->provide_recommendation(this->agent, state);
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ static TNC_Result receive_msg(private_imv_test_agent_t *this, imv_state_t *state
|
|||
out_msg->add_attribute(out_msg, attr);
|
||||
|
||||
/* send PA-TNC message with excl flag set */
|
||||
result = out_msg->send(out_msg, TRUE);
|
||||
result = out_msg->send(out_msg, TRUE);
|
||||
out_msg->destroy(out_msg);
|
||||
|
||||
return result;
|
||||
|
@ -214,11 +214,11 @@ static TNC_Result receive_msg(private_imv_test_agent_t *this, imv_state_t *state
|
|||
if (result != TNC_RESULT_SUCCESS)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return this->agent->provide_recommendation(this->agent, state);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
return TNC_RESULT_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue