From 986482f033c2f9a58e490577f67a348fd4af384e Mon Sep 17 00:00:00 2001 From: om Date: Sat, 6 May 2006 17:28:55 +0000 Subject: 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 --- src/modules/m_operjoin.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/modules/m_operjoin.cpp') 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; } - -- cgit v1.3.1-10-gc9f91