diff options
author | Adam <Adam@anope.org> | 2013-02-25 00:26:49 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-02-25 00:26:49 -0500 |
commit | 8561941e222cfeef8d99e93782d7f7e146e60932 (patch) | |
tree | 3491edebd08d77ff8a62459704f8a03a7b9721e9 | |
parent | 5d4db2b85408202086ae35f38306e81f9216959e (diff) |
Don't enforce session limit on clients with no IP on Unreal, fix typo in /cs down syntax, fix os_session messages to reference ip
-rw-r--r-- | data/operserv.example.conf | 2 | ||||
-rw-r--r-- | modules/commands/cs_updown.cpp | 2 | ||||
-rw-r--r-- | modules/commands/os_session.cpp | 7 | ||||
-rw-r--r-- | modules/protocol/unreal.cpp | 19 | ||||
-rw-r--r-- | src/sockets.cpp | 5 |
5 files changed, 22 insertions, 13 deletions
diff --git a/data/operserv.example.conf b/data/operserv.example.conf index 8e2afbc0a..fa17a1df9 100644 --- a/data/operserv.example.conf +++ b/data/operserv.example.conf @@ -154,7 +154,7 @@ operserv * * This directive is optional, if not set, nothing will be sent. */ - sessionlimitexceeded = "The session limit for your host %s has been exceeded." + sessionlimitexceeded = "The session limit for your IP %s has been exceeded." /* * Same as above, but should be used to provide a website address where users can find out more diff --git a/modules/commands/cs_updown.cpp b/modules/commands/cs_updown.cpp index 85eeb0af1..27e1984d1 100644 --- a/modules/commands/cs_updown.cpp +++ b/modules/commands/cs_updown.cpp @@ -100,7 +100,7 @@ class CommandCSDown : public Command CommandCSDown(Module *creator) : Command(creator, "chanserv/down", 0, 2) { this->SetDesc(_("Removes a selected nicks status from a channel")); - this->SetSyntax(_("[\037channel\037 ]\037nick\037]]")); + this->SetSyntax(_("[\037channel\037 [\037nick\037]]")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override diff --git a/modules/commands/os_session.cpp b/modules/commands/os_session.cpp index 949aabbe8..1edda00d6 100644 --- a/modules/commands/os_session.cpp +++ b/modules/commands/os_session.cpp @@ -652,7 +652,7 @@ class OSSession : public Module if (OperServ) { if (!Config->SessionLimitExceeded.empty()) - u->SendMessage(OperServ, Config->SessionLimitExceeded.c_str(), u->host.c_str()); + u->SendMessage(OperServ, Config->SessionLimitExceeded.c_str(), u->ip.c_str()); if (!Config->SessionLimitDetailsLoc.empty()) u->SendMessage(OperServ, "%s", Config->SessionLimitDetailsLoc.c_str()); } @@ -660,7 +660,7 @@ class OSSession : public Module ++session->hits; if (Config->MaxSessionKill && session->hits >= Config->MaxSessionKill && akills) { - const Anope::string &akillmask = "*@" + u->host; + const Anope::string &akillmask = "*@" + u->ip; XLine *x = new XLine(akillmask, Config->OperServ, Anope::CurTime + Config->SessionAutoKillExpiry, "Session limit exceeded", XLineManager::GenerateUID()); akills->AddXLine(x); akills->Send(NULL, x); @@ -693,7 +693,7 @@ class OSSession : public Module } if (!session) { - Log(LOG_DEBUG) << "Tried to delete non-existant session: " << u->host; + Log(LOG_DEBUG) << "Tried to delete non-existant session: " << u->ip; return; } @@ -712,6 +712,7 @@ class OSSession : public Module exception_type("Exception", Exception::Unserialize), ss(this), commandossession(this), commandosexception(this), akills("XLineManager", "xlinemanager/sgline") { this->SetAuthor("Anope"); + this->SetPermanent(true); Implementation i[] = { I_OnUserConnect, I_OnPreUserLogoff }; ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation)); diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp index 01141b6a3..b7cd2e322 100644 --- a/modules/protocol/unreal.cpp +++ b/modules/protocol/unreal.cpp @@ -778,17 +778,20 @@ struct IRCDMessageNick : IRCDMessage { if (params.size() == 11) { - Anope::string decoded_ip; - Anope::B64Decode(params[9], decoded_ip); - Anope::string ip; - try + if (params[9] != "*") { - sockaddrs ip_addr; - ip_addr.ntop(params[9].length() == 8 ? AF_INET : AF_INET6, decoded_ip.c_str()); - ip = ip_addr.addr(); + Anope::string decoded_ip; + Anope::B64Decode(params[9], decoded_ip); + + try + { + sockaddrs ip_addr; + ip_addr.ntop(params[9].length() == 8 ? AF_INET : AF_INET6, decoded_ip.c_str()); + ip = ip_addr.addr(); + } + catch (const SocketException &ex) { } } - catch (const SocketException &ex) { } Anope::string vhost = params[8]; if (vhost.equals_cs("*")) diff --git a/src/sockets.cpp b/src/sockets.cpp index 1049d0b7f..53ca40f80 100644 --- a/src/sockets.cpp +++ b/src/sockets.cpp @@ -148,6 +148,11 @@ void sockaddrs::pton(int type, const Anope::string &address, int pport) void sockaddrs::ntop(int type, const void *src) { + char buf[INET6_ADDRSTRLEN]; + + if (inet_ntop(type, src, buf, sizeof(buf)) != buf) + throw SocketException("Invalid addr"); + switch (type) { case AF_INET: |