diff options
author | Adam <Adam@anope.org> | 2012-09-07 21:22:19 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2012-09-07 21:22:19 -0400 |
commit | 4eb7db80a630df8f6e57e6e64662138f96c0c904 (patch) | |
tree | aed6431c2ec3ca582101be1080840e43b674d36f /modules/commands/os_session.cpp | |
parent | 9d6626f70ce866e2e98ce7ce607695b14a8375b7 (diff) |
Fix os_session to really use ips for quits, don't enforce session for spoofed users/other users who have no ip, clean up warnings
Diffstat (limited to 'modules/commands/os_session.cpp')
-rw-r--r-- | modules/commands/os_session.cpp | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/modules/commands/os_session.cpp b/modules/commands/os_session.cpp index 91db78da2..a1396f293 100644 --- a/modules/commands/os_session.cpp +++ b/modules/commands/os_session.cpp @@ -299,14 +299,14 @@ class CommandOSException : public Command else if (expires > 0) expires += Anope::CurTime; - int limit = -1; + unsigned limit = -1; try { - limit = convertTo<int>(limitstr); + limit = convertTo<unsigned>(limitstr); } catch (const ConvertException &) { } - if (limit < 0 || limit > static_cast<int>(Config->MaxSessionLimit)) + if (limit > Config->MaxSessionLimit) { source.Reply(_("Invalid session limit. It must be a valid integer greater than or equal to zero and less than \002%d\002."), Config->MaxSessionLimit); return; @@ -414,7 +414,7 @@ class CommandOSException : public Command } catch (const ConvertException &) { } - if (n1 >= 0 && n1 < session_service->GetExceptions().size() && n2 >= 0 && n2 < session_service->GetExceptions().size() && n1 != n2) + if (n1 >= 0 && static_cast<unsigned>(n1) < session_service->GetExceptions().size() && n2 >= 0 && static_cast<unsigned>(n2) < session_service->GetExceptions().size() && n1 != n2) { Exception *temp = session_service->GetExceptions()[n1]; session_service->GetExceptions()[n1] = session_service->GetExceptions()[n2]; @@ -607,7 +607,15 @@ class OSSession : public Module void AddSession(User *u, bool exempt) { - Session *session = this->ss.FindSession(u->ip); + Session *session; + try + { + session = this->ss.FindSession(u->ip); + } + catch (const SocketException &) + { + return; + } if (session) { @@ -669,7 +677,15 @@ class OSSession : public Module void DelSession(User *u) { - Session *session = this->ss.FindSession(u->host); + Session *session; + try + { + session = this->ss.FindSession(u->ip); + } + catch (const SocketException &) + { + return; + } if (!session) { if (debug) |