Make SWID directory where tags are stored configurable
authorAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 5 Sep 2013 10:25:02 +0000 (12:25 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 5 Sep 2013 10:25:02 +0000 (12:25 +0200)
man/strongswan.conf.5.in
src/libpts/plugins/imc_swid/Makefile.am
src/libpts/plugins/imc_swid/imc_swid.c
src/libpts/swid/swid_inventory.c
src/libpts/swid/swid_inventory.h

index ebd5ed9..3ccc438 100644 (file)
@@ -970,6 +970,9 @@ Send open listening ports without being prompted
 .BR libimcv.plugins.imv-scanner.remediation_uri
 URI pointing to scanner remediation instructions
 .TP
 .BR libimcv.plugins.imv-scanner.remediation_uri
 URI pointing to scanner remediation instructions
 .TP
+.BR libimcv.plugins.imc-swid.swid_directory "[$(prefix)/share]"
+Directory where SWID tags are located
+.TP
 .BR libimcv.plugins.imc-test.additional_ids " [0]"
 Number of additional IMC IDs
 .TP
 .BR libimcv.plugins.imc-test.additional_ids " [0]"
 Number of additional IMC IDs
 .TP
index be8d5f4..14a4293 100644 (file)
@@ -21,7 +21,8 @@ AM_CPPFLAGS = \
        -I$(top_srcdir)/src/libstrongswan \
        -I$(top_srcdir)/src/libtncif \
        -I$(top_srcdir)/src/libimcv \
        -I$(top_srcdir)/src/libstrongswan \
        -I$(top_srcdir)/src/libtncif \
        -I$(top_srcdir)/src/libimcv \
-       -I$(top_srcdir)/src/libpts
+       -I$(top_srcdir)/src/libpts \
+       -DSWID_DIRECTORY=\"${prefix}/share\"
 
 AM_CFLAGS = \
        -rdynamic
 
 AM_CFLAGS = \
        -rdynamic
index ed6dd8b..8e7c49b 100644 (file)
@@ -155,6 +155,7 @@ static TNC_Result receive_message(imc_state_t *state, imc_msg_t *in_msg)
                u_int8_t flags;
                u_int32_t request_id, eid_epoch;
                swid_inventory_t *swid_inventory;
                u_int8_t flags;
                u_int32_t request_id, eid_epoch;
                swid_inventory_t *swid_inventory;
+               char *swid_directory;
                bool full_tags;
 
                type = attr->get_type(attr);
                bool full_tags;
 
                type = attr->get_type(attr);
@@ -178,8 +179,11 @@ static TNC_Result receive_message(imc_state_t *state, imc_msg_t *in_msg)
                }
                full_tags = (flags & TCG_SWID_ATTR_REQ_FLAG_R) == 0;
 
                }
                full_tags = (flags & TCG_SWID_ATTR_REQ_FLAG_R) == 0;
 
+               swid_directory = lib->settings->get_str(lib->settings,
+                                                               "libimcv.plugins.imc-swid.swid_directory",
+                                                                SWID_DIRECTORY);
                swid_inventory = swid_inventory_create(full_tags);
                swid_inventory = swid_inventory_create(full_tags);
-               if (!swid_inventory->collect(swid_inventory))
+               if (!swid_inventory->collect(swid_inventory, swid_directory))
                {
                        swid_inventory->destroy(swid_inventory);
                        attr = swid_error_create(TCG_SWID_ERROR, request_id,
                {
                        swid_inventory->destroy(swid_inventory);
                        attr = swid_error_create(TCG_SWID_ERROR, request_id,
index 9a33018..9d5c309 100644 (file)
@@ -30,8 +30,6 @@
 
 typedef struct private_swid_inventory_t private_swid_inventory_t;
 
 
 typedef struct private_swid_inventory_t private_swid_inventory_t;
 
-#define SWID_TAG_DIRECTORY     "/usr/share"
-
 /**
  * Private data of a swid_inventory_t object.
  *
 /**
  * Private data of a swid_inventory_t object.
  *
@@ -179,9 +177,9 @@ end:
 }
 
 METHOD(swid_inventory_t, collect, bool,
 }
 
 METHOD(swid_inventory_t, collect, bool,
-       private_swid_inventory_t *this)
+       private_swid_inventory_t *this, char *directory)
 {
 {
-       return collect_tags(this, SWID_TAG_DIRECTORY);
+       return collect_tags(this, directory);
 }
 
 METHOD(swid_inventory_t, add, void,
 }
 
 METHOD(swid_inventory_t, add, void,
index 444ed57..ae3a0c2 100644 (file)
@@ -33,9 +33,10 @@ struct swid_inventory_t {
        /**
         * Collect the SWID tags stored on the endpoint
         *
        /**
         * Collect the SWID tags stored on the endpoint
         *
+        * @param directory             SWID directory path
         * @return                              TRUE if successful
         */
         * @return                              TRUE if successful
         */
-       bool (*collect)(swid_inventory_t *this);
+       bool (*collect)(swid_inventory_t *this, char *directory);
 
        /**
         * Collect the SWID tags stored on the endpoint
 
        /**
         * Collect the SWID tags stored on the endpoint