X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=apps%2Fsilcd%2Fcommand_reply.c;h=79eb2bbeabebbc518b25719608d2e336f2e17d5f;hb=579f5c6c93c452155943b6526f4c64f6deb27982;hp=53124d40e338119ee307e87448952482e8b6f2c9;hpb=0fce694339f6b8068a8bd9334140a69212989ca7;p=silc.git diff --git a/apps/silcd/command_reply.c b/apps/silcd/command_reply.c index 53124d40..79eb2bbe 100644 --- a/apps/silcd/command_reply.c +++ b/apps/silcd/command_reply.c @@ -613,6 +613,7 @@ SILC_SERVER_CMD_REPLY_FUNC(join) { SilcServerCommandReplyContext cmd = (SilcServerCommandReplyContext)context; SilcServer server = cmd->server; + SilcIDCacheEntry cache = NULL; SilcCommandStatus status; SilcChannelID *id; SilcClientID *client_id = NULL; @@ -702,7 +703,8 @@ SILC_SERVER_CMD_REPLY_FUNC(join) silc_buffer_put(client_mode_list, tmp, len); /* See whether we already have the channel. */ - entry = silc_idlist_find_channel_by_id(server->local_list, id, NULL); + entry = silc_idlist_find_channel_by_name(server->local_list, + channel_name, &cache); if (!entry) { /* Add new channel */ @@ -719,7 +721,21 @@ SILC_SERVER_CMD_REPLY_FUNC(join) goto out; } } else { - silc_free(id); + /* The entry exists. */ + if (entry->id) + silc_free(entry->id); + entry->id = id; + cache->id = entry->id; + + /* Remove the founder auth data if the mode is not set but we have + them in the entry */ + if (!(mode & SILC_CHANNEL_MODE_FOUNDER_AUTH) && entry->founder_key) { + silc_pkcs_public_key_free(entry->founder_key); + if (entry->founder_passwd) { + silc_free(entry->founder_passwd); + entry->founder_passwd = NULL; + } + } } if (entry->hmac_name && hmac) {