Skip to content

Commit

Permalink
Add validation for channel name, throws an exception aborting the mod…
Browse files Browse the repository at this point in the history
…ule loading if the name is invalid

git-svn-id: http://svn.inspircd.org/repository/branches/1_0_stable@3934 e03df62e-2008-0410-955e-edbf42e46eb7
  • Loading branch information
om committed May 6, 2006
1 parent 600d241 commit 986482f
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/modules/m_operjoin.cpp
Expand Up @@ -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:
Expand All @@ -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)
Expand Down Expand Up @@ -78,4 +92,3 @@ extern "C" void * init_module( void )
{
return new ModuleOperjoinFactory;
}

0 comments on commit 986482f

Please sign in to comment.