diff options
author | Romain Francoise <rfrancoise@debian.org> | 2014-10-21 19:28:38 +0200 |
---|---|---|
committer | Romain Francoise <rfrancoise@debian.org> | 2014-10-21 19:41:50 +0200 |
commit | b23b0e5609ed4b3d29396a1727aab035fa4a395f (patch) | |
tree | 091d0b144dd92a0c124b7fbe9eae68f79cb975dc /src/libimcv/ita/ita_attr_get_settings.c | |
parent | 4a01a7e2574040cf246fd00ebff173b873c17349 (diff) | |
download | vyos-strongswan-b23b0e5609ed4b3d29396a1727aab035fa4a395f.tar.gz vyos-strongswan-b23b0e5609ed4b3d29396a1727aab035fa4a395f.zip |
Import upstream release 5.2.1
Diffstat (limited to 'src/libimcv/ita/ita_attr_get_settings.c')
-rw-r--r-- | src/libimcv/ita/ita_attr_get_settings.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/src/libimcv/ita/ita_attr_get_settings.c b/src/libimcv/ita/ita_attr_get_settings.c index d0bc31d32..3c047fb82 100644 --- a/src/libimcv/ita/ita_attr_get_settings.c +++ b/src/libimcv/ita/ita_attr_get_settings.c @@ -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 @@ -64,7 +64,12 @@ struct private_ita_attr_get_settings_t { pen_type_t type; /** - * Attribute value + * Length of attribute value + */ + size_t length; + + /** + * Attribute value or segment */ chunk_t value; @@ -130,6 +135,7 @@ METHOD(pa_tnc_attr_t, build, void, enumerator->destroy(enumerator); this->value = writer->extract_buf(writer); + this->length = this->value.len; writer->destroy(writer); } @@ -141,10 +147,15 @@ METHOD(pa_tnc_attr_t, process, status_t, chunk_t name; status_t status = FAILED; + *offset = 0; + + if (this->value.len < this->length) + { + return NEED_MORE; + } if (this->value.len < ITA_GET_SETTINGS_MIN_SIZE) { DBG1(DBG_TNC, "insufficient data for ITA Get Settings attribute"); - *offset = 0; return FAILED; } @@ -171,6 +182,12 @@ end: return status; } +METHOD(pa_tnc_attr_t, add_segment, void, + private_ita_attr_get_settings_t *this, chunk_t segment) +{ + this->value = chunk_cat("mc", this->value, segment); +} + METHOD(pa_tnc_attr_t, get_ref, pa_tnc_attr_t*, private_ita_attr_get_settings_t *this) { @@ -217,6 +234,7 @@ pa_tnc_attr_t *ita_attr_get_settings_create(char *name) .set_noskip_flag = _set_noskip_flag, .build = _build, .process = _process, + .add_segment = _add_segment, .get_ref = _get_ref, .destroy = _destroy, }, @@ -238,7 +256,8 @@ pa_tnc_attr_t *ita_attr_get_settings_create(char *name) /** * Described in header. */ -pa_tnc_attr_t *ita_attr_get_settings_create_from_data(chunk_t data) +pa_tnc_attr_t *ita_attr_get_settings_create_from_data(size_t length, + chunk_t data) { private_ita_attr_get_settings_t *this; @@ -251,6 +270,7 @@ pa_tnc_attr_t *ita_attr_get_settings_create_from_data(chunk_t data) .set_noskip_flag = _set_noskip_flag, .build = _build, .process = _process, + .add_segment = _add_segment, .get_ref = _get_ref, .destroy = _destroy, }, @@ -258,6 +278,7 @@ pa_tnc_attr_t *ita_attr_get_settings_create_from_data(chunk_t data) .create_enumerator = _create_enumerator, }, .type = { PEN_ITA, ITA_ATTR_GET_SETTINGS }, + .length = length, .value = chunk_clone(data), .list = linked_list_create(), .ref = 1, |