From f84e25dbb74f4726279f89d6d88bf815dc6b93d1 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Mon, 7 Oct 2002 16:23:09 +0000 Subject: [PATCH] Allow command reply packets from clients as well. Allow Requested Attributes reply from client for WHOIS. --- apps/silcd/command_reply.c | 28 ++++++++++++++++++++++++++-- apps/silcd/packet_receive.c | 5 ----- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/apps/silcd/command_reply.c b/apps/silcd/command_reply.c index 55d62bb5..65056586 100644 --- a/apps/silcd/command_reply.c +++ b/apps/silcd/command_reply.c @@ -290,6 +290,25 @@ silc_server_command_reply_whois_save(SilcServerCommandReplyContext cmd) return TRUE; } +/* Handle requested attributes reply in WHOIS from client */ + +static char +silc_server_command_reply_whois_save_client(SilcServerCommandReplyContext cmd) +{ + unsigned char *tmp; + SilcUInt32 len; + SilcClientEntry client = cmd->sock->user_data; + + /* Take Requested Attributes if set. */ + tmp = silc_argument_get_arg_type(cmd->args, 11, &len); + if (tmp && client) { + silc_free(client->attrs); + client->attrs = silc_memdup(tmp, len); + } + + return TRUE; +} + /* Reiceved reply for WHOIS command. We sent the whois request to our primary router, if we are normal server, and thus has now received reply to the command. We will figure out what client originally sent us the @@ -303,8 +322,13 @@ SILC_SERVER_CMD_REPLY_FUNC(whois) COMMAND_CHECK_STATUS; - if (!silc_server_command_reply_whois_save(cmd)) - goto out; + if (cmd->sock->type != SILC_SOCKET_TYPE_CLIENT) { + if (!silc_server_command_reply_whois_save(cmd)) + goto out; + } else { + if (!silc_server_command_reply_whois_save_client(cmd)) + goto out; + } /* Pending callbacks are not executed if this was an list entry */ if (status != SILC_STATUS_OK && diff --git a/apps/silcd/packet_receive.c b/apps/silcd/packet_receive.c index 4589ab7c..22ebddbf 100644 --- a/apps/silcd/packet_receive.c +++ b/apps/silcd/packet_receive.c @@ -1900,11 +1900,6 @@ void silc_server_command_reply(SilcServer server, SILC_LOG_DEBUG(("Start")); - /* Source must be server or router */ - if (packet->src_id_type != SILC_ID_SERVER && - sock->type != SILC_SOCKET_TYPE_ROUTER) - return; - if (packet->dst_id_type == SILC_ID_CHANNEL) return; -- 2.43.0