summaryrefslogtreecommitdiff
path: root/src/libimcv/swima
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2018-09-24 15:11:14 +0200
committerYves-Alexis Perez <corsac@debian.org>2018-09-24 15:11:14 +0200
commite0e280b7669435b991b7e457abd8aa450930b3e8 (patch)
tree3e6084f13b14ad2df104e2ce6e589eb96c5f7ac9 /src/libimcv/swima
parent51a71ee15c1bcf0e82f363a16898f571e211f9c3 (diff)
downloadvyos-strongswan-e0e280b7669435b991b7e457abd8aa450930b3e8.tar.gz
vyos-strongswan-e0e280b7669435b991b7e457abd8aa450930b3e8.zip
New upstream version 5.7.0
Diffstat (limited to 'src/libimcv/swima')
-rw-r--r--src/libimcv/swima/swima_collector.c12
-rw-r--r--src/libimcv/swima/swima_data_model.c6
-rw-r--r--src/libimcv/swima/swima_event.h1
3 files changed, 14 insertions, 5 deletions
diff --git a/src/libimcv/swima/swima_collector.c b/src/libimcv/swima/swima_collector.c
index 096093b01..d2b50616f 100644
--- a/src/libimcv/swima/swima_collector.c
+++ b/src/libimcv/swima/swima_collector.c
@@ -13,6 +13,8 @@
* for more details.
*/
+#define _GNU_SOURCE /* for asprintf() */
+
#include "swima_collector.h"
#include <swid_gen/swid_gen.h>
@@ -319,7 +321,7 @@ static status_t generate_tags(private_swima_collector_t *this,
static bool collect_tags(private_swima_collector_t *this, char *pathname,
swima_inventory_t *targets, bool is_swidtag_dir)
{
- char *rel_name, *abs_name, *suffix, *pos;
+ char *rel_name, *abs_name, *suffix, *pos, *uri;
chunk_t *swid_tag, sw_id, sw_locator;
swima_record_t *sw_record;
struct stat st;
@@ -433,8 +435,12 @@ static bool collect_tags(private_swima_collector_t *this, char *pathname,
}
DBG2(DBG_IMC, " %s", rel_name);
+ sw_locator = chunk_empty;
pos = strstr(pathname, "/swidtag");
- sw_locator = pos ? chunk_create(pathname, pos - pathname) : chunk_empty;
+ if (pos && asprintf(&uri, "file://%.*s", pos - pathname, pathname) > 0)
+ {
+ sw_locator = chunk_from_str(uri);
+ }
sw_record = swima_record_create(0, sw_id, sw_locator);
sw_record->set_source_id(sw_record, SOURCE_ID_COLLECTOR);
if (!this->sw_id_only)
@@ -442,8 +448,10 @@ static bool collect_tags(private_swima_collector_t *this, char *pathname,
sw_record->set_record(sw_record, *swid_tag);
}
this->inventory->add(this->inventory, sw_record);
+
chunk_unmap(swid_tag);
chunk_free(&sw_id);
+ chunk_free(&sw_locator);
}
success = TRUE;
diff --git a/src/libimcv/swima/swima_data_model.c b/src/libimcv/swima/swima_data_model.c
index f444724c1..f38d92145 100644
--- a/src/libimcv/swima/swima_data_model.c
+++ b/src/libimcv/swima/swima_data_model.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 Andreas Steffen
+ * Copyright (C) 2017-2018 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -19,10 +19,10 @@
* ISO/IEC 19770-2-2015: Information Technology - Software Asset Management -
* Part 2: Software Identification Tag
*/
-pen_type_t swima_data_model_iso_2015_swid_xml = { PEN_IETF, 1 };
+pen_type_t swima_data_model_iso_2015_swid_xml = { PEN_IETF, 0 };
/**
* ISO/IEC 19770-2-2009: Information Technology - Software Asset Management -
* Part 2: Software Identification Tag
*/
-pen_type_t swima_data_model_iso_2009_swid_xml = { PEN_IETF, 2 };
+pen_type_t swima_data_model_iso_2009_swid_xml = { PEN_IETF, 1 };
diff --git a/src/libimcv/swima/swima_event.h b/src/libimcv/swima/swima_event.h
index fe69d6aad..7391f3e9f 100644
--- a/src/libimcv/swima/swima_event.h
+++ b/src/libimcv/swima/swima_event.h
@@ -25,6 +25,7 @@
#include <library.h>
+#define SWIMA_EVENT_ACTION_NONE 0
#define SWIMA_EVENT_ACTION_CREATION 1
#define SWIMA_EVENT_ACTION_DELETION 2
#define SWIMA_EVENT_ACTION_ALTERATION 3