diff options
author | Adam <Adam@anope.org> | 2011-05-03 00:13:19 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2011-05-16 04:10:18 -0400 |
commit | b59602abf85d522bb2f188be70b6cb7c9556a856 (patch) | |
tree | 77ffb4df0714463da7cf8c9531e90fad4c763aed | |
parent | fd21c36725fc52fd186e058bb2b5f6c4c37b81bb (diff) |
Check for a valid server in /operserv noop
-rw-r--r-- | include/services.h | 2 | ||||
-rw-r--r-- | modules/core/os_noop.cpp | 27 | ||||
-rw-r--r-- | modules/protocol/bahamut.cpp | 4 | ||||
-rw-r--r-- | modules/protocol/unreal.cpp | 4 |
4 files changed, 19 insertions, 18 deletions
diff --git a/include/services.h b/include/services.h index 9bb49dba2..6467f1668 100644 --- a/include/services.h +++ b/include/services.h @@ -857,7 +857,7 @@ class CoreExport IRCDProto public: virtual ~IRCDProto() { } - virtual void SendSVSNOOP(const Anope::string &, int) { } + virtual void SendSVSNOOP(const Server *, bool) { } virtual void SendTopic(BotInfo *, Channel *) = 0; virtual void SendVhostDel(User *) { } virtual void SendAkill(User *, const XLine *) = 0; diff --git a/modules/core/os_noop.cpp b/modules/core/os_noop.cpp index a8c0f9559..b17f26dfc 100644 --- a/modules/core/os_noop.cpp +++ b/modules/core/os_noop.cpp @@ -28,34 +28,37 @@ class CommandOSNOOP : public Command const Anope::string &cmd = params[0]; const Anope::string &server = params[1]; - if (cmd.equals_ci("SET")) + Server *s = Server::Find(server); + if (s == NULL) + source.Reply(_("Server %s does not exist."), server.c_str()); + else if (cmd.equals_ci("SET")) { - Anope::string reason; - /* Remove the O:lines */ - ircdproto->SendSVSNOOP(server, 1); + ircdproto->SendSVSNOOP(s, true); - reason = "NOOP command used by " + u->nick; - Log(LOG_ADMIN, u, this) << "on " << server; - source.Reply(_("All O:lines of \002%s\002 have been removed."), server.c_str()); + Log(LOG_ADMIN, u, this) << "SET on " << s->GetName(); + source.Reply(_("All O:lines of \002%s\002 have been removed."), s->GetName().c_str()); + Anope::string reason = "NOOP command used by " + u->nick; /* Kill all the IRCops of the server */ for (Anope::insensitive_map<User *>::iterator it = UserListByNick.begin(); it != UserListByNick.end();) { User *u2 = it->second; ++it; - if (u2 && u2->HasMode(UMODE_OPER) && Anope::Match(u2->server->GetName(), server, true)) + if (u2 && u2->HasMode(UMODE_OPER) && u2->server == s) u2->Kill(Config->s_OperServ, reason); } } else if (cmd.equals_ci("REVOKE")) { - ircdproto->SendSVSNOOP(server, 0); - source.Reply(_("All O:lines of \002%s\002 have been reset."), server.c_str()); + Log(LOG_ADMIN, u, this) << "REVOKE on " << s->GetName(); + ircdproto->SendSVSNOOP(s, false); + source.Reply(_("All O:lines of \002%s\002 have been reset."), s->GetName().c_str()); } else this->OnSyntaxError(source, ""); + return MOD_CONT; } @@ -69,9 +72,7 @@ class CommandOSNOOP : public Command "prevent them from rehashing the server (because this\n" "would just cancel the effect).\n" "\002NOOP REVOKE\002 makes all removed O:lines available again\n" - "on the given \002server\002.\n" - "\002Note:\002 The \002server\002 is not checked at all by the\n" - "Services.")); + "on the given \002server\002.\n")); return true; } diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp index 59f611867..92aee74fb 100644 --- a/modules/protocol/bahamut.cpp +++ b/modules/protocol/bahamut.cpp @@ -131,9 +131,9 @@ class BahamutIRCdProto : public IRCDProto } /* SVSNOOP */ - void SendSVSNOOP(const Anope::string &server, int set) + void SendSVSNOOP(const Server *server, bool set) { - send_cmd("", "SVSNOOP %s %s", server.c_str(), set ? "+" : "-"); + send_cmd("", "SVSNOOP %s %s", server->GetName().c_str(), set ? "+" : "-"); } /* SGLINE */ diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp index fa25a1049..cb7a54d61 100644 --- a/modules/protocol/unreal.cpp +++ b/modules/protocol/unreal.cpp @@ -91,9 +91,9 @@ void unreal_cmd_chgident(const Anope::string &nick, const Anope::string &vIdent) class UnrealIRCdProto : public IRCDProto { /* SVSNOOP */ - void SendSVSNOOP(const Anope::string &server, int set) + void SendSVSNOOP(const Server *server, bool set) { - send_cmd("", "f %s %s", server.c_str(), set ? "+" : "-"); + send_cmd("", "f %s %s", server->GetName().c_str(), set ? "+" : "-"); } void SendAkillDel(const XLine *x) |