From 00b2cc9ce6b9e4d4869d986ada1cf64d22b95455 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 24 Apr 2014 01:38:45 -0400 Subject: [PATCH] Require at least user@host format for akills. Fix XLine::GetHost() not returning anything if an xline only has a host --- modules/commands/os_akill.cpp | 5 +++++ src/xline.cpp | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/commands/os_akill.cpp b/modules/commands/os_akill.cpp index c81a6b515..af8573752 100644 --- a/modules/commands/os_akill.cpp +++ b/modules/commands/os_akill.cpp @@ -160,6 +160,11 @@ class CommandOSAKill : public Command source.Reply(USERHOST_MASK_TOO_WIDE, mask.c_str()); return; } + else if (mask.find('@') == Anope::string::npos) + { + source.Reply(BAD_USERHOST_MASK); + return; + } if (Config->GetModule("operserv")->Get("addakiller", "yes") && !source.GetNick().empty()) reason = "[" + source.GetNick() + "] " + reason; diff --git a/src/xline.cpp b/src/xline.cpp index ea74ba8c7..6b3ba90f4 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -103,7 +103,12 @@ Anope::string XLine::GetHost() const return this->mask.substr(host_t + 1); } else - return ""; + { + if (real_t != Anope::string::npos) + return this->mask.substr(0, real_t); + else + return this->mask; + } } Anope::string XLine::GetReal() const