aboutsummaryrefslogtreecommitdiffstats
path: root/src/libimcv/plugins/imc_os
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2012-10-31 20:29:36 +0100
committerAndreas Steffen <andreas.steffen@strongswan.org>2012-10-31 20:29:36 +0100
commit9901207a0976de8ebe102c2b94fa78de4526466d (patch)
treecaa9b6482b469f2128f4681cf6aea50ca5078690 /src/libimcv/plugins/imc_os
parent3e765dad95c88687e557c997258981efaae28477 (diff)
downloadstrongswan-9901207a0976de8ebe102c2b94fa78de4526466d.tar.bz2
strongswan-9901207a0976de8ebe102c2b94fa78de4526466d.tar.xz
transmit Product Vendor ID if known
Diffstat (limited to 'src/libimcv/plugins/imc_os')
-rw-r--r--src/libimcv/plugins/imc_os/imc_os.c28
1 files changed, 26 insertions, 2 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);
}