Allow command reply packets from clients as well.
authorPekka Riikonen <priikone@silcnet.org>
Mon, 7 Oct 2002 16:23:09 +0000 (16:23 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Mon, 7 Oct 2002 16:23:09 +0000 (16:23 +0000)
Allow Requested Attributes reply from client for WHOIS.

apps/silcd/command_reply.c
apps/silcd/packet_receive.c

index 55d62bb5921a59b8ca4e93471e23147387df0040..65056586d3e73db30eb20aa560a32416c210bb18 100644 (file)
@@ -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 &&
index 4589ab7c0c6b25d02a58cee8101c8df081c3fcc8..22ebddbf677d0991b2e15572689ee6d9d54bf0a8 100644 (file)
@@ -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;