updates.
authorPekka Riikonen <priikone@silcnet.org>
Sat, 15 Dec 2001 18:49:39 +0000 (18:49 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Sat, 15 Dec 2001 18:49:39 +0000 (18:49 +0000)
CHANGES
TODO
apps/silcd/command.c
apps/silcd/packet_receive.c
apps/silcd/protocol.c
apps/silcd/server.c
lib/silcclient/command.c
lib/silcclient/command_reply.c
lib/silccore/silcauth.c
lib/silccore/silcpacket.c

diff --git a/CHANGES b/CHANGES
index 5abf16fa826260a35ffa889d645f9d74571b8ca0..b449fa480e48572f23328f8e48a947afcb33e503 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,16 @@
+Sat Dec 15 20:31:50 EET 2001  Pekka Riikonen <priikone@silcnet.org>
+
+       * Fixed the server's password authentication to use the
+         length of the locally saved password, and not the one
+         sent in the packet.  Affected file silcd/protocol.c.
+
+       * Fixed same password authentication problem in the
+         Authentication Payload handling routines in
+         lib/silccore/silcauth.c.
+
+       * Yet another password authentication problem fixed with
+         channel password handling in silcd/command.c.
+
 Mon Dec 10 19:57:40 EET 2001  Pekka Riikonen <priikone@silcnet.org>
 
        * If first character of string in silc_parse_userfqdn is '@'
diff --git a/TODO b/TODO
index 090af4c4f7ec5e227b967f043cecd8d48852ea11..757b9c127bc9f5a41b70ac22ea9c2c935e4ca0de 100644 (file)
--- a/TODO
+++ b/TODO
@@ -39,6 +39,14 @@ TODO/bugs In SILC Client Library
 TODO/bugs In SILC Server
 ========================
 
+ o It is possible that IDENTIFy's check_client will register two pending       
+   callbacks for same ident, which must not happen.  Check same for WHOIS
+   as well.
+
+ o If auto-reconnecting to router and EOF is received during the
+   connecting phase the server will not try to auto-reconnect anymore
+   after that.  Fix to auto-reconnect.
+
  o Backup router related issues
 
        o Channel user mode changes are notified unnecessarely when
index 3784e732160717e3920e1994514dcd7f362d5621..38d7a74e2f92a8963800972a92594275d031de55 100644 (file)
@@ -1956,6 +1956,7 @@ silc_server_command_identify_process(SilcServerCommandContext cmd)
                                           &count);
   if (ret < 1)
     return ret;
+  ret = 0;
 
   /* Check that all mandatory fields are present and request those data
      from the server who owns the client if necessary. */
@@ -3159,8 +3160,7 @@ static void silc_server_command_join_channel(SilcServer server,
     }
   
     if (!passphrase || !channel->passphrase ||
-        memcmp(channel->passphrase, passphrase,
-               strlen(channel->passphrase))) {
+        memcmp(passphrase, channel->passphrase, strlen(channel->passphrase))) {
       silc_server_command_send_status_reply(cmd, SILC_COMMAND_JOIN,
                                            SILC_STATUS_ERR_BAD_PASSWORD);
       goto out;
index 926163899005ea30c40485d2b411a3e4c16db780..9dcc3fa7848f5aa81481cf1d9dc802994bbcefd9 100644 (file)
@@ -1317,7 +1317,7 @@ void silc_server_command_reply(SilcServer server,
 
   if (packet->dst_id_type == SILC_ID_SERVER) {
     /* For now this must be for us */
-    if (memcmp(packet->dst_id, server->id_string, packet->dst_id_len)) {
+    if (memcmp(packet->dst_id, server->id_string, server->id_string_len)) {
       SILC_LOG_ERROR(("Cannot process command reply to unknown server"));
       return;
     }
index 64d40f1f26f493c508f403ca6b6c7764636314d0..e8f55d87c9080b43dc02aec8eba1081629ff0e77 100644 (file)
@@ -131,12 +131,11 @@ silc_verify_public_key_internal(SilcServer server, SilcSocketConnection sock,
 
       /* Save the key for future checking */
       unlink(filename);
-      silc_pkcs_save_public_key_data(filename, pk, pk_len,
-                                    SILC_PKCS_FILE_PEM);
+      silc_pkcs_save_public_key_data(filename, pk, pk_len, SILC_PKCS_FILE_PEM);
       return TRUE;
     }
 
-    if (memcmp(encpk, pk, encpk_len)) {
+    if (memcmp(pk, encpk, encpk_len)) {
       SILC_LOG_WARNING(("%s (%s) port %d server public key does not match "
                        "with local copy", sock->hostname, sock->ip, 
                        sock->port));
@@ -711,13 +710,13 @@ SILC_TASK_CALLBACK(silc_server_protocol_key_exchange)
  */
 
 static int 
-silc_server_password_authentication(SilcServer server, char *auth1
-                                   char *auth2)
+silc_server_password_authentication(SilcServer server, char *remote_auth
+                                   char *local_auth)
 {
-  if (!auth1 || !auth2)
+  if (!remote_auth || !local_auth)
     return FALSE;
 
-  if (!memcmp(auth1, auth2, strlen(auth1)))
+  if (!memcmp(remote_auth, local_auth, strlen(local_auth)))
     return TRUE;
 
   return FALSE;
index 2dfbbbbbf7c357dd48a2f28e63bbd019be1f567e..f90aca67e2ba55daa6568bd6ea54f9dbf4777fd8 100644 (file)
@@ -1633,7 +1633,7 @@ SILC_TASK_CALLBACK(silc_server_packet_parse_real)
     if (!(packet->flags & SILC_PACKET_FLAG_BROADCAST) &&
        packet->dst_id_type == SILC_ID_SERVER && 
        sock->type != SILC_SOCKET_TYPE_CLIENT &&
-       memcmp(packet->dst_id, server->id_string, packet->dst_id_len)) {
+       memcmp(packet->dst_id, server->id_string, server->id_string_len)) {
       
       /* Route the packet to fastest route for the destination ID */
       void *id = silc_id_str2id(packet->dst_id, packet->dst_id_len, 
index cf3fc46e4f34072ba8f34e0018929882d81a3586..da743a42c2ec70247f970baca10f15d345a0a9bc 100644 (file)
@@ -34,6 +34,8 @@
 #define COMMAND_ERROR cmd->client->internal->ops->command(cmd->client, \
   cmd->conn, cmd, FALSE, cmd->command->cmd)
 
+#define SAY cmd->client->internal->ops->say
+
 /* Generic function to send any command. The arguments must be sent already
    encoded into correct form and in correct order. */
 
@@ -252,8 +254,8 @@ SILC_CLIENT_CMD_FUNC(whowas)
   }
 
   if (cmd->argc < 2 || cmd->argc > 3) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-            "Usage: /WHOWAS <nickname>[@<server>] [<count>]");
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+       "Usage: /WHOWAS <nickname>[@<server>] [<count>]");
     COMMAND_ERROR;
     goto out;
   }
@@ -366,8 +368,8 @@ SILC_CLIENT_CMD_FUNC(nick)
   }
 
   if (cmd->argc < 2) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                         "Usage: /NICK <nickname>");
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+       "Usage: /NICK <nickname>");
     COMMAND_ERROR;
     goto out;
   }
@@ -378,12 +380,12 @@ SILC_CLIENT_CMD_FUNC(nick)
   /* Show current nickname */
   if (cmd->argc < 2) {
     if (cmd->conn) {
-      cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                           "Your nickname is %s on server %s", 
-                           conn->nickname, conn->remote_host);
+      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+         "Your nickname is %s on server %s", 
+         conn->nickname, conn->remote_host);
     } else {
-      cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                           "Your nickname is %s", conn->nickname);
+      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+         "Your nickname is %s", conn->nickname);
     }
 
     COMMAND;
@@ -485,16 +487,16 @@ SILC_CLIENT_CMD_FUNC(topic)
   }
 
   if (cmd->argc < 2 || cmd->argc > 3) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
-                         "Usage: /TOPIC <channel> [<topic>]");
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
+       "Usage: /TOPIC <channel> [<topic>]");
     COMMAND_ERROR;
     goto out;
   }
 
   if (cmd->argv[1][0] == '*') {
     if (!conn->current_channel) {
-      cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                           "You are not on any channel");
+      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+         "You are not on any channel");
       COMMAND_ERROR;
       goto out;
     }
@@ -504,16 +506,16 @@ SILC_CLIENT_CMD_FUNC(topic)
   }
 
   if (!conn->current_channel) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                         "You are not on that channel");
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+       "You are not on that channel");
     COMMAND_ERROR;
     goto out;
   }
 
   /* Get the Channel ID of the channel */
   if (!silc_idcache_find_by_name_one(conn->channel_cache, name, &id_cache)) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                         "You are not on that channel");
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+       "You are not on that channel");
     COMMAND_ERROR;
     goto out;
   }
@@ -566,17 +568,17 @@ SILC_CLIENT_CMD_FUNC(invite)
   }
 
   if (cmd->argc < 2) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
-                  "Usage: /INVITE <channel> [<nickname>[@server>]"
-                  "[+|-[<nickname>[@<server>[!<username>[@hostname>]]]]]");
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
+       "Usage: /INVITE <channel> [<nickname>[@server>]"
+       "[+|-[<nickname>[@<server>[!<username>[@hostname>]]]]]");
     COMMAND_ERROR;
     goto out;
   }
 
   if (cmd->argv[1][0] == '*') {
     if (!conn->current_channel) {
-      cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                           "You are not on any channel");
+      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+         "You are not on any channel");
       COMMAND_ERROR;
       goto out;
     }
@@ -587,8 +589,8 @@ SILC_CLIENT_CMD_FUNC(invite)
 
     channel = silc_client_get_channel(cmd->client, conn, name);
     if (!channel) {
-      cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                           "You are on that channel");
+      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+         "You are on that channel");
       COMMAND_ERROR;
       goto out;
     }
@@ -794,8 +796,8 @@ SILC_CLIENT_CMD_FUNC(kill)
   }
 
   if (cmd->argc < 2) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                         "Usage: /KILL <nickname> [<comment>]");
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+       "Usage: /KILL <nickname> [<comment>]");
     COMMAND_ERROR;
     goto out;
   }
@@ -1059,8 +1061,8 @@ SILC_CLIENT_CMD_FUNC(motd)
   }
 
   if (cmd->argc < 1 || cmd->argc > 2) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
-                         "Usage: /MOTD [<server>]");
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
+       "Usage: /MOTD [<server>]");
     COMMAND_ERROR;
     goto out;
   }
@@ -1104,8 +1106,8 @@ SILC_CLIENT_CMD_FUNC(umode)
   }
 
   if (cmd->argc < 2) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                 "Usage: /UMODE +|-<modes>");
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+       "Usage: /UMODE +|-<modes>");
     COMMAND_ERROR;
     goto out;
   }
@@ -1199,16 +1201,16 @@ SILC_CLIENT_CMD_FUNC(cmode)
   }
 
   if (cmd->argc < 3) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                 "Usage: /CMODE <channel> +|-<modes> [{ <arguments>}]");
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+       "Usage: /CMODE <channel> +|-<modes> [{ <arguments>}]");
     COMMAND_ERROR;
     goto out;
   }
 
   if (cmd->argv[1][0] == '*') {
     if (!conn->current_channel) {
-      cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                           "You are not on any channel");
+      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+         "You are not on any channel");
       COMMAND_ERROR;
       goto out;
     }
@@ -1219,8 +1221,8 @@ SILC_CLIENT_CMD_FUNC(cmode)
 
     channel = silc_client_get_channel(cmd->client, conn, name);
     if (!channel) {
-      cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                           "You are on that channel");
+      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+         "You are on that channel");
       COMMAND_ERROR;
       goto out;
     }
@@ -1278,8 +1280,8 @@ SILC_CLIENT_CMD_FUNC(cmode)
        mode |= SILC_CHANNEL_MODE_ULIMIT;
        type = 3;
        if (cmd->argc < 4) {
-         cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-              "Usage: /CMODE <channel> +|-<modes> [{ <arguments>}]");
+         SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+             "Usage: /CMODE <channel> +|-<modes> [{ <arguments>}]");
          COMMAND_ERROR;
          goto out;
        }
@@ -1296,8 +1298,8 @@ SILC_CLIENT_CMD_FUNC(cmode)
        mode |= SILC_CHANNEL_MODE_PASSPHRASE;
        type = 4;
        if (cmd->argc < 4) {
-         cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-              "Usage: /CMODE <channel> +|-<modes> [{ <arguments>}]");
+         SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+             "Usage: /CMODE <channel> +|-<modes> [{ <arguments>}]");
          COMMAND_ERROR;
          goto out;
        }
@@ -1312,8 +1314,8 @@ SILC_CLIENT_CMD_FUNC(cmode)
        mode |= SILC_CHANNEL_MODE_CIPHER;
        type = 5;
        if (cmd->argc < 4) {
-         cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-              "Usage: /CMODE <channel> +|-<modes> [{ <arguments>}]");
+         SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+             "Usage: /CMODE <channel> +|-<modes> [{ <arguments>}]");
          COMMAND_ERROR;
          goto out;
        }
@@ -1328,8 +1330,8 @@ SILC_CLIENT_CMD_FUNC(cmode)
        mode |= SILC_CHANNEL_MODE_HMAC;
        type = 6;
        if (cmd->argc < 4) {
-         cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-              "Usage: /CMODE <channel> +|-<modes> [{ <arguments>}]");
+         SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+             "Usage: /CMODE <channel> +|-<modes> [{ <arguments>}]");
          COMMAND_ERROR;
          goto out;
        }
@@ -1345,8 +1347,8 @@ SILC_CLIENT_CMD_FUNC(cmode)
        type = 7;
 
        if (cmd->argc < 4) {
-         cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-              "Usage: /CMODE <channel> +|-<modes> [{ <arguments>}]");
+         SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+             "Usage: /CMODE <channel> +|-<modes> [{ <arguments>}]");
          COMMAND_ERROR;
          goto out;
        }
@@ -1430,16 +1432,16 @@ SILC_CLIENT_CMD_FUNC(cumode)
   }
 
   if (cmd->argc < 4) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                 "Usage: /CUMODE <channel> +|-<modes> <nickname>[@<server>]");
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+       "Usage: /CUMODE <channel> +|-<modes> <nickname>[@<server>]");
     COMMAND_ERROR;
     goto out;
   }
 
   if (cmd->argv[1][0] == '*') {
     if (!conn->current_channel) {
-      cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                           "You are not on any channel");
+      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+         "You are not on any channel");
       COMMAND_ERROR;
       goto out;
     }
@@ -1450,8 +1452,8 @@ SILC_CLIENT_CMD_FUNC(cumode)
 
     channel = silc_client_get_channel(cmd->client, conn, name);
     if (!channel) {
-      cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                           "You are on that channel");
+      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+         "You are on that channel");
       COMMAND_ERROR;
       goto out;
     }
@@ -1596,16 +1598,16 @@ SILC_CLIENT_CMD_FUNC(kick)
   }
 
   if (cmd->argc < 3) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                         "Usage: /KICK <channel> <nickname> [<comment>]");
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+       "Usage: /KICK <channel> <nickname> [<comment>]");
     COMMAND_ERROR;
     goto out;
   }
 
   if (cmd->argv[1][0] == '*') {
     if (!conn->current_channel) {
-      cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                           "You are not on any channel");
+      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+         "You are not on any channel");
       COMMAND_ERROR;
       goto out;
     }
@@ -1615,16 +1617,16 @@ SILC_CLIENT_CMD_FUNC(kick)
   }
 
   if (!conn->current_channel) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                         "You are not on that channel");
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+       "You are not on that channel");
     COMMAND_ERROR;
     goto out;
   }
 
   /* Get the Channel ID of the channel */
   if (!silc_idcache_find_by_name_one(conn->channel_cache, name, &id_cache)) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                         "You are not on that channel");
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+       "You are not on that channel");
     COMMAND_ERROR;
     goto out;
   }
@@ -1641,9 +1643,8 @@ SILC_CLIENT_CMD_FUNC(kick)
   target = silc_idlist_get_client(cmd->client, conn, nickname, 
                                  cmd->argv[2], FALSE);
   if (!target) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                         "No such client: %s",
-                         cmd->argv[2]);
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+       "No such client: %s", cmd->argv[2]);
     COMMAND_ERROR;
     goto out;
   }
@@ -1723,8 +1724,8 @@ SILC_CLIENT_CMD_FUNC(oper)
   }
 
   if (cmd->argc < 2) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                         "Usage: /OPER <username> [-pubkey]");
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+       "Usage: /OPER <username> [-pubkey]");
     COMMAND_ERROR;
     goto out;
   }
@@ -1791,8 +1792,8 @@ SILC_CLIENT_CMD_FUNC(silcoper)
   }
 
   if (cmd->argc < 2) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                         "Usage: /SILCOPER <username> [-pubkey]");
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+       "Usage: /SILCOPER <username> [-pubkey]");
     COMMAND_ERROR;
     goto out;
   }
@@ -1828,8 +1829,8 @@ SILC_CLIENT_CMD_FUNC(connect)
   }
 
   if (cmd->argc < 2) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                         "Usage: /CONNECT <server> [<port>]");
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+       "Usage: /CONNECT <server> [<port>]");
     COMMAND_ERROR;
     goto out;
   }
@@ -1877,17 +1878,17 @@ SILC_CLIENT_CMD_FUNC(ban)
   }
 
   if (cmd->argc < 2) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                  "Usage: /BAN <channel> "
-                  "[+|-[<nickname>[@<server>[!<username>[@hostname>]]]]]");
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+       "Usage: /BAN <channel> "
+       "[+|-[<nickname>[@<server>[!<username>[@hostname>]]]]]");
     COMMAND_ERROR;
     goto out;
   }
 
   if (cmd->argv[1][0] == '*') {
     if (!conn->current_channel) {
-      cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                           "You are not on any channel");
+      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+         "You are not on any channel");
       COMMAND_ERROR;
       goto out;
     }
@@ -1898,8 +1899,8 @@ SILC_CLIENT_CMD_FUNC(ban)
 
     channel = silc_client_get_channel(cmd->client, conn, name);
     if (!channel) {
-      cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                           "You are on that channel");
+      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+         "You are on that channel");
       COMMAND_ERROR;
       goto out;
     }
@@ -1955,8 +1956,8 @@ SILC_CLIENT_CMD_FUNC(close)
   }
 
   if (cmd->argc < 2) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                         "Usage: /CLOSE <server> [<port>]");
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+       "Usage: /CLOSE <server> [<port>]");
     COMMAND_ERROR;
     goto out;
   }
@@ -2027,16 +2028,16 @@ SILC_CLIENT_CMD_FUNC(leave)
   }
 
   if (cmd->argc != 2) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                         "Usage: /LEAVE <channel>");
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+       "Usage: /LEAVE <channel>");
     COMMAND_ERROR;
     goto out;
   }
 
   if (cmd->argv[1][0] == '*') {
     if (!conn->current_channel) {
-      cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                           "You are not on any channel");
+      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+         "You are not on any channel");
       COMMAND_ERROR;
       goto out;
     }
@@ -2047,8 +2048,8 @@ SILC_CLIENT_CMD_FUNC(leave)
 
   /* Get the Channel ID of the channel */
   if (!silc_idcache_find_by_name_one(conn->channel_cache, name, &id_cache)) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                         "You are not on that channel");
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+       "You are not on that channel");
     COMMAND_ERROR;
     goto out;
   }
@@ -2094,16 +2095,16 @@ SILC_CLIENT_CMD_FUNC(users)
   }
 
   if (cmd->argc != 2) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                         "Usage: /USERS <channel>");
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+       "Usage: /USERS <channel>");
     COMMAND_ERROR;
     goto out;
   }
 
   if (cmd->argv[1][0] == '*') {
     if (!conn->current_channel) {
-      cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                           "You are not on any channel");
+      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+         "You are not on any channel");
       COMMAND_ERROR;
       goto out;
     }
@@ -2162,9 +2163,8 @@ SILC_CLIENT_CMD_FUNC(getkey)
     
     if (status == SILC_STATUS_ERR_NO_SUCH_NICK ||
        status == SILC_STATUS_ERR_NO_SUCH_SERVER) {
-      cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
-                           "%s", 
-                           silc_client_command_status_message(status));
+      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR, "%s", 
+         silc_client_command_status_message(status));
       COMMAND_ERROR;
       goto out;
     }
index 5fee4e825b52ad3d08c245bab454b80baf4c4a9f..50601561d18ee25c508ed224a604d08348e1557f 100644 (file)
@@ -89,6 +89,8 @@ const SilcCommandStatusMessage silc_command_status_messages[] = {
   command_reply(cmd->client, cmd->sock->user_data, cmd->payload,       \
   FALSE, silc_command_get(cmd->payload), status)
 
+#define SAY cmd->client->internal->ops->say
+
 /* All functions that call the COMMAND_CHECK_STATUS or the
    COMMAND_CHECK_STATUS_LIST macros must have out: goto label. */
 
@@ -606,21 +608,16 @@ SILC_CLIENT_CMD_REPLY_FUNC(nick)
 
   SILC_GET16_MSB(status, silc_argument_get_arg_type(cmd->args, 1, NULL));
   if (status != SILC_STATUS_OK) {
-    cmd->client->internal->ops->say(
-                            cmd->client, 
-                            conn, SILC_CLIENT_MESSAGE_ERROR,
-                            "Cannot set nickname: %s", 
-                            silc_client_command_status_message(status));
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+       "Cannot set nickname: %s", silc_client_command_status_message(status));
     COMMAND_REPLY_ERROR;
     goto out;
   }
 
   argc = silc_argument_get_arg_num(cmd->args);
   if (argc < 2 || argc > 2) {
-    cmd->client->internal->ops->say(
-                           cmd->client, 
-                           conn, SILC_CLIENT_MESSAGE_ERROR,
-                           "Cannot set nickname: bad reply to command");
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+       "Cannot set nickname: bad reply to command");
     COMMAND_REPLY_ERROR;
     goto out;
   }
@@ -696,8 +693,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(topic)
 
   SILC_GET16_MSB(status, silc_argument_get_arg_type(cmd->args, 1, NULL));
   if (status != SILC_STATUS_OK) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
-            "%s", silc_client_command_status_message(status));
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+       "%s", silc_client_command_status_message(status));
     COMMAND_REPLY_ERROR;
     goto out;
   }
@@ -757,8 +754,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(invite)
   tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
   SILC_GET16_MSB(status, tmp);
   if (status != SILC_STATUS_OK) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
-            "%s", silc_client_command_status_message(status));
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+       "%s", silc_client_command_status_message(status));
     COMMAND_REPLY_ERROR;
     goto out;
   }
@@ -804,8 +801,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(kill)
 
   SILC_GET16_MSB(status, silc_argument_get_arg_type(cmd->args, 1, NULL));
   if (status != SILC_STATUS_OK) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
-            "%s", silc_client_command_status_message(status));
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+       "%s", silc_client_command_status_message(status));
     COMMAND_REPLY_ERROR;
     goto out;
   }
@@ -839,11 +836,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(info)
   tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
   SILC_GET16_MSB(status, tmp);
   if (status != SILC_STATUS_OK) {
-    cmd->client->internal->ops->say(
-                         cmd->client, conn, 
-                         SILC_CLIENT_MESSAGE_ERROR,
-                         "%s", 
-                         silc_client_command_status_message(status));
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR, "%s", 
+       silc_client_command_status_message(status));
     COMMAND_REPLY_ERROR;
     goto out;
   }
@@ -907,8 +901,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(ping)
 
   SILC_GET16_MSB(status, silc_argument_get_arg_type(cmd->args, 1, NULL));
   if (status != SILC_STATUS_OK) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
-            "%s", silc_client_command_status_message(status));
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+       "%s", silc_client_command_status_message(status));
     COMMAND_REPLY_ERROR;
     goto out;
   }
@@ -926,10 +920,10 @@ SILC_CLIENT_CMD_REPLY_FUNC(ping)
       continue;
     if (SILC_ID_SERVER_COMPARE(conn->ping[i].dest_id, id)) {
       diff = curtime - conn->ping[i].start_time;
-      cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
-                           "Ping reply from %s: %d second%s", 
-                           conn->ping[i].dest_name, diff, 
-                           diff == 1 ? "" : "s");
+      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, 
+         "Ping reply from %s: %d second%s", 
+         conn->ping[i].dest_name, diff, 
+         diff == 1 ? "" : "s");
       
       conn->ping[i].start_time = 0;
       silc_free(conn->ping[i].dest_id);
@@ -972,16 +966,16 @@ SILC_CLIENT_CMD_REPLY_FUNC(join)
   SILC_GET16_MSB(status, silc_argument_get_arg_type(cmd->args, 1, NULL));
   if (status != SILC_STATUS_OK) {
     if (status != SILC_STATUS_ERR_USER_ON_CHANNEL)
-      cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
-                           "%s", silc_client_command_status_message(status));
+      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+         "%s", silc_client_command_status_message(status));
     COMMAND_REPLY_ERROR;
     goto out;
   }
 
   argc = silc_argument_get_arg_num(cmd->args);
   if (argc < 7 || argc > 14) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
-            "Cannot join channel: Bad reply packet");
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+       "Cannot join channel: Bad reply packet");
     COMMAND_REPLY_ERROR;
     goto out;
   }
@@ -989,8 +983,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(join)
   /* Get channel name */
   tmp = silc_argument_get_arg_type(cmd->args, 2, NULL);
   if (!tmp) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
-                         "Cannot join channel: Bad reply packet");
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+       "Cannot join channel: Bad reply packet");
     COMMAND_REPLY_ERROR;
     goto out;
   }
@@ -999,8 +993,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(join)
   /* Get Channel ID */
   tmp = silc_argument_get_arg_type(cmd->args, 3, &len);
   if (!tmp) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
-                         "Cannot join channel: Bad reply packet");
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+       "Cannot join channel: Bad reply packet");
     COMMAND_REPLY_ERROR;
     silc_free(channel_name);
     goto out;
@@ -1046,9 +1040,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(join)
   hmac = silc_argument_get_arg_type(cmd->args, 11, NULL);
   if (hmac) {
     if (!silc_hmac_alloc(hmac, NULL, &channel->hmac)) {
-      cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR, 
-                           "Cannot join channel: Unsupported HMAC `%s'",
-                           hmac);
+      SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR, 
+         "Cannot join channel: Unsupported HMAC `%s'", hmac);
       COMMAND_REPLY_ERROR;
       silc_free(channel_name);
       goto out;
@@ -1166,8 +1159,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(motd)
   tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
   SILC_GET16_MSB(status, tmp);
   if (status != SILC_STATUS_OK) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
-            "%s", silc_client_command_status_message(status));
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+       "%s", silc_client_command_status_message(status));
     COMMAND_REPLY_ERROR;
     return;
   }
@@ -1196,8 +1189,7 @@ SILC_CLIENT_CMD_REPLY_FUNC(motd)
        if (i == 2)
          line[0] = ' ';
        
-       cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO,
-                             "%s", line);
+       SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_INFO, "%s", line);
        
        if (!strlen(cp))
          break;
@@ -1228,8 +1220,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(umode)
   tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
   SILC_GET16_MSB(status, tmp);
   if (status != SILC_STATUS_OK) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
-            "%s", silc_client_command_status_message(status));
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+       "%s", silc_client_command_status_message(status));
     COMMAND_REPLY_ERROR;
     goto out;
   }
@@ -1268,8 +1260,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(cmode)
 
   SILC_GET16_MSB(status, silc_argument_get_arg_type(cmd->args, 1, NULL));
   if (status != SILC_STATUS_OK) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
-            "%s", silc_client_command_status_message(status));
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+       "%s", silc_client_command_status_message(status));
     COMMAND_REPLY_ERROR;
     goto out;
   }
@@ -1333,8 +1325,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(cumode)
   
   SILC_GET16_MSB(status, silc_argument_get_arg_type(cmd->args, 1, NULL));
   if (status != SILC_STATUS_OK) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
-            "%s", silc_client_command_status_message(status));
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+       "%s", silc_client_command_status_message(status));
     COMMAND_REPLY_ERROR;
     goto out;
   }
@@ -1422,9 +1414,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(kick)
   tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
   SILC_GET16_MSB(status, tmp);
   if (status != SILC_STATUS_OK) {
-    cmd->client->internal->ops->say(
-                     cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
-                     "%s", silc_client_command_status_message(status));
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+       "%s", silc_client_command_status_message(status));
     COMMAND_REPLY_ERROR;
     goto out;
   }
@@ -1448,9 +1439,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(silcoper)
   tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
   SILC_GET16_MSB(status, tmp);
   if (status != SILC_STATUS_OK) {
-    cmd->client->internal->ops->say(
-                      cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
-                      "%s", silc_client_command_status_message(status));
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+       "%s", silc_client_command_status_message(status));
     COMMAND_REPLY_ERROR;
     goto out;
   }
@@ -1474,10 +1464,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(oper)
   tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
   SILC_GET16_MSB(status, tmp);
   if (status != SILC_STATUS_OK) {
-    cmd->client->internal->ops->say(
-                      cmd->client, conn, 
-                      SILC_CLIENT_MESSAGE_ERROR,
-                      "%s", silc_client_command_status_message(status));
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+       "%s", silc_client_command_status_message(status));
     COMMAND_REPLY_ERROR;
     goto out;
   }
@@ -1501,9 +1489,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(connect)
   tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
   SILC_GET16_MSB(status, tmp);
   if (status != SILC_STATUS_OK) {
-    cmd->client->internal->ops->say(
-                      cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
-                      "%s", silc_client_command_status_message(status));
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+       "%s", silc_client_command_status_message(status));
     COMMAND_REPLY_ERROR;
     goto out;
   }
@@ -1531,9 +1518,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(ban)
   tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
   SILC_GET16_MSB(status, tmp);
   if (status != SILC_STATUS_OK) {
-    cmd->client->internal->ops->say(
-                      cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
-                      "%s", silc_client_command_status_message(status));
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+       "%s", silc_client_command_status_message(status));
     COMMAND_REPLY_ERROR;
     goto out;
   }
@@ -1579,9 +1565,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(close)
   tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
   SILC_GET16_MSB(status, tmp);
   if (status != SILC_STATUS_OK) {
-    cmd->client->internal->ops->say(
-                        cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
-                        "%s", silc_client_command_status_message(status));
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+       "%s", silc_client_command_status_message(status));
     COMMAND_REPLY_ERROR;
     goto out;
   }
@@ -1605,9 +1590,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(shutdown)
   tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
   SILC_GET16_MSB(status, tmp);
   if (status != SILC_STATUS_OK) {
-    cmd->client->internal->ops->say(
-                        cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
-                        "%s", silc_client_command_status_message(status));
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+       "%s", silc_client_command_status_message(status));
     COMMAND_REPLY_ERROR;
     goto out;
   }
@@ -1633,9 +1617,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(leave)
   tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
   SILC_GET16_MSB(status, tmp);
   if (status != SILC_STATUS_OK) {
-    cmd->client->internal->ops->say(
-                         cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
-                         "%s", silc_client_command_status_message(status));
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+       "%s", silc_client_command_status_message(status));
     COMMAND_REPLY_ERROR;
     goto out;
   }
@@ -1674,9 +1657,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(users)
   tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
   SILC_GET16_MSB(status, tmp);
   if (status != SILC_STATUS_OK) {
-    cmd->client->internal->ops->say(
-                         cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
-                         "%s", silc_client_command_status_message(status));
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+       "%s", silc_client_command_status_message(status));
     COMMAND_REPLY_ERROR;
     goto out;
   }
@@ -1885,8 +1867,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(getkey)
   tmp = silc_argument_get_arg_type(cmd->args, 1, NULL);
   SILC_GET16_MSB(status, tmp);
   if (status != SILC_STATUS_OK) {
-    cmd->client->internal->ops->say(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
-                         "%s", silc_client_command_status_message(status));
+    SAY(cmd->client, conn, SILC_CLIENT_MESSAGE_ERROR,
+       "%s", silc_client_command_status_message(status));
     COMMAND_REPLY_ERROR;
     goto out;
   }
index 36c51e93dd3494eebb5a453c99cbc9fcdee50583..e66f9653834e69de3e69b0099bf82d4ef81a268d 100644 (file)
@@ -358,7 +358,7 @@ bool silc_auth_verify(SilcAuthPayload payload, SilcAuthMethod auth_method,
   case SILC_AUTH_PASSWORD:
     /* Passphrase based authentication. The `pkcs', `hash', `id' and `type'
        arguments are not needed. */
-    if (!memcmp(payload->auth_data, auth_data, payload->auth_len)) {
+    if (!memcmp(payload->auth_data, auth_data, auth_data_len)) {
       SILC_LOG_DEBUG(("Authentication successful"));
       return TRUE;
     }
index 044c19652ae5fcada8f05884b2386b096101245c..6d6c0747d63d8a8c8623c4cfa06ac1d0fe817a4d 100644 (file)
@@ -462,7 +462,7 @@ static int silc_packet_check_mac(SilcHmac hmac, SilcBuffer buffer,
     silc_hmac_final(hmac, mac, &mac_len);
 
     /* Compare the HMAC's (buffer->tail has the packet's HMAC) */
-    if (memcmp(mac, buffer->tail, mac_len)) {
+    if (memcmp(buffer->tail, mac, mac_len)) {
       SILC_LOG_ERROR(("MAC failed"));
       return FALSE;
     }