initialize chunks and add debug output
authorAndreas Steffen <andreas.steffen@strongswan.org>
Tue, 16 Nov 2010 21:28:10 +0000 (22:28 +0100)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Tue, 16 Nov 2010 21:28:10 +0000 (22:28 +0100)
src/libcharon/plugins/tnc_imv/tnc_imv_recommendations.c

index 5e8eccf..b162a36 100644 (file)
@@ -275,7 +275,7 @@ METHOD(recommendations_t, get_preferred_language, chunk_t,
 METHOD(recommendations_t, set_preferred_language, void,
        private_tnc_imv_recommendations_t *this, chunk_t pref_lang)
 {
-       chunk_free(&this->preferred_language);
+       free(this->preferred_language.ptr);
        this->preferred_language = chunk_clone(pref_lang);
 }
 
@@ -286,6 +286,9 @@ METHOD(recommendations_t, set_reason_string, TNC_Result,
        recommendation_entry_t *entry;
        bool found = FALSE;
 
+       DBG2(DBG_TNC, "IMV %u is setting reason string to '%.*s'",
+                id, reason.len, reason.ptr);
+
        enumerator = this->recs->create_enumerator(this->recs);
        while (enumerator->enumerate(enumerator, &entry))
        {
@@ -308,6 +311,9 @@ METHOD(recommendations_t, set_reason_language, TNC_Result,
        recommendation_entry_t *entry;
        bool found = FALSE;
 
+       DBG2(DBG_TNC, "IMV %u is setting reason language to '%.*s'",
+                id, reason_lang.len, reason_lang.ptr);
+
        enumerator = this->recs->create_enumerator(this->recs);
        while (enumerator->enumerate(enumerator, &entry))
        {
@@ -371,6 +377,8 @@ recommendations_t* tnc_imv_recommendations_create(linked_list_t *imv_list)
                entry->have_recommendation = FALSE;
                entry->rec = TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION;
                entry->eval = TNC_IMV_EVALUATION_RESULT_DONT_KNOW;
+               entry->reason = chunk_empty;
+               entry->reason_language = chunk_empty;
                this->recs->insert_last(this->recs, entry);             
        }
        enumerator->destroy(enumerator);