updates.
authorPekka Riikonen <priikone@silcnet.org>
Sun, 19 May 2002 17:55:52 +0000 (17:55 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Sun, 19 May 2002 17:55:52 +0000 (17:55 +0000)
CHANGES
apps/silcd/packet_receive.c
apps/silcd/server_util.c
lib/silcclient/client_notify.c

diff --git a/CHANGES b/CHANGES
index 6269d56782faed390e3c3ccb10aaf326070e72a1..8cb8887ddb13f6a3b2dea4fc6845bfbb60024a9b 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,9 @@ Sun May 19 18:59:00 EEST 2002 Pekka Riikonen <priikone@silcnet.org>
          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 <priikone@silcnet.org>
 
        * Allow multiple identical pending commands to be registered
index 9a0a7ba802671f962dc7216466d5dc2f1b7e9b57..a5894c591d7bfc2a0e77a0444e5706f15dbbbeef 100644 (file)
@@ -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;
index 890844ec71f815bde7e68e368fee7e20fe3fae27..b00fbb0d707a2d778ad65a7e22e0a8d4e0abc260 100644 (file)
@@ -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)) {
index 317bd078d26a33f1f355a86131ae22bcfeaa308e..64ad2658cfead157f2ecfb3dd774e8f14d0ceeca 100644 (file)
@@ -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,