Only allow admins to load the shell module

The exception to this is if ZNC is compiled with -DMOD_SHELL_ALLOW_EVERYONE
x-x wanted this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1007 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2008-04-01 08:57:21 +00:00
parent cbdfaf0ed3
commit 617e732f66

View File

@@ -43,6 +43,18 @@ public:
}
}
virtual bool OnLoad(const CString& sArgs, CString& sMessage)
{
#ifndef MOD_SHELL_ALLOW_EVERYONE
if (!m_pUser->IsAdmin()) {
sMessage = "You must be admin to use the shell module";
return false;
}
#endif
return true;
}
virtual void OnModCommand(const CString& sCommand) {
if ((strcasecmp(sCommand.c_str(), "cd") == 0) || (strncasecmp(sCommand.c_str(), "cd ", 3) == 0)) {
CString sPath = CUtils::ChangeDir(m_sPath, ((sCommand.length() == 2) ? CString(CZNC::Get().GetHomePath()) : CString(sCommand.substr(3))), CZNC::Get().GetHomePath());