updates. silc.client.0.7.2
authorPekka Riikonen <priikone@silcnet.org>
Sat, 5 Jan 2002 12:38:42 +0000 (12:38 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Sat, 5 Jan 2002 12:38:42 +0000 (12:38 +0000)
19 files changed:
CHANGES
Makefile.am.pre
TODO
apps/irssi/src/silc/core/silc-core.c
apps/silcd/command.c
apps/silcd/packet_receive.c
apps/silcd/server_util.c
apps/silcd/server_util.h
configure.in.pre
lib/silcclient/README
lib/silcclient/client.c
lib/silcclient/client.h
lib/silcclient/client_notify.c
lib/silcclient/command.c
lib/silcclient/command_reply.c
lib/silcclient/idlist.c
lib/silcsim/Makefile.am
lib/silcutil/silcutil.c
lib/silcutil/silcutil.h

diff --git a/CHANGES b/CHANGES
index ee6beaa626d0d6cae362fa4c9fc24dc5978883c3..a29581d80abc34326c92db5b0afbcfade0c71596 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,38 @@
+Sat Jan  5 13:37:29 EET 2002  Pekka Riikonen <priikone@silcnet.org>
+
+       * Added the silc_client_del_client to remove the client from
+         all channels as well.  Affected file lib/silcclient/idlist.c.
+
+       * Fixed the client library to correctly remove the client
+         from all channels when the client entry is being destroyed.
+         Affected file lib/silcclient/client_notify.c, command.c.
+
+       * Added auto-nicking support to the client library.  If the
+         applicatio now sets client->nickname it will be sent to the
+         server after connecting by the library.  This way for example
+         SILCNICK (or IRCNICK) environment variables will have effect
+         and always change the nickname automatically to whatever
+         it is wanted.  Affected file lib/silcclient/client.[ch].
+
+       * Renamed silc_server_command_bad_chars to the
+         silc_server_name_bad_chars and moved it to the
+         silcd/server_util.[ch].  Added also new function
+         silc_server_name_modify_bad to return nickname that
+         includes bad characters as new nickname without those
+         bad characters.  This check and modify is now used in
+         silc_server_new_client when the username is initially set
+         as nickname, so it must be checked to be valid nickname.
+         Affected file silcd/packet_receive.c.
+
+       * The nickname length is now taken from the packet for real
+         and not trusted to strlen() since it clearly can return
+         wrong length for nickname including bad characters.  This
+         also applies to channel names.  Affected file silcd/command.c.
+
+       * Removed the lib/silcsilm/modules directory.  Modules are now
+         compiled into the lib/silcsim.  Fixed the copying of the
+         modules to follow symbolic links in Makefile.am.pre.
+
 Wed Jan  2 18:56:21 EET 2002  Pekka Riikonen <priikone@silcnet.org>
 
        * Fixed silc_string_regexify list creation.  Fixes bugs with
 Wed Jan  2 18:56:21 EET 2002  Pekka Riikonen <priikone@silcnet.org>
 
        * Fixed silc_string_regexify list creation.  Fixes bugs with
index 510b418adb5806facc45c6f638bebfa086d27cb1..dc200b2e650750015da41adc183dd0b898c3ff7e 100644 (file)
@@ -55,7 +55,7 @@ generate-server-key:
        fi
 
 sim-install:
        fi
 
 sim-install:
-       -cp -fR $(srcdir)/lib/silcsim/modules/*.so $(modulesdir)/
+       -cp -fRL $(srcdir)/lib/silcsim/*.so $(modulesdir)/
 
 doc-install:
        $(INSTALL_DATA) $(srcdir)/doc/CodingStyle $(docdir)/
 
 doc-install:
        $(INSTALL_DATA) $(srcdir)/doc/CodingStyle $(docdir)/
diff --git a/TODO b/TODO
index a159efef4edf7a53f70448d1084a2008e0ad5c1d..6f8aa18b77122547cde72e38a6b8bd59ff9afce9 100644 (file)
--- a/TODO
+++ b/TODO
@@ -17,10 +17,6 @@ TODO/bugs in Irssi SILC client
    cipher, hash, hmac and pkcs configuration to the Irssi SILC's config
    file.
 
    cipher, hash, hmac and pkcs configuration to the Irssi SILC's config
    file.
 
- o Add auto-nick support to Irssi, so that the user specified nickname
-   would be sent to the server immediately (automatically) after the
-   client is connected to the server.
-
  o Add PERL scripting support from Irssi CVS.
 
  o Extend the /HELP command to support sub commands or something.  So
  o Add PERL scripting support from Irssi CVS.
 
  o Extend the /HELP command to support sub commands or something.  So
@@ -51,11 +47,6 @@ TODO/bugs In SILC Client Library
    not needed and its usage is buggy when the context is registered
    to multiple pending commands.
 
    not needed and its usage is buggy when the context is registered
    to multiple pending commands.
 
- o Add perhaps an option of setting the nickname to the client context.
-   If set (and username != nickname) the client libary would send NICK
-   command to the server after connecting to automatically set the
-   nickname.
-
  o Additions to do after protocol version 1.1:
 
        o Fix the NICK_CHANGE notify handling not to create new entry
  o Additions to do after protocol version 1.1:
 
        o Fix the NICK_CHANGE notify handling not to create new entry
@@ -70,6 +61,7 @@ TODO/bugs In SILC Server
 ========================
 
  o strerror messages from premature EOF's to signoff messages.
 ========================
 
  o strerror messages from premature EOF's to signoff messages.
+   (add perhaps a socket error thingy to SilcSockeConnection).
 
  o Backup router related issues
 
 
  o Backup router related issues
 
index f5ea52a34107de8b04d65317fc37919442084ea1..1bc44d9855279d2b303567493e384d15b32cb09b 100644 (file)
@@ -122,13 +122,11 @@ static void silc_init_userinfo(void)
   }
 
   /* nick */
   }
 
   /* nick */
-  /* Actually take SILCUSER or IRCUSER since nickname cannot be set
-     beforehand in SILC (XXX auto-nicking support should be added to Irssi). */
   nick = settings_get_str("nick");
   if (nick == NULL || *nick == '\0') {
   nick = settings_get_str("nick");
   if (nick == NULL || *nick == '\0') {
-    str = g_getenv("SILCUSER");
+    str = g_getenv("SILCNICK");
     if (!str)
     if (!str)
-      str = g_getenv("IRCUSER");
+      str = g_getenv("IRCNICK");
     settings_set_str("nick", str != NULL ? str : user_name);
     
     nick = settings_get_str("nick");
     settings_set_str("nick", str != NULL ? str : user_name);
     
     nick = settings_get_str("nick");
@@ -312,6 +310,7 @@ void silc_core_init_finish(void)
 
   /* Get user information */
   silc_client->username = g_strdup(settings_get_str("user_name"));
 
   /* Get user information */
   silc_client->username = g_strdup(settings_get_str("user_name"));
+  silc_client->nickname = g_strdup(settings_get_str("nick"));
   silc_client->hostname = silc_net_localhost();
   silc_client->realname = g_strdup(settings_get_str("real_name"));
 
   silc_client->hostname = silc_net_localhost();
   silc_client->realname = g_strdup(settings_get_str("real_name"));
 
index e83ef754ccd1655f2302e6f8fc571d9ce1be12fa..cb487e23880534f81c4212f61c830107fb8efe8c 100644 (file)
@@ -1951,25 +1951,6 @@ SILC_SERVER_CMD_FUNC(identify)
   silc_server_command_free(cmd);
 }
 
   silc_server_command_free(cmd);
 }
 
-/* Checks string for bad characters and returns TRUE if they are found. */
-
-static int silc_server_command_bad_chars(char *nick)
-{
-  int i;
-
-  for (i = 0; i < strlen(nick); i++) {
-    if (!isascii(nick[i]))
-      return TRUE;
-    if (nick[i] <= 32) return TRUE;
-    if (nick[i] == ' ') return TRUE;
-    if (nick[i] == '*') return TRUE;
-    if (nick[i] == '?') return TRUE;
-    if (nick[i] == ',') return TRUE;
-  }
-
-  return FALSE;
-}
-
 /* Server side of command NICK. Sets nickname for user. Setting
    nickname causes generation of a new client ID for the client. The
    new client ID is sent to the client after changing the nickname. */
 /* Server side of command NICK. Sets nickname for user. Setting
    nickname causes generation of a new client ID for the client. The
    new client ID is sent to the client after changing the nickname. */
@@ -1981,6 +1962,7 @@ SILC_SERVER_CMD_FUNC(nick)
   SilcServer server = cmd->server;
   SilcBuffer packet, nidp, oidp = NULL;
   SilcClientID *new_id;
   SilcServer server = cmd->server;
   SilcBuffer packet, nidp, oidp = NULL;
   SilcClientID *new_id;
+  uint32 nick_len;
   char *nick;
   uint16 ident = silc_command_get_ident(cmd->payload);
   int nickfail = 0;
   char *nick;
   uint16 ident = silc_command_get_ident(cmd->payload);
   int nickfail = 0;
@@ -1991,16 +1973,15 @@ SILC_SERVER_CMD_FUNC(nick)
   SILC_SERVER_COMMAND_CHECK(SILC_COMMAND_NICK, cmd, 1, 1);
 
   /* Check nickname */
   SILC_SERVER_COMMAND_CHECK(SILC_COMMAND_NICK, cmd, 1, 1);
 
   /* Check nickname */
-  nick = silc_argument_get_arg_type(cmd->args, 1, NULL);
-  if (silc_server_command_bad_chars(nick) == TRUE) {
+  nick = silc_argument_get_arg_type(cmd->args, 1, &nick_len);
+  if (nick_len > 128)
+    nick[128] = '\0';
+  if (silc_server_name_bad_chars(nick, nick_len) == TRUE) {
     silc_server_command_send_status_reply(cmd, SILC_COMMAND_NICK,
                                          SILC_STATUS_ERR_BAD_NICKNAME);
     goto out;
   }
 
     silc_server_command_send_status_reply(cmd, SILC_COMMAND_NICK,
                                          SILC_STATUS_ERR_BAD_NICKNAME);
     goto out;
   }
 
-  if (strlen(nick) > 128)
-    nick[128] = '\0';
-
   /* Check for same nickname */
   if (!strcmp(client->nickname, nick)) {
     nidp = silc_id_payload_encode(client->id, SILC_ID_CLIENT);
   /* Check for same nickname */
   if (!strcmp(client->nickname, nick)) {
     nidp = silc_id_payload_encode(client->id, SILC_ID_CLIENT);
@@ -3297,10 +3278,10 @@ SILC_SERVER_CMD_FUNC(join)
   }
   channel_name = tmp;
 
   }
   channel_name = tmp;
 
-  if (strlen(channel_name) > 256)
+  if (tmp_len > 256)
     channel_name[255] = '\0';
 
     channel_name[255] = '\0';
 
-  if (silc_server_command_bad_chars(channel_name) == TRUE) {
+  if (silc_server_name_bad_chars(channel_name, tmp_len) == TRUE) {
     silc_server_command_send_status_reply(cmd, SILC_COMMAND_JOIN,
                                          SILC_STATUS_ERR_BAD_CHANNEL);
     goto out;
     silc_server_command_send_status_reply(cmd, SILC_COMMAND_JOIN,
                                          SILC_STATUS_ERR_BAD_CHANNEL);
     goto out;
index 9dcc3fa7848f5aa81481cf1d9dc802994bbcefd9..ae4f909c497911972d9a5f58d1315ddf5cb550ff 100644 (file)
@@ -1472,6 +1472,7 @@ SilcClientEntry silc_server_new_client(SilcServer server,
   SilcBuffer reply;
   SilcIDListData idata;
   char *username = NULL, *realname = NULL, *id_string;
   SilcBuffer reply;
   SilcIDListData idata;
   char *username = NULL, *realname = NULL, *id_string;
+  uint16 username_len;
   uint32 id_len;
   int ret;
   char *hostname, *nickname;
   uint32 id_len;
   int ret;
   char *hostname, *nickname;
@@ -1496,14 +1497,13 @@ SilcClientEntry silc_server_new_client(SilcServer server,
 
   /* Parse incoming packet */
   ret = silc_buffer_unformat(buffer,
 
   /* Parse incoming packet */
   ret = silc_buffer_unformat(buffer,
-                            SILC_STR_UI16_STRING_ALLOC(&username),
+                            SILC_STR_UI16_NSTRING_ALLOC(&username, 
+                                                        &username_len),
                             SILC_STR_UI16_STRING_ALLOC(&realname),
                             SILC_STR_END);
   if (ret == -1) {
                             SILC_STR_UI16_STRING_ALLOC(&realname),
                             SILC_STR_END);
   if (ret == -1) {
-    if (username)
-      silc_free(username);
-    if (realname)
-      silc_free(realname);
+    silc_free(username);
+    silc_free(realname);
     silc_server_disconnect_remote(server, sock, "Server closed connection: "
                                   "Incomplete client information");
     return NULL;
     silc_server_disconnect_remote(server, sock, "Server closed connection: "
                                   "Incomplete client information");
     return NULL;
@@ -1511,17 +1511,22 @@ SilcClientEntry silc_server_new_client(SilcServer server,
 
   if (!username) {
     silc_free(username);
 
   if (!username) {
     silc_free(username);
-    if (realname)
-      silc_free(realname);
+    silc_free(realname);
     silc_server_disconnect_remote(server, sock, "Server closed connection: "
                                   "Incomplete client information");
     return NULL;
   }
 
     silc_server_disconnect_remote(server, sock, "Server closed connection: "
                                   "Incomplete client information");
     return NULL;
   }
 
-  if (strlen(username) > 128)
-    username[127] = '\0';
+  if (username_len > 128)
+    username[128] = '\0';
 
 
-  nickname = strdup(username);
+  /* Check for bad characters for nickname, and modify the nickname if
+     it includes those. */
+  if (silc_server_name_bad_chars(username, username_len)) {
+    nickname = silc_server_name_modify_bad(username, username_len);
+  } else {
+    nickname = strdup(username);
+  }
 
   /* Make sanity checks for the hostname of the client. If the hostname
      is provided in the `username' check that it is the same than the
 
   /* Make sanity checks for the hostname of the client. If the hostname
      is provided in the `username' check that it is the same than the
@@ -1540,8 +1545,7 @@ SilcClientEntry silc_server_new_client(SilcServer server,
        strcmp(sock->hostname, hostname)) {
       silc_free(username);
       silc_free(hostname);
        strcmp(sock->hostname, hostname)) {
       silc_free(username);
       silc_free(hostname);
-      if (realname)
-       silc_free(realname);
+      silc_free(realname);
       silc_server_disconnect_remote(server, sock, 
                                    "Server closed connection: "
                                    "Incomplete client information");
       silc_server_disconnect_remote(server, sock, 
                                    "Server closed connection: "
                                    "Incomplete client information");
@@ -1558,18 +1562,15 @@ SilcClientEntry silc_server_new_client(SilcServer server,
        phostname && strcmp(phostname, hostname)) {
       silc_free(username);
       silc_free(hostname);
        phostname && strcmp(phostname, hostname)) {
       silc_free(username);
       silc_free(hostname);
-      if (phostname)
-       silc_free(phostname);
-      if (realname)
-       silc_free(realname);
+      silc_free(phostname);
+      silc_free(realname);
       silc_server_disconnect_remote(server, sock, 
                                    "Server closed connection: "
                                    "Incomplete client information");
       return NULL;
     }
     
       silc_server_disconnect_remote(server, sock, 
                                    "Server closed connection: "
                                    "Incomplete client information");
       return NULL;
     }
     
-    if (phostname)
-      silc_free(phostname);
+    silc_free(phostname);
   } else {
     /* The hostname is not present, add it. */
     char *newusername;
   } else {
     /* The hostname is not present, add it. */
     char *newusername;
index 1f21972ee1af751f96665a0a4e0fe000f1771a9c..f090ff1d43bd5a5099d9fd2250089cb84626da51 100644 (file)
@@ -723,3 +723,42 @@ bool silc_server_client_on_channel(SilcClientEntry client,
 
   return FALSE;
 }
 
   return FALSE;
 }
+
+/* Checks string for bad characters and returns TRUE if they are found. */
+
+bool silc_server_name_bad_chars(const char *name, uint32 name_len)
+{
+  int i;
+
+  for (i = 0; i < name_len; i++) {
+    if (!isascii(name[i]))
+      return TRUE;
+    if (name[i] <= 32) return TRUE;
+    if (name[i] == ' ') return TRUE;
+    if (name[i] == '*') return TRUE;
+    if (name[i] == '?') return TRUE;
+    if (name[i] == ',') return TRUE;
+  }
+
+  return FALSE;
+}
+
+/* Modifies the `name' if it includes bad characters and returns new
+   allocated name that does not include bad characters. */
+
+char *silc_server_name_modify_bad(const char *name, uint32 name_len)
+{
+  int i;
+  char *newname = strdup(name);
+
+  for (i = 0; i < name_len; i++) {
+    if (!isascii(newname[i])) newname[i] = '_';
+    if (newname[i] <= 32) newname[i] = '_';
+    if (newname[i] == ' ') newname[i] = '_';
+    if (newname[i] == '*') newname[i] = '_';
+    if (newname[i] == '?') newname[i] = '_';
+    if (newname[i] == ',') newname[i] = '_';
+  }
+
+  return newname;
+}
index 8ac40c4522e1ee3ffc7ce3d13a67cdb24270f04a..9cfe16070e7e753f96cb0779cb5151ae4dfb41ac 100644 (file)
@@ -74,4 +74,11 @@ bool silc_server_channel_has_local(SilcChannelEntry channel);
 bool silc_server_client_on_channel(SilcClientEntry client,
                                   SilcChannelEntry channel);
 
 bool silc_server_client_on_channel(SilcClientEntry client,
                                   SilcChannelEntry channel);
 
+/* Checks string for bad characters and returns TRUE if they are found. */
+bool silc_server_name_bad_chars(const char *name, uint32 name_len);
+
+/* Modifies the `nick' if it includes bad characters and returns new
+   allocated nickname that does not include bad characters. */
+char *silc_server_name_modify_bad(const char *name, uint32 name_len);
+
 #endif /* SERVER_UTIL_H */
 #endif /* SERVER_UTIL_H */
index 831465cbe18e0371dd080856da943dee82e295c6..dc2d40bab503ca063aa2af659d78b32cd964a044 100644 (file)
@@ -786,7 +786,6 @@ lib/silcmath/Makefile
 lib/silcmath/mpi/Makefile.defines
 lib/silcmath/mpi/Makefile.defines_int
 lib/silcsim/Makefile
 lib/silcmath/mpi/Makefile.defines
 lib/silcmath/mpi/Makefile.defines_int
 lib/silcsim/Makefile
-lib/silcsim/modules/Makefile
 lib/silcske/Makefile
 lib/silcutil/Makefile
 lib/silcutil/unix/Makefile
 lib/silcske/Makefile
 lib/silcutil/Makefile
 lib/silcutil/unix/Makefile
index 4295f27cbc23c616d36c2e68c669088b203dcb59..c5a392e0fa80181a19dd8515b75721e4dd29fab8 100644 (file)
@@ -1,7 +1,7 @@
 
                       SILC Client Library Manual
 
 
                       SILC Client Library Manual
 
-                             Version 0.5
+                             Version 0.7
 
 1.0 Introduction
 
 
 1.0 Introduction
 
@@ -79,6 +79,11 @@ the initializing function:
        client->public_key
        client->private_key
 
        client->public_key
        client->private_key
 
+You may also set client->nickname if you want.  If it is set then the
+library will change the nickname to that one after the client is connected
+to the server.  If not set, then server will initially give the nickname
+which is same as the username.
+
 After setting the pointers one must call:
 
        silc_client_init(client);
 After setting the pointers one must call:
 
        silc_client_init(client);
index fe6705968ec2764b9120cbc992ddb9f430aacf6b..ba3c70e9b92d1c12b2d6d2f05d0d647fc7c9a7f7 100644 (file)
@@ -1,16 +1,15 @@
 /*
 
 /*
 
-  client.c
+  client.c 
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2001 Pekka Riikonen
+  Copyright (C) 1997 - 2002 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-  
+  the Free Software Foundation; version 2 of the License.
+
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@@ -385,7 +384,8 @@ bool silc_client_start_key_exchange(SilcClient client,
      Make sure they do not do that. */
   silc_schedule_task_del_by_fd(client->schedule, fd);
 
      Make sure they do not do that. */
   silc_schedule_task_del_by_fd(client->schedule, fd);
 
-  conn->nickname = strdup(client->username);
+  conn->nickname = (client->nickname ? strdup(client->nickname) :
+                   strdup(client->username));
   conn->sock->hostname = strdup(conn->remote_host);
   conn->sock->ip = strdup(conn->remote_host);
   conn->sock->port = conn->remote_port;
   conn->sock->hostname = strdup(conn->remote_host);
   conn->sock->ip = strdup(conn->remote_host);
   conn->sock->port = conn->remote_port;
@@ -1500,7 +1500,14 @@ void silc_client_receive_new_id(SilcClient client,
                   (void *)conn->local_entry, 0, NULL);
 
   if (connecting) {
                   (void *)conn->local_entry, 0, NULL);
 
   if (connecting) {
-    /* Issue INFO comqmand to fetch the real server name and server information
+    /* Send NICK command if the nickname was set by the application (and is
+       not same as the username). */
+    if (client->nickname && strcmp(client->nickname, client->username))
+      silc_client_command_send(client, conn, SILC_COMMAND_NICK, 
+                              ++conn->cmd_ident, 1, 1, 
+                              client->nickname, strlen(client->nickname));
+
+    /* Issue INFO command to fetch the real server name and server information
        and other stuff. */
     silc_client_command_register(client, SILC_COMMAND_INFO, NULL, NULL,
                                 silc_client_command_reply_info_i, 0, 
        and other stuff. */
     silc_client_command_register(client, SILC_COMMAND_INFO, NULL, NULL,
                                 silc_client_command_reply_info_i, 0, 
index 2b40557b91296c9053ec432884e15ca7e7e53cc0..63593f79e4230a940b39bdaddf11de3c6b858c81 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2001 Pekka Riikonen
+  Copyright (C) 1997 - 2002 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -152,6 +152,7 @@ struct SilcClientConnectionStruct {
 /* Main client structure. */
 struct SilcClientStruct {
   char *username;              /* Username, must be set by application */
 /* Main client structure. */
 struct SilcClientStruct {
   char *username;              /* Username, must be set by application */
+  char *nickname;              /* Nickname, may be set by application  */
   char *hostname;              /* hostname, must be set by application */
   char *realname;              /* Real name, must be set be application */
 
   char *hostname;              /* hostname, must be set by application */
   char *realname;              /* Real name, must be set be application */
 
index 8b3663b979e5492162b6513cd7e84f13d349dd37..987d5d08764c60dc88cb621168a9f6780c18745f 100644 (file)
@@ -1,16 +1,15 @@
 /*
 
 /*
 
-  client_notify.c
+  client_notify.c 
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2001 Pekka Riikonen
+  Copyright (C) 1997 - 2002 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-  
+  the Free Software Foundation; version 2 of the License.
+
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@@ -851,11 +850,9 @@ void silc_client_notify_by_server(SilcClient client,
     /* Notify application. */
     client->internal->ops->notify(client, conn, type, client_entry, tmp);
 
     /* Notify application. */
     client->internal->ops->notify(client, conn, type, client_entry, tmp);
 
-    if (client_entry != conn->local_entry) {
-      /* Remove client from all channels */
-      silc_client_remove_from_channels(client, conn, client_entry);
+    if (client_entry != conn->local_entry)
+      /* Remove the client from all channels and free it */
       silc_client_del_client(client, conn, client_entry);
       silc_client_del_client(client, conn, client_entry);
-    }
 
     break;
     
 
     break;
     
@@ -904,7 +901,7 @@ void silc_client_notify_by_server(SilcClient client,
        if (client_entry == conn->local_entry)
          continue;
 
        if (client_entry == conn->local_entry)
          continue;
 
-       silc_client_remove_from_channels(client, conn, client_entry);
+       /* Remove the client from all channels and free it */
        silc_client_del_client(client, conn, client_entry);
       }
       silc_free(clients);
        silc_client_del_client(client, conn, client_entry);
       }
       silc_free(clients);
index 37ea4d6fff9744b1a1482f13475d326af447e8ff..8329e8034e2b5525b7cc3740dc0027864f1ac4c8 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2001 Pekka Riikonen
+  Copyright (C) 1997 - 2002 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -746,10 +746,9 @@ SILC_TASK_CALLBACK(silc_client_command_kill_remove_later)
   /* Get the target client */
   target = silc_idlist_get_client(cmd->client, conn, nickname, 
                                  cmd->argv[1], FALSE);
   /* Get the target client */
   target = silc_idlist_get_client(cmd->client, conn, nickname, 
                                  cmd->argv[1], FALSE);
-  if (target) {
-    silc_client_remove_from_channels(client, conn, target);
+  if (target)
+    /* Remove the client from all channels and free it */
     silc_client_del_client(client, conn, target);
     silc_client_del_client(client, conn, target);
-  }
 
   silc_free(nickname);
   silc_client_command_free(cmd);
 
   silc_free(nickname);
   silc_client_command_free(cmd);
index 50601561d18ee25c508ed224a604d08348e1557f..affe3d60d538682e26a4189522c20d04a31513cd 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2001 Pekka Riikonen
+  Copyright (C) 1997 - 2002 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
index d56421c2bfabeb5865546016462cefc707b2aa51..5eb11b4b57ac29188abeb8b283e8e4706e10847c 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 2001 Pekka Riikonen
+  Copyright (C) 2001 - 2002 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -700,7 +700,13 @@ bool silc_client_del_client(SilcClient client, SilcClientConnection conn,
                            SilcClientEntry client_entry)
 {
   bool ret = silc_idcache_del_by_context(conn->client_cache, client_entry);
                            SilcClientEntry client_entry)
 {
   bool ret = silc_idcache_del_by_context(conn->client_cache, client_entry);
+
+  /* Remove from channels */
+  silc_client_remove_from_channels(client, conn, client_entry);
+
+  /* Free the client entry data */
   silc_client_del_client_entry(client, conn, client_entry);
   silc_client_del_client_entry(client, conn, client_entry);
+
   return ret;
 }
 
   return ret;
 }
 
index ac9d278d171a38c2acad0efa38a23d942c3e6098..866c941c0368efad92a604213d29ba5db15b4124 100644 (file)
@@ -28,10 +28,6 @@ libsilcsim_a_SOURCES = \
        silcsim.c \
        silcsimutil.c
 
        silcsim.c \
        silcsimutil.c
 
-SIM_MODULES_DIR = modules
-
-SUBDIRS = modules
-
 #
 # SILC Ciphers to be compiled as modules
 #
 #
 # SILC Ciphers to be compiled as modules
 #
@@ -60,14 +56,14 @@ endif
 $(SIM_CIPHER_OBJS): ../silccrypt/libsilccrypt.a
        $(LTCOMPILE) -c $(srcdir)/../silccrypt/$*.c
        $(LIBTOOL) --mode=link $(LINK) -rpath $(silc_modulesdir) -o lib$*.la $*.lo
 $(SIM_CIPHER_OBJS): ../silccrypt/libsilccrypt.a
        $(LTCOMPILE) -c $(srcdir)/../silccrypt/$*.c
        $(LIBTOOL) --mode=link $(LINK) -rpath $(silc_modulesdir) -o lib$*.la $*.lo
-       cd $(srcdir)/$(SIM_MODULES_DIR) && $(LN_S) -f $(srcdir)/../.libs/lib$*.so $(srcdir)/$*.sim.so
+       cd $(srcdir) && $(LN_S) -f $(srcdir)/../.libs/lib$*.so $(srcdir)/$*.sim.so
 
 $(SIM_HASH_OBJS): ../silccrypt/libsilccrypt.a
        $(LTCOMPILE) -c $(srcdir)/../silccrypt/$*.c
        $(LIBTOOL) --mode=link $(LINK) -rpath $(silc_modulesdir) -o lib$*.la $*.lo
 
 $(SIM_HASH_OBJS): ../silccrypt/libsilccrypt.a
        $(LTCOMPILE) -c $(srcdir)/../silccrypt/$*.c
        $(LIBTOOL) --mode=link $(LINK) -rpath $(silc_modulesdir) -o lib$*.la $*.lo
-       cd $(srcdir)/$(SIM_MODULES_DIR) && $(LN_S) -f $(srcdir)/../.libs/lib$*.so $(srcdir)/$*.sim.so
+       cd $(srcdir) && $(LN_S) -f $(srcdir)/../.libs/lib$*.so $(srcdir)/$*.sim.so
 
 
-CLEANFILES = $(SIM_MODULES_DIR)/*.sim.so *.la
+CLEANFILES = *.sim.so *.la
 
 if SILC_DIST_TOOLKIT
 include_HEADERS = silcsim.h silcsimutil.h
 
 if SILC_DIST_TOOLKIT
 include_HEADERS = silcsim.h silcsimutil.h
index 6b5a36ce3ead51f25ac5630b36c9a1f714e9aa7e..450694b0171282a0d7434112e7f88f494ae41368 100644 (file)
@@ -1,16 +1,15 @@
 /*
 
 /*
 
-  silcutil.c
+  silcutil.c 
 
 
-  Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
+  Author: Pekka Riikonen <priikone@silcnet.org>
 
 
-  Copyright (C) 1997 - 2000 Pekka Riikonen
+  Copyright (C) 1997 - 2002 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-  
+  the Free Software Foundation; version 2 of the License.
+
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
index 0307119455ad52e0a7ae678f36cca97690701fb3..a8e2addad0fc7317d53047acc3a4907e32044609 100644 (file)
@@ -1,16 +1,15 @@
 /*
 
 /*
 
-  silcutil.h
+  silcutil.h 
 
 
-  Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
+  Author: Pekka Riikonen <priikone@silcnet.org>
 
 
-  Copyright (C) 1997 - 2000 Pekka Riikonen
+  Copyright (C) 1997 - 2002 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-  
+  the Free Software Foundation; version 2 of the License.
+
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the