summaryrefslogtreecommitdiff
path: root/src/libimcv/ita/ita_attr_command.c
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2013-01-02 14:18:20 +0100
committerYves-Alexis Perez <corsac@debian.org>2013-01-02 14:18:20 +0100
commitc1343b3278cdf99533b7902744d15969f9d6fdc1 (patch)
treed5ed3dc5677a59260ec41cd39bb284d3e94c91b3 /src/libimcv/ita/ita_attr_command.c
parentb34738ed08c2227300d554b139e2495ca5da97d6 (diff)
downloadvyos-strongswan-c1343b3278cdf99533b7902744d15969f9d6fdc1.tar.gz
vyos-strongswan-c1343b3278cdf99533b7902744d15969f9d6fdc1.zip
Imported Upstream version 5.0.1
Diffstat (limited to 'src/libimcv/ita/ita_attr_command.c')
-rw-r--r--src/libimcv/ita/ita_attr_command.c32
1 files changed, 11 insertions, 21 deletions
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,
);