updates.
authorPekka Riikonen <priikone@silcnet.org>
Tue, 22 Jan 2002 18:31:15 +0000 (18:31 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Tue, 22 Jan 2002 18:31:15 +0000 (18:31 +0000)
CHANGES
TODO
apps/irssi/src/silc/core/client_ops.c
apps/silcd/command.c
lib/silcclient/client.c
lib/silcclient/client_keyagr.c
lib/silcclient/command.c
lib/silcclient/idlist.c

diff --git a/CHANGES b/CHANGES
index 12f8820c3130e0e4bb0a48a533c65bd953f53551..0d6761e42cb96e5d1102170f1ce9fc7328c51771 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,20 @@
+Tue Jan 22 18:19:36 EET 2002  Pekka Riikonen <priikone@silcnet.org>
+
+       * 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 <priikone@silcnet.org>
 
        * Removed the SilcClientCommandDestructor from the client
diff --git a/TODO b/TODO
index 2c2aadadccdf44dc9c1906f4a5014c3aac919a98..5ae10ef85a4972ab30e087761425966c8b4d10e6 100644 (file)
--- 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.
index de650f0415ac772c6a82c4876beeb5f86b1e19c6..448109ccaeb35dccba9c79e9ad07199440102e61 100644 (file)
@@ -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));
   }
 }
index e4ff2f4d46d246073ed497ed2391f58e275f80db..11e930370cf9a98f9a45daf6eb015055670fa035 100644 (file)
@@ -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;
   }
 
index ae7f31566bcdf0e54fe843a7f678fdd0bb8b6949..b1099389aad451abc0a181d53476476256349c72 100644 (file)
@@ -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)
index 2c5e20880c3ef617bdbb80d858d959d42c9892cb..d0197898019cf4036021611d1d1a808a232b24ec 100644 (file)
@@ -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;
index e494c01386bebea6cbcad919f23a5b1a2f27d964..aebcf54e6effd58d839622362252e2fc4f999fe7 100644 (file)
@@ -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, 
index 19c917d13c00ee41caf84834741b589f326934cf..4cf7a5eee9089aac500092b800c52c3e64ed5fb7 100644 (file)
@@ -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);