From 585dfe7568ae737e159b9da637cbe5a704d0812a Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Sun, 19 May 2002 17:55:52 +0000 Subject: [PATCH] updates. --- CHANGES | 3 +++ apps/silcd/packet_receive.c | 27 ++++++++++++++++++++++++--- apps/silcd/server_util.c | 4 ++-- lib/silcclient/client_notify.c | 5 ++++- 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index 6269d567..8cb8887d 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,9 @@ Sun May 19 18:59:00 EEST 2002 Pekka Riikonen to not use freed memory. Affected file is lib/silcclient/client_notify.c. + * Fixed CUMODE_CHANGE notify handling in server. Affected + file silcd/packet_receive.c. + Sat May 18 11:35:19 EEST 2002 Pekka Riikonen * Allow multiple identical pending commands to be registered diff --git a/apps/silcd/packet_receive.c b/apps/silcd/packet_receive.c index 9a0a7ba8..a5894c59 100644 --- a/apps/silcd/packet_receive.c +++ b/apps/silcd/packet_receive.c @@ -744,7 +744,7 @@ void silc_server_notify(SilcServer server, if (!silc_server_client_on_channel(client, channel, &chl)) goto out; - if (client != client2) { + if (client != client2 && server->server_type == SILC_ROUTER) { /* Sender must be operator */ if (!(chl->mode & SILC_CHANNEL_UMODE_CHANOP) && !(chl->mode & SILC_CHANNEL_UMODE_CHANFO)) { @@ -752,7 +752,6 @@ void silc_server_notify(SilcServer server, goto out; } - /* Check that target is on channel */ if (!silc_server_client_on_channel(client2, channel, &chl)) goto out; @@ -764,7 +763,29 @@ void silc_server_notify(SilcServer server, } } + /* Get target channel entry */ + if (!silc_server_client_on_channel(client2, channel, &chl)) + goto out; + if (mode & SILC_CHANNEL_UMODE_CHANFO && + !(channel->mode & SILC_CHANNEL_MODE_FOUNDER_AUTH) && !client && + server->server_type == SILC_ROUTER) { + /* Get the founder of the channel and if found then this client + cannot be the founder since there already is one. */ + silc_hash_table_list(channel->user_list, &htl); + while (silc_hash_table_get(&htl, NULL, (void *)&chl2)) + if (chl2->mode & SILC_CHANNEL_UMODE_CHANFO) { + mode &= ~SILC_CHANNEL_UMODE_CHANFO; + silc_server_force_cumode_change(server, sock, channel, chl, mode); + notify_sent = TRUE; + break; + } + silc_hash_table_list_reset(&htl); + if (!(mode & SILC_CHANNEL_UMODE_CHANFO)) + break; + } + + if (client && mode & SILC_CHANNEL_UMODE_CHANFO && !(chl->mode & SILC_CHANNEL_UMODE_CHANFO) && server->server_type == SILC_ROUTER) { /* Check whether this client is allowed to be channel founder on @@ -813,7 +834,7 @@ void silc_server_notify(SilcServer server, /* Now match the public key we have cached and public key sent. They must match. */ - if (client && client->data.public_key && + if (client->data.public_key && !silc_pkcs_public_key_compare(channel->founder_key, client->data.public_key)) { mode &= ~SILC_CHANNEL_UMODE_CHANFO; diff --git a/apps/silcd/server_util.c b/apps/silcd/server_util.c index 890844ec..b00fbb0d 100644 --- a/apps/silcd/server_util.c +++ b/apps/silcd/server_util.c @@ -624,7 +624,7 @@ void silc_server_remove_channels_by_server(SilcServer server, SilcIDCacheEntry id_cache = NULL; SilcChannelEntry channel = NULL; - SILC_LOG_DEBUG(("Start")); + SILC_LOG_DEBUG(("Removing channels by server")); if (silc_idcache_get_all(server->global_list->channels, &list)) { if (silc_idcache_list_first(list, &id_cache)) { @@ -650,7 +650,7 @@ void silc_server_update_channels_by_server(SilcServer server, SilcIDCacheEntry id_cache = NULL; SilcChannelEntry channel = NULL; - SILC_LOG_DEBUG(("Start")); + SILC_LOG_DEBUG(("Updating channels by server")); if (silc_idcache_get_all(server->global_list->channels, &list)) { if (silc_idcache_list_first(list, &id_cache)) { diff --git a/lib/silcclient/client_notify.c b/lib/silcclient/client_notify.c index 317bd078..64ad2658 100644 --- a/lib/silcclient/client_notify.c +++ b/lib/silcclient/client_notify.c @@ -741,8 +741,11 @@ void silc_client_notify_by_server(SilcClient client, /* Find target Client entry */ client_entry2 = silc_client_get_client_by_id(client, conn, client_id); - if (!client_entry2) + if (!client_entry2) { + silc_client_notify_by_server_resolve(client, conn, packet, + SILC_ID_CLIENT, client_id); goto out; + } /* Get channel entry */ channel_id = silc_id_str2id(packet->dst_id, packet->dst_id_len, -- 2.24.0