updates. SILC.0.2.5
authorPekka Riikonen <priikone@silcnet.org>
Sun, 20 May 2001 11:14:45 +0000 (11:14 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Sun, 20 May 2001 11:14:45 +0000 (11:14 +0000)
CHANGES
apps/silcd/command.c
apps/silcd/idlist.c
lib/silcclient/command_reply.c
lib/silcclient/idlist.c
lib/silccore/idcache.c
prepare

diff --git a/CHANGES b/CHANGES
index bc2d871e5ccb196f9184552dbbb484bf025dc38f..0af543804c7b2257b633735b3df34ca6321a67d5 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,12 @@
+Sun May 20 13:45:58 EEST 2001  Pekka Riikonen <priikone@poseidon.pspt.fi>
+
+       * silc_idcache_purge_by_context deletes the entry now by context
+         as it is supposed to do.  Affected file lib/silccore/idcache.c.
+
+       * Send the ERR_NO_SUCH_NICK in the WHOIS command reply if the
+         client is not anymore valid (WHOWAS givens the info) and not
+         the ERR_NO_SUCH_CLIENT_ID if the nickname still exists.
+
 Sat May 19 16:30:03 EEST 2001  Pekka Riikonen <priikone@poseidon.pspt.fi>
 
        * Removed the `data' and `data_len' arguments from the ID Cache
index 28cd5674cea127d04a3f0928a4149c8e1d4ada30..31283fd0f098a3e64c14749b6f3e12938d9bb05e 100644 (file)
@@ -555,11 +555,18 @@ silc_server_command_whois_send_reply(SilcServerCommandContext cmd,
 
     if (entry->data.registered == FALSE) {
       if (clients_count == 1) {
-       SilcBuffer idp = silc_id_payload_encode(entry->id, SILC_ID_CLIENT);
-       silc_server_command_send_status_data(cmd, SILC_COMMAND_WHOIS,
-                                            SILC_STATUS_ERR_NO_SUCH_CLIENT_ID,
-                                            2, idp->data, idp->len);
-       silc_buffer_free(idp);
+       if (entry->nickname) {
+         silc_server_command_send_status_data(cmd, SILC_COMMAND_WHOIS,
+                                              SILC_STATUS_ERR_NO_SUCH_NICK,
+                                              3, entry->nickname, 
+                                              strlen(entry->nickname));
+       } else {
+         SilcBuffer idp = silc_id_payload_encode(entry->id, SILC_ID_CLIENT);
+         silc_server_command_send_status_data(cmd, SILC_COMMAND_WHOIS,
+                                    SILC_STATUS_ERR_NO_SUCH_CLIENT_ID,
+                                              2, idp->data, idp->len);
+         silc_buffer_free(idp);
+       }
       }
       continue;
     }
index 8da1366274fc7cfd2f0841a95c8945de835615c8..a647c949d5dd8beb5f4bf1fe2d42577ec73e5b29 100644 (file)
@@ -383,6 +383,8 @@ int silc_idlist_get_clients_by_nickname(SilcIDList id_list, char *nickname,
   
   *clients_count += i;
 
+  SILC_LOG_DEBUG(("Found %d clients", *clients_count));
+
   return TRUE;
 }
 
@@ -404,6 +406,10 @@ int silc_idlist_get_clients_by_hash(SilcIDList id_list, char *nickname,
 
   silc_hash_make(md5hash, nickname, strlen(nickname), hash);
 
+  /* As the Client ID is hashed in the ID cache by hashing only the hash
+     from the Client ID, we can do a lookup with only the hash not the
+     other parts of the ID and get all the clients with that hash, ie.
+     with that nickname, as the hash is from the nickname. */
   memset(&client_id, 0, sizeof(client_id));
   memcpy(&client_id.hash, hash, sizeof(client_id.hash));
   if (!silc_idcache_find_by_id(id_list->clients, &client_id, &list))
@@ -424,6 +430,8 @@ int silc_idlist_get_clients_by_hash(SilcIDList id_list, char *nickname,
   
   *clients_count += i;
 
+  SILC_LOG_DEBUG(("Found %d clients", *clients_count));
+
   return TRUE;
 }
 
index 629acd05dd31be2a0e32eb96e877e5f9b5d16926..03f13c9879b805b47f68f049871a859d689f6d58 100644 (file)
@@ -1043,7 +1043,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(join)
     SILC_GET32_MSB(mode, client_mode_list->data);
 
     /* Check if we have this client cached already. */
-    if (!silc_idcache_find_by_id_one_ext(conn->client_cache, (void *)client_id, 
+    if (!silc_idcache_find_by_id_one_ext(conn->client_cache, 
+                                        (void *)client_id, 
                                         NULL, NULL, 
                                         silc_hash_client_id_compare, NULL,
                                         &id_cache)) {
@@ -1638,7 +1639,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(users)
     SILC_GET32_MSB(mode, client_mode_list->data);
 
     /* Check if we have this client cached already. */
-    if (!silc_idcache_find_by_id_one_ext(conn->client_cache, (void *)client_id, 
+    if (!silc_idcache_find_by_id_one_ext(conn->client_cache, 
+                                        (void *)client_id, 
                                         NULL, NULL, 
                                         silc_hash_client_id_compare, NULL,
                                         &id_cache)) {
@@ -1773,7 +1775,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(getkey)
   if (id_type == SILC_ID_CLIENT) {
     client_id = silc_id_payload_get_id(idp);
 
-    if (!silc_idcache_find_by_id_one_ext(conn->client_cache, (void *)client_id, 
+    if (!silc_idcache_find_by_id_one_ext(conn->client_cache, 
+                                        (void *)client_id, 
                                         NULL, NULL, 
                                         silc_hash_client_id_compare, NULL,
                                         &id_cache))
index 487b739c55b5e426bff79d328cb6aa3da5611b0e..e03b89df7015313146b9cbe43fbd2b7667067e4d 100644 (file)
@@ -124,8 +124,7 @@ SilcClientEntry *silc_client_get_clients_local(SilcClient client,
   int i = 0;
 
   /* Find ID from cache */
-  if (!silc_idcache_find_by_name(conn->client_cache, nickname, 
-                                &list))
+  if (!silc_idcache_find_by_name(conn->client_cache, nickname, &list))
     return NULL;
 
   if (!silc_idcache_list_count(list)) {
@@ -357,8 +356,7 @@ SilcClientEntry silc_idlist_get_client(SilcClient client,
   SilcClientEntry entry = NULL;
 
   /* Find ID from cache */
-  if (!silc_idcache_find_by_name(conn->client_cache, nickname, 
-                                &list)) {
+  if (!silc_idcache_find_by_name(conn->client_cache, nickname, &list)) {
   identify:
 
     if (query) {
index ee557dce87a8c5be33a9c3838d008b3294553735..7b8b1fa7b4d529778784c36abbf747b6dc1e322b 100644 (file)
@@ -304,6 +304,7 @@ bool silc_idcache_purge(SilcIDCache cache)
 bool silc_idcache_purge_by_context(SilcIDCache cache, void *context)
 {
   SilcIDCacheEntry entry;
+  bool ret = FALSE;
 
   if (!silc_hash_table_find(cache->context_table, context, NULL, 
                            (void *)&entry))
@@ -313,7 +314,15 @@ bool silc_idcache_purge_by_context(SilcIDCache cache, void *context)
   if (cache->destructor)
     cache->destructor(cache, entry);
   
-  return silc_idcache_del(cache, entry);
+  if (entry->name)
+    ret = silc_hash_table_del_by_context(cache->name_table, entry->name, 
+                                        entry);
+  if (entry->context)
+    ret = silc_hash_table_del(cache->context_table, entry->context);
+  if (entry->id)
+    ret = silc_hash_table_del_by_context(cache->id_table, entry->id, entry);
+
+  return ret;
 }
 
 /* Callback that is called by the hash table routine when traversing
diff --git a/prepare b/prepare
index 275bed67b3dfd522e46f5762a3fe0f8b1902aa13..c3405b91d08b9c504071114dce68f0f033e70b82 100755 (executable)
--- a/prepare
+++ b/prepare
@@ -25,7 +25,7 @@
 # temporary files (including these prepare* scripts) are removed.
 #
 
-SILC_VERSION=0.2.4
+SILC_VERSION=0.2.5
 
 version=$1
 if test "$version" = ""; then