Couldn't detach and reattach twice, because of the previous
authorPatrik Weiskircher <pat@silcnet.org>
Sat, 1 May 2004 11:57:54 +0000 (11:57 +0000)
committerPatrik Weiskircher <pat@silcnet.org>
Sat, 1 May 2004 11:57:54 +0000 (11:57 +0000)
commit.

CHANGES
apps/silcd/packet_receive.c

diff --git a/CHANGES b/CHANGES
index 31c0efc1d3f0d2f7dc38acb216d9e156c169b004..2fa3adb28e83fca8080daf489c0ac0a95214ec54 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,8 @@
+Sat May  1 13:55:54 CEST 2004  Patrik Weiskircher <pat@icore.at>
+
+       * Couldn't detach and reattach twice, because of the previous
+         commit. Affected file silcd/packet_receive.c
+
 Fri Apr 30 19:40:28 CEST 2004  Patrik Weiskircher <pat@icore.at>
 
        * Added check to ignore Port value if Initiator is FALSE. 
index fb1a453571d0db3c74087db8aaa166cb93fd64b7..26eed0ee19e38b57d4472028f617324ef6d37c7a 100644 (file)
@@ -3683,6 +3683,19 @@ void silc_server_resume_client(SilcServer server,
       return;
     }
 
+    if (detached_client->data.status & SILC_IDLIST_STATUS_RESUMED) {
+      SILC_LOG_ERROR(("Client %s (%s) tried to attach more than once, "
+                     "closing connection", sock->hostname, sock->ip));
+      silc_server_disconnect_remote(server, sock,
+                                    SILC_STATUS_ERR_INCOMPLETE_INFORMATION,
+                                   "Resuming not possible");
+      if (sock->user_data)
+       silc_server_free_sock_user_data(server, sock, NULL);
+      silc_free(client_id);
+
+      return;
+    }
+
     if (detached_client->resuming_client &&
        detached_client->resuming_client != client) {
       SILC_LOG_ERROR(("Client %s (%s) tried to attach more than once, "
@@ -3846,6 +3859,9 @@ void silc_server_resume_client(SilcServer server,
     detached_client->mode &= ~SILC_UMODE_DETACHED;
     server->stat.my_detached--;
 
+    /* we are finished - reset resuming client */
+    detached_client->resuming_client = NULL;
+
     /* Check if anyone is watching this client */
     if (server->server_type == SILC_ROUTER)
       silc_server_check_watcher_list(server, detached_client, NULL,