updates.
authorPekka Riikonen <priikone@silcnet.org>
Tue, 4 Jun 2002 15:30:09 +0000 (15:30 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Tue, 4 Jun 2002 15:30:09 +0000 (15:30 +0000)
CHANGES
apps/silcd/command.c

diff --git a/CHANGES b/CHANGES
index 5f41b0b244171d209fb117f1e76048bb3848aa7d..25d5d7e04cb9f82a0189264a286a5d875d506bda 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,9 @@
+Tue Jun  4 18:36:05 EEST 2002 Pekka Riikonen <priikone@silcnet.org>
+
+       * Fixed detach timeout handling to use Client ID and not
+         the actual client entry which may be freed in the callback.
+         Affected file silcd/command.c.
+
 Thu May 30 15:53:45 CEST 2002 Pekka Riikonen <priikone@silcnet.org>
 
        * Merged c0ffee's multiple interface support patch.
index be933055b0333eed2c5de5c38d95efa221231de1..25468230de55357919f6cfb2e8ff46ce6b10b560 100644 (file)
@@ -4877,13 +4877,19 @@ SILC_TASK_CALLBACK(silc_server_command_detach_cb)
 SILC_TASK_CALLBACK(silc_server_command_detach_timeout)
 {
   QuitInternal q = (QuitInternal)context;
-  SilcClientEntry client = (SilcClientEntry)q->sock;
+  SilcClientID *client_id = (SilcClientID *)q->sock;
+  SilcClientEntry client;
 
   SILC_LOG_DEBUG(("Start"));
 
-  if (client->mode & SILC_UMODE_DETACHED)
+  client = silc_idlist_find_client_by_id(q->server->local_list, client_id,
+                                        FALSE, NULL);
+
+  if (client && client->mode & SILC_UMODE_DETACHED)
     silc_server_free_client_data(q->server, NULL, client, TRUE,
                                 "Detach timeout");
+
+  silc_free(client_id);
   silc_free(q);
 }
 
@@ -4899,8 +4905,7 @@ SILC_SERVER_CMD_FUNC(detach)
 
   if (server->config->detach_disabled) {
     silc_server_command_send_status_reply(cmd, SILC_COMMAND_DETACH,
-                                         SILC_STATUS_ERR_UNKNOWN_COMMAND,
-                                         0);
+                                         SILC_STATUS_ERR_UNKNOWN_COMMAND, 0);
     goto out;
   }
 
@@ -4933,7 +4938,7 @@ SILC_SERVER_CMD_FUNC(detach)
   if (server->config->detach_timeout) {
     q = silc_calloc(1, sizeof(*q));
     q->server = server;
-    q->sock = (void *)client;
+    q->sock = silc_id_dup(client->id, SILC_ID_CLIENT);
     silc_schedule_task_add(server->schedule, 0, 
                           silc_server_command_detach_timeout,
                           q, server->config->detach_timeout * 60,