If some client tries to resume more than once at the same time,
authorPatrik Weiskircher <pat@silcnet.org>
Sat, 1 May 2004 10:23:49 +0000 (10:23 +0000)
committerPatrik Weiskircher <pat@silcnet.org>
Sat, 1 May 2004 10:23:49 +0000 (10:23 +0000)
server crashed. Router didn't crash, but showed odd behaviour
(didn't allow clients to join anymore, ..).

apps/silcd/idlist.h
apps/silcd/packet_receive.c

index cfb46feaddf2847f56cea06e3aba6296646dfbd1..dd2b8eb24753e73e354d2294443f7f242a30973c 100644 (file)
@@ -366,6 +366,10 @@ struct SilcClientEntryStruct {
   /* data.status is RESOLVING and this includes the resolving command
      reply identifier. */
   SilcUInt16 resolve_cmd_ident;
+
+  /* we need this so nobody can resume more than once at the same time - 
+   * server crashes, really odd behaviour, ... */
+  SilcClientEntry resuming_client;
 };
 
 /*
index 44f26d1653d4517b19c265c22c13ddc0b867dec5..fb1a453571d0db3c74087db8aaa166cb93fd64b7 100644 (file)
@@ -3683,6 +3683,23 @@ void silc_server_resume_client(SilcServer server,
       return;
     }
 
+    if (detached_client->resuming_client &&
+       detached_client->resuming_client != client) {
+      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;
+
     if (!(detached_client->mode & SILC_UMODE_DETACHED))
       resolve = TRUE;
     if (!silc_hash_table_count(detached_client->channels) &&