updates.
authorPekka Riikonen <priikone@silcnet.org>
Mon, 26 Mar 2001 16:05:28 +0000 (16:05 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Mon, 26 Mar 2001 16:05:28 +0000 (16:05 +0000)
CHANGES
TODO
apps/silcd/command.c
apps/silcd/command_reply.c
apps/silcd/idlist.c
apps/silcd/idlist.h
apps/silcd/packet_receive.c
apps/silcd/protocol.c
apps/silcd/route.c
apps/silcd/serverconfig.c
doc/draft-riikonen-silc-pp-01.nroff

diff --git a/CHANGES b/CHANGES
index c047d18c4ed5441e0ea843f7145cb8ef4fbad181..bb857d3273c4c0c910bc5afc73c7eb1926f68fbe 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -11,6 +11,14 @@ Mon Mar 26 14:39:48 EEST 2001  Pekka Riikonen <priikone@poseidon.pspt.fi>
          Also, do not remove the client entry when giving the KILL 
          command but when the KILLED notify is received.
 
+       * Removed silc_idlist_find_client_by_nickname from the server.
+         Not needed anymore.  Affected files silcd/idlist.[ch].
+
+       * Implemented the CHANNEL_CHANGE notify type handling to the
+         server.  Affected file silcd/server.c.
+
+       * Updated TODO.
+
 Mon Mar 26 12:11:14 EEST 2001  Pekka Riikonen <priikone@poseidon.pspt.fi>
 
        * Added silc_server_send_notify_invite to send the INVITE
diff --git a/TODO b/TODO
index 14ccfa8375681de9d9fd6405d9e09cbe774a051a..15a3fc3e48e57bedd41c3a3443d129c534a221e6 100644 (file)
--- a/TODO
+++ b/TODO
@@ -102,8 +102,6 @@ TODO In SILC Server
 
  o TODO in commands (command.c and command_reply.c):
 
-       o WHOIS <count> argument is probably ignored
-       o IDENTIFY <count> argument is probably ignored
        o RESTART is not implemented
        o CMODE should be rewritten as it uses a lot duplicated code.
          Some of the modes may still not be implemented or is implemented
@@ -117,9 +115,23 @@ TODO In SILC Server
 
  o TODO in notify types (packet_receive.c):
 
-       o CHANNEL_CHANGE notify type is not implemented
        o SERVER_SIGNOFF notify type is not implemented
 
+ o TODO in authentication protocol (protocol.c):
+
+       o Public key authentication is missing in initiator side.  It must
+         be implemented by creating the authentication data.
+
+ o TODO in general server (server.c)
+
+       o SILC_PACKET_CONNECTION_AUTH_REQUEST packet type is not
+         implemented.
+
+       o silc_server_connect_to_router_second checks the authentication
+         method to be used in the connection.  However, if it does not
+         find it it must resolve it from the responder by sending the
+         SILC_PACKET_CONNECTION_AUTH_REQUEST packet.
+
  o Packet processing can be made faster. All packet function in the
    packet_receive.c has same prototypes.  Instead of calling those from
    huge switch() make a table of callback functions that can be called
@@ -146,6 +158,9 @@ TODO In SILC Server
  o Connection classes should be actually implemented in serverconfig.c.
    They can be defined but they are totally ignored currently.
 
+ o Connection redirect, if server is full, is not implemented.  I also
+   don't know how to do it currently.  Maybe it shouldn't be done at all.
+
 
 TODO In SILC Libraries
 ======================
index 43cc4d21101d041612a7165723760dcf1dd635e4..4dd4aeb3fc9fe453e7da285c905da14620a413eb 100644 (file)
@@ -1342,6 +1342,8 @@ silc_server_command_identify_send_reply(SilcServerCommandContext cmd,
   SilcClientEntry entry;
   SilcCommandStatus status;
   unsigned short ident = silc_command_get_ident(cmd->payload);
+  char nh[256], uh[256];
+  SilcSocketConnection hsock;
 
   status = SILC_STATUS_OK;
   if (clients_count > 1)
@@ -1374,50 +1376,44 @@ silc_server_command_identify_send_reply(SilcServerCommandContext cmd,
     idp = silc_id_payload_encode(entry->id, SILC_ID_CLIENT);
     tmp = silc_argument_get_first_arg(cmd->args, NULL);
     
-    /* XXX */
-    {
-      char nh[256], uh[256];
-      SilcSocketConnection hsock;
-
-      memset(uh, 0, sizeof(uh));
-      memset(nh, 0, sizeof(nh));
-      
-      strncat(nh, entry->nickname, strlen(entry->nickname));
-      if (!strchr(entry->nickname, '@')) {
-       strncat(nh, "@", 1);
-       len = entry->router ? strlen(entry->router->server_name) :
-         strlen(server->server_name);
-       strncat(nh, entry->router ? entry->router->server_name :
-               server->server_name, len);
-      }
+    memset(uh, 0, sizeof(uh));
+    memset(nh, 0, sizeof(nh));
       
-      if (!entry->username) {
-       packet = silc_command_reply_payload_encode_va(SILC_COMMAND_IDENTIFY,
-                                                     status, ident, 2,
-                                                     2, idp->data, idp->len, 
-                                                     3, nh, strlen(nh));
-      } else {
-       strncat(uh, entry->username, strlen(entry->username));
-       if (!strchr(entry->username, '@')) {
-         strncat(uh, "@", 1);
-         hsock = (SilcSocketConnection)entry->connection;
-         len = strlen(hsock->hostname);
-         strncat(uh, hsock->hostname, len);
-       }
+    strncat(nh, entry->nickname, strlen(entry->nickname));
+    if (!strchr(entry->nickname, '@')) {
+      strncat(nh, "@", 1);
+      len = entry->router ? strlen(entry->router->server_name) :
+       strlen(server->server_name);
+      strncat(nh, entry->router ? entry->router->server_name :
+             server->server_name, len);
+    }
       
-       packet = silc_command_reply_payload_encode_va(SILC_COMMAND_IDENTIFY,
-                                                     status, ident, 3,
-                                                     2, idp->data, idp->len, 
-                                                     3, nh, strlen(nh),
-                                                     4, uh, strlen(uh));
+    if (!entry->username) {
+      packet = silc_command_reply_payload_encode_va(SILC_COMMAND_IDENTIFY,
+                                                   status, ident, 2,
+                                                   2, idp->data, idp->len, 
+                                                   3, nh, strlen(nh));
+    } else {
+      strncat(uh, entry->username, strlen(entry->username));
+      if (!strchr(entry->username, '@')) {
+       strncat(uh, "@", 1);
+       hsock = (SilcSocketConnection)entry->connection;
+       len = strlen(hsock->hostname);
+       strncat(uh, hsock->hostname, len);
       }
       
-      silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY,
-                             0, packet->data, packet->len, FALSE);
-      
-      silc_buffer_free(packet);
-      silc_buffer_free(idp);
+      packet = silc_command_reply_payload_encode_va(SILC_COMMAND_IDENTIFY,
+                                                   status, ident, 3,
+                                                   2, idp->data, idp->len, 
+                                                   3, nh, strlen(nh),
+                                                   4, uh, strlen(uh));
     }
+      
+    silc_server_packet_send(server, cmd->sock, SILC_PACKET_COMMAND_REPLY,
+                           0, packet->data, packet->len, FALSE);
+    
+    silc_buffer_free(packet);
+    silc_buffer_free(idp);
   }
 }
 
index 37c2838d8001511c1fc0e6722f9d56e140f84f2d..4b865ad8d0375c22370677f801939b206a06fcfa 100644 (file)
@@ -122,9 +122,7 @@ void silc_server_command_reply_free(SilcServerCommandReplyContext cmd)
   }
 }
 
-/* Caches the received WHOIS information. If we are normal server currently
-   we cache global information only for short period of time.  */
-/* XXX cache expirying not implemented yet! */
+/* Caches the received WHOIS information. */
 
 static char
 silc_server_command_reply_whois_save(SilcServerCommandReplyContext cmd)
index f756df1372948dd1c2d9a0f34aae74a0e7985f56..888f5bc2168879bc8ac8ad534a2c03635f59a93c 100644 (file)
@@ -422,52 +422,6 @@ silc_idlist_get_clients_by_hash(SilcIDList id_list, char *nickname,
   return clients;
 }
 
-/* Finds client entry by nickname. */
-
-SilcClientEntry
-silc_idlist_find_client_by_nickname(SilcIDList id_list, char *nickname,
-                                   char *server, SilcIDCacheEntry *ret_entry)
-{
-  SilcIDCacheList list = NULL;
-  SilcIDCacheEntry id_cache = NULL;
-  SilcClientEntry client = NULL;
-
-  SILC_LOG_DEBUG(("Client by nickname"));
-
-  if (server) {
-    if (!silc_idcache_find_by_data(id_list->clients, nickname, &list))
-      return NULL;
-
-#if 0
-    while (silc_idcache_list_next(list, &id_cache)) {
-      client = (SilcClientEntry)id_cache->context;
-
-      if (!strcmp(server, XXX, strlen(server)))
-       break;
-
-      client = NULL;
-    }
-#endif
-
-   silc_idcache_list_free(list);
-
-   if (!client)
-     return NULL;
-  } else {
-    if (!silc_idcache_find_by_data_one(id_list->clients, nickname, &id_cache))
-      return NULL;
-
-    client = (SilcClientEntry)id_cache->context;
-
-    if (ret_entry)
-      *ret_entry = id_cache;
-  }
-
-  SILC_LOG_DEBUG(("Found"));
-
-  return client;
-}
-
 /* Finds client by nickname hash. */
 
 SilcClientEntry
index 1198e58af567fba7b9df9514e79700042771e27a..637564849bf9aca36d74f0ab24a1d49425665e15 100644 (file)
@@ -502,10 +502,6 @@ silc_idlist_get_clients_by_hash(SilcIDList id_list, char *nickname,
                                SilcHash md5hash,
                                unsigned int *clients_count);
 SilcClientEntry
-silc_idlist_find_client_by_nickname(SilcIDList id_list, char *nickname,
-                                   char *server,
-                                   SilcIDCacheEntry *ret_entry);
-SilcClientEntry
 silc_idlist_find_client_by_hash(SilcIDList id_list, char *nickname,
                                SilcHash md5hash, SilcIDCacheEntry *ret_entry);
 SilcClientEntry
index 937cc2e7eada0657c19cf2417e45b2e0437ac686..ecfab1cf72e8412f090f132571f697177dbb0d05 100644 (file)
@@ -37,7 +37,7 @@ void silc_server_notify(SilcServer server,
   SilcNotifyPayload payload;
   SilcNotifyType type;
   SilcArgumentPayload args;
-  SilcChannelID *channel_id;
+  SilcChannelID *channel_id, *channel_id2;
   SilcClientID *client_id, *client_id2;
   SilcChannelEntry channel;
   SilcClientEntry client;
@@ -570,7 +570,55 @@ void silc_server_notify(SilcServer server,
     break;
 
   case SILC_NOTIFY_TYPE_CHANNEL_CHANGE:
-    SILC_LOG_DEBUG(("CHANNEL CHANGE notify (not-impl XXX)"));
+    /*
+     * Distribute to the local clients on the channel and change the
+     * channel ID.
+     */
+
+    SILC_LOG_DEBUG(("CHANNEL CHANGE"));
+
+    /* Get the old Channel ID */
+    tmp = silc_argument_get_arg_type(args, 1, &tmp_len);
+    if (!tmp)
+      goto out;
+    channel_id = silc_id_payload_parse_id(tmp, tmp_len);
+    if (!channel_id)
+      goto out;
+
+    /* Get the channel entry */
+    channel = silc_idlist_find_channel_by_id(server->global_list, 
+                                            channel_id, NULL);
+    if (!channel) {
+      channel = silc_idlist_find_channel_by_id(server->local_list, 
+                                              channel_id, NULL);
+      if (!channel) {
+       silc_free(channel_id);
+       goto out;
+      }
+    }
+
+    /* Send the notify to the channel */
+    silc_server_packet_send_to_channel(server, sock, channel, packet->type, 
+                                      FALSE, packet->buffer->data, 
+                                      packet->buffer->len, FALSE);
+
+    /* Get the new Channel ID */
+    tmp = silc_argument_get_arg_type(args, 2, &tmp_len);
+    if (!tmp)
+      goto out;
+    channel_id2 = silc_id_payload_parse_id(tmp, tmp_len);
+    if (!channel_id2)
+      goto out;
+
+    /* Replace the Channel ID */
+    if (!silc_idlist_replace_channel_id(server->global_list, channel_id,
+                                       channel_id2))
+      silc_idlist_replace_channel_id(server->local_list, channel_id,
+                                    channel_id2);
+
+    silc_free(channel_id);
+    silc_free(channel_id2);
+
     break;
 
   case SILC_NOTIFY_TYPE_SERVER_SIGNOFF:
@@ -1449,20 +1497,6 @@ static void silc_server_new_id_real(SilcServer server,
       if (sock->type == SILC_SOCKET_TYPE_SERVER)
        server->stat.cell_clients++;
       server->stat.clients++;
-
-#if 0
-      /* XXX Adding two ID's with same IP number replaces the old entry thus
-        gives wrong route. Thus, now disabled until figured out a better way
-        to do this or when removed the whole thing. This could be removed
-        because entry->router->connection gives always the most optimal route
-        for the ID anyway (unless new routes (faster perhaps) are established
-        after receiving this ID, this we don't know however). */
-      /* Add route cache for this ID */
-      silc_server_route_add(silc_server_route_hash(
-                           ((SilcClientID *)id)->ip.s_addr,
-                           server->id->port), ((SilcClientID *)id)->ip.s_addr,
-                           router);
-#endif
     }
     break;
 
@@ -1479,15 +1513,6 @@ static void silc_server_new_id_real(SilcServer server,
     if (sock->type == SILC_SOCKET_TYPE_SERVER)
       server->stat.cell_servers++;
     server->stat.servers++;
-
-#if 0
-    /* Add route cache for this ID */
-    silc_server_route_add(silc_server_route_hash(
-                         ((SilcServerID *)id)->ip.s_addr,
-                         ((SilcServerID *)id)->port), 
-                         ((SilcServerID *)id)->ip.s_addr,
-                         router);
-#endif
     break;
 
   case SILC_ID_CHANNEL:
index 8275145db84c5a4f32026007b18ecfeacc03999e..e5c6b8de0c3cf2e38a48f0fa840af058ce40eb46 100644 (file)
@@ -102,17 +102,6 @@ int silc_server_protocol_ke_set_keys(SilcSKE ske,
     idata->receive_key->set_iv(idata->receive_key, keymat->receive_iv);
   }
 
-  /* Allocate PKCS to be used */
-#if 0
-  /* XXX Do we ever need to allocate PKCS for the connection??
-     If yes, we need to change KE protocol to get the initiators
-     public key. */
-  silc_pkcs_alloc(pkcs->pkcs->name, &idata->pkcs);
-  idata->public_key = silc_pkcs_public_key_alloc(XXX);
-  silc_pkcs_set_public_key(idata->pkcs, ske->ke2_payload->pk_data, 
-                          ske->ke2_payload->pk_len);
-#endif
-
   /* Save the hash */
   if (!silc_hash_alloc(hash->hash->name, &idata->hash)) {
     silc_cipher_free(idata->send_key);
@@ -441,8 +430,6 @@ SILC_TASK_CALLBACK(silc_server_protocol_key_exchange)
  * Connection Authentication protocol functions
  */
 
-/* XXX move these to somehwere else */
-
 int silc_server_password_authentication(SilcServer server, char *auth1, 
                                        char *auth2)
 {
@@ -650,7 +637,7 @@ SILC_TASK_CALLBACK(silc_server_protocol_connection_auth)
                                                          auth_data,
                                                          payload_len, 
                                                          ctx->ske);
-                                                         
+
              if (ret) {
                memset(auth_data, 0, payload_len);
                silc_free(auth_data);
@@ -873,10 +860,6 @@ SILC_TASK_CALLBACK(silc_server_protocol_connection_auth)
            auth_data_len = ctx->auth_data_len;
            break;
          }
-
-         /* No authentication data exits. Ask interactively from user. */
-         /* XXX */
-
          break;
          
        case SILC_AUTH_PUBLIC_KEY:
index 09d9926279d0cc92c8af3719463c57ce9975ec1f..3563b4987c11ca4227b4e05fdc0a67a4beb746b3 100644 (file)
  * routes. If route entry doesn't exist for a specific destination, server
  * uses primary route (default route).
  */
+/* XXX Adding two ID's with same IP number replaces the old entry thus
+   gives wrong route. Thus, now disabled until figured out a better way
+   to do this or when removed the whole thing. This could be removed
+   because entry->router->connection gives always the most optimal route
+   for the ID anyway (unless new routes (faster perhaps) are established
+   after receiving this ID, this we don't know however). */
 /* $Id$ */
 
 #include "serverincludes.h"
index d1c0ad37c10c7266136c81b61d9a7bd3c2c86ec1..5acb4c58fd27e1048e1e22f0b912a60572c3f15a 100644 (file)
@@ -1029,9 +1029,6 @@ int silc_server_config_parse_lines(SilcServerConfig config,
     }
 
     pc = pc->next;
-    /* XXXX */
-    //    silc_free(pc->prev);
-    //    pc->prev = NULL;
   }
 
   if (check == FALSE)
@@ -1090,7 +1087,8 @@ int silc_server_config_check_sections(unsigned int checkmask)
     
     return FALSE;
   }
-  if (!(checkmask & (1L << SILC_CONFIG_SERVER_SECTION_TYPE_CLIENT_CONNECTION))) {
+  if (!(checkmask & 
+       (1L << SILC_CONFIG_SERVER_SECTION_TYPE_CLIENT_CONNECTION))) {
     
     return FALSE;
   }
index 0567d6d75c246cd5accdfd8cab9071c343885ae0..8ab11cf1f61516f66b9b7fadd3f61626f15d7bee 100644 (file)
@@ -1264,9 +1264,10 @@ ID's sent in arguments are sent inside ID Payload.
 10    SILC_NOTIFY_TYPE_CHANNEL_CHANGE
 
       Sent when channel's ID has changed for a reason or another.  This 
-      is sent by normal server to the client.  Client must change the 
-      old Channel ID to the new one.  This type must be sent only to the
-      clients who is joined on the channel.
+      is sent by normal server to the client.  This can also be sent by
+      router to other server to force the Channel ID change.  The Channel
+      ID must be changed to use the new one.  When sent to clients, this
+      type must be sent only to the clients who is joined on the channel.
 
       Max Arguments:  2
           Arguments:  (1) <Old Channel ID>  (2) <New Channel ID>