fixed generation of PA-TNC error messages
This commit is contained in:
@@ -207,7 +207,7 @@ METHOD(pa_tnc_msg_t, process, status_t,
|
|||||||
pa_tnc_attr_t *error;
|
pa_tnc_attr_t *error;
|
||||||
u_int8_t version;
|
u_int8_t version;
|
||||||
u_int32_t reserved, offset, attr_offset;
|
u_int32_t reserved, offset, attr_offset;
|
||||||
pen_type_t error_code;
|
pen_type_t error_code = { PEN_IETF, PA_ERROR_INVALID_PARAMETER };
|
||||||
|
|
||||||
/* process message header */
|
/* process message header */
|
||||||
if (this->encoding.len < PA_TNC_HEADER_SIZE)
|
if (this->encoding.len < PA_TNC_HEADER_SIZE)
|
||||||
@@ -224,9 +224,8 @@ METHOD(pa_tnc_msg_t, process, status_t,
|
|||||||
|
|
||||||
if (version != PA_TNC_VERSION)
|
if (version != PA_TNC_VERSION)
|
||||||
{
|
{
|
||||||
pen_type_t error_code = { PEN_IETF, PA_ERROR_VERSION_NOT_SUPPORTED };
|
|
||||||
|
|
||||||
DBG1(DBG_TNC, "PA-TNC version %u not supported", version);
|
DBG1(DBG_TNC, "PA-TNC version %u not supported", version);
|
||||||
|
error_code = pen_type_create(PEN_IETF, PA_ERROR_VERSION_NOT_SUPPORTED);
|
||||||
error = ietf_attr_pa_tnc_error_create(error_code, this->encoding);
|
error = ietf_attr_pa_tnc_error_create(error_code, this->encoding);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
@@ -244,7 +243,6 @@ METHOD(pa_tnc_msg_t, process, status_t,
|
|||||||
pa_tnc_attr_t *attr;
|
pa_tnc_attr_t *attr;
|
||||||
enum_name_t *pa_attr_names;
|
enum_name_t *pa_attr_names;
|
||||||
ietf_attr_pa_tnc_error_t *error_attr;
|
ietf_attr_pa_tnc_error_t *error_attr;
|
||||||
pen_type_t error_code;
|
|
||||||
|
|
||||||
attr_info = reader->peek(reader);
|
attr_info = reader->peek(reader);
|
||||||
attr_info.len = PA_TNC_ATTR_INFO_SIZE;
|
attr_info.len = PA_TNC_ATTR_INFO_SIZE;
|
||||||
@@ -272,7 +270,6 @@ METHOD(pa_tnc_msg_t, process, status_t,
|
|||||||
{
|
{
|
||||||
DBG1(DBG_TNC, "%u bytes too small for PA-TNC attribute length",
|
DBG1(DBG_TNC, "%u bytes too small for PA-TNC attribute length",
|
||||||
length);
|
length);
|
||||||
error_code = pen_type_create(PEN_IETF, PA_ERROR_INVALID_PARAMETER);
|
|
||||||
error = ietf_attr_pa_tnc_error_create_with_offset(error_code,
|
error = ietf_attr_pa_tnc_error_create_with_offset(error_code,
|
||||||
this->encoding, offset + PA_TNC_ATTR_INFO_SIZE);
|
this->encoding, offset + PA_TNC_ATTR_INFO_SIZE);
|
||||||
goto err;
|
goto err;
|
||||||
@@ -281,7 +278,6 @@ METHOD(pa_tnc_msg_t, process, status_t,
|
|||||||
if (!reader->read_data(reader, length - PA_TNC_ATTR_HEADER_SIZE, &value))
|
if (!reader->read_data(reader, length - PA_TNC_ATTR_HEADER_SIZE, &value))
|
||||||
{
|
{
|
||||||
DBG1(DBG_TNC, "insufficient bytes for PA-TNC attribute value");
|
DBG1(DBG_TNC, "insufficient bytes for PA-TNC attribute value");
|
||||||
error_code = pen_type_create(PEN_IETF, PA_ERROR_INVALID_PARAMETER);
|
|
||||||
error = ietf_attr_pa_tnc_error_create_with_offset(error_code,
|
error = ietf_attr_pa_tnc_error_create_with_offset(error_code,
|
||||||
this->encoding, offset + PA_TNC_ATTR_INFO_SIZE);
|
this->encoding, offset + PA_TNC_ATTR_INFO_SIZE);
|
||||||
goto err;
|
goto err;
|
||||||
@@ -314,8 +310,7 @@ METHOD(pa_tnc_msg_t, process, status_t,
|
|||||||
if (attr->process(attr, &attr_offset) != SUCCESS)
|
if (attr->process(attr, &attr_offset) != SUCCESS)
|
||||||
{
|
{
|
||||||
attr->destroy(attr);
|
attr->destroy(attr);
|
||||||
if (error_code.vendor_id == PEN_IETF &&
|
if (vendor_id == PEN_IETF && type == IETF_ATTR_PA_TNC_ERROR)
|
||||||
error_code.type == IETF_ATTR_PA_TNC_ERROR)
|
|
||||||
{
|
{
|
||||||
/* error while processing a PA-TNC error attribute - abort */
|
/* error while processing a PA-TNC error attribute - abort */
|
||||||
reader->destroy(reader);
|
reader->destroy(reader);
|
||||||
@@ -338,7 +333,6 @@ METHOD(pa_tnc_msg_t, process, status_t,
|
|||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
DBG1(DBG_TNC, "insufficient bytes for PA-TNC attribute header");
|
DBG1(DBG_TNC, "insufficient bytes for PA-TNC attribute header");
|
||||||
error_code = pen_type_create(PEN_IETF, PA_ERROR_INVALID_PARAMETER);
|
|
||||||
error = ietf_attr_pa_tnc_error_create_with_offset(error_code,
|
error = ietf_attr_pa_tnc_error_create_with_offset(error_code,
|
||||||
this->encoding, offset);
|
this->encoding, offset);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user