diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-05-05 19:25:09 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-05-05 19:25:09 +0000 |
commit | b0e469b0bbdbc76692364e1f52ef613cc02a2a06 (patch) | |
tree | 2f9972d763391733c2a5aa455d861e9a0566263b /src | |
parent | 80845a3a693952fb9044b16da90cd8225d2d2e15 (diff) |
Fix for crash found by potter if you set up two redirects in two channels to forward the user back and forth between the two in a loop.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6889 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_banredirect.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index 1564cef57..6150c5193 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -187,12 +187,14 @@ class ModuleBanRedirect : public Module { BanRedirect* re; InspIRCd* Srv; + bool nofollow; public: ModuleBanRedirect(InspIRCd* Me) : Module::Module(Me), Srv(Me) { re = new BanRedirect(Me); + nofollow = false; if(!Srv->AddModeWatcher(re)) throw ModuleException("Could not add mode watcher"); @@ -255,6 +257,12 @@ class ModuleBanRedirect : public Module virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname, std::string &privs) { + /* This prevents recursion when a user sets multiple ban redirects in a chain + * (thanks Potter) + */ + if (nofollow) + return 0; + /* Return 1 to prevent the join, 0 to allow it */ if (chan) { @@ -285,7 +293,9 @@ class ModuleBanRedirect : public Module else { user->WriteServ("470 %s :You are banned from %s. You are being automatically redirected to %s", user->nick, chan->name, redir->targetchan.c_str()); + nofollow = true; chanrec::JoinUser(Srv, user, redir->targetchan.c_str(), false, ""); + nofollow = false; return 1; } } |