Prevent "GLINE +test", "GLINE +test" from creating duplicate G-lines.
authorMichael Poole <mdpoole@troilus.org>
Wed, 2 Feb 2005 22:28:15 +0000 (22:28 +0000)
committerMichael Poole <mdpoole@troilus.org>
Wed, 2 Feb 2005 22:28:15 +0000 (22:28 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1308 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
ircd/gline.c

index adf1f9dc8d57c69ec1360a6ee63218f27cca95bc..c09464e6ca9482610f3cd244a88a98dd1bb1920e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,10 @@
        * ircd/Makefile.in (install-*): Remove commented-out code to touch
        and chown MPATH and RPATH.
 
+       * ircd/gline.c (gline_find): Allow searching for host-based
+       G-lines by plain hostname (not *@host), thus preventing "GLINE
+       test ..." from inserting duplicate G-lines.
+
 2005-01-26  Michael Poole <mdpoole@troilus.org>
 
        * include/ircd_alloc.h (DoMallocZero): Parenthesize macro
index 6de036232afe2728ec89f376f85bc8822c52d79e..5994e3eab4b86986752a7d8dee57cbd9ed83d28f 100644 (file)
@@ -641,10 +641,7 @@ gline_find(char *userhost, unsigned int flags)
     return 0;
 
   DupString(t_uh, userhost);
-  canon_userhost(t_uh, &user, &host, 0);
-
-  if (BadPtr(user))
-    return 0;
+  canon_userhost(t_uh, &user, &host, "*");
 
   for (gline = GlobalGlineList; gline; gline = sgline) {
     sgline = gline->gl_next;
@@ -657,14 +654,12 @@ gline_find(char *userhost, unsigned int flags)
     else if (flags & GLINE_EXACT) {
       if (((gline->gl_host && host && ircd_strcmp(gline->gl_host, host) == 0)
            || (!gline->gl_host && !host)) &&
-          ((!user && ircd_strcmp(gline->gl_user, "*") == 0) ||
-          ircd_strcmp(gline->gl_user, user) == 0))
+          (ircd_strcmp(gline->gl_user, user) == 0))
        break;
     } else {
       if (((gline->gl_host && host && match(gline->gl_host, host) == 0)
            || (!gline->gl_host && !host)) &&
-         ((!user && ircd_strcmp(gline->gl_user, "*") == 0) ||
-          match(gline->gl_user, user) == 0))
+         (match(gline->gl_user, user) == 0))
       break;
     }
   }