From: Pekka Riikonen Date: Sat, 7 Sep 2002 19:36:21 +0000 (+0000) Subject: When disabled channel is found on normal server in JOIN, do X-Git-Tag: silc.server.0.9.5~16 X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=commitdiff_plain;h=994158889dde7e9d13994b8648c56b829fda45bb When disabled channel is found on normal server in JOIN, do not re-create the channel to avoid duplicates. --- diff --git a/CHANGES b/CHANGES index 7f37de79..e2348abd 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,9 @@ +Sat Sep 7 22:26:50 EEST 2002 Pekka Riikonen + + * If normal server is standalone and found existing but disabled + channel, do not re-create the channel since it creates + duplicate same channels. Affected file silcd/server.c. + Sat Sep 7 16:02:09 EEST 2002 Pekka Riikonen * In JOIN notify handling, mark that the cache entry of the diff --git a/TODO b/TODO index 5e91d50e..3e8e5a89 100644 --- a/TODO +++ b/TODO @@ -1,8 +1,6 @@ TODO/bugs in Irssi SILC client ============================== - o /NAMES list is not emptied when /LEAVEin the channel. - o UTF-8 encode/decode WHOIS userinfos, topic, etc. o Add STATS. @@ -25,6 +23,10 @@ TODO/bugs In SILC Client Library TODO/bugs In SILC Server ======================== + o Backup router can accidently free its own id_entry and ID? Could happen + when some server is connecting and connecting fails (like too many + connections, etc). Some weird crashes relating to this occurred. + o Implement the and the Attribute Payload to the core library, client and server. Maybe implementations of RFC 2425 and RFC 2426 to make it complete. diff --git a/apps/silcd/command.c b/apps/silcd/command.c index 2790042e..086836c5 100644 --- a/apps/silcd/command.c +++ b/apps/silcd/command.c @@ -3583,26 +3583,27 @@ SILC_SERVER_CMD_FUNC(join) if (!channel || (channel->disabled && server->server_type != SILC_ROUTER)) { - /* Channel not found */ + /* Channel not found or not valid */ /* If we are standalone server we don't have a router, we just create - the channel by ourselves. */ + the channel by ourselves (unless it existed). */ if (server->standalone) { - channel = silc_server_create_new_channel(server, server->id, cipher, - hmac, channel_name, TRUE); if (!channel) { - silc_server_command_send_status_reply( - cmd, SILC_COMMAND_JOIN, - SILC_STATUS_ERR_UNKNOWN_ALGORITHM, - 0); - silc_free(client_id); - goto out; - } - - umode = (SILC_CHANNEL_UMODE_CHANOP | SILC_CHANNEL_UMODE_CHANFO); - created = TRUE; - create_key = FALSE; + channel = silc_server_create_new_channel(server, server->id, cipher, + hmac, channel_name, TRUE); + if (!channel) { + silc_server_command_send_status_reply( + cmd, SILC_COMMAND_JOIN, + SILC_STATUS_ERR_UNKNOWN_ALGORITHM, + 0); + silc_free(client_id); + goto out; + } + umode = (SILC_CHANNEL_UMODE_CHANOP | SILC_CHANNEL_UMODE_CHANFO); + created = TRUE; + create_key = FALSE; + } } else { /* The channel does not exist on our server. If we are normal server diff --git a/apps/silcd/server.c b/apps/silcd/server.c index 2d739f8a..f95613aa 100644 --- a/apps/silcd/server.c +++ b/apps/silcd/server.c @@ -1369,6 +1369,7 @@ SILC_TASK_CALLBACK(silc_server_connect_to_router_final) if (!sconn->backup) { /* Mark this router our primary router if we're still standalone */ if (server->standalone) { + SILC_LOG_DEBUG(("This connection is our primary router")); server->id_entry->router = id_entry; server->router = id_entry; server->standalone = FALSE; diff --git a/apps/silcd/server_util.c b/apps/silcd/server_util.c index 27077f68..59102d13 100644 --- a/apps/silcd/server_util.c +++ b/apps/silcd/server_util.c @@ -176,7 +176,7 @@ bool silc_server_remove_clients_by_server(SilcServer server, client = (SilcClientEntry)id_cache->context; /* If client is not registered, is not originated from `router' - or is not owned by `entry', skip it. */ + and is not owned by `entry', skip it. */ if (!(client->data.status & SILC_IDLIST_STATUS_REGISTERED) || client->router != router || (router != entry && !SILC_ID_COMPARE(client->id, entry->id, @@ -236,7 +236,7 @@ bool silc_server_remove_clients_by_server(SilcServer server, client = (SilcClientEntry)id_cache->context; /* If client is not registered, is not originated from `router' - or is not owned by `entry', skip it. */ + and is not owned by `entry', skip it. */ if (!(client->data.status & SILC_IDLIST_STATUS_REGISTERED) || client->router != router || (router != entry && !SILC_ID_COMPARE(client->id, entry->id,