Make SWID directory where tags are stored configurable
This commit is contained in:
@@ -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.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
|
||||
|
||||
@@ -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/libpts
|
||||
-I$(top_srcdir)/src/libpts \
|
||||
-DSWID_DIRECTORY=\"${prefix}/share\"
|
||||
|
||||
AM_CFLAGS = \
|
||||
-rdynamic
|
||||
|
||||
@@ -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;
|
||||
char *swid_directory;
|
||||
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;
|
||||
|
||||
swid_directory = lib->settings->get_str(lib->settings,
|
||||
"libimcv.plugins.imc-swid.swid_directory",
|
||||
SWID_DIRECTORY);
|
||||
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,
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
|
||||
typedef struct private_swid_inventory_t private_swid_inventory_t;
|
||||
|
||||
#define SWID_TAG_DIRECTORY "/usr/share"
|
||||
|
||||
/**
|
||||
* Private data of a swid_inventory_t object.
|
||||
*
|
||||
@@ -179,9 +177,9 @@ end:
|
||||
}
|
||||
|
||||
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,
|
||||
|
||||
@@ -33,9 +33,10 @@ struct swid_inventory_t {
|
||||
/**
|
||||
* Collect the SWID tags stored on the endpoint
|
||||
*
|
||||
* @param directory SWID directory path
|
||||
* @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
|
||||
|
||||
Reference in New Issue
Block a user