Merged silc_1_0_branch to trunk.
[silc.git] / apps / silcd / idlist.c
index 621c4c4ffccc8600c8db86416e5c3bf5b9b7c40c..0a1561ce63dc62f5fb631d1c33d76af1bb94f876 100644 (file)
@@ -407,7 +407,6 @@ int silc_idlist_del_client(SilcIDList id_list, SilcClientEntry entry)
   SILC_LOG_DEBUG(("Start"));
 
   if (entry) {
-    /* Remove from cache. Destructor callback deletes stuff. */
     if (!silc_idcache_del_by_context(id_list->clients, entry)) {
       SILC_LOG_DEBUG(("Unknown client, did not delete"));
       return FALSE;
@@ -435,12 +434,19 @@ int silc_idlist_del_client(SilcIDList id_list, SilcClientEntry entry)
 /* ID Cache destructor */
 
 void silc_idlist_client_destructor(SilcIDCache cache,
-                                  SilcIDCacheEntry entry)
+                                  SilcIDCacheEntry entry,
+                                  void *context)
 {
+  SilcServer server = context;
   SilcClientEntry client;
 
   client = (SilcClientEntry)entry->context;
   if (client) {
+    /* Remove this client from the public key hash list */
+    if (client->data.public_key)
+      silc_hash_table_del_by_context(server->pk_hash,
+                                    client->data.public_key, client);
+
     assert(!silc_hash_table_count(client->channels));
     silc_free(client->nickname);
     silc_free(client->servername);
@@ -448,6 +454,8 @@ void silc_idlist_client_destructor(SilcIDCache cache,
     silc_free(client->userinfo);
     silc_free(client->id);
     silc_free(client->attrs);
+    if (client->data.public_key)
+      silc_pkcs_public_key_free(client->data.public_key);
     silc_hash_table_free(client->channels);
 
     memset(client, 'A', sizeof(*client));