Author: Bleep <tomh@inxpress.net>
authorBleep <twhelvey1@home.com>
Sat, 11 Dec 1999 08:54:13 +0000 (08:54 +0000)
committerBleep <twhelvey1@home.com>
Sat, 11 Dec 1999 08:54:13 +0000 (08:54 +0000)
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
BUGS
ChangeLog
ircd/hash.c

index f8629dc3dbfef315eb455500e5d2e138a1fbc351..cc34d54795bfad24c674757d98bffaaab3e639f8 100644 (file)
--- a/.patches
+++ b/.patches
@@ -1 +1 @@
-ircu2.10.07+.03
+ircu2.10.07+.04
diff --git a/BUGS b/BUGS
index 80df2d9d95ff07dfeaa9a39a1615f364fafcdd70..2ca133755e40a24678e11c8a0e8ce42ed140d9d7 100644 (file)
--- 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)"
 #
+
index f5e51aab088e957fc064f693292d890b1d389431..689fa0825e9721473d8ca328441860e42eb21894 100644 (file)
--- 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
index 700880ba945e470f49eb142473de7c09071632f6..375ebea455dd6374b29c4cc27978041a42794850 100644 (file)
@@ -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;
 }
 
 /*