From: Patrik Weiskircher Date: Fri, 19 Dec 2003 23:52:14 +0000 (+0000) Subject: fixed a bug in the whois using attributes function where no X-Git-Tag: silc.server.0.9.16~15 X-Git-Url: http://git.silcnet.org/gitweb/?a=commitdiff_plain;h=aa92c979194e9c71e6401fe9829dce3498e0506d;p=silc.git fixed a bug in the whois using attributes function where no error was sent if no nickname and client id but the attributes were given to whois. --- diff --git a/CHANGES b/CHANGES index 869c670d..400e07af 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,9 @@ +Sat Dec 20 00:44:47 CET 2003 Patrik Weiskircher + + * fixed a bug in the whois using attributes function where no + error was sent if no nickname and client id but the attributes were + given to whois. Affected file silcd/server_query.c + Tue Dec 16 21:34:59 CET 2003 Patrik Weiskircher * remove public key from public key hashtable on detach. Affected diff --git a/apps/silcd/server_query.c b/apps/silcd/server_query.c index c8d768af..ccc39324 100644 --- a/apps/silcd/server_query.c +++ b/apps/silcd/server_query.c @@ -572,6 +572,7 @@ void silc_server_query_parse(SilcServer server, SilcServerQuery query) typedef struct { SilcClientEntry **clients; SilcUInt32 *clients_count; + bool found; } *SilcServerPublicKeyUser, SilcServerPublicKeyUserStruct; void silc_server_public_key_hash_foreach(void *key, void *context, @@ -584,6 +585,8 @@ void silc_server_public_key_hash_foreach(void *key, void *context, if (!context) return; + uc->found = TRUE; + (*uc->clients) = silc_realloc((*uc->clients), sizeof((**uc->clients)) * ((*uc->clients_count) + 1)); @@ -620,8 +623,6 @@ void silc_server_query_check_attributes(SilcServer server, switch (attribute) { case SILC_ATTRIBUTE_USER_PUBLIC_KEY: - found = TRUE; - SILC_LOG_DEBUG(("Finding clients by public key attribute")); if (!silc_attribute_get_object(attr, &pk, sizeof(pk))) @@ -642,10 +643,14 @@ void silc_server_query_check_attributes(SilcServer server, usercontext.clients = clients; usercontext.clients_count = clients_count; + usercontext.found = FALSE; silc_hash_table_find_foreach(server->pk_hash, publickey, silc_server_public_key_hash_foreach, &usercontext); + + if (usercontext.found == TRUE) + found = TRUE; } else { for (i = 0; i < *clients_count; i++) { entry = (*clients)[i]; @@ -656,6 +661,8 @@ void silc_server_query_check_attributes(SilcServer server, if (!silc_hash_table_find_by_context(server->pk_hash, publickey, entry, NULL)) (*clients)[i] = NULL; + else + found = TRUE; } } silc_free(pk.type); @@ -668,7 +675,6 @@ void silc_server_query_check_attributes(SilcServer server, if (!found && !query->nickname && !query->ids) { silc_server_query_send_error(server, query, SILC_STATUS_ERR_NOT_ENOUGH_PARAMS, 0); - silc_server_query_free(query); } }