From 8221f7af775a38780ffacfd876b68a2edda8eb97 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Mon, 17 Jun 2002 20:12:13 +0000 Subject: [PATCH] Reverted a change made to CUMODE command which broke it. Moved the server->sockets freeing to silc_server_stop. --- CHANGES | 3 +++ apps/silcd/command.c | 16 ++++++++++++++++ apps/silcd/server.c | 19 ++++++++++--------- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/CHANGES b/CHANGES index f33435d5..be9e3221 100644 --- a/CHANGES +++ b/CHANGES @@ -8,6 +8,9 @@ Mon Jun 17 21:30:55 EEST 2002 Pekka Riikonen * Fixed memory leaks from libraries and server. Affected files around the tree. + * Reverted back a fix made to CUMODE which broke it. + Affected file silcd/command.c. + Sun Jun 16 11:49:45 EEST 2002 Pekka Riikonen * Added SILC_MESSAGE_FLAG_UTF8 to the protocol specs and the diff --git a/apps/silcd/command.c b/apps/silcd/command.c index 168f7bb3..9760e1b5 100644 --- a/apps/silcd/command.c +++ b/apps/silcd/command.c @@ -4503,11 +4503,27 @@ SILC_SERVER_CMD_FUNC(cumode) if (target_mask & SILC_CHANNEL_UMODE_CHANOP) { /* Promote to operator */ if (!(chl->mode & SILC_CHANNEL_UMODE_CHANOP)) { + if (!(sender_mask & SILC_CHANNEL_UMODE_CHANOP) && + !(sender_mask & SILC_CHANNEL_UMODE_CHANFO)) { + silc_server_command_send_status_reply(cmd, SILC_COMMAND_CUMODE, + SILC_STATUS_ERR_NO_CHANNEL_PRIV, + 0); + goto out; + } + chl->mode |= SILC_CHANNEL_UMODE_CHANOP; notify = TRUE; } } else { if (chl->mode & SILC_CHANNEL_UMODE_CHANOP) { + if (!(sender_mask & SILC_CHANNEL_UMODE_CHANOP) && + !(sender_mask & SILC_CHANNEL_UMODE_CHANFO)) { + silc_server_command_send_status_reply(cmd, SILC_COMMAND_CUMODE, + SILC_STATUS_ERR_NO_CHANNEL_PRIV, + 0); + goto out; + } + /* Demote to normal user */ chl->mode &= ~SILC_CHANNEL_UMODE_CHANOP; notify = TRUE; diff --git a/apps/silcd/server.c b/apps/silcd/server.c index 10530e00..0f3e2da5 100644 --- a/apps/silcd/server.c +++ b/apps/silcd/server.c @@ -77,8 +77,6 @@ int silc_server_alloc(SilcServer *new_server) void silc_server_free(SilcServer server) { - int i; - if (!server) return; @@ -94,13 +92,6 @@ void silc_server_free(SilcServer server) } #endif - for (i = 0; i < server->config->param.connections_max; i++) { - if (!server->sockets[i]) - continue; - silc_socket_free(server->sockets[i]); - } - silc_free(server->sockets); - silc_server_config_unref(&server->config_ref); if (server->rng) silc_rng_free(server->rng); @@ -584,6 +575,16 @@ void silc_server_stop(SilcServer server) SILC_LOG_DEBUG(("Stopping server")); if (server->schedule) { + int i; + + for (i = 0; i < server->config->param.connections_max; i++) { + if (!server->sockets[i]) + continue; + silc_socket_free(server->sockets[i]); + } + silc_free(server->sockets); + server->sockets = NULL; + silc_schedule_stop(server->schedule); silc_schedule_uninit(server->schedule); server->schedule = NULL; -- 2.24.0