From 53ce645e53b7f6132f7cf34b3468d7dd64ce3a2a Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Wed, 2 Feb 2005 22:28:15 +0000 Subject: [PATCH] Prevent "GLINE +test", "GLINE +test" from creating duplicate G-lines. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1308 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- ChangeLog | 4 ++++ ircd/gline.c | 11 +++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index adf1f9d..c09464e 100644 --- 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 * include/ircd_alloc.h (DoMallocZero): Parenthesize macro diff --git a/ircd/gline.c b/ircd/gline.c index 6de0362..5994e3e 100644 --- a/ircd/gline.c +++ b/ircd/gline.c @@ -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; } } -- 2.20.1