updates.
authorPekka Riikonen <priikone@silcnet.org>
Sat, 3 Feb 2001 11:07:57 +0000 (11:07 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Sat, 3 Feb 2001 11:07:57 +0000 (11:07 +0000)
CHANGES
apps/silcd/command.c
apps/silcd/packet_receive.c
apps/silcd/protocol.c
apps/silcd/testi2.conf

diff --git a/CHANGES b/CHANGES
index f7d07e0d4eb4cc72dadf0349313db9738d8b07af..6f17e20e6081112fc945c03fe9d72996fe9f0f2b 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,25 @@
+Sat Feb  3 15:44:54 EET 2001  Pekka Riikonen <priikone@poseidon.pspt.fi>
+
+       * Oops, a little mistake in server's connection authentication 
+         protocol.  The protocol is not ended with FAILURE but with
+         SUCCESS if the authentication is Ok. :)  Affected file is
+         silcd/protocol.c.
+
+       * Implemented NICK_CHANGE notify handling in server in the file
+         silcd/packet_receive.c  The NICK_CHANGE notify is distributed to
+         the local clients on the channel.  After the changing nickname
+         in router environment snhould work and the [<unknown>] nickname
+         should appear no more.
+         The silc_server_replace_id function that receives the Replace ID
+         payload now sends the NICK_CHANGE notify type also in the file
+         silcd/packet_receive.c
+
+       * Changed WHOIS and IDENTIFY command to support the maximum amount
+         of arguments defined in protocol specs (3328 arguments).  This 
+         fixed a bug that caused problems when there were more than three
+         users on a channel.
+
 Fri Feb  2 11:42:56 EET 2001  Pekka Riikonen <priikone@poseidon.pspt.fi>
 
        * Added extra parameter, command identifier, to the
@@ -16,7 +38,7 @@ Fri Feb  2 11:42:56 EET 2001  Pekka Riikonen <priikone@poseidon.pspt.fi>
          that we are now re-sending.  Ignored if NULL.  Affected file
          silcd/packet_send.[ch].
 
-       * Added some server statistics support in sil/server_internal.h
+       * Added some server statistics support in silcd/server_internal.h
          SilcServerStatistics structure and around the server code.  Also
          send some nice statistics information when client is connecting
          to the client.
index 2f748cea5c32a2c92970eedffa9d3c4f498d1d4d..44ef1f94153b85498253684ae4bc7add3d0ed08a 100644 (file)
@@ -768,7 +768,7 @@ SILC_SERVER_CMD_FUNC(whois)
   SilcServerCommandContext cmd = (SilcServerCommandContext)context;
   int ret;
 
-  SILC_SERVER_COMMAND_CHECK_ARGC(SILC_COMMAND_WHOIS, cmd, 1, 3);
+  SILC_SERVER_COMMAND_CHECK_ARGC(SILC_COMMAND_WHOIS, cmd, 1, 3328);
 
   if (cmd->sock->type == SILC_SOCKET_TYPE_CLIENT)
     ret = silc_server_command_whois_from_client(cmd);
@@ -1167,7 +1167,7 @@ SILC_SERVER_CMD_FUNC(identify)
   SilcServerCommandContext cmd = (SilcServerCommandContext)context;
   int ret;
 
-  SILC_SERVER_COMMAND_CHECK_ARGC(SILC_COMMAND_IDENTIFY, cmd, 1, 3);
+  SILC_SERVER_COMMAND_CHECK_ARGC(SILC_COMMAND_IDENTIFY, cmd, 1, 3328);
 
   if (cmd->sock->type == SILC_SOCKET_TYPE_CLIENT)
     ret = silc_server_command_identify_from_client(cmd);
@@ -1225,7 +1225,7 @@ SILC_SERVER_CMD_FUNC(nick)
   /* Send notify about nickname change to our router. We send the new
      ID and ask to replace it with the old one. If we are router the
      packet is broadcasted. */
-  if (!cmd->server->standalone)
+  if (!server->standalone)
     silc_server_send_replace_id(server, server->router->connection, 
                                server->server_type == SILC_SERVER ? 
                                FALSE : TRUE, client->id,
@@ -1647,6 +1647,8 @@ void silc_server_command_send_users(SilcServer server,
   SilcBuffer buffer, idp;
   SilcPacketContext *packet = silc_packet_context_alloc();
 
+  SILC_LOG_DEBUG(("Start"));
+
   /* Create USERS command packet and process it. */
   idp = silc_id_payload_encode(channel->id, SILC_ID_CHANNEL);
   buffer = silc_command_payload_encode_va(SILC_COMMAND_USERS, 0, 1,
index 88f08709a5619cd6b5ffda3cf0f59de2921eb473..ed5df4bf1ab5866e3b1f3c91d3c06ed0a7390b0f 100644 (file)
@@ -336,14 +336,36 @@ void silc_server_replace_id(SilcServer server,
   /* Replace the old ID */
   switch(old_id_type) {
   case SILC_ID_CLIENT:
-    SILC_LOG_DEBUG(("Old Client ID id(%s)", 
-                   silc_id_render(id, SILC_ID_CLIENT)));
-    SILC_LOG_DEBUG(("New Client ID id(%s)", 
-                   silc_id_render(id2, SILC_ID_CLIENT)));
-    if (silc_idlist_replace_client_id(server->local_list, id, id2) == NULL)
-      if (server->server_type == SILC_ROUTER)
-       silc_idlist_replace_client_id(server->global_list, id, id2);
-    break;
+    {
+      SilcBuffer nidp, oidp;
+      SilcClientEntry client = NULL;
+
+      SILC_LOG_DEBUG(("Old Client ID id(%s)", 
+                     silc_id_render(id, SILC_ID_CLIENT)));
+      SILC_LOG_DEBUG(("New Client ID id(%s)", 
+                     silc_id_render(id2, SILC_ID_CLIENT)));
+
+      if ((client = silc_idlist_replace_client_id(server->local_list, 
+                                                 id, id2)) == NULL)
+       if (server->server_type == SILC_ROUTER)
+         client = silc_idlist_replace_client_id(server->global_list, id, id2);
+      
+      if (client) {
+       oidp = silc_id_payload_encode(id, SILC_ID_CLIENT);
+       nidp = silc_id_payload_encode(id2, SILC_ID_CLIENT);
+
+       /* Send the NICK_CHANGE notify type to local clients on the channels
+          this client is joined to. */
+       silc_server_send_notify_on_channels(server, client, 
+                                           SILC_NOTIFY_TYPE_NICK_CHANGE, 2,
+                                           oidp->data, oidp->len, 
+                                           nidp->data, nidp->len);
+       
+       silc_buffer_free(nidp);
+       silc_buffer_free(oidp);
+      }
+      break;
+    }
 
   case SILC_ID_SERVER:
     SILC_LOG_DEBUG(("Old Server ID id(%s)", 
@@ -859,7 +881,7 @@ void silc_server_notify(SilcServer server,
   SilcNotifyType type;
   SilcArgumentPayload args;
   SilcChannelID *channel_id;
-  SilcClientID *client_id;
+  SilcClientID *client_id, *client_id2;
   SilcChannelEntry channel;
   SilcClientEntry client;
   unsigned char *tmp;
@@ -1013,8 +1035,10 @@ void silc_server_notify(SilcServer server,
     if (!client) {
       client = silc_idlist_find_client_by_id(server->local_list, 
                                             client_id, NULL);
-      if (!client)
+      if (!client) {
+       silc_free(client_id);
        goto out;
+      }
     }
     silc_free(client_id);
 
@@ -1025,12 +1049,76 @@ void silc_server_notify(SilcServer server,
     silc_idlist_del_client(server->global_list, client);
     break;
 
-    /* Ignore rest notify types for now */
-  case SILC_NOTIFY_TYPE_NONE:
-  case SILC_NOTIFY_TYPE_INVITE:
+  case SILC_NOTIFY_TYPE_NICK_CHANGE:
+    {
+      /* 
+       * Distribute the notify to local clients on the channel
+       */
+      unsigned char *id, *id2;
+
+      SILC_LOG_DEBUG(("NICK CHANGE notify"));
+      
+      /* Get old client ID */
+      id = silc_argument_get_arg_type(args, 1, &tmp_len);
+      if (!id)
+       goto out;
+      client_id = silc_id_payload_parse_id(id, tmp_len);
+      
+      /* Get new client ID */
+      id2 = silc_argument_get_arg_type(args, 2, &tmp_len);
+      if (!id2)
+       goto out;
+      client_id2 = silc_id_payload_parse_id(id2, tmp_len);
+      
+      SILC_LOG_DEBUG(("Old Client ID id(%s)", 
+                     silc_id_render(client_id, SILC_ID_CLIENT)));
+      SILC_LOG_DEBUG(("New Client ID id(%s)", 
+                     silc_id_render(client_id2, SILC_ID_CLIENT)));
+
+      /* Replace the Client ID */
+      client = silc_idlist_replace_client_id(server->global_list, client_id,
+                                            client_id2);
+      if (!client)
+       client = silc_idlist_replace_client_id(server->local_list, client_id, 
+                                              client_id2);
+
+      if (client)
+       /* Send the NICK_CHANGE notify type to local clients on the channels
+          this client is joined to. */
+       silc_server_send_notify_on_channels(server, client, 
+                                           SILC_NOTIFY_TYPE_NICK_CHANGE, 2,
+                                           id, tmp_len, 
+                                           id2, tmp_len);
+
+      silc_free(client_id);
+      if (!client)
+       silc_free(client_id2);
+      break;
+    }
   case SILC_NOTIFY_TYPE_TOPIC_SET:
+    /* 
+     * Distribute the notify to local clients on the channel
+     */
+    SILC_LOG_DEBUG(("TOPIC SET notify (not-impl XXX)"));
+    break;
+
   case SILC_NOTIFY_TYPE_CMODE_CHANGE:
+    /* 
+     * Distribute the notify to local clients on the channel
+     */
+    SILC_LOG_DEBUG(("CMODE CHANGE notify (not-impl XXX)"));
+    break;
+
   case SILC_NOTIFY_TYPE_CUMODE_CHANGE:
+    /* 
+     * Distribute the notify to local clients on the channel
+     */
+    SILC_LOG_DEBUG(("CUMODE CHANGE notify (not-impl XXX)"));
+    break;
+
+    /* Ignore rest notify types for now */
+  case SILC_NOTIFY_TYPE_NONE:
+  case SILC_NOTIFY_TYPE_INVITE:
   case SILC_NOTIFY_TYPE_MOTD:
   default:
     break;
index b7744da8ca64239c97e28793b0f325a850155f80..60d8b0a142e347b6943c5118a565fb8301bdce84 100644 (file)
@@ -886,7 +886,7 @@ SILC_TASK_CALLBACK(silc_server_protocol_connection_auth)
       SILC_PUT32_MSB(SILC_CONN_AUTH_OK, ok);
 
       /* Authentication failed */
-      silc_server_packet_send(server, ctx->sock, SILC_PACKET_FAILURE,
+      silc_server_packet_send(server, ctx->sock, SILC_PACKET_SUCCESS,
                              0, ok, 4, TRUE);
 
       /* Unregister the timeout task since the protocol has ended. 
index c0ffb921e4ab9eb95484c278c00e54da99899d9e..fccab92fa4f0fba9e6fc23782382697c1ccc2794 100644 (file)
@@ -1,8 +1,8 @@
 [Cipher]
-rc6:/home/silc/silc/lib/silcsim/modules/rc6.sim.so:16:16
-twofish:/home/silc/silc/lib/silcsim/modules/twofish.sim.so:16:16
-mars:/home/silc/silc/lib/silcsim/modules/mars.sim.so:16:16
-none:/home/silc/silc/lib/silcsim/modules/none.sim.so:0:0
+rc6:../lib/silcsim/modules/rc6.sim.so:16:16
+twofish:../lib/silcsim/modules/twofish.sim.so:16:16
+mars:../lib/silcsim/modules/mars.sim.so:16:16
+none:../lib/silcsim/modules/none.sim.so:0:0
 
 [HashFunction]
 md5::64:16
@@ -16,15 +16,15 @@ sha1::64:20
 Mun huone:Mun servo:Pekka Riikonen:priikone@poseidon.pspt.fi
 
 [ServerInfo]
-lassi.kuo.fi.ssh.com:10.2.1.7:Kuopio, Finland:1335
+lassi.kuo.fi.ssh.com:212.146.8.246:Kuopio, Finland:1334
 
 [ListenPort]
-10.2.1.7:10.2.1.7:1335
+212.146.8.246:212.146.8.246:1334
 
 [Logging]
-infologfile:silcd3.log:10000
+infologfile:silcd2.log:10000
 #warninglogfile:/var/log/silcd_warning.log:10000
-errorlogfile:silcd3.log:10000
+errorlogfile:silcd2.log:10000
 #fatallogfile:/var/log/silcd_error.log:
 
 [ConnectionClass]
@@ -32,18 +32,15 @@ errorlogfile:silcd3.log:10000
 2:200:300:400
 
 [ClientConnection]
-10.2.1.199:passwd:priikone:333:1
 :::1333:1
 :::1334:1
 :::1335:1
 :::1336:1
 
 [AdminConnection]
-10.2.1.199:passwd:priikone:priikone:1
 
 [ServerConnection]
-10.2.1.7:passwd:priikone:1333:1:1
-10.2.1.7:passwd:priikone:1336:1:1
+212.146.8.246:passwd:priikone:1333:1:1
 
 [RouterConnection]