From cab52df4ee38665d122be2dbee7adaf2b6db3763 Mon Sep 17 00:00:00 2001 From: Bleep Date: Sat, 11 Dec 1999 08:54:13 +0000 Subject: [PATCH] Author: Bleep Log message: Bug Fix. This fixes a bug which was causing stale entries to be left in the client hash table when names were changed. From Isomer: I believe that it doesn't actually /do/ anything if your at the head of the bucket. It should remove you from the bucket and place you in the new one. Patch should be trivial for someone with cvs access to apply. int hChangeClient(aClient *cptr, char *newname) { register HASHREGS oldhash = strhash(cptr->name); register HASHREGS newhash = strhash(newname); register aClient *tmp; tmp = clientTable[oldhash]; if (tmp == cptr) return 0; /* ^^^^^^^^ shouldn't we do something here? */ git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@11 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- .patches | 2 +- BUGS | 3 ++- ChangeLog | 6 +++++- ircd/hash.c | 32 +++++--------------------------- 4 files changed, 13 insertions(+), 30 deletions(-) diff --git a/.patches b/.patches index f8629dc..cc34d54 100644 --- a/.patches +++ b/.patches @@ -1 +1 @@ -ircu2.10.07+.03 +ircu2.10.07+.04 diff --git a/BUGS b/BUGS index 80df2d9..2ca1337 100644 --- a/BUGS +++ b/BUGS @@ -1,7 +1,8 @@ # -# $Id: BUGS,v 1.1.1.1 1999-11-16 05:13:14 codercom Exp $ +# $Id: BUGS,v 1.2 1999-12-11 08:54:13 bleep Exp $ # # Undernet ircu BUGS File # Please put information about known bugs here, if the bug has been resolved # please comment the entry with "(fixed)" # + diff --git a/ChangeLog b/ChangeLog index f5e51aa..689fa08 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,12 +1,16 @@ # # ChangeLog for Undernet ircu Servers # -# $Id: ChangeLog,v 1.4 1999-11-29 00:26:41 bleep Exp $ +# $Id: ChangeLog,v 1.5 1999-12-11 08:54:13 bleep Exp $ # # Please insert new entries on the top of the list, a one or two line comment # is sufficient. Please include your name on the entries we know who to blame. # Please keep lines < 80 chars. #------------------------------------------------------------------------------- +* hash.c (hChangeClient): bug fix. If the client pointer matched the first + pointer in the bucket, the change was ignored (returned 0), leaving stale + values in the hash table, eventually causing the server to die for mysterious + reasons. Bug discovered by Quant and Isomer --Bleep * config-sh.in, channel.h, numeric.h, channel.c, s_debug.c, s_err.c: add lchanmode patch by CaptJay, add symbols to incredibly long feature string. Bump patchlevel to .03 --Bleep diff --git a/ircd/hash.c b/ircd/hash.c index 700880b..375ebea 100644 --- a/ircd/hash.c +++ b/ircd/hash.c @@ -311,20 +311,17 @@ int hRemClient(aClient *cptr) { clientTable[hashv] = cptr->hnext; return 0; - }; - + } while (tmp) { if (tmp->hnext == cptr) { tmp->hnext = tmp->hnext->hnext; return 0; - }; + } tmp = tmp->hnext; - }; - + } return -1; - } /* @@ -345,32 +342,13 @@ int hRemClient(aClient *cptr) */ int hChangeClient(aClient *cptr, char *newname) { - register HASHREGS oldhash = strhash(cptr->name); register HASHREGS newhash = strhash(newname); - register aClient *tmp; - tmp = clientTable[oldhash]; - - if (tmp == cptr) - return 0; + hRemClient(cptr); - while (tmp) - { - if (tmp->hnext == cptr) - { - tmp->hnext = cptr->hnext; - cptr->hnext = clientTable[newhash]; - clientTable[newhash] = cptr; - return 0; - }; - tmp = tmp->hnext; - }; - - /* Well... do our best anyway... link it to the correct list, - and then... Fail (and core if we are debugging) ! */ cptr->hnext = clientTable[newhash]; clientTable[newhash] = cptr; - return -1; + return 0; } /* -- 2.20.1