terminate TNCCS 1.1 connection after sending recommendation
authorAndreas Steffen <andreas.steffen@strongswan.org>
Mon, 10 Jan 2011 06:22:02 +0000 (07:22 +0100)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Tue, 11 Jan 2011 00:17:40 +0000 (01:17 +0100)
src/libcharon/plugins/tnccs_11/tnccs_11.c

index 9d3989b..b5b2a8a 100644 (file)
@@ -199,6 +199,19 @@ static void handle_message(private_tnccs_11_t *this, tnccs_msg_t *msg)
                                                                        chunk_create(lang, strlen(lang)));
                        break;
                }
+               case TNCCS_MSG_REASON_STRINGS:
+               {
+                       tnccs_reason_strings_msg_t *reason_msg;
+                       chunk_t reason_string, reason_lang;
+
+                       reason_msg = (tnccs_reason_strings_msg_t*)msg;
+                       reason_string = reason_msg->get_reason(reason_msg, &reason_lang);
+                       DBG2(DBG_TNC, "reason string is '%.*s",   reason_string.len,
+                                                                                                         reason_string.ptr);
+                       DBG2(DBG_TNC, "reason language is '%.*s", reason_lang.len,
+                                                                                                         reason_lang.ptr);
+                       break;
+               }
                default:
                        break;
        }
@@ -319,6 +332,9 @@ static void check_and_build_recommendation(private_tnccs_11_t *this)
                        this->batch->add_msg(this->batch, msg);
                }
                enumerator->destroy(enumerator);
+
+               /* we have reache the final state */
+               this->delete_state = TRUE;
        }
 }
 
@@ -359,7 +375,8 @@ METHOD(tls_t, build, status_t,
        /* Do not allow any asynchronous IMCs or IMVs to add additional messages */
        this->mutex->lock(this->mutex);
 
-       if (this->is_server && (!this->batch || this->fatal_error))
+       if (this->is_server && !this->delete_state &&
+          (!this->batch || this->fatal_error))
        {
                check_and_build_recommendation(this);
        }