From cb95ad2d35f1796567fbebc9e848c10d4bd2e7b9 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Mon, 8 Jun 2009 08:58:35 +0300 Subject: [PATCH] silcd: Fixed IDENTIFY command reply handling for channels The IDENTIFY comamnd reply for channels were broken because the channel ID parsing always failed. This would cause issues like USERS command not returning the users for a channel, making the channel appear empty, in some specific cases. Fixed also the USERS command reply to not query the channel information from router more than once. --- apps/silcd/command_reply.c | 8 +++++--- apps/silcd/command_reply.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/silcd/command_reply.c b/apps/silcd/command_reply.c index 47c7a3f5..bb32bb2b 100644 --- a/apps/silcd/command_reply.c +++ b/apps/silcd/command_reply.c @@ -603,7 +603,7 @@ silc_server_command_reply_identify_save(SilcServerCommandReplyContext cmd) char *name, *info; SilcClientID client_id; SilcServerID server_id; - SilcChannelID*channel_id; + SilcChannelID channel_id; SilcClientEntry client; SilcServerEntry server_entry; SilcChannelEntry channel; @@ -652,7 +652,7 @@ silc_server_command_reply_identify_save(SilcServerCommandReplyContext cmd) to global list since server didn't have it in the lists so it must be global. */ client = silc_idlist_add_client(server->global_list, - nick[0] ? strdup(nick) : NULL, + nick[0] ? strdup(nick) : NULL, info ? strdup(info) : NULL, NULL, silc_id_dup(&client_id, SILC_ID_CLIENT), silc_packet_get_context(cmd->sock), @@ -1287,7 +1287,7 @@ SILC_SERVER_CMD_REPLY_FUNC(users) if (!channel) { SilcBuffer idp; - if (server->server_type != SILC_SERVER) + if (cmd->pending || server->server_type != SILC_SERVER) goto out; idp = silc_id_payload_encode(SILC_ID_GET_ID(id), SILC_ID_CHANNEL); @@ -1302,6 +1302,8 @@ SILC_SERVER_CMD_REPLY_FUNC(users) silc_server_command_pending(server, SILC_COMMAND_IDENTIFY, server->cmd_ident, silc_server_command_reply_users, cmd); + + cmd->pending = TRUE; return; } } diff --git a/apps/silcd/command_reply.h b/apps/silcd/command_reply.h index 2b367187..bee08124 100644 --- a/apps/silcd/command_reply.h +++ b/apps/silcd/command_reply.h @@ -49,6 +49,7 @@ typedef struct { SilcServerCommandPendingCallbacks callbacks; SilcUInt32 callbacks_count; SilcUInt16 ident; + unsigned int pending : 1; } *SilcServerCommandReplyContext; /* Macros */ -- 2.24.0