Use python-based swidGenerator to generated SWID tags
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2012 Andreas Steffen
|
||||
* Copyright (C) 2012-2014 Andreas Steffen
|
||||
* HSR Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
@@ -41,8 +41,6 @@ typedef struct package_entry_t package_entry_t;
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
*/
|
||||
|
||||
#define INSTALLED_PACKAGES_MIN_SIZE 4
|
||||
|
||||
/**
|
||||
* Private data of an ietf_attr_installed_packages_t object.
|
||||
*/
|
||||
@@ -132,7 +130,7 @@ METHOD(pa_tnc_attr_t, build, void,
|
||||
{
|
||||
return;
|
||||
}
|
||||
writer = bio_writer_create(INSTALLED_PACKAGES_MIN_SIZE);
|
||||
writer = bio_writer_create(IETF_INSTALLED_PACKAGES_MIN_SIZE);
|
||||
writer->write_uint16(writer, 0x0000);
|
||||
writer->write_uint16(writer, this->packages->get_count(this->packages));
|
||||
|
||||
@@ -160,7 +158,7 @@ METHOD(pa_tnc_attr_t, process, status_t,
|
||||
|
||||
*offset = 0;
|
||||
|
||||
if (this->value.len < INSTALLED_PACKAGES_MIN_SIZE)
|
||||
if (this->value.len < IETF_INSTALLED_PACKAGES_MIN_SIZE)
|
||||
{
|
||||
DBG1(DBG_TNC, "insufficient data for IETF installed packages");
|
||||
return FAILED;
|
||||
@@ -168,7 +166,7 @@ METHOD(pa_tnc_attr_t, process, status_t,
|
||||
reader = bio_reader_create(this->value);
|
||||
reader->read_uint16(reader, &reserved);
|
||||
reader->read_uint16(reader, &count);
|
||||
*offset = INSTALLED_PACKAGES_MIN_SIZE;
|
||||
*offset = IETF_INSTALLED_PACKAGES_MIN_SIZE;
|
||||
|
||||
while (reader->remaining(reader))
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2012 Andreas Steffen
|
||||
* Copyright (C) 2012-2014 Andreas Steffen
|
||||
* HSR Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
@@ -26,6 +26,7 @@ typedef struct ietf_attr_installed_packages_t ietf_attr_installed_packages_t;
|
||||
#include "ietf_attr.h"
|
||||
#include "pa_tnc/pa_tnc_attr.h"
|
||||
|
||||
#define IETF_INSTALLED_PACKAGES_MIN_SIZE 4
|
||||
|
||||
/**
|
||||
* Class implementing the IETF PA-TNC Installed Packages attribute.
|
||||
|
||||
@@ -216,6 +216,30 @@ INSERT INTO products ( /* 36 */
|
||||
'Ubuntu 14.04 x86_64'
|
||||
);
|
||||
|
||||
INSERT INTO products ( /* 37 */
|
||||
name
|
||||
) VALUES (
|
||||
'Debian 7.3 i686'
|
||||
);
|
||||
|
||||
INSERT INTO products ( /* 38 */
|
||||
name
|
||||
) VALUES (
|
||||
'Debian 7.3 x86_64'
|
||||
);
|
||||
|
||||
INSERT INTO products ( /* 39 */
|
||||
name
|
||||
) VALUES (
|
||||
'Debian 7.4 i686'
|
||||
);
|
||||
|
||||
INSERT INTO products ( /* 40 */
|
||||
name
|
||||
) VALUES (
|
||||
'Debian 7.4 x86_64'
|
||||
);
|
||||
|
||||
/* Directories */
|
||||
|
||||
INSERT INTO directories ( /* 1 */
|
||||
@@ -666,6 +690,18 @@ INSERT INTO groups_product_defaults (
|
||||
4, 27
|
||||
);
|
||||
|
||||
INSERT INTO groups_product_defaults (
|
||||
group_id, product_id
|
||||
) VALUES (
|
||||
4, 37
|
||||
);
|
||||
|
||||
INSERT INTO groups_product_defaults (
|
||||
group_id, product_id
|
||||
) VALUES (
|
||||
4, 39
|
||||
);
|
||||
|
||||
INSERT INTO groups_product_defaults (
|
||||
group_id, product_id
|
||||
) VALUES (
|
||||
@@ -696,6 +732,18 @@ INSERT INTO groups_product_defaults (
|
||||
5, 28
|
||||
);
|
||||
|
||||
INSERT INTO groups_product_defaults (
|
||||
group_id, product_id
|
||||
) VALUES (
|
||||
5, 38
|
||||
);
|
||||
|
||||
INSERT INTO groups_product_defaults (
|
||||
group_id, product_id
|
||||
) VALUES (
|
||||
5, 40
|
||||
);
|
||||
|
||||
INSERT INTO groups_product_defaults (
|
||||
group_id, product_id
|
||||
) VALUES (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2011-2012 Andreas Steffen
|
||||
* Copyright (C) 2011-2014 Andreas Steffen
|
||||
* HSR Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
@@ -26,6 +26,8 @@ typedef struct pa_tnc_attr_t pa_tnc_attr_t;
|
||||
#include <library.h>
|
||||
#include <pen/pen.h>
|
||||
|
||||
#define PA_TNC_ATTR_HEADER_SIZE 12
|
||||
|
||||
/**
|
||||
* Interface for an RFC 5792 PA-TNC Posture Attribute.
|
||||
*
|
||||
@@ -71,7 +73,7 @@ struct pa_tnc_attr_t {
|
||||
* @param relative error offset within attribute body
|
||||
* @return result status
|
||||
*/
|
||||
status_t (*process)(pa_tnc_attr_t *this, u_int32_t *offset);
|
||||
status_t (*process)(pa_tnc_attr_t *this, uint32_t *offset);
|
||||
|
||||
/**
|
||||
* Get a new reference to the PA-TNC attribute
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2011-2012 Andreas Steffen
|
||||
* Copyright (C) 2011-2014 Andreas Steffen
|
||||
* HSR Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <pen/pen.h>
|
||||
#include <utils/debug.h>
|
||||
|
||||
|
||||
typedef struct private_pa_tnc_msg_t private_pa_tnc_msg_t;
|
||||
|
||||
/**
|
||||
@@ -38,7 +37,6 @@ typedef struct private_pa_tnc_msg_t private_pa_tnc_msg_t;
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
*/
|
||||
|
||||
#define PA_TNC_HEADER_SIZE 8
|
||||
#define PA_TNC_RESERVED 0x000000
|
||||
|
||||
/**
|
||||
@@ -59,7 +57,6 @@ typedef struct private_pa_tnc_msg_t private_pa_tnc_msg_t;
|
||||
|
||||
#define PA_TNC_ATTR_FLAG_NONE 0x00
|
||||
#define PA_TNC_ATTR_FLAG_NOSKIP (1<<7)
|
||||
#define PA_TNC_ATTR_HEADER_SIZE 12
|
||||
#define PA_TNC_ATTR_INFO_SIZE 8
|
||||
|
||||
/**
|
||||
@@ -86,7 +83,7 @@ struct private_pa_tnc_msg_t {
|
||||
/**
|
||||
* Message identifier
|
||||
*/
|
||||
u_int32_t identifier;
|
||||
uint32_t identifier;
|
||||
|
||||
/**
|
||||
* Current PA-TNC Message size
|
||||
@@ -139,13 +136,13 @@ METHOD(pa_tnc_msg_t, build, bool,
|
||||
pa_tnc_attr_t *attr;
|
||||
enum_name_t *pa_attr_names;
|
||||
pen_type_t type;
|
||||
u_int8_t flags;
|
||||
uint8_t flags;
|
||||
chunk_t value;
|
||||
nonce_gen_t *ng;
|
||||
|
||||
/* generate a nonce as a message identifier */
|
||||
ng = lib->crypto->create_nonce_gen(lib->crypto);
|
||||
if (!ng || !ng->get_nonce(ng, 4, (u_int8_t*)&this->identifier))
|
||||
if (!ng || !ng->get_nonce(ng, 4, (uint8_t*)&this->identifier))
|
||||
{
|
||||
DBG1(DBG_TNC, "failed to generate random PA-TNC message identifier");
|
||||
DESTROY_IF(ng);
|
||||
@@ -205,8 +202,8 @@ METHOD(pa_tnc_msg_t, process, status_t,
|
||||
{
|
||||
bio_reader_t *reader;
|
||||
pa_tnc_attr_t *error;
|
||||
u_int8_t version;
|
||||
u_int32_t reserved, offset, attr_offset;
|
||||
uint8_t version;
|
||||
uint32_t reserved, offset, attr_offset;
|
||||
pen_type_t error_code = { PEN_IETF, PA_ERROR_INVALID_PARAMETER };
|
||||
|
||||
/* process message header */
|
||||
@@ -237,8 +234,8 @@ METHOD(pa_tnc_msg_t, process, status_t,
|
||||
while (reader->remaining(reader) >= PA_TNC_ATTR_HEADER_SIZE)
|
||||
{
|
||||
pen_t vendor_id;
|
||||
u_int8_t flags;
|
||||
u_int32_t type, length;
|
||||
uint8_t flags;
|
||||
uint32_t type, length;
|
||||
chunk_t value, attr_info;
|
||||
pa_tnc_attr_t *attr;
|
||||
enum_name_t *pa_attr_names;
|
||||
@@ -372,7 +369,7 @@ METHOD(pa_tnc_msg_t, process_ietf_std_errors, bool,
|
||||
ietf_attr_pa_tnc_error_t *error_attr;
|
||||
pen_type_t error_code;
|
||||
chunk_t msg_info, attr_info;
|
||||
u_int32_t offset;
|
||||
uint32_t offset;
|
||||
|
||||
error_attr = (ietf_attr_pa_tnc_error_t*)attr;
|
||||
error_code = error_attr->get_error_code(error_attr);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2011-2012 Andreas Steffen
|
||||
* Copyright (C) 2011-2014 Andreas Steffen
|
||||
* HSR Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
@@ -24,6 +24,7 @@
|
||||
typedef struct pa_tnc_msg_t pa_tnc_msg_t;
|
||||
|
||||
#define PA_TNC_VERSION 0x01
|
||||
#define PA_TNC_HEADER_SIZE 8
|
||||
|
||||
#include "pa_tnc_attr.h"
|
||||
|
||||
|
||||
@@ -353,11 +353,12 @@ static void add_installed_packages(imc_state_t *state, imc_msg_t *msg)
|
||||
* Compute the maximum IETF Installed Packages attribute size
|
||||
* leaving space for an additional ITA Angel attribute
|
||||
*/
|
||||
max_attr_size = state->get_max_msg_len(state) - 8 - 12;
|
||||
max_attr_size = state->get_max_msg_len(state) -
|
||||
PA_TNC_HEADER_SIZE - PA_TNC_ATTR_HEADER_SIZE;
|
||||
|
||||
/* At least one IETF Installed Packages attribute is sent */
|
||||
attr = ietf_attr_installed_packages_create();
|
||||
attr_size = 12 + 4;
|
||||
attr_size = PA_TNC_ATTR_HEADER_SIZE + IETF_INSTALLED_PACKAGES_MIN_SIZE;
|
||||
|
||||
enumerator = os->create_package_enumerator(os);
|
||||
if (enumerator)
|
||||
@@ -384,7 +385,8 @@ static void add_installed_packages(imc_state_t *state, imc_msg_t *msg)
|
||||
|
||||
/* create the next IETF Installed Packages attribute */
|
||||
attr = ietf_attr_installed_packages_create();
|
||||
attr_size = 12 + 4;
|
||||
attr_size = PA_TNC_ATTR_HEADER_SIZE +
|
||||
IETF_INSTALLED_PACKAGES_MIN_SIZE;
|
||||
}
|
||||
attr_cast = (ietf_attr_installed_packages_t*)attr;
|
||||
attr_cast->add(attr_cast, name, version);
|
||||
|
||||
Reference in New Issue
Block a user