summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2013-01-02 18:36:09 +0100
committerattilamolnar <attilamolnar@hush.com>2013-01-02 18:36:09 +0100
commit9cd47a421dd7a1b5bb155091fd4173e95ed8da55 (patch)
tree51e0281a5694c16881f56e5875152f083025e5a6
parentd0aa0fab53653ed86da9773c96acaa20021f0003 (diff)
m_banredirect Deny the join to the redirect channel if it has a redirecting ban set that matches the user
Fixes #395 reported by @patatje368
-rw-r--r--src/modules/m_banredirect.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp
index c2dff9126..ee52a5cfb 100644
--- a/src/modules/m_banredirect.cpp
+++ b/src/modules/m_banredirect.cpp
@@ -269,13 +269,6 @@ class ModuleBanRedirect : public Module
virtual ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
{
- /* This prevents recursion when a user sets multiple ban redirects in a chain
- * (thanks Potter)
- */
- if (nofollow)
- return MOD_RES_PASSTHRU;
-
- /* Return 1 to prevent the join, 0 to allow it */
if (chan)
{
BanRedirectList* redirects = re.extItem.get(chan);
@@ -303,6 +296,16 @@ class ModuleBanRedirect : public Module
{
if(InspIRCd::Match(user->GetFullRealHost(), redir->banmask) || InspIRCd::Match(user->GetFullHost(), redir->banmask) || InspIRCd::MatchCIDR(ipmask, redir->banmask))
{
+ /* This prevents recursion when a user sets multiple ban redirects in a chain
+ * (thanks Potter)
+ *
+ * If we're here and nofollow is true then we're already redirecting this user
+ * and there's a redirecting ban set on this channel that matches him, too.
+ * Deny both joins.
+ */
+ if (nofollow)
+ return MOD_RES_DENY;
+
/* tell them they're banned and are being transferred */
Channel* destchan = ServerInstance->FindChan(redir->targetchan);
std::string destlimit;