projects
/
silc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1bf35a2
)
If during query the original command caller quits we top the
author
Pekka Riikonen
<priikone@silcnet.org>
Thu, 7 Apr 2005 12:43:58 +0000
(12:43 +0000)
committer
Pekka Riikonen
<priikone@silcnet.org>
Thu, 7 Apr 2005 12:43:58 +0000
(12:43 +0000)
query.
CHANGES
patch
|
blob
|
history
apps/silcd/packet_receive.c
patch
|
blob
|
history
apps/silcd/server.c
patch
|
blob
|
history
apps/silcd/server_query.c
patch
|
blob
|
history
apps/silcd/server_util.c
patch
|
blob
|
history
diff --git
a/CHANGES
b/CHANGES
index 1c7562421c194fd214b69fda42028034e32939a7..9dcb5dfc362894c863bf5fe45c058099467d7694 100644
(file)
--- a/
CHANGES
+++ b/
CHANGES
@@
-1,3
+1,9
@@
+Thu Apr 7 14:50:01 EEST 2005 Pekka Riikonen <priikone@silcnet.org>
+
+ * During query, check if the original command caller goes
+ away. If it does, stop the query. Affected file
+ silcd/server_query.c.
+
Wed Apr 6 16:56:53 EEST 2005 Pekka Riikonen <priikone@silcnet.org>
* Added some better error messages. Affected file
Wed Apr 6 16:56:53 EEST 2005 Pekka Riikonen <priikone@silcnet.org>
* Added some better error messages. Affected file
diff --git
a/apps/silcd/packet_receive.c
b/apps/silcd/packet_receive.c
index 97340d5f6f762620cb4be8087abcec59d294ee90..88ed838da877cd5fff6eef89e98ef9246ac1e6af 100644
(file)
--- a/
apps/silcd/packet_receive.c
+++ b/
apps/silcd/packet_receive.c
@@
-2893,9
+2893,13
@@
static void silc_server_new_id_real(SilcServer server,
if (server->server_type == SILC_ROUTER) {
/* Add the client's public key to hash table or get the key with
GETKEY command. */
if (server->server_type == SILC_ROUTER) {
/* Add the client's public key to hash table or get the key with
GETKEY command. */
- if (entry->data.public_key)
- silc_hash_table_add(server->pk_hash, entry->data.public_key, entry);
- else
+ if (entry->data.public_key) {
+ if (!silc_hash_table_find_by_context(server->pk_hash,
+ entry->data.public_key,
+ entry, NULL))
+ silc_hash_table_add(server->pk_hash, entry->data.public_key,
+ entry);
+ } else
silc_server_send_command(server, router_sock,
SILC_COMMAND_GETKEY, ++server->cmd_ident,
1, 1, buffer->data, buffer->len);
silc_server_send_command(server, router_sock,
SILC_COMMAND_GETKEY, ++server->cmd_ident,
1, 1, buffer->data, buffer->len);
diff --git
a/apps/silcd/server.c
b/apps/silcd/server.c
index cadbdab1ec69cb252114ec30e22a7a9a309d9ace..2c3875a5c12bc8826866dcbfbe418621fddc5a20 100644
(file)
--- a/
apps/silcd/server.c
+++ b/
apps/silcd/server.c
@@
-2040,8
+2040,11
@@
SILC_TASK_CALLBACK(silc_server_accept_new_connection_final)
}
/* Add public key to hash list (for whois using attributes) */
}
/* Add public key to hash list (for whois using attributes) */
- silc_hash_table_add(server->pk_hash,
- entry->data.public_key, client);
+ if (!silc_hash_table_find_by_context(server->pk_hash,
+ entry->data.public_key,
+ client, NULL))
+ silc_hash_table_add(server->pk_hash,
+ entry->data.public_key, client);
id_entry = (void *)client;
break;
id_entry = (void *)client;
break;
diff --git
a/apps/silcd/server_query.c
b/apps/silcd/server_query.c
index da4a30f9c9043c393040563439b6f0810079b26c..a02fcd1803b38d84d14f7a03a9fa6122a79826ff 100644
(file)
--- a/
apps/silcd/server_query.c
+++ b/
apps/silcd/server_query.c
@@
-323,6
+323,13
@@
void silc_server_query_send_router_reply(void *context, void *reply)
SILC_LOG_DEBUG(("Received reply from router to query"));
SILC_LOG_DEBUG(("Received reply from router to query"));
+ /* If the original command caller has gone away, just stop. */
+ if (query->cmd->sock->users == 1) {
+ SILC_LOG_DEBUG(("Original command caller vanished"));
+ silc_server_query_free(query);
+ return;
+ }
+
/* Check if router sent error reply */
if (cmdr && !silc_command_get_status(cmdr->payload, NULL, NULL)) {
SilcBuffer buffer;
/* Check if router sent error reply */
if (cmdr && !silc_command_get_status(cmdr->payload, NULL, NULL)) {
SilcBuffer buffer;
@@
-671,7
+678,7
@@
void silc_server_query_check_attributes(SilcServer server,
/* If no clients were found, we only check the attributes
if the user wasn't searching for nickname/ids */
/* If no clients were found, we only check the attributes
if the user wasn't searching for nickname/ids */
- if (!
*clients
) {
+ if (!
(*clients)
) {
no_clients = TRUE;
if (query->nickname || query->ids_count)
return;
no_clients = TRUE;
if (query->nickname || query->ids_count)
return;
@@
-1283,6
+1290,13
@@
void silc_server_query_resolve_reply(void *context, void *reply)
SILC_LOG_DEBUG(("Reprocess the query"));
SILC_LOG_DEBUG(("Reprocess the query"));
+ /* If the original command caller has gone away, just stop. */
+ if (query->cmd->sock->users == 1) {
+ SILC_LOG_DEBUG(("Original command caller vanished"));
+ silc_server_query_free(query);
+ return;
+ }
+
/* We have received all queries. Now re-search all information required
to complete this query. Reason we cannot save the values found in
the first search is that SilcClientEntry, SilcServerEntry and
/* We have received all queries. Now re-search all information required
to complete this query. Reason we cannot save the values found in
the first search is that SilcClientEntry, SilcServerEntry and
@@
-1316,7
+1330,7
@@
void silc_server_query_send_reply(SilcServer server,
SilcUInt32 len;
SilcBuffer idp;
int i, k, valid_count;
SilcUInt32 len;
SilcBuffer idp;
int i, k, valid_count;
- char nh[
256], uh[256
];
+ char nh[
384], uh[384
];
bool sent_reply = FALSE;
SILC_LOG_DEBUG(("Sending reply to query"));
bool sent_reply = FALSE;
SILC_LOG_DEBUG(("Sending reply to query"));
@@
-1404,7
+1418,6
@@
void silc_server_query_send_reply(SilcServer server,
" : "), entry->nickname));
idp = silc_id_payload_encode(entry->id, SILC_ID_CLIENT);
" : "), entry->nickname));
idp = silc_id_payload_encode(entry->id, SILC_ID_CLIENT);
- memset(uh, 0, sizeof(uh));
memset(nh, 0, sizeof(nh));
silc_strncat(nh, sizeof(nh), entry->nickname, strlen(entry->nickname));
memset(nh, 0, sizeof(nh));
silc_strncat(nh, sizeof(nh), entry->nickname, strlen(entry->nickname));
@@
-1432,6
+1445,8
@@
void silc_server_query_send_reply(SilcServer server,
memset(fempty, 0, sizeof(fempty));
memset(idle, 0, sizeof(idle));
memset(fempty, 0, sizeof(fempty));
memset(idle, 0, sizeof(idle));
+ memset(uh, 0, sizeof(uh));
+
silc_strncat(uh, sizeof(uh), entry->username,
strlen(entry->username));
if (!strchr(entry->username, '@') && entry->connection) {
silc_strncat(uh, sizeof(uh), entry->username,
strlen(entry->username));
if (!strchr(entry->username, '@') && entry->connection) {
diff --git
a/apps/silcd/server_util.c
b/apps/silcd/server_util.c
index 54a95feb5ad86538488fd003e1dbded40835d0ad..46cf87aa619cf6f9e4d5bb7a77d0b722dc1d1d7e 100644
(file)
--- a/
apps/silcd/server_util.c
+++ b/
apps/silcd/server_util.c
@@
-223,6
+223,9
@@
bool silc_server_remove_clients_by_server(SilcServer server,
/* Remove the client entry */
if (!server_signoff) {
client->data.status &= ~SILC_IDLIST_STATUS_REGISTERED;
/* Remove the client entry */
if (!server_signoff) {
client->data.status &= ~SILC_IDLIST_STATUS_REGISTERED;
+ client->mode = 0;
+ client->router = NULL;
+ client->connection = NULL;
id_cache->expire = SILC_ID_CACHE_EXPIRE_DEF;
} else {
silc_idlist_del_data(client);
id_cache->expire = SILC_ID_CACHE_EXPIRE_DEF;
} else {
silc_idlist_del_data(client);
@@
-287,6
+290,9
@@
bool silc_server_remove_clients_by_server(SilcServer server,
/* Remove the client entry */
if (!server_signoff) {
client->data.status &= ~SILC_IDLIST_STATUS_REGISTERED;
/* Remove the client entry */
if (!server_signoff) {
client->data.status &= ~SILC_IDLIST_STATUS_REGISTERED;
+ client->mode = 0;
+ client->router = NULL;
+ client->connection = NULL;
id_cache->expire = SILC_ID_CACHE_EXPIRE_DEF;
} else {
silc_idlist_del_data(client);
id_cache->expire = SILC_ID_CACHE_EXPIRE_DEF;
} else {
silc_idlist_del_data(client);
@@
-1656,7
+1662,6
@@
void silc_server_kill_client(SilcServer server,
if (SILC_IS_LOCAL(remote_client)) {
server->stat.my_clients--;
silc_schedule_task_del_by_context(server->schedule, remote_client);
if (SILC_IS_LOCAL(remote_client)) {
server->stat.my_clients--;
silc_schedule_task_del_by_context(server->schedule, remote_client);
- silc_idlist_del_data(remote_client);
}
/* Remove remote client */
}
/* Remove remote client */