+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 '@'
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
&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. */
}
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;
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;
}
/* 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));
*/
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;
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,
#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. */
}
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;
}
}
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;
}
/* 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;
}
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;
}
}
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;
}
}
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;
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
}
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;
}
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;
}
}
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;
}
}
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;
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
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;
}
}
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;
}
}
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;
}
/* 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;
}
}
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;
}
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;
}
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. */
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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);
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;
}
/* 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;
}
/* 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;
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;
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;
}
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;
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}