summaryrefslogtreecommitdiff
path: root/src/libimcv/plugins/imv_os/imv_os.c
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2013-04-26 14:57:47 +0200
committerYves-Alexis Perez <corsac@debian.org>2013-04-26 14:57:47 +0200
commit10e5fb2b9b2f27c83b3e5a1d048b158d5cf42a43 (patch)
treebf1d05a2e37dbd1911b86fcc026fbe49b0239c71 /src/libimcv/plugins/imv_os/imv_os.c
parent7585facf05d927eb6df3929ce09ed5e60d905437 (diff)
downloadvyos-strongswan-10e5fb2b9b2f27c83b3e5a1d048b158d5cf42a43.tar.gz
vyos-strongswan-10e5fb2b9b2f27c83b3e5a1d048b158d5cf42a43.zip
Imported Upstream version 5.0.3
Diffstat (limited to 'src/libimcv/plugins/imv_os/imv_os.c')
-rw-r--r--src/libimcv/plugins/imv_os/imv_os.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/libimcv/plugins/imv_os/imv_os.c b/src/libimcv/plugins/imv_os/imv_os.c
index 65538df07..f1cb74e50 100644
--- a/src/libimcv/plugins/imv_os/imv_os.c
+++ b/src/libimcv/plugins/imv_os/imv_os.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Andreas Steffen
+ * Copyright (C) 2012-2013 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -360,7 +360,9 @@ static TNC_Result receive_message(imv_state_t *state, imv_msg_t *in_msg)
out_msg->add_attribute(out_msg, attr);
}
- if (fatal_error)
+ if (fatal_error ||
+ (os_state->get_attribute_request(os_state) &&
+ os_state->get_info(os_state, NULL, NULL, NULL) == NULL))
{
state->set_recommendation(state,
TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION,
@@ -371,10 +373,13 @@ static TNC_Result receive_message(imv_state_t *state, imv_msg_t *in_msg)
/* If all Installed Packages attributes were received, go to assessment */
if (!assessment &&
!os_state->get_package_request(os_state) &&
- !os_state->get_angel_count(os_state))
+ !os_state->get_angel_count(os_state) &&
+ os_state->get_info(os_state, NULL, NULL, NULL))
{
int device_id, count, count_update, count_blacklist, count_ok;
u_int os_settings;
+ u_int32_t id_type;
+ chunk_t id_value;
os_settings = os_state->get_os_settings(os_state);
os_state->get_count(os_state, &count, &count_update, &count_blacklist,
@@ -385,9 +390,10 @@ static TNC_Result receive_message(imv_state_t *state, imv_msg_t *in_msg)
/* Store device information in database */
device_id = os_state->get_device_id(os_state);
+ id_value = state->get_ar_id(state, &id_type);
if (os_db && device_id)
{
- os_db->set_device_info(os_db, device_id,
+ os_db->set_device_info(os_db, device_id, id_type, id_value,
os_state->get_info(os_state, NULL, NULL, NULL),
count, count_update, count_blacklist, os_settings);
}
@@ -518,6 +524,8 @@ TNC_Result TNC_IMV_BatchEnding(TNC_IMVID imv_id,
{
imv_state_t *state;
imv_os_state_t *os_state;
+ TNC_IMV_Action_Recommendation rec;
+ TNC_IMV_Evaluation_Result eval;
TNC_Result result = TNC_RESULT_SUCCESS;
if (!imv_os)
@@ -531,6 +539,18 @@ TNC_Result TNC_IMV_BatchEnding(TNC_IMVID imv_id,
}
os_state = (imv_os_state_t*)state;
+ state->get_recommendation(state, &rec, &eval);
+
+ /*
+ * Don't send an attribute request if an evaluation is available
+ * or if an attribute request has already been sent
+ */
+ if (eval != TNC_IMV_EVALUATION_RESULT_DONT_KNOW ||
+ os_state->get_attribute_request(os_state))
+ {
+ return TNC_RESULT_SUCCESS;
+ }
+
if (os_state->get_info(os_state, NULL, NULL, NULL) == NULL)
{
imv_msg_t *out_msg;
@@ -548,6 +568,7 @@ TNC_Result TNC_IMV_BatchEnding(TNC_IMVID imv_id,
attr_cast->add(attr_cast, PEN_IETF, IETF_ATTR_FORWARDING_ENABLED);
attr_cast->add(attr_cast, PEN_IETF, IETF_ATTR_FACTORY_DEFAULT_PWD_ENABLED);
out_msg->add_attribute(out_msg, attr);
+ os_state->set_attribute_request(os_state, TRUE);
/* send PA-TNC message with excl flag not set */
result = out_msg->send(out_msg, FALSE);