From 6f2d85fbb6b2a50a4dfcff9ef5e305b76e7fd7f4 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Thu, 31 Jul 2003 16:37:25 +0000 Subject: [PATCH] - Fixed bug in /silence regarding cloaked hosts, reported by kuwatog (#0001157). --- Changes | 1 + src/modules/m_message.c | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Changes b/Changes index 49ee8aeb1..551d71ca9 100644 --- a/Changes +++ b/Changes @@ -2304,3 +2304,4 @@ seen. gmtime warning still there - Fixed bug with SWHOIS: oper::swhois wasn't broadcasted correctly which made it only show up in local (or server) /whois, reported by format (#0001141). - minor m_kick tweak. +- Fixed bug in /silence regarding cloaked hosts, reported by kuwatog (#0001157). diff --git a/src/modules/m_message.c b/src/modules/m_message.c index 796fd6dda..fef056a89 100644 --- a/src/modules/m_message.c +++ b/src/modules/m_message.c @@ -614,14 +614,29 @@ static int is_silenced(aClient *sptr, aClient *acptr) Link *lp; anUser *user; static char sender[HOSTLEN + NICKLEN + USERLEN + 5]; - + static char senderx[HOSTLEN + NICKLEN + USERLEN + 5]; + char checkv = 0; + if (!(acptr->user) || !(lp = acptr->user->silence) || !(user = sptr->user)) return 0; + ircsprintf(sender, "%s!%s@%s", sptr->name, user->username, user->realhost); + /* We also check for matches against sptr->user->virthost if present, + * this is checked regardless of mode +x so you can't do tricks like: + * evil has +x and msgs, victim places silence on +x host, evil does -x + * and can msg again. -- Syzop + */ + if (sptr->user->virthost) + { + ircsprintf(senderx, "%s!%s@%s", sptr->name, user->username, + sptr->user->virthost); + checkv = 1; + } + for (; lp; lp = lp->next) { - if (!match(lp->value.cp, sender)) + if (!match(lp->value.cp, sender) || (checkv && !match(lp->value.cp, senderx))) { if (!MyConnect(sptr)) {