Send empty CDATA batch if TNC client has no data to send

This commit is contained in:
Andreas Steffen
2012-12-23 22:16:30 +01:00
parent ef33a4ab82
commit 9787b9f2e0
+15 -3
View File
@@ -646,7 +646,9 @@ METHOD(tls_t, build, status_t,
if (this->batch_type == PB_BATCH_NONE) if (this->batch_type == PB_BATCH_NONE)
{ {
if (this->is_server && state == PB_STATE_SERVER_WORKING) if (this->is_server)
{
if (state == PB_STATE_SERVER_WORKING)
{ {
if (this->state_machine->get_empty_cdata(this->state_machine)) if (this->state_machine->get_empty_cdata(this->state_machine))
{ {
@@ -659,15 +661,25 @@ METHOD(tls_t, build, status_t,
this->batch_type = PB_BATCH_SDATA; this->batch_type = PB_BATCH_SDATA;
} }
} }
}
else else
{ {
switch (state)
{
case PB_STATE_CLIENT_WORKING:
DBG2(DBG_TNC, "no client data to send, "
"sending empty PB-TNC CDATA batch");
this->batch_type = PB_BATCH_CDATA;
break;
case PB_STATE_DECIDED:
/** /**
* In the DECIDED state and if no CRETRY is under way, * In the DECIDED state and if no CRETRY is under way,
* a PB-TNC client replies with an empty CLOSE batch. * a PB-TNC client replies with an empty CLOSE batch.
*/ */
if (state == PB_STATE_DECIDED)
{
this->batch_type = PB_BATCH_CLOSE; this->batch_type = PB_BATCH_CLOSE;
break;
default:
break;
} }
} }
} }