From c1343b3278cdf99533b7902744d15969f9d6fdc1 Mon Sep 17 00:00:00 2001 From: Yves-Alexis Perez Date: Wed, 2 Jan 2013 14:18:20 +0100 Subject: Imported Upstream version 5.0.1 --- src/libimcv/ita/ita_attr_command.c | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) (limited to 'src/libimcv/ita/ita_attr_command.c') diff --git a/src/libimcv/ita/ita_attr_command.c b/src/libimcv/ita/ita_attr_command.c index 5c1577a7c..d43e4777b 100644 --- a/src/libimcv/ita/ita_attr_command.c +++ b/src/libimcv/ita/ita_attr_command.c @@ -1,5 +1,6 @@ /* - * Copyright (C) 2011 Andreas Steffen, HSR Hochschule fuer Technik Rapperswil + * Copyright (C) 2011-2012 Andreas Steffen + * HSR Hochschule fuer Technik Rapperswil * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -32,14 +33,9 @@ struct private_ita_attr_command_t { ita_attr_command_t public; /** - * Attribute vendor ID + * Vendor-specific attribute type */ - pen_t vendor_id; - - /** - * Attribute type - */ - u_int32_t type; + pen_type_t type; /** * Attribute value @@ -62,13 +58,7 @@ struct private_ita_attr_command_t { refcount_t ref; }; -METHOD(pa_tnc_attr_t, get_vendor_id, pen_t, - private_ita_attr_command_t *this) -{ - return this->vendor_id; -} - -METHOD(pa_tnc_attr_t, get_type, u_int32_t, +METHOD(pa_tnc_attr_t, get_type, pen_type_t, private_ita_attr_command_t *this) { return this->type; @@ -95,6 +85,10 @@ METHOD(pa_tnc_attr_t, set_noskip_flag,void, METHOD(pa_tnc_attr_t, build, void, private_ita_attr_command_t *this) { + if (this->value.ptr) + { + return; + } this->value = chunk_create(this->command, strlen(this->command)); this->value = chunk_clone(this->value); } @@ -143,7 +137,6 @@ pa_tnc_attr_t *ita_attr_command_create(char *command) INIT(this, .public = { .pa_tnc_attribute = { - .get_vendor_id = _get_vendor_id, .get_type = _get_type, .get_value = _get_value, .get_noskip_flag = _get_noskip_flag, @@ -155,8 +148,7 @@ pa_tnc_attr_t *ita_attr_command_create(char *command) }, .get_command = _get_command, }, - .vendor_id = PEN_ITA, - .type = ITA_ATTR_COMMAND, + .type = { PEN_ITA, ITA_ATTR_COMMAND }, .command = strdup(command), .ref = 1, ); @@ -174,7 +166,6 @@ pa_tnc_attr_t *ita_attr_command_create_from_data(chunk_t data) INIT(this, .public = { .pa_tnc_attribute = { - .get_vendor_id = _get_vendor_id, .get_type = _get_type, .get_value = _get_value, .build = _build, @@ -184,8 +175,7 @@ pa_tnc_attr_t *ita_attr_command_create_from_data(chunk_t data) }, .get_command = _get_command, }, - .vendor_id = PEN_ITA, - .type = ITA_ATTR_COMMAND, + .type = {PEN_ITA, ITA_ATTR_COMMAND }, .value = chunk_clone(data), .ref = 1, ); -- cgit v1.2.3