From 14edb231add4bd112e284ddf650cb6eb655e46a1 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Tue, 10 Sep 2002 07:51:23 +0000 Subject: [PATCH] Assure that endless loop with detached client resolving cannot happen. --- CHANGES | 7 +++++++ TODO | 3 --- apps/silcd/idlist.h | 2 ++ apps/silcd/packet_receive.c | 5 +++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 6e59cd83..52d12616 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,10 @@ +Tue Sep 10 09:50:08 CEST 2002 Pekka Riikonen + + * Assure that endless loop cannot happen with detached client + resolving on normal server. Added idlist status + SILC_IDLIST_STATUS_RESUME_RES. Affected files are + silcd/idlist.h and silcd/packet_receive.c. + Mon Sep 9 12:18:18 CEST 2002 Pekka Riikonen * Incoming file transfer request cannot use same session as diff --git a/TODO b/TODO index 1827c82a..09bc7249 100644 --- a/TODO +++ b/TODO @@ -26,9 +26,6 @@ TODO/bugs In SILC Client Library TODO/bugs In SILC Server ======================== - o Possibility of endless loop with detached client resolving in server. - Has happened once. Check the logic. - o Backup router can accidently free its own id_entry and ID? Could happen when some server is connecting and connecting fails (like too many connections, etc). Some weird crashes relating to this occurred. diff --git a/apps/silcd/idlist.h b/apps/silcd/idlist.h index ec10bc59..64171f7d 100644 --- a/apps/silcd/idlist.h +++ b/apps/silcd/idlist.h @@ -64,6 +64,8 @@ typedef SilcUInt8 SilcIDListStatus; #define SILC_IDLIST_STATUS_DISABLED 0x08 /* Entry is disabled */ #define SILC_IDLIST_STATUS_RESUMED 0x10 /* Entry is resumed */ #define SILC_IDLIST_STATUS_LOCAL 0x20 /* Entry locally connected */ +#define SILC_IDLIST_STATUS_RESUME_RES 0x40 /* Entry resolved while + resuming */ /* Generic ID list data structure. diff --git a/apps/silcd/packet_receive.c b/apps/silcd/packet_receive.c index 525ada9d..0725f7e8 100644 --- a/apps/silcd/packet_receive.c +++ b/apps/silcd/packet_receive.c @@ -3385,6 +3385,8 @@ SILC_SERVER_CMD_FUNC(resume_resolve) silc_server_free_sock_user_data(server, sock, NULL); goto out; } + + client->data.status |= SILC_IDLIST_STATUS_RESUME_RES; } /* Reprocess the packet */ @@ -3492,6 +3494,8 @@ void silc_server_resume_client(SilcServer server, resolve = TRUE; if (!detached_client->nickname) resolve = TRUE; + if (detached_client->data.status & SILC_IDLIST_STATUS_RESUME_RES) + resolve = FALSE; if (resolve) { if (server->server_type == SILC_SERVER && !server->standalone) { @@ -3611,6 +3615,7 @@ void silc_server_resume_client(SilcServer server, silc_idlist_add_data(detached_client, idata); detached_client->data.status |= SILC_IDLIST_STATUS_REGISTERED; detached_client->data.status |= SILC_IDLIST_STATUS_RESUMED; + detached_client->data.status &= ~SILC_IDLIST_STATUS_RESUME_RES; detached_client->mode &= ~SILC_UMODE_DETACHED; server->stat.my_detached--; -- 2.24.0