aboutsummaryrefslogtreecommitdiffstats
path: root/src/libimcv/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/libimcv/plugins')
-rw-r--r--src/libimcv/plugins/imc_os/imc_os.c28
-rw-r--r--src/libimcv/plugins/imv_os/imv_os.c16
2 files changed, 39 insertions, 5 deletions
diff --git a/src/libimcv/plugins/imc_os/imc_os.c b/src/libimcv/plugins/imc_os/imc_os.c
index f50b8aa87..48bc6e286 100644
--- a/src/libimcv/plugins/imc_os/imc_os.c
+++ b/src/libimcv/plugins/imc_os/imc_os.c
@@ -123,8 +123,32 @@ TNC_Result TNC_IMC_NotifyConnectionChange(TNC_IMCID imc_id,
static void add_product_info(imc_msg_t *msg)
{
pa_tnc_attr_t *attr;
-
- attr = ietf_attr_product_info_create(PEN_IETF, 0, os->get_name(os));
+ chunk_t os_name;
+ pen_t vendor_id = PEN_IETF;
+ char *vendor;
+ int i;
+
+ typedef struct vendor_pen_t {
+ char *vendor;
+ pen_t pen;
+ } vendor_pen_t;
+
+ vendor_pen_t vendor_pens[] = {
+ { "Debian", PEN_DEBIAN },
+ { "Ubuntu", PEN_CANONICAL }
+ };
+
+ os_name = os->get_name(os);
+ for (i = 0; i < countof(vendor_pens); i++)
+ {
+ vendor = vendor_pens[i].vendor;
+ if (chunk_equals(os_name, chunk_create(vendor, strlen(vendor))))
+ {
+ vendor_id = vendor_pens[i].pen;
+ break;
+ }
+ }
+ attr = ietf_attr_product_info_create(vendor_id, 0, os_name);
msg->add_attribute(msg, attr);
}
diff --git a/src/libimcv/plugins/imv_os/imv_os.c b/src/libimcv/plugins/imv_os/imv_os.c
index 2346918b8..2cb60efcc 100644
--- a/src/libimcv/plugins/imv_os/imv_os.c
+++ b/src/libimcv/plugins/imv_os/imv_os.c
@@ -138,11 +138,21 @@ static TNC_Result receive_message(imv_state_t *state, imv_msg_t *in_msg)
case IETF_ATTR_PRODUCT_INFORMATION:
{
ietf_attr_product_info_t *attr_cast;
+ pen_t vendor_id;
attr_cast = (ietf_attr_product_info_t*)attr;
- os_name = attr_cast->get_info(attr_cast, NULL, NULL);
- DBG1(DBG_IMV, "operating system name is '%.*s'",
- os_name.len, os_name.ptr);
+ os_name = attr_cast->get_info(attr_cast, &vendor_id, NULL);
+ if (vendor_id != PEN_IETF)
+ {
+ DBG1(DBG_IMV, "operating system name is '%.*s' "
+ "from vendor %N", os_name.len, os_name.ptr,
+ pen_names, vendor_id);
+ }
+ else
+ {
+ DBG1(DBG_IMV, "operating system name is '%.*s'",
+ os_name.len, os_name.ptr);
+ }
break;
}
case IETF_ATTR_STRING_VERSION: