send a reason string only if action recommendation is not allow

This commit is contained in:
Andreas Steffen
2011-06-14 15:45:34 +02:00
parent 08dc42b025
commit 0dbfdece4f
+8 -2
View File
@@ -431,7 +431,12 @@ METHOD(imv_agent_t, provide_recommendation, TNC_Result,
this->id, this->name, connection_id); this->id, this->name, connection_id);
return TNC_RESULT_FATAL; return TNC_RESULT_FATAL;
} }
state->get_recommendation(state, &rec, &eval);
/* send a reason string if action recommendation is not allow */
if (rec != TNC_IMV_ACTION_RECOMMENDATION_ALLOW)
{
/* check if there a preferred language has been requested */ /* check if there a preferred language has been requested */
if (this->get_attribute && if (this->get_attribute &&
this->get_attribute(this->id, connection_id, this->get_attribute(this->id, connection_id,
@@ -446,7 +451,8 @@ METHOD(imv_agent_t, provide_recommendation, TNC_Result,
/* find a reason string for the preferred or default language and set it */ /* find a reason string for the preferred or default language and set it */
if (this->set_attribute && if (this->set_attribute &&
state->get_reason_string(state, pref_lang, &reason_string, &reason_lang)) state->get_reason_string(state, pref_lang, &reason_string,
&reason_lang))
{ {
this->set_attribute(this->id, connection_id, this->set_attribute(this->id, connection_id,
TNC_ATTRIBUTEID_REASON_STRING, TNC_ATTRIBUTEID_REASON_STRING,
@@ -455,8 +461,8 @@ METHOD(imv_agent_t, provide_recommendation, TNC_Result,
TNC_ATTRIBUTEID_REASON_LANGUAGE, TNC_ATTRIBUTEID_REASON_LANGUAGE,
reason_lang.len, reason_lang.ptr); reason_lang.len, reason_lang.ptr);
} }
}
state->get_recommendation(state, &rec, &eval);
return this->provide_recommendation(this->id, connection_id, rec, eval); return this->provide_recommendation(this->id, connection_id, rec, eval);
} }