Fixed CUMODE_CHANGE for founder mode change to comply with 1.2.
authorPekka Riikonen <priikone@silcnet.org>
Thu, 9 Oct 2003 10:08:19 +0000 (10:08 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Thu, 9 Oct 2003 10:08:19 +0000 (10:08 +0000)
CHANGES
TODO
apps/silcd/packet_receive.c

diff --git a/CHANGES b/CHANGES
index f967987e03735568ac7dab8209de906b6079ed48..e70cca5a6c4b11009c7fcb3bf9f128928b6a267e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,9 @@
+Thu Oct  9 12:06:40 CEST 2003  Pekka Riikonen <priikone@silcnet.org>
+
+       * 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 <priikone@silcnet.org>
 
        * ERR_BAD_PASSWORD now returns the Channel ID of the channel
diff --git a/TODO b/TODO
index c70ae542ccc8e93f21c8eb4c9ec7c0a484a7c4e8..ff8a28cb4eab148f09fc38a5718ec66d7a80dce3 100644 (file)
--- 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
index 5e2e96f56d720b437a8ac1cb9d2e38ad5b9af623..3fedae33f591cf7f2093df15e8505896d8dee9fc 100644 (file)
@@ -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) {