From 9a3e485d73ab5455dd6e2d0f76e684a70f847d8b Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Tue, 22 Jan 2002 18:31:15 +0000 Subject: [PATCH] updates. --- CHANGES | 17 +++++++++++++++++ TODO | 12 ++---------- apps/irssi/src/silc/core/client_ops.c | 3 ++- apps/silcd/command.c | 4 ++-- lib/silcclient/client.c | 2 ++ lib/silcclient/client_keyagr.c | 13 +++++++------ lib/silcclient/command.c | 5 ----- lib/silcclient/idlist.c | 16 ++++++++++++++-- 8 files changed, 46 insertions(+), 26 deletions(-) diff --git a/CHANGES b/CHANGES index 12f8820c..0d6761e4 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,20 @@ +Tue Jan 22 18:19:36 EET 2002 Pekka Riikonen + + * Removed assert()'s from the lib/silcclient/client_keyagr.c. + + * Fixed the NICK command to always give the unformatted + nickname to the one giving the NICK command. If unformatted + nickname is cached already it will be formatted and the + local entry will always get the unformatted nickname. + Affected file lib/silcclient/idlist.c. + + * Fixed some double frees from client library commands. + Affected file is lib/silcclient/command.c. + + * Fixed CUMODE command in server to assure that no one can + change founder's mode than the founder itself, there was a + little bug. Affected file silcd/command.c. + Mon Jan 21 19:07:53 EET 2002 Pekka Riikonen * Removed the SilcClientCommandDestructor from the client diff --git a/TODO b/TODO index 2c2aadad..5ae10ef8 100644 --- a/TODO +++ b/TODO @@ -30,18 +30,11 @@ TODO/bugs in Irssi SILC client TODO/bugs In SILC Client Library ================================ - o Remove the assert from silc_client_file_send. - o The PRIVATE_MESSAGE_KEY packet is not handled (it is implemented though). This should be added and perhaps new client operation should be added to notify application that it was received and set the key only if application wishes to set (accept the key) it. - o When changing own nickname and there exists a same nickname the library - can give the client now nickname in format nick@host. This is new - behaviour and maybe should be removed. The changer should always - get the one it wants and not have the formatted nickname. - o Additions to do after protocol version 1.1: o Fix the NICK_CHANGE notify handling not to create new entry @@ -55,9 +48,6 @@ TODO/bugs In SILC Client Library TODO/bugs In SILC Server ======================== - o removing other's modes on channel seems to be possible due to some - cumode bug. - o Add hashed passwords to silcd.conf file. o Backup router related issues @@ -277,6 +267,8 @@ least could be done. should be analyzed too how slow the task registering process actually is, and find out ways to optimize it. + o Add SilcAsyncOperation to utility library. + o Cipher optimizations (asm, that this) at least for i386 would be nice. o Add builtin SOCKS and HTTP Proxy support, well the SOCKS at least. diff --git a/apps/irssi/src/silc/core/client_ops.c b/apps/irssi/src/silc/core/client_ops.c index de650f04..448109cc 100644 --- a/apps/irssi/src/silc/core/client_ops.c +++ b/apps/irssi/src/silc/core/client_ops.c @@ -223,7 +223,8 @@ void silc_connect(SilcClient client, SilcClientConnection conn, int success) signal_emit("event connected", 1, server); } else { server->connection_lost = TRUE; - server->conn->context = NULL; + if (server->conn) + server->conn->context = NULL; server_disconnect(SERVER(server)); } } diff --git a/apps/silcd/command.c b/apps/silcd/command.c index e4ff2f4d..11e93037 100644 --- a/apps/silcd/command.c +++ b/apps/silcd/command.c @@ -4252,9 +4252,9 @@ SILC_SERVER_CMD_FUNC(cumode) /* If the target client is founder, no one else can change their mode but themselves. */ - if (chl->mode & SILC_CHANNEL_UMODE_CHANFO && chl->client != target_client) { + if (chl->mode & SILC_CHANNEL_UMODE_CHANFO && client != target_client) { silc_server_command_send_status_reply(cmd, SILC_COMMAND_CUMODE, - SILC_STATUS_ERR_NOT_YOU); + SILC_STATUS_ERR_NO_CHANNEL_PRIV); goto out; } diff --git a/lib/silcclient/client.c b/lib/silcclient/client.c index ae7f3156..b1099389 100644 --- a/lib/silcclient/client.c +++ b/lib/silcclient/client.c @@ -372,6 +372,8 @@ static void silc_client_start_key_exchange_cb(SilcSocketConnection sock, SilcProtocol protocol; SilcClientKEInternalContext *proto_ctx; + SILC_LOG_DEBUG(("Start")); + if (!conn->sock->hostname) conn->sock->hostname = strdup(conn->remote_host); if (!conn->sock->ip) diff --git a/lib/silcclient/client_keyagr.c b/lib/silcclient/client_keyagr.c index 2c5e2088..d0197898 100644 --- a/lib/silcclient/client_keyagr.c +++ b/lib/silcclient/client_keyagr.c @@ -306,9 +306,7 @@ void silc_client_send_key_agreement(SilcClient client, SilcClientKeyAgreement ke = NULL; SilcBuffer buffer; - assert(client_entry); - - if (client_entry->ke) + if (!client_entry || client_entry->ke) return; /* Create the listener if hostname and port was provided. @@ -518,7 +516,8 @@ void silc_client_perform_key_agreement(SilcClient client, SILC_LOG_DEBUG(("Start")); - assert(client_entry && hostname && port); + if (!client_entry || !hostname || !port) + return; ke = silc_calloc(1, sizeof(*ke)); ke->client = client; @@ -556,7 +555,8 @@ void silc_client_perform_key_agreement_fd(SilcClient client, SILC_LOG_DEBUG(("Start")); - assert(client_entry); + if (!client_entry) + return; ke = silc_calloc(1, sizeof(*ke)); ke->client = client; @@ -614,7 +614,8 @@ void silc_client_abort_key_agreement(SilcClient client, SilcClientConnection conn, SilcClientEntry client_entry) { - assert(client_entry); + if (!client_entry) + return; if (client_entry->ke) { SilcClientKeyAgreement ke; diff --git a/lib/silcclient/command.c b/lib/silcclient/command.c index e494c013..aebcf54e 100644 --- a/lib/silcclient/command.c +++ b/lib/silcclient/command.c @@ -600,7 +600,6 @@ SILC_CLIENT_CMD_FUNC(invite) COMMAND_ERROR; goto out; } - silc_free(nickname); /* Client entry not found, it was requested thus mark this to be pending command. */ @@ -803,8 +802,6 @@ SILC_CLIENT_CMD_FUNC(kill) goto out; } - silc_free(nickname); - /* Client entry not found, it was requested thus mark this to be pending command. */ silc_client_command_pending(conn, SILC_COMMAND_IDENTIFY, @@ -1459,8 +1456,6 @@ SILC_CLIENT_CMD_FUNC(cumode) goto out; } - silc_free(nickname); - /* Client entry not found, it was requested thus mark this to be pending command. */ silc_client_command_pending(conn, SILC_COMMAND_IDENTIFY, diff --git a/lib/silcclient/idlist.c b/lib/silcclient/idlist.c index 19c917d1..4cf7a5ee 100644 --- a/lib/silcclient/idlist.c +++ b/lib/silcclient/idlist.c @@ -915,6 +915,7 @@ void silc_client_nickname_format(SilcClient client, int i, off = 0, len; SilcClientEntry *clients; uint32 clients_count = 0; + SilcClientEntry unformatted = NULL; SILC_LOG_DEBUG(("Start")); @@ -999,10 +1000,15 @@ void silc_client_nickname_format(SilcClient client, char tmp[6]; int num, max = 1; - if (clients_count == 1) + if (clients_count == 1) { + unformatted = clients[0]; break; + } for (i = 0; i < clients_count; i++) { + if (!strncasecmp(clients[i]->nickname, client_entry->nickname, + strlen(clients[i]->nickname))) + unformatted = clients[i]; if (strncasecmp(clients[i]->nickname, newnick, off)) continue; if (strlen(clients[i]->nickname) <= off) @@ -1011,7 +1017,7 @@ void silc_client_nickname_format(SilcClient client, if (num > max) max = num; } - + memset(tmp, 0, sizeof(tmp)); snprintf(tmp, sizeof(tmp) - 1, "%d", ++max); len = strlen(tmp); @@ -1034,6 +1040,12 @@ void silc_client_nickname_format(SilcClient client, newnick = silc_realloc(newnick, sizeof(*newnick) * (off + 1)); newnick[off] = 0; + /* If we are changing nickname of our local entry we'll enforce + that we will always get the unformatted nickname. Give our + format number to the one that is not formatted now. */ + if (unformatted && client_entry == conn->local_entry) + client_entry = unformatted; + silc_free(client_entry->nickname); client_entry->nickname = newnick; silc_free(clients); -- 2.24.0