restrict PA-TNC messages to maximum size

This commit is contained in:
Andreas Steffen
2012-07-12 21:26:18 +02:00
parent c5d2e61802
commit 968c83cdeb
15 changed files with 243 additions and 29 deletions
+14 -4
View File
@@ -78,10 +78,15 @@ struct private_tnccs_20_t {
pb_tnc_batch_type_t batch_type;
/**
* Maximum PA-TNC batch size
* Maximum PB-TNC batch size
*/
size_t max_batch_len;
/**
* Maximum PA-TNC message size
*/
size_t max_msg_len;
/**
* Mutex locking the batch in construction
*/
@@ -407,8 +412,9 @@ METHOD(tls_t, process, status_t,
if (this->is_server && !this->connection_id)
{
this->connection_id = tnc->tnccs->create_connection(tnc->tnccs,
TNCCS_2_0, (tnccs_t*)this, _send_msg,
&this->request_handshake_retry, &this->recs);
TNCCS_2_0, (tnccs_t*)this, _send_msg,
&this->request_handshake_retry,
this->max_msg_len, &this->recs);
if (!this->connection_id)
{
return FAILED;
@@ -583,7 +589,8 @@ METHOD(tls_t, build, status_t,
this->connection_id = tnc->tnccs->create_connection(tnc->tnccs,
TNCCS_2_0, (tnccs_t*)this, _send_msg,
&this->request_handshake_retry, NULL);
&this->request_handshake_retry,
this->max_msg_len, NULL);
if (!this->connection_id)
{
return FAILED;
@@ -797,6 +804,9 @@ tls_t *tnccs_20_create(bool is_server)
.max_batch_len = lib->settings->get_int(lib->settings,
"%s.plugins.tnccs-20.max_batch_size", 65522,
charon->name),
.max_msg_len = lib->settings->get_int(lib->settings,
"%s.plugins.tnccs-20.max_msg_size", 65490,
charon->name),
);
return &this->public;