Allow only WHOIS command reply from client.
authorPekka Riikonen <priikone@silcnet.org>
Mon, 7 Oct 2002 16:27:10 +0000 (16:27 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Mon, 7 Oct 2002 16:27:10 +0000 (16:27 +0000)
apps/silcd/command_reply.c

index 65056586d3e73db30eb20aa560a32416c210bb18..6d427ca9e626ebb36cc782d148dc6a12790c8fe7 100644 (file)
@@ -85,14 +85,21 @@ void silc_server_command_reply_process(SilcServer server,
   ctx->payload = payload;
   ctx->args = silc_command_get_args(ctx->payload);
   ctx->ident = silc_command_get_ident(ctx->payload);
+  command = silc_command_get(ctx->payload);
+
+  /* Client is not allowed to send reply to all commands */
+  if (sock->type == SILC_SOCKET_TYPE_CLIENT &&
+      command != SILC_COMMAND_WHOIS) {
+    silc_server_command_reply_free(ctx);
+    return;
+  }
       
   /* Check for pending commands and mark to be exeucted */
   ctx->callbacks = 
-    silc_server_command_pending_check(server, silc_command_get(ctx->payload), 
+    silc_server_command_pending_check(server, command,
                                      ctx->ident, &ctx->callbacks_count);
 
   /* Execute command reply */
-  command = silc_command_get(ctx->payload);
   for (cmd = silc_command_reply_list; cmd->cb; cmd++)
     if (cmd->cmd == command)
       break;