mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
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:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user