From 5d34c3610c4c8f45f4f40859bc09b9239dc5427d Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Sun, 11 Nov 2007 21:09:35 +0000 Subject: [PATCH] Free stream data always in eod of stream. Added some debugs too. --- CHANGES | 8 +++++++- apps/silcd/packet_send.c | 2 +- apps/silcd/server.c | 17 ++++++++++------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/CHANGES b/CHANGES index 64c6d05b..dc2339de 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,10 @@ -Sun Nov 11 16:02:12 EET 2007 Pekka Riikonen +Sun Nov 11 23:04:54 EET 2007 Pekka Riikonen + + * Free stream data and abort ongoing protocols correctly + for primary router connections receiving end of stream. + Affected file is apps/silcd/server.c. + +Sun Nov 11 16:02:12 EET 2007 Pekka Riikonen * SILC Server 1.1 Beta4. diff --git a/apps/silcd/packet_send.c b/apps/silcd/packet_send.c index 234b88f0..7a900109 100644 --- a/apps/silcd/packet_send.c +++ b/apps/silcd/packet_send.c @@ -295,7 +295,7 @@ void silc_server_packet_send_to_channel(SilcServer server, int k; /* This doesn't send channel message packets */ - assert(type != SILC_PACKET_CHANNEL_MESSAGE); + SILC_ASSERT(type != SILC_PACKET_CHANNEL_MESSAGE); /* If there are global users in the channel we will send the message first to our router for further routing. */ diff --git a/apps/silcd/server.c b/apps/silcd/server.c index 8093acf6..fd57d9d4 100644 --- a/apps/silcd/server.c +++ b/apps/silcd/server.c @@ -202,6 +202,7 @@ static void silc_server_packet_eos(SilcPacketEngine engine, if (server->router_conn && server->router_conn->sock == stream && !server->router && server->standalone) { silc_server_create_connections(server); + silc_server_free_sock_user_data(server, stream, NULL); } else { /* If backup disconnected then mark that resuming will not be allowed */ if (server->server_type == SILC_ROUTER && !server->backup_router && @@ -1341,9 +1342,9 @@ silc_server_ke_auth_compl(SilcConnAuth connauth, SilcBool success, SilcID remote_id; const char *ip; - SILC_LOG_DEBUG(("Connection authentication completed")); + SILC_LOG_DEBUG(("Connection %p authentication completed", sconn)); - sconn->op = NULL; + entry->op = NULL; if (success == FALSE) { /* Authentication failed */ @@ -1583,7 +1584,9 @@ static void silc_server_ke_completed(SilcSKE ske, SilcSKEStatus status, SilcHmac hmac_send, hmac_receive; SilcHash hash; - sconn->op = NULL; + SILC_LOG_DEBUG(("Connection %p, SKE completed", sconn)); + + entry->op = NULL; if (status != SILC_SKE_STATUS_OK) { /* SKE failed */ @@ -1657,7 +1660,7 @@ static void silc_server_ke_completed(SilcSKE ske, SilcSKEStatus status, entry->data.rekey = rekey; /* Start connection authentication */ - sconn->op = + entry->op = silc_connauth_initiator(connauth, server->server_type == SILC_SERVER ? SILC_CONN_SERVER : SILC_CONN_ROUTER, auth_meth, auth_data, auth_data_len, @@ -1720,7 +1723,7 @@ void silc_server_start_key_exchange(SilcServerConnection sconn) params.flags |= SILC_SKE_SP_FLAG_PFS; /* Start SILC Key Exchange protocol */ - SILC_LOG_DEBUG(("Starting key exchange protocol")); + SILC_LOG_DEBUG(("Starting key exchange protocol, connection %p", sconn)); ske = silc_ske_alloc(server->rng, server->schedule, server->repository, server->public_key, server->private_key, sconn); if (!ske) { @@ -1737,7 +1740,7 @@ void silc_server_start_key_exchange(SilcServerConnection sconn) /* Start key exchange protocol */ params.version = silc_version_string; params.timeout_secs = server->config->key_exchange_timeout; - sconn->op = silc_ske_initiator(ske, sconn->sock, ¶ms, NULL); + entry->op = silc_ske_initiator(ske, sconn->sock, ¶ms, NULL); } /* Timeout callback that will be called to retry connecting to remote @@ -1804,7 +1807,7 @@ static void silc_server_connection_established(SilcNetStatus status, switch (status) { case SILC_NET_OK: - SILC_LOG_DEBUG(("Connection to %s:%d established", + SILC_LOG_DEBUG(("Connection %p to %s:%d established", sconn, sconn->remote_host, sconn->remote_port)); /* Continue with key exchange protocol */ -- 2.24.0