Added os_info support to HCD IMC
authorAndreas Steffen <andreas.steffen@strongswan.org>
Wed, 27 May 2015 08:19:31 +0000 (10:19 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Tue, 18 Aug 2015 19:25:38 +0000 (21:25 +0200)
src/libimcv/plugins/imc_hcd/imc_hcd.c

index 35badeb..cdea220 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <imc/imc_agent.h>
 #include <imc/imc_msg.h>
+#include <imc/imc_os_info.h>
 #include <generic/generic_attr_bool.h>
 #include <generic/generic_attr_chunk.h>
 #include <generic/generic_attr_string.h>
@@ -39,6 +40,7 @@ static pen_type_t msg_types[] = {
 };
 
 static imc_agent_t *imc_hcd;
+static imc_os_info_t *os;
 
 typedef struct quadruple_t quadruple_t;
 
@@ -82,6 +84,15 @@ TNC_Result TNC_IMC_API TNC_IMC_Initialize(TNC_IMCID imc_id,
                return TNC_RESULT_FATAL;
        }
 
+       os = imc_os_info_create();
+       if (!os)
+       {
+               imc_hcd->destroy(imc_hcd);
+               imc_hcd = 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");
@@ -696,6 +707,9 @@ TNC_Result TNC_IMC_API TNC_IMC_Terminate(TNC_IMCID imc_id)
        imc_hcd->destroy(imc_hcd);
        imc_hcd = NULL;
 
+       os->destroy(os);
+       os = NULL;
+
        return TNC_RESULT_SUCCESS;
 }