From: Pekka Riikonen Date: Thu, 14 Apr 2005 17:57:52 +0000 (+0000) Subject: Handle command reply correctly for LIST. X-Git-Tag: silc.toolkit.0.9.14~18 X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=commitdiff_plain;h=5ffb0c45be403fdae7dbd99a94b0bce76356746e Handle command reply correctly for LIST. --- diff --git a/CHANGES b/CHANGES index 0ed4ca68..0d8dddb2 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,14 @@ +Thu Apr 14 20:25:08 EEST 2005 Pekka Riikonen + + * Handle empty LIST command reply correcttly in server. Affected + file silcd/command_reply.c. + + * Handle empty LIST command reply correctly in client library. + The application will now receive one LIST command reply with + all arguments set to NULL if there are no channels. Updated + Client Library documentation accordingly. Affected file + lib/silcclient/command_reply.c. + Tue Apr 12 00:02:09 EEST 2005 Pekka Riikonen * Added channel name string stringprep profile to the protocol diff --git a/apps/silcd/command_reply.c b/apps/silcd/command_reply.c index d1200015..b4862c61 100644 --- a/apps/silcd/command_reply.c +++ b/apps/silcd/command_reply.c @@ -1502,6 +1502,8 @@ SILC_SERVER_CMD_REPLY_FUNC(list) COMMAND_CHECK_STATUS; tmp = silc_argument_get_arg_type(cmd->args, 2, &len); + if (!tmp) + goto out; channel_id = silc_id_payload_parse_id(tmp, len, NULL); if (!channel_id) goto out; diff --git a/lib/doc/command_reply_args.html b/lib/doc/command_reply_args.html index 5d2843f4..a38209e9 100644 --- a/lib/doc/command_reply_args.html +++ b/lib/doc/command_reply_args.html @@ -153,7 +153,11 @@ const SilcClientID *old_client_id Returns the list of channel in the SILC network. Each call of command reply returns one channel. This means that the command reply is called multiple -times to return list of channels. The 'channel_topic' may be NULL. +times to return list of channels. The 'channel', 'channel_name' and +'channel_topic' may be NULL. However, the 'channel' and 'channel_name' +are NULL only if there are no channels in the network. In this case +this reply is called once with all arguments set to NULL. Application +must be able to handle this situation correctly. SilcChannelEntry channel, char *channel_name, char *channel_topic, SilcUInt32 user_count diff --git a/lib/silcclient/command_reply.c b/lib/silcclient/command_reply.c index abc51d1d..3c041113 100644 --- a/lib/silcclient/command_reply.c +++ b/lib/silcclient/command_reply.c @@ -634,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; }