From 5d7a8c729e4aa27689e453c1f8eb2d8da461bb74 Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Mon, 12 Sep 2005 20:36:24 +0000 Subject: [PATCH] Check client hostnames against ban masks more rigorously. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1481 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- ChangeLog | 6 ++++++ ircd/channel.c | 19 +++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 50694df..f7f7953 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-09-12 Michael Poole + + * ircd/channel.c (find_ban): Compare ban mask against hostname + even when it looks like an IP, to match things like *!*@1.* when + users have a hostname like 1.2.3.example.com. + 2005-09-12 Michael Poole * RELEASE.NOTES: Note the resolution of ambiguous ipmasks. diff --git a/ircd/channel.c b/ircd/channel.c index de609e7..e1ea3ba 100644 --- a/ircd/channel.c +++ b/ircd/channel.c @@ -381,16 +381,15 @@ struct Ban *find_ban(struct Client *cptr, struct Ban *banlist) /* Compare host portion of ban. */ hostmask = banlist->banstr + banlist->nu_len + 1; if (((banlist->flags & BAN_IPMASK) - ? !ipmask_check(&cli_ip(cptr), &banlist->address, banlist->addrbits) - : match(hostmask, iphost)) - && match(hostmask, cli_user(cptr)->host) - && !(sr && match(hostmask, sr) == 0)) - continue; - /* If an exception matches, no ban can match. */ - if (banlist->flags & BAN_EXCEPTION) - return NULL; - /* Otherwise, remember this ban but keep searching for an exception. */ - found = banlist; + && ipmask_check(&cli_ip(cptr), &banlist->address, banlist->addrbits)) + || match(hostmask, cli_user(cptr)->host) + || (sr && match(hostmask, sr) == 0)) { + /* If an exception matches, no ban can match. */ + if (banlist->flags & BAN_EXCEPTION) + return NULL; + /* Otherwise, remember this ban but keep searching for an exception. */ + found = banlist; + } } return found; } -- 2.20.1