centralized processing of assessment information
[strongswan.git] / src / libimcv / imv / imv_msg.c
index d7fd436..b628c32 100644 (file)
@@ -191,7 +191,7 @@ METHOD(imv_msg_t, send_assessment, TNC_Result,
        TNC_IMV_Action_Recommendation rec;
        TNC_IMV_Evaluation_Result eval;
        pa_tnc_attr_t *attr;
-       char *string, *lang_code;
+       char *string = NULL, *lang_code = NULL, *uri = NULL;
        enumerator_t *e;
 
        /* Send an IETF Assessment Result attribute if enabled */
@@ -202,17 +202,27 @@ METHOD(imv_msg_t, send_assessment, TNC_Result,
                attr = ietf_attr_assess_result_create(eval);
                add_attribute(this, attr);
 
+               /* Send IETF Remediation Instructions if available */
                if (eval != TNC_IMV_EVALUATION_RESULT_COMPLIANT)
                {
                        e = this->agent->create_language_enumerator(this->agent,
-                                                                                                               this->state);
+                                                                       this->state);
                        if (this->state->get_remediation_instructions(this->state,
-                                                                                               e, &string, &lang_code))
+                                                                       e, &string, &lang_code, &uri))
                        {
-                               attr = ietf_attr_remediation_instr_create_from_string(
+                               if (string && lang_code)
+                               {
+                                       attr = ietf_attr_remediation_instr_create_from_string(
                                                                        chunk_create(string, strlen(string)),
                                                                        chunk_create(lang_code, strlen(lang_code)));
-                               add_attribute(this, attr);
+                                       add_attribute(this, attr);
+                               }
+                               if (uri)
+                               {
+                                       attr = ietf_attr_remediation_instr_create_from_uri(
+                                                                       chunk_create(uri, strlen(uri)));
+                                       add_attribute(this, attr);
+                               }
                        }
                        e->destroy(e);
                }