aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/m_operjoin.cpp
diff options
context:
space:
mode:
authorGravatar om2006-05-06 17:28:55 +0000
committerGravatar om2006-05-06 17:28:55 +0000
commit986482f033c2f9a58e490577f67a348fd4af384e (patch)
tree0d3e38a8e2886ec42b8eec6d699acb1fa3b93dbb /src/modules/m_operjoin.cpp
parentBackport of EAGAIN check (diff)
Add validation for channel name, throws an exception aborting the module loading if the name is invalid
git-svn-id: http://svn.inspircd.org/repository/branches/1_0_stable@3934 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_operjoin.cpp')
-rw-r--r--src/modules/m_operjoin.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp
index cba931257..1ba636716 100644
--- a/src/modules/m_operjoin.cpp
+++ b/src/modules/m_operjoin.cpp
@@ -9,6 +9,15 @@ using namespace std;
/* $ModDesc: Forces opers to join a specified channel on oper-up */
+class OperJoinException : public ModuleException
+{
+ private:
+ std::string err;
+ public:
+ OperJoinException(std::string message) : err(message) { }
+ virtual const char* GetReason() { return err.c_str(); }
+};
+
class ModuleOperjoin : public Module
{
private:
@@ -23,6 +32,11 @@ class ModuleOperjoin : public Module
Srv = Me;
conf = new ConfigReader;
operChan = conf->ReadValue("operjoin", "channel", 0);
+
+ if(!IsValidChannelName(operChan.c_str()))
+ {
+ throw OperJoinException("m_operjoin.so: Channel name configured invalid: " + operChan);
+ }
}
void Implements(char* List)
@@ -78,4 +92,3 @@ extern "C" void * init_module( void )
{
return new ModuleOperjoinFactory;
}
-