aboutsummaryrefslogtreecommitdiffstats
path: root/src/libimcv/plugins/imc_os
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2012-10-10 21:54:05 +0200
committerAndreas Steffen <andreas.steffen@strongswan.org>2012-10-10 21:54:21 +0200
commit6ab1502519025e2bd05d01d49fe3d0f1ce8d6bd6 (patch)
treeb851d0b12249cefd3bdbec8efac1e0f8d5c4e175 /src/libimcv/plugins/imc_os
parent7f3bf2b12f81e85c9a0a66c6bcc5c2b44db66b49 (diff)
downloadstrongswan-6ab1502519025e2bd05d01d49fe3d0f1ce8d6bd6.tar.bz2
strongswan-6ab1502519025e2bd05d01d49fe3d0f1ce8d6bd6.tar.xz
implemented os_info_t class
Diffstat (limited to 'src/libimcv/plugins/imc_os')
-rw-r--r--src/libimcv/plugins/imc_os/imc_os.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/libimcv/plugins/imc_os/imc_os.c b/src/libimcv/plugins/imc_os/imc_os.c
index be6fb36ac..a397dfa5f 100644
--- a/src/libimcv/plugins/imc_os/imc_os.c
+++ b/src/libimcv/plugins/imc_os/imc_os.c
@@ -24,6 +24,7 @@
#include <ietf/ietf_attr_pa_tnc_error.h>
#include <ietf/ietf_attr_product_info.h>
#include <ietf/ietf_attr_string_version.h>
+#include <os_info/os_info.h>
#include <tncif_pa_subtypes.h>
@@ -40,6 +41,7 @@ static const char imc_name[] = "OS";
#define IMC_SUBTYPE PA_SUBTYPE_IETF_OPERATING_SYSTEM
static imc_agent_t *imc_os;
+static os_info_t *os;
/**
* see section 3.8.1 of TCG TNC IF-IMC Specification 1.3
@@ -60,6 +62,16 @@ TNC_Result TNC_IMC_Initialize(TNC_IMCID imc_id,
{
return TNC_RESULT_FATAL;
}
+
+ os = os_info_create();
+ if (!os)
+ {
+ imc_os->destroy(imc_os);
+ imc_os = NULL;
+
+ return TNC_RESULT_FATAL;
+ }
+
if (min_version > TNC_IFIMC_VERSION_1 || max_version < TNC_IFIMC_VERSION_1)
{
DBG1(DBG_IMC, "no common IF-IMC version");
@@ -110,9 +122,8 @@ TNC_Result TNC_IMC_NotifyConnectionChange(TNC_IMCID imc_id,
static void add_product_info(linked_list_t *attr_list)
{
pa_tnc_attr_t *attr;
- char *os_name = "Ubuntu";
- attr = ietf_attr_product_info_create(PEN_IETF, 0, os_name);
+ attr = ietf_attr_product_info_create(PEN_IETF, 0, os->get_name(os));
attr_list->insert_last(attr_list, attr);
}
@@ -122,9 +133,9 @@ static void add_product_info(linked_list_t *attr_list)
static void add_string_version(linked_list_t *attr_list)
{
pa_tnc_attr_t *attr;
- chunk_t os_version = { "12.04", 5};
- attr = ietf_attr_string_version_create(os_version, chunk_empty, chunk_empty);
+ attr = ietf_attr_string_version_create(os->get_version(os),
+ chunk_empty, chunk_empty);
attr_list->insert_last(attr_list, attr);
}
@@ -362,6 +373,9 @@ TNC_Result TNC_IMC_Terminate(TNC_IMCID imc_id)
imc_os->destroy(imc_os);
imc_os = NULL;
+ os->destroy(os);
+ os = NULL;
+
return TNC_RESULT_SUCCESS;
}