From 17c5ba9b971a776243f3ba1a7095efc5ce2a4844 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Mon, 28 Oct 2002 19:29:08 +0000 Subject: [PATCH] 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. --- CHANGES | 8 ++++++++ apps/silcd/server_query.c | 35 +++++++++++++++++++++++------------ 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/CHANGES b/CHANGES index 3dad411d..e367886e 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,11 @@ +Mon Oct 28 21:23:39 EET 2002 Pekka Riikonen + + * 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 * Merged c0ffee's /set heartbeat patch to Irssi SILC client. diff --git a/apps/silcd/server_query.c b/apps/silcd/server_query.c index 089272f6..a8bd816b 100644 --- a/apps/silcd/server_query.c +++ b/apps/silcd/server_query.c @@ -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; } } -- 2.24.0