From ca7f322762d7944d0366c69d704892e7dc74643f Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Wed, 27 Mar 2002 18:34:26 +0000 Subject: [PATCH] updates. --- CHANGES | 18 ++++++++++++++++++ TODO | 8 +------- TODO-1.0 | 2 ++ apps/silcd/packet_receive.c | 32 +++++++++++++++++++++++--------- lib/silcclient/client_notify.c | 17 ++++++++++------- lib/silccore/silcidcache.c | 23 +++++++---------------- 6 files changed, 61 insertions(+), 39 deletions(-) diff --git a/CHANGES b/CHANGES index ee399f1c..66a4a746 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,21 @@ +Wed Mar 27 19:43:16 EET 2002 Pekka Riikonen + + * Fixed the KICKED notify handling in client library to + correctly remove the channel and all entries from the + channel when I was kicked. This bug crashed the client. + + Fixed yet another but in KICKED notify handling to remove + the kicked client correctly from the channel. + + Affected file is lib/silcclient/client_notify.c. + + * Fixed a minor bug in looking up correct client entry + in KICKED notify in server. Affected file is + silcd/packet_receive.c. + + * Fixed the lib/silcmath/Makefile.am to include the MPI and GMP + sources correctly to distribution. Fixes --with-gmp option. + Wed Mar 27 00:07:11 EET 2002 Pekka Riikonen * Fixed a bug in the silc_client_nickname_format function that diff --git a/TODO b/TODO index 8c389dbc..7812eab4 100644 --- a/TODO +++ b/TODO @@ -27,8 +27,6 @@ TODO/bugs In SILC Client Library TODO/bugs In SILC Server ======================== - o KICKing doesn't work. - o Configuration file additions (Do this to 0.8.x): o Add incoming connection frequency, incoming connection frequency @@ -74,11 +72,7 @@ TODO/bugs In SILC Libraries o WIN32 silc_net_create_connection_async does not work the same way than on Unix. Do it with threads on WIN32. The function works but - is not actually async currently. - - o EPOC specific additions/changes required: - - o lib/silcutil/epoc routines missing or not completed. + is not actually async currently (Fix this to 1.0). TODO in Toolkit Documentation diff --git a/TODO-1.0 b/TODO-1.0 index b843d59b..afda54a9 100644 --- a/TODO-1.0 +++ b/TODO-1.0 @@ -159,6 +159,8 @@ least could be done. o EPOC specific additions/changes required: + o lib/silcutil/epoc routines missing or not completed. + o The PKCS#1 also calls global RNG (even though it is not used currently in SILC, the interface allows its use). diff --git a/apps/silcd/packet_receive.c b/apps/silcd/packet_receive.c index 111f3b01..a3f0848a 100644 --- a/apps/silcd/packet_receive.c +++ b/apps/silcd/packet_receive.c @@ -404,8 +404,10 @@ void silc_server_notify(SilcServer server, if (!silc_server_client_on_channel(client, channel, &chl)) goto out; if (chl->mode == SILC_CHANNEL_UMODE_NONE && - channel->mode & SILC_CHANNEL_MODE_TOPIC) + channel->mode & SILC_CHANNEL_MODE_TOPIC) { + SILC_LOG_DEBUG(("Topic change is not allowed")); goto out; + } /* Change the topic */ silc_free(channel->topic); @@ -540,8 +542,10 @@ void silc_server_notify(SilcServer server, if (client) { if (!silc_server_client_on_channel(client, channel, &chl)) goto out; - if (!silc_server_check_cmode_rights(server, channel, chl, mode)) + if (!silc_server_check_cmode_rights(server, channel, chl, mode)) { + SILC_LOG_DEBUG(("CMODE change is not allowed")); goto out; + } } /* Send the same notify to the channel */ @@ -685,16 +689,20 @@ void silc_server_notify(SilcServer server, if (client != client2) { /* Sender must be operator */ - if (chl->mode == SILC_CHANNEL_UMODE_NONE) + if (chl->mode == SILC_CHANNEL_UMODE_NONE) { + SILC_LOG_DEBUG(("CUMODE change is not allowed")); goto out; + } /* Check that target is on channel */ if (!silc_server_client_on_channel(client2, channel, &chl)) goto out; /* If target is founder mode change is not allowed. */ - if (chl->mode & SILC_CHANNEL_UMODE_CHANFO) + if (chl->mode & SILC_CHANNEL_UMODE_CHANFO) { + SILC_LOG_DEBUG(("CUMODE change is not allowed")); goto out; + } } } @@ -822,8 +830,10 @@ void silc_server_notify(SilcServer server, if (!silc_server_client_on_channel(client, channel, &chl)) goto out; if (chl->mode == SILC_CHANNEL_UMODE_NONE && - channel->mode & SILC_CHANNEL_MODE_INVITE) + channel->mode & SILC_CHANNEL_MODE_INVITE) { + SILC_LOG_DEBUG(("Inviting is not allowed")); goto out; + } /* Get the added invite */ tmp = silc_argument_get_arg_type(args, 4, &tmp_len); @@ -1128,8 +1138,8 @@ void silc_server_notify(SilcServer server, client2 = silc_idlist_find_client_by_id(server->global_list, client_id, TRUE, NULL); if (!client2) { - client = silc_idlist_find_client_by_id(server->local_list, - client_id, TRUE, NULL); + client2 = silc_idlist_find_client_by_id(server->local_list, + client_id, TRUE, NULL); if (!client2) { silc_free(client_id); goto out; @@ -1140,8 +1150,10 @@ void silc_server_notify(SilcServer server, /* Kicker must be operator on channel */ if (!silc_server_client_on_channel(client2, channel, &chl)) goto out; - if (chl->mode == SILC_CHANNEL_UMODE_NONE) + if (chl->mode == SILC_CHANNEL_UMODE_NONE) { + SILC_LOG_DEBUG(("Kicking is not allowed")); goto out; + } } /* Send to channel */ @@ -1249,8 +1261,10 @@ void silc_server_notify(SilcServer server, SILC_GET32_MSB(mode, tmp); /* Check that mode changing is allowed. */ - if (!silc_server_check_umode_rights(server, client, mode)) + if (!silc_server_check_umode_rights(server, client, mode)) { + SILC_LOG_DEBUG(("UMODE change is not allowed")); goto out; + } /* Change the mode */ client->mode = mode; diff --git a/lib/silcclient/client_notify.c b/lib/silcclient/client_notify.c index 89073dd9..5e13bf72 100644 --- a/lib/silcclient/client_notify.c +++ b/lib/silcclient/client_notify.c @@ -797,16 +797,19 @@ void silc_client_notify_by_server(SilcClient client, client->internal->ops->notify(client, conn, type, client_entry, tmp, client_entry2, channel); - /* If I was kicked from channel, remove the channel */ + /* Remove kicked client from channel */ if (client_entry == conn->local_entry) { + /* If I was kicked from channel, remove the channel */ if (conn->current_channel == channel) conn->current_channel = NULL; - silc_idcache_del_by_id(conn->channel_cache, channel->id); - silc_free(channel->channel_name); - silc_free(channel->id); - silc_free(channel->key); - silc_cipher_free(channel->channel_key); - silc_free(channel); + silc_client_del_channel(client, conn, channel); + } else { + chu = silc_client_on_channel(channel, client_entry); + if (chu) { + silc_hash_table_del(client_entry->channels, channel); + silc_hash_table_del(channel->user_list, client_entry); + silc_free(chu); + } } break; diff --git a/lib/silccore/silcidcache.c b/lib/silccore/silcidcache.c index 65ef1338..a23d6aca 100644 --- a/lib/silccore/silcidcache.c +++ b/lib/silccore/silcidcache.c @@ -108,17 +108,16 @@ SilcIDCache silc_idcache_alloc(SilcUInt32 count, SilcIdType id_type, cache = silc_calloc(1, sizeof(*cache)); if (!cache) return NULL; - cache->id_table = silc_hash_table_alloc(count, silc_hash_id, + cache->id_table = silc_hash_table_alloc(count, silc_hash_id, (void *)(SilcUInt32)id_type, - silc_hash_id_compare, - (void *)(SilcUInt32)id_type, - silc_idcache_destructor, NULL, - FALSE); + silc_hash_id_compare, + (void *)(SilcUInt32)id_type, + silc_idcache_destructor, NULL, TRUE); cache->name_table = silc_hash_table_alloc(count, silc_hash_string, NULL, - silc_hash_string_compare, NULL, - NULL, NULL, FALSE); + silc_hash_string_compare, NULL, + NULL, NULL, TRUE); cache->context_table = silc_hash_table_alloc(count, silc_hash_ptr, NULL, - NULL, NULL, NULL, NULL, FALSE); + NULL, NULL, NULL, NULL, TRUE); cache->destructor = destructor; cache->type = id_type; @@ -179,14 +178,6 @@ bool silc_idcache_add(SilcIDCache cache, char *name, void *id, if (context) silc_hash_table_add(cache->context_table, context, c); - /* See whether we have time to rehash the tables */ - if ((silc_hash_table_count(cache->id_table) / 2) > - silc_hash_table_size(cache->id_table)) { - silc_hash_table_rehash(cache->id_table, 0); - silc_hash_table_rehash(cache->name_table, 0); - silc_hash_table_rehash(cache->context_table, 0); - } - if (ret) *ret = c; -- 2.24.0