From: Pekka Riikonen Date: Thu, 9 Oct 2003 10:08:19 +0000 (+0000) Subject: Fixed CUMODE_CHANGE for founder mode change to comply with 1.2. X-Git-Tag: silc.client.0.9.13~11 X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=commitdiff_plain;h=d30a00e4a5236f758443d251df335f9a6d3780f9 Fixed CUMODE_CHANGE for founder mode change to comply with 1.2. --- diff --git a/CHANGES b/CHANGES index f967987e..e70cca5a 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,9 @@ +Thu Oct 9 12:06:40 CEST 2003 Pekka Riikonen + + * Fixed the CUMODE_CHANGE for founder mode changes to comply + with 1.2 version of the protocol. Affected file is + silcd/packet_receive.c. + Wed Oct 8 19:41:15 EEST 2003 Pekka Riikonen * ERR_BAD_PASSWORD now returns the Channel ID of the channel diff --git a/TODO b/TODO index c70ae542..ff8a28cb 100644 --- a/TODO +++ b/TODO @@ -9,8 +9,6 @@ TODO for Irssi SILC Client 1.0 TODO for SILC Server 1.0 ======================== - o Fix CUMODE_CHANGE founder key things. - o Backup router testing - test all resume error cases for backup router diff --git a/apps/silcd/packet_receive.c b/apps/silcd/packet_receive.c index 5e2e96f5..3fedae33 100644 --- a/apps/silcd/packet_receive.c +++ b/apps/silcd/packet_receive.c @@ -948,6 +948,11 @@ void silc_server_notify(SilcServer server, break; } + /* Check whether to give founder rights to this user or not. The + problem here is that we get only the public key of the client, + but no authentication data. We must assume that server has + already authenticated the user (and thus we must trust the + server). */ if (mode & SILC_CHANNEL_UMODE_CHANFO && !(chl->mode & SILC_CHANNEL_UMODE_CHANFO) && server->server_type == SILC_ROUTER && @@ -957,7 +962,8 @@ void silc_server_notify(SilcServer server, /* If channel doesn't have founder auth mode then it's impossible that someone would be getting founder rights with CUMODE command. In that case there already either is founder or there isn't - founder at all on the channel. */ + founder at all on the channel (valid only when 'client' is + valid). */ if (client && !(channel->mode & SILC_CHANNEL_MODE_FOUNDER_AUTH)) { /* Force the mode to not have founder mode */ chl->mode = mode &= ~SILC_CHANNEL_UMODE_CHANFO; @@ -969,24 +975,12 @@ void silc_server_notify(SilcServer server, /* 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)) + while (silc_hash_table_get(&htl, NULL, (void **)&chl2)) if (chl2->mode & SILC_CHANNEL_UMODE_CHANFO) { - /* XXX this is not correct anymore in 1.2 -Pekka */ - - /* If the founder on the channel is not the one whom has set - the founder mode, then it's possible that this CUMODE_CHANGE - is correct. Due to netsplits it's possible that this - situation happens. */ - if (!(channel->mode & SILC_CHANNEL_MODE_FOUNDER_AUTH) || - (channel->founder_key && chl2->client->data.public_key && - silc_pkcs_public_key_compare( - channel->founder_key, - chl2->client->data.public_key))) { - chl->mode = mode &= ~SILC_CHANNEL_UMODE_CHANFO; - silc_server_force_cumode_change(server, sock, channel, - chl, mode); - notify_sent = TRUE; - } + chl->mode = 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); @@ -1010,16 +1004,6 @@ void silc_server_notify(SilcServer server, /* Now match the public key we have cached and public key sent. They must match. */ -#if 0 /* The key may be other than the client's in 1.2 */ - if (client && client->data.public_key && - !silc_pkcs_public_key_compare(channel->founder_key, - client->data.public_key)) { - chl->mode = mode &= ~SILC_CHANNEL_UMODE_CHANFO; - silc_server_force_cumode_change(server, sock, channel, chl, mode); - notify_sent = TRUE; - break; - } -#endif if (!silc_pkcs_public_key_compare(channel->founder_key, founder_key)) { chl->mode = mode &= ~SILC_CHANNEL_UMODE_CHANFO; @@ -1030,7 +1014,8 @@ void silc_server_notify(SilcServer server, } /* There cannot be anyone else as founder on the channel now. This - client is definitely the founder due to this authentication */ + client is definitely the founder due to this 'authentication'. + We trust the server did the actual authentication earlier. */ silc_hash_table_list(channel->user_list, &htl); while (silc_hash_table_get(&htl, NULL, (void *)&chl2)) if (chl2->mode & SILC_CHANNEL_UMODE_CHANFO) {