From: Pekka Riikonen Date: Sat, 10 Nov 2001 19:40:47 +0000 (+0000) Subject: updates. X-Git-Tag: silcertest~14 X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=commitdiff_plain;h=9760bfae79884774c7a7edcd4035ca770bcf9a87 updates. --- diff --git a/CHANGES b/CHANGES index f9a63bd7..f65dc8c9 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,10 @@ +Sat Nov 10 21:39:22 EET 2001 Pekka Riikonen + + * If the incoming packet type is REKEY or REKEY_DONE process + that packet always synchronously. Fixes yet another MAC + failed error on slow (dialup) connections. Affected file + lib/silcclient/client.c and silcd/server.c. + Thu Nov 8 22:21:09 EET 2001 Pekka Riikonen * Call check_version SKE callback for initiator too. Affected diff --git a/TODO b/TODO index 03544691..15baff85 100644 --- a/TODO +++ b/TODO @@ -42,6 +42,10 @@ TODO/bugs In SILC Client Library o WHOIS shows the formatted nickname wrong in some circumstances. + o Set incrorrect key and /MSG him, screen gets screwed. + + o Crashes if lots of concurrent /PING's. + o JOIN command's argument handling is buggy. See the XXX in the code. diff --git a/apps/silcd/server.c b/apps/silcd/server.c index bfee9c32..3a227c50 100644 --- a/apps/silcd/server.c +++ b/apps/silcd/server.c @@ -1666,9 +1666,11 @@ bool silc_server_packet_parse(SilcPacketParserContext *parser_context, process all packets synchronously, since there might be packets in queue that we are not able to decrypt without first processing the packets before them. */ - if (sock->protocol && sock->protocol->protocol && - (sock->protocol->protocol->type == SILC_PROTOCOL_SERVER_KEY_EXCHANGE || - sock->protocol->protocol->type == SILC_PROTOCOL_SERVER_REKEY)) { + if ((parser_context->packet->type == SILC_PACKET_REKEY || + parser_context->packet->type == SILC_PACKET_REKEY_DONE) || + (sock->protocol && sock->protocol->protocol && + (sock->protocol->protocol->type == SILC_PROTOCOL_SERVER_KEY_EXCHANGE || + sock->protocol->protocol->type == SILC_PROTOCOL_SERVER_REKEY))) { silc_server_packet_parse_real(server->schedule, 0, sock->sock, parser_context); @@ -3377,7 +3379,7 @@ void silc_server_announce_get_channels(SilcServer server, (*channel_ids)[i] = NULL; silc_server_announce_get_channel_users(server, channel, channel_users, - channel_users_modes[i]); + &(*channel_users_modes)[i]); (*channel_ids)[i] = channel->id; i++; diff --git a/lib/silcclient/client.c b/lib/silcclient/client.c index 7ff149fd..687341ec 100644 --- a/lib/silcclient/client.c +++ b/lib/silcclient/client.c @@ -778,7 +778,7 @@ static bool silc_client_packet_parse(SilcPacketParserContext *parser_context, SilcPacketContext *packet = parser_context->packet; SilcPacketType ret; - if (conn && conn->hmac_receive) + if (conn && conn->hmac_receive && conn->sock == sock) conn->psn_receive = parser_context->packet->sequence + 1; /* Parse the packet immediately */ @@ -797,9 +797,10 @@ static bool silc_client_packet_parse(SilcPacketParserContext *parser_context, process all packets synchronously, since there might be packets in queue that we are not able to decrypt without first processing the packets before them. */ - if (sock->protocol && sock->protocol->protocol && - (sock->protocol->protocol->type == SILC_PROTOCOL_CLIENT_KEY_EXCHANGE || - sock->protocol->protocol->type == SILC_PROTOCOL_CLIENT_REKEY)) { + if ((ret == SILC_PACKET_REKEY || ret == SILC_PACKET_REKEY_DONE) || + (sock->protocol && sock->protocol->protocol && + (sock->protocol->protocol->type == SILC_PROTOCOL_CLIENT_KEY_EXCHANGE || + sock->protocol->protocol->type == SILC_PROTOCOL_CLIENT_REKEY))) { /* Parse the incoming packet type */ silc_client_packet_parse_type(client, sock, packet); diff --git a/lib/silccore/silcpacket.c b/lib/silccore/silcpacket.c index 0791a70f..044c1965 100644 --- a/lib/silccore/silcpacket.c +++ b/lib/silccore/silcpacket.c @@ -332,7 +332,6 @@ void silc_packet_receive_process(SilcSocketConnection sock, { SilcPacketParserContext *parse_ctx; int packetlen, paddedlen, mac_len = 0; - int block_len = cipher ? silc_cipher_get_block_len(cipher) : 0; bool cont = TRUE; /* Do not process for disconnected connection */ @@ -379,6 +378,7 @@ void silc_packet_receive_process(SilcSocketConnection sock, parse_ctx = silc_calloc(1, sizeof(*parse_ctx)); parse_ctx->packet = silc_packet_context_alloc(); parse_ctx->packet->buffer = silc_buffer_alloc(paddedlen + mac_len); + parse_ctx->packet->type = sock->inbuf->data[3]; parse_ctx->packet->padlen = sock->inbuf->data[4]; parse_ctx->packet->sequence = sequence++; parse_ctx->sock = sock; @@ -390,7 +390,8 @@ void silc_packet_receive_process(SilcSocketConnection sock, paddedlen + mac_len); SILC_LOG_HEXDUMP(("Incoming packet (%d) (%dB decrypted), len %d", - sequence - 1, block_len, paddedlen + mac_len), + sequence - 1, SILC_PACKET_MIN_HEADER_LEN, + paddedlen + mac_len), sock->inbuf->data, paddedlen + mac_len); /* Check whether this is normal or special packet */ diff --git a/lib/silccore/silcpacket.h b/lib/silccore/silcpacket.h index 54e5453c..3bfd897f 100644 --- a/lib/silccore/silcpacket.h +++ b/lib/silccore/silcpacket.h @@ -174,21 +174,21 @@ typedef unsigned char SilcPacketFlags; * Packet flags. Flags are defined above. * * unsigned char *src_id - * uint16 src_id_len + * uint8 src_id_len * unsigned char src_id_type * * Source ID, its length and type. On packet reception retuned ID's * are always the hash values of the ID's from the packet. * * unsigned char *dst_id; - * uint16 dst_id_len; + * uint8 dst_id_len; * unsigned char src_id_type; * * Destination ID, its length and type. On packet reception retuned * ID's are always the hash values of the ID's from the packet. * * uint16 truelen - * uint16 padlen + * uint8 padlen * * The true lenght of the packet and the padded length of the packet. * These may be set by the caller before calling any of the