]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Fix m_banredirect causing bans added for hosts being rewritten as nicks
authorAdam <Adam@anope.org>
Mon, 20 Oct 2014 19:14:54 +0000 (15:14 -0400)
committerAdam <Adam@anope.org>
Thu, 23 Oct 2014 04:06:49 +0000 (00:06 -0400)
src/modules/m_banredirect.cpp

index 2e25925410d6ef67d03f2a80b9b9da3da1d8999d..1b9e361bf408dc12fd0697f354323388941a3545 100644 (file)
@@ -75,6 +75,9 @@ class BanRedirect : public ModeWatcher
                        if (param.length() >= 2 && param[1] == ':')
                                return true;
 
+                       if (param.find('#') == std::string::npos)
+                               return true;
+
                        if(adding && (channel->bans.size() > static_cast<unsigned>(maxbans)))
                        {
                                source->WriteNumeric(478, "%s %s :Channel ban list for %s is full (maximum entries for this channel is %ld)", source->nick.c_str(), channel->name.c_str(), channel->name.c_str(), maxbans);
@@ -119,6 +122,14 @@ class BanRedirect : public ModeWatcher
                                mask[NICK].swap(mask[IDENT]);
                        }
 
+                       if (!mask[NICK].empty() && mask[IDENT].empty() && mask[HOST].empty())
+                       {
+                               if (mask[NICK].find('.') != std::string::npos || mask[NICK].find(':') != std::string::npos)
+                               {
+                                       mask[NICK].swap(mask[HOST]);
+                               }
+                       }
+
                        for(int i = 0; i < 3; i++)
                        {
                                if(mask[i].empty())