added IETF standard error handling method
[strongswan.git] / src / libpts / plugins / imv_attestation / imv_attestation.c
index 7803fb6..cd6f5b5 100644 (file)
@@ -239,8 +239,11 @@ static TNC_Result receive_message(TNC_IMVID imv_id,
                return result;
        }
 
+       /* preprocess any IETF standard error attributes */
+       result = pa_tnc_msg->process_ietf_std_errors(pa_tnc_msg) ?
+                                       TNC_RESULT_FATAL : TNC_RESULT_SUCCESS;
+
        attr_list = linked_list_create();
-       result = TNC_RESULT_SUCCESS;
 
        /* analyze PA-TNC attributes */
        enumerator = pa_tnc_msg->create_attribute_enumerator(pa_tnc_msg);
@@ -253,43 +256,22 @@ static TNC_Result receive_message(TNC_IMVID imv_id,
                                ietf_attr_pa_tnc_error_t *error_attr;
                                pen_t error_vendor_id;
                                pa_tnc_error_code_t error_code;
-                               chunk_t msg_info, attr_info;
-                               u_int32_t offset;
+                               chunk_t msg_info;
 
                                error_attr = (ietf_attr_pa_tnc_error_t*)attr;
                                error_vendor_id = error_attr->get_vendor_id(error_attr);
-                               error_code = error_attr->get_error_code(error_attr);
-                               msg_info = error_attr->get_msg_info(error_attr);
 
-                               if (error_vendor_id == PEN_IETF)
-                               {
-                                       DBG1(DBG_IMV, "received PA-TNC error '%N' "
-                                                                 "concerning message %#B",
-                                                pa_tnc_error_code_names, error_code, &msg_info);
-
-                                       switch (error_code)
-                                       {
-                                               case PA_ERROR_INVALID_PARAMETER:
-                                                       offset = error_attr->get_offset(error_attr);
-                                                       DBG1(DBG_IMV, "  occurred at offset of %u bytes",
-                                                                offset);
-                                                       break;
-                                               case PA_ERROR_ATTR_TYPE_NOT_SUPPORTED:
-                                                       attr_info = error_attr->get_attr_info(error_attr);
-                                                       DBG1(DBG_IMV, "  unsupported attribute %#B",
-                                                                &attr_info);
-                                                       break;
-                                               default:
-                                                       break;
-                                       }
-                               }
-                               else if (error_vendor_id == PEN_TCG)
+                               if (error_vendor_id == PEN_TCG)
                                {
+                                       error_code = error_attr->get_error_code(error_attr);
+                                       msg_info = error_attr->get_msg_info(error_attr);
+
                                        DBG1(DBG_IMV, "received TCG-PTS error '%N'",
                                                 pts_error_code_names, error_code);
                                        DBG1(DBG_IMV, "error information: %B", &msg_info);
+
+                                       result = TNC_RESULT_FATAL;
                                }
-                               result = TNC_RESULT_FATAL;
                        }
                        else if (attr->get_type(attr) == IETF_ATTR_PRODUCT_INFORMATION)
                        {