diff options
author | dz <dz@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-03-18 19:15:25 +0000 |
---|---|---|
committer | dz <dz@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-03-18 19:15:25 +0000 |
commit | e430a965545e89391b63dcda9ca3bded13146711 (patch) | |
tree | bb4f6c6626579643be5f337c4ce2baf00bfaad07 /src | |
parent | a36020d088d020b6e5941d205e555f982134fa41 (diff) |
fix dccallow logic to allow <badfile:action> to override <dccallow:defaultaction>, spotted by Taros.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11234 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_dccallow.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index 22df5aa7e..c2febadce 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -340,23 +340,26 @@ class ModuleDCCAllow : public Module std::string defaultaction = Conf->ReadValue("dccallow", "action", 0); std::string filename = tokens[2]; - if (defaultaction == "allow") - return 0; - + bool found = false; for (unsigned int i = 0; i < bfl.size(); i++) { if (InspIRCd::Match(filename, bfl[i].filemask, ascii_case_insensitive_map)) { + /* We have a matching badfile entry, override whatever the default action is */ if (bfl[i].action == "allow") return 0; - } - else - { - if (defaultaction == "allow") - return 0; + else + { + found = true; + break; + } } } + /* only follow the default action if no badfile matches were found above */ + if ((!found) && (defaultaction == "allow")) + return 0; + user->WriteServ("NOTICE %s :The user %s is not accepting DCC SENDs from you. Your file %s was not sent.", user->nick.c_str(), u->nick.c_str(), filename.c_str()); u->WriteServ("NOTICE %s :%s (%s@%s) attempted to send you a file named %s, which was blocked.", u->nick.c_str(), user->nick.c_str(), user->ident.c_str(), user->dhost.c_str(), filename.c_str()); u->WriteServ("NOTICE %s :If you trust %s and were expecting this, you can type /DCCALLOW HELP for information on the DCCALLOW system.", u->nick.c_str(), user->nick.c_str()); |