From bfd5528f28264772a245dc29f41d4bb5d29fb1eb Mon Sep 17 00:00:00 2001 From: me_desk Date: Thu, 22 Aug 2013 21:22:29 +0000 Subject: fixed NEWCONN_BUFSIZE to make it equal to CONNID packet size in order to prevent interpreting TLS session data that follows this packet as some PICA protocol message. This is workaround, problem must be fixed in more proper way git-svn-id: svn://localhost/project_picapica/trunk@265 fb96df88-216d-11de-830c-f3023f12d8ac --- PICA_node.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'PICA_node.c') diff --git a/PICA_node.c b/PICA_node.c index 8afa573..09a3197 100755 --- a/PICA_node.c +++ b/PICA_node.c @@ -211,18 +211,26 @@ PICA_debug1("received CONNID"); caller_id = buf + 2; callee_id = buf + 2 + PICA_ID_SIZE; -//PICA_debug1("CONNID: caller_id=%u callee_id=%u",caller_id,callee_id); +{ +char caller_id_buf[2 * PICA_ID_SIZE], callee_id_buf[2 * PICA_ID_SIZE]; +PICA_debug1("CONNID: caller_id=%s callee_id=%s",PICA_id_to_base64(caller_id, caller_id_buf),PICA_id_to_base64(callee_id, callee_id_buf)); +} link=cclink_list_search(caller_id, callee_id); if (!link) + { + PICA_debug3("corresponding cclink not found"); return 0; - + } if (link->state!=PICA_CCLINK_LOCAL_WAITCONNCLE && link->state!=PICA_CCLINK_LOCAL_WAITCONNCLR && link->state!=PICA_CCLINK_N2NCLR_WAITCONNCLR && link->state!=PICA_CCLINK_N2NCLE_WAITCONNCLE) + { + PICA_debug2("found cclink is not in expected state"); return 0; - + } + { struct client *c; //проверка IP адреса. @@ -266,7 +274,7 @@ if (link->state==PICA_CCLINK_N2NCLE_WAITCONNCLE) return 0; } } - +PICA_debug3("CONNID processed successfully"); cclink_activate(link,nc->sck); newconn_free(nc); return 1; @@ -1356,7 +1364,7 @@ return 1; void newconn_close(struct newconn* nc) { CLOSE(nc->sck); -PICA_debug2("closed socket %i", nc->sck); +PICA_debug3("newconn_close(): nc = %p closed socket %i", nc, nc->sck); nc->sck=0; nc->pos=0; @@ -2141,7 +2149,6 @@ for (i=0;i