diff options
| author | me_desk <me_desk@fb96df88-216d-11de-830c-f3023f12d8ac> | 2013-08-22 21:22:29 +0000 |
|---|---|---|
| committer | me_desk <me_desk@fb96df88-216d-11de-830c-f3023f12d8ac> | 2013-08-22 21:22:29 +0000 |
| commit | bfd5528f28264772a245dc29f41d4bb5d29fb1eb (patch) | |
| tree | c9f9beb72d7a91baaaf84117d6b541941306b524 | |
| parent | ba711be9bdce4b3d0ced9bff5e2399aa3442e611 (diff) | |
| download | pica-pica-bfd5528f28264772a245dc29f41d4bb5d29fb1eb.tar.gz pica-pica-bfd5528f28264772a245dc29f41d4bb5d29fb1eb.zip | |
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
| -rw-r--r-- | PICA_id.h | 2 | ||||
| -rwxr-xr-x | PICA_node.c | 19 | ||||
| -rwxr-xr-x | PICA_node.h | 6 |
3 files changed, 17 insertions, 10 deletions
@@ -19,4 +19,4 @@ char *PICA_id_to_base64(const unsigned char *id, char *buf); } #endif -#endif
\ No newline at end of file +#endif 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<MAX_NEWCONNS;i++) if(!PICA_processdatastream(newconns[i].buf,&(newconns[i].pos),newconns+i /*arg*/,_msginfo_newconn, MSGINFO_MSGSNUM(_msginfo_newconn) )) { - //puts("processdatastream error\n");//debug newconn_close(newconns+i); } //FD_CLR(newconns[i].sck,readfds); diff --git a/PICA_node.h b/PICA_node.h index 43b24f5..27011ee 100755 --- a/PICA_node.h +++ b/PICA_node.h @@ -67,9 +67,9 @@ #define PICA_NETWORKNAME "TESTNET" // TEMP //CONF -#define NEWCONN_BUFSIZE 64 -//#define CL_RBUFSIZE 32 -//#define CL_WBUFSIZE 128 +#define NEWCONN_BUFSIZE 58 //FIXME this is the size of CONNID packet, this packet is followed by TLS session negotiation data. + //TLS data must not be interpreted as some PICA packet by PICA_processdatastream(), + //so buffer size is limited by the size of CONNID. #define DEFAULT_BUF_SIZE 4096 |
