Permalink
Browse files

m_banredirect Deny the join to the redirect channel if it has a redir…

…ecting ban set that matches the user


Fixes #395 reported by @patatje368
  • Loading branch information...
attilamolnar committed Jan 2, 2013
1 parent d0aa0fa commit 9cd47a421dd7a1b5bb155091fd4173e95ed8da55
Showing with 10 additions and 7 deletions.
  1. +10 −7 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;

0 comments on commit 9cd47a4

Please sign in to comment.