updates
authorPekka Riikonen <priikone@silcnet.org>
Thu, 23 May 2002 12:31:21 +0000 (12:31 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Thu, 23 May 2002 12:31:21 +0000 (12:31 +0000)
CHANGES
apps/silcd/packet_receive.c
lib/silcclient/client_notify.c

diff --git a/CHANGES b/CHANGES
index a147cec3f7b2077fff54a45d6ec526083812dbf3..020616a6db9e8fdf91661698280dc422c97f8214 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -3,6 +3,10 @@ Thu May 23 12:00:14 CEST 2002 Pekka Riikonen <priikone@silcnet.org>
        * When resuming client, remove the old client entry from
          the watcher list too.  Affected file silcd/packet_receive.c.
 
+       * Do not allow normal server to force founder mode away
+         from router if the founder mode is already set.  Affected
+         file silcd/packet_receive.c.
+
 Sun May 19 18:59:00 EEST 2002 Pekka Riikonen <priikone@silcnet.org>
 
        * Fixed the CHANNEL_CHANGE notify handling in client libary
index fdd002373de8ff227ecf0e7346b3f62ab86113d8..b20af01c5a9f03dccfc6a9e7e999ce4a5ae769c9 100644 (file)
@@ -554,6 +554,20 @@ void silc_server_notify(SilcServer server,
        SILC_LOG_DEBUG(("CMODE change is not allowed"));
        goto out;
       }
+    } else {
+      if (server->server_type == SILC_ROUTER &&
+         channel->mode & SILC_CHANNEL_MODE_FOUNDER_AUTH &&
+         !(mode & SILC_CHANNEL_MODE_FOUNDER_AUTH)) {
+       SILC_LOG_DEBUG(("Enforcing sender to change channel mode"));
+       silc_server_send_notify_cmode(server, sock, FALSE, channel,
+                                     channel->mode, server->id,
+                                     SILC_ID_SERVER,
+                                     channel->cipher,
+                                     channel->hmac_name,
+                                     channel->passphrase,
+                                     channel->founder_key);
+       goto out;
+      }
     }
 
     /* Send the same notify to the channel */
index 64ad2658cfead157f2ecfb3dd774e8f14d0ceeca..de788f443382df06725ac4255ea2aa7753246ac5 100644 (file)
@@ -44,6 +44,21 @@ SILC_TASK_CALLBACK(silc_client_notify_check_client)
   silc_free(res);
 }
 
+SILC_TASK_CALLBACK(silc_client_notify_del_client_cb)
+{
+  SilcClientNotifyResolve res = (SilcClientNotifyResolve)context;
+  SilcClient client = res->context;
+  SilcClientConnection conn = res->sock->user_data;
+  SilcClientID *client_id = res->packet;
+  SilcClientEntry client_entry;
+  client_entry = silc_client_get_client_by_id(client, conn, client_id);
+  if (client_entry)
+    silc_client_del_client(client, conn, client_entry);
+  silc_free(client_id);
+  silc_socket_free(res->sock);
+  silc_free(res);
+}
+
 /* Called when notify is received and some async operation (such as command)
    is required before processing the notify message. This calls again the
    silc_client_notify_by_server and reprocesses the original notify packet. */
@@ -1086,6 +1101,7 @@ void silc_client_notify_by_server(SilcClient client,
        * Received notify about some client we are watching
        */
       SilcNotifyType notify = 0;
+      bool del_client = FALSE;
 
       SILC_LOG_DEBUG(("Notify: WATCH"));
 
@@ -1147,11 +1163,22 @@ void silc_client_notify_by_server(SilcClient client,
         client is on some channel */
       if (tmp && notify == SILC_NOTIFY_TYPE_NICK_CHANGE &&
          !silc_hash_table_count(client_entry->channels))
-       silc_client_del_client(client, conn, client_entry);
+       del_client = TRUE;
       else if (notify == SILC_NOTIFY_TYPE_SIGNOFF ||
               notify == SILC_NOTIFY_TYPE_SERVER_SIGNOFF ||
               notify == SILC_NOTIFY_TYPE_KILLED)
-       silc_client_del_client(client, conn, client_entry);
+       del_client = TRUE;
+
+      if (del_client) {
+       SilcClientNotifyResolve res = silc_calloc(1, sizeof(*res));
+       res->context = client;
+       res->sock = silc_socket_dup(conn->sock);
+       res->packet = client_id;
+        client_id = NULL;
+       silc_schedule_task_add(client->schedule, conn->sock->sock,
+                              silc_client_notify_del_client_cb, res,
+                              1, 0, SILC_TASK_TIMEOUT, SILC_TASK_PRI_NORMAL);
+      }
     }
     break;