Send PA-TNC assessment result even if no workitems are available
authorAndreas Steffen <andreas.steffen@strongswan.org>
Sun, 23 Jun 2013 22:22:38 +0000 (00:22 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Sun, 23 Jun 2013 22:22:38 +0000 (00:22 +0200)
src/libimcv/plugins/imv_scanner/imv_scanner_agent.c
src/libimcv/plugins/imv_scanner/imv_scanner_state.c

index b164054..a8a12bc 100644 (file)
@@ -255,6 +255,10 @@ METHOD(imv_agent_if_t, batch_ending, TNC_Result,
                return TNC_RESULT_SUCCESS;
        }
 
+       /* create an empty out message - we might need it */
+       out_msg = imv_msg_create(this->agent, state, id, imv_id, TNC_IMCID_ANY,
+                                                        msg_types[0]);
+
        if (!session)
        {
                DBG2(DBG_IMV, "no workitems available - no evaluation possible");
@@ -263,13 +267,15 @@ METHOD(imv_agent_if_t, batch_ending, TNC_Result,
                                                        TNC_IMV_EVALUATION_RESULT_DONT_KNOW);
                scanner_state->set_handshake_state(scanner_state,
                                                        IMV_SCANNER_STATE_END);
-               return TNC_RESULT_SUCCESS;
+               result = out_msg->send_assessment(out_msg);
+               out_msg->destroy(out_msg);
+               if (result != TNC_RESULT_SUCCESS)
+               {
+                       return result;
+               }
+               return this->agent->provide_recommendation(this->agent, state);
        }
 
-       /* create an empty out message - we might need it */
-       out_msg = imv_msg_create(this->agent, state, id, imv_id, TNC_IMCID_ANY,
-                                                        msg_types[0]);
-
        if (handshake_state == IMV_SCANNER_STATE_INIT)
        {
                enumerator = session->create_workitem_enumerator(session);
index eeb7045..d8bba98 100644 (file)
@@ -272,7 +272,7 @@ METHOD(imv_state_t, get_reason_string, bool,
        private_imv_scanner_state_t *this, enumerator_t *language_enumerator,
        chunk_t *reason_string, char **reason_language)
 {
-       if (!this->violating_ports)
+       if (this->violating_ports->get_count(this->violating_ports) == 0)
        {
                return FALSE;
        }
@@ -292,7 +292,7 @@ METHOD(imv_state_t, get_remediation_instructions, bool,
        private_imv_scanner_state_t *this, enumerator_t *language_enumerator,
        chunk_t *string, char **lang_code, char **uri)
 {
-       if (!this->violating_ports)
+       if (this->violating_ports->get_count(this->violating_ports) == 0)
        {
                return FALSE;
        }