In IDENTIFY command parsing, send all other IDs except
authorPekka Riikonen <priikone@silcnet.org>
Mon, 28 Oct 2002 19:29:08 +0000 (19:29 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Mon, 28 Oct 2002 19:29:08 +0000 (19:29 +0000)
Client IDs explicitly to router for resolving on normal
server.  Also check that ID received in WHOIS command is
always Client ID, others are not allowed.

CHANGES
apps/silcd/server_query.c

diff --git a/CHANGES b/CHANGES
index 3dad411dcc76bbefc4b454e628d8d2ab68614300..e367886ead5ca43720d48437bfeb5615313529f7 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,11 @@
+Mon Oct 28 21:23:39 EET 2002  Pekka Riikonen <priikone@silcnet.org>
+
+       * In IDENTIFY command parsing, send all other IDs except
+         Client IDs explicitly to router for resolving on normal
+         server.  Also check that ID received in WHOIS command is
+         always Client ID, others are not allowed.  Affected file
+         silcd/server_query.c.
+
 Sun Oct 27 11:44:32 EET 2002  Pekka Riikonen <priikone@silcnet.org>
 
        * Merged c0ffee's /set heartbeat patch to Irssi SILC client.
index 089272f6294eb2027a25bdf262da5b4e5089038d..a8bd816b4dd93ab0613eb785df7212bde95d792c 100644 (file)
@@ -388,8 +388,8 @@ void silc_server_query_parse(SilcServer server, SilcServerQuery query)
        if (!tmp)
          continue;
 
-       id = silc_id_payload_parse_id(tmp, tmp_len, NULL);
-       if (!id) {
+       id = silc_id_payload_parse_id(tmp, tmp_len, &id_type);
+       if (!id || id_type != SILC_ID_CLIENT) {
          silc_server_query_add_error(server, query, TRUE, i + 4,
                                      SILC_STATUS_ERR_BAD_CLIENT_ID);
          continue;
@@ -514,18 +514,29 @@ void silc_server_query_parse(SilcServer server, SilcServerQuery query)
        /* Normal server must check whether this ID exist, and if not then
           send the query to router, unless done so already */
        if (server->server_type == SILC_SERVER && !query->resolved) {
-         if (!silc_idlist_find_client_by_id(server->local_list,
-                                            id, TRUE, NULL)) {
-           if (cmd->sock->type != SILC_SOCKET_TYPE_CLIENT ||
-               !silc_idlist_find_client_by_id(server->global_list,
+         if (id_type == SILC_ID_CLIENT) {
+           if (!silc_idlist_find_client_by_id(server->local_list,
                                               id, TRUE, NULL)) {
-             silc_server_query_send_router(server, query);
-             for (i = 0; i < query->ids_count; i++)
-               silc_free(query->ids[i].id);
-             silc_free(query->ids);
-             silc_free(id);
-             return;
+             if (cmd->sock->type != SILC_SOCKET_TYPE_CLIENT ||
+                 !silc_idlist_find_client_by_id(server->global_list,
+                                                id, TRUE, NULL)) {
+               silc_server_query_send_router(server, query);
+               for (i = 0; i < query->ids_count; i++)
+                 silc_free(query->ids[i].id);
+               silc_free(query->ids);
+               silc_free(id);
+               return;
+             }
            }
+         } else {
+           /* For now all other ID's except Client ID's are explicitly
+              sent to router for resolving. */
+           silc_server_query_send_router(server, query);
+           for (i = 0; i < query->ids_count; i++)
+             silc_free(query->ids[i].id);
+           silc_free(query->ids);
+           silc_free(id);
+           return;
          }
        }