openbsd-ports/net/silc-client/patches/patch-lib_silcclient_command_reply_c
brad 83f9d7cc09 rev 1.115.2.19
Handle command reply correctly for LIST.

rev 1.115.2.18

Check for valid entry creations.

From silc CVS via Zoran Ivanic <zoc at 5mm dot org>
2005-07-28 20:56:45 +00:00

70 lines
2.3 KiB
Plaintext

$OpenBSD: patch-lib_silcclient_command_reply_c,v 1.1 2005/07/28 20:56:45 brad Exp $
--- lib/silcclient/command_reply.c.orig Thu Mar 31 01:07:10 2005
+++ lib/silcclient/command_reply.c Thu Jul 28 15:20:27 2005
@@ -230,6 +230,11 @@ silc_client_command_reply_whois_save(Sil
client_entry =
silc_client_add_client(cmd->client, conn, nickname, username, realname,
client_id, mode);
+ if (!client_entry) {
+ if (notify)
+ COMMAND_REPLY_ERROR(SILC_STATUS_ERR_NOT_ENOUGH_PARAMS);
+ return;
+ }
} else {
silc_client_update_client(cmd->client, conn, client_entry,
nickname, username, realname, mode);
@@ -413,6 +418,11 @@ silc_client_command_reply_identify_save(
client_entry =
silc_client_add_client(cmd->client, conn, name, info, NULL,
silc_id_dup(client_id, id_type), 0);
+ if (!client_entry) {
+ if (notify)
+ COMMAND_REPLY_ERROR(SILC_STATUS_ERR_NOT_ENOUGH_PARAMS);
+ return;
+ }
} else {
silc_client_update_client(cmd->client, conn, client_entry,
name, info, NULL, 0);
@@ -466,6 +476,11 @@ silc_client_command_reply_identify_save(
/* Add new channel entry */
channel_entry = silc_client_add_channel(client, conn, name, 0,
channel_id);
+ if (!channel_entry) {
+ if (notify)
+ COMMAND_REPLY_ERROR(SILC_STATUS_ERR_NOT_ENOUGH_PARAMS);
+ return;
+ }
channel_id = NULL;
}
@@ -619,7 +634,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(list)
tmp = silc_argument_get_arg_type(cmd->args, 2, &len);
if (!tmp) {
- COMMAND_REPLY_ERROR(SILC_STATUS_ERR_NOT_ENOUGH_PARAMS);
+ /* There were no channels in the network. */
+ COMMAND_REPLY((SILC_ARGS, NULL, NULL, 0));
goto out;
}
@@ -1049,6 +1065,10 @@ SILC_CLIENT_CMD_REPLY_FUNC(join)
channel = silc_client_add_channel(cmd->client, conn, channel_name,
mode, channel_id);
}
+ if (!channel) {
+ COMMAND_REPLY_ERROR(SILC_STATUS_ERR_BAD_CHANNEL);
+ goto out;
+ }
conn->current_channel = channel;
channel->mode = mode;
@@ -1112,6 +1132,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(join)
client_entry =
silc_client_add_client(cmd->client, conn, NULL, NULL, NULL,
silc_id_dup(client_id, SILC_ID_CLIENT), 0);
+ if (!client_entry)
+ goto out;
}
/* Join client to the channel */