mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 02:59:01 -04:00
Add <security:allowcoreunload>.
When enabled (the default) this setting prevents the unloading of core modules such as cmd_privmsg.
This commit is contained in:
parent
1626437cbf
commit
b331d0549b
@ -657,6 +657,9 @@
|
|||||||
# #
|
# #
|
||||||
|
|
||||||
<security
|
<security
|
||||||
|
# allowcoreunload: If this value is set to yes, Opers will be able to
|
||||||
|
# unload core modules (e.g. cmd_privmsg.so).
|
||||||
|
allowcoreunload="no"
|
||||||
|
|
||||||
# announceinvites: This option controls which members of the channel
|
# announceinvites: This option controls which members of the channel
|
||||||
# receive an announcement when someone is INVITEd. Available values:
|
# receive an announcement when someone is INVITEd. Available values:
|
||||||
|
@ -42,6 +42,13 @@ class CommandUnloadmodule : public Command
|
|||||||
|
|
||||||
CmdResult CommandUnloadmodule::Handle (const std::vector<std::string>& parameters, User *user)
|
CmdResult CommandUnloadmodule::Handle (const std::vector<std::string>& parameters, User *user)
|
||||||
{
|
{
|
||||||
|
if (!ServerInstance->Config->ConfValue("security")->getBool("allowcoreunload") &&
|
||||||
|
InspIRCd::Match(parameters[0], "cmd_*.so", ascii_case_insensitive_map))
|
||||||
|
{
|
||||||
|
user->WriteNumeric(972, "%s %s :You cannot unload core commands!", user->nick.c_str(), parameters[0].c_str());
|
||||||
|
return CMD_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
if (parameters[0] == "cmd_unloadmodule.so" || parameters[0] == "cmd_loadmodule.so")
|
if (parameters[0] == "cmd_unloadmodule.so" || parameters[0] == "cmd_loadmodule.so")
|
||||||
{
|
{
|
||||||
user->WriteNumeric(972, "%s %s :You cannot unload module loading commands!", user->nick.c_str(), parameters[0].c_str());
|
user->WriteNumeric(972, "%s %s :You cannot unload module loading commands!", user->nick.c_str(), parameters[0].c_str());
|
||||||
|
@ -79,6 +79,13 @@ class CommandGunloadmodule : public Command
|
|||||||
|
|
||||||
CmdResult Handle (const std::vector<std::string> ¶meters, User *user)
|
CmdResult Handle (const std::vector<std::string> ¶meters, User *user)
|
||||||
{
|
{
|
||||||
|
if (!ServerInstance->Config->ConfValue("security")->getBool("allowcoreunload") &&
|
||||||
|
InspIRCd::Match(parameters[0], "cmd_*.so", ascii_case_insensitive_map))
|
||||||
|
{
|
||||||
|
user->WriteNumeric(972, "%s %s :You cannot unload core commands!", user->nick.c_str(), parameters[0].c_str());
|
||||||
|
return CMD_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
std::string servername = parameters.size() > 1 ? parameters[1] : "*";
|
std::string servername = parameters.size() > 1 ? parameters[1] : "*";
|
||||||
|
|
||||||
if (InspIRCd::Match(ServerInstance->Config->ServerName.c_str(), servername))
|
if (InspIRCd::Match(ServerInstance->Config->ServerName.c_str(), servername))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user