From 95c5aa91953db978879ec21c236a871257fe7036 Mon Sep 17 00:00:00 2001 From: Matt Schatz Date: Sat, 9 Mar 2019 18:20:20 -0700 Subject: Fix BanCache entries existing after X-line expiry. When DefaultApply() adds a hit to the BanCache it uses the X-line duration to set a duration on the entry. This can result in an entry lasting longer than the X-line itself. Fix this by setting the entry duration to the time left on the X-line. --- src/xline.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/xline.cpp b/src/xline.cpp index 586c7342a..ba8a446e3 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -541,7 +541,7 @@ void XLine::DefaultApply(User* u, const std::string &line, bool bancache) { ServerInstance->Logs->Log("BANCACHE", DEBUG, "BanCache: Adding positive hit (" + line + ") for " + u->GetIPString()); if (this->duration > 0) - ServerInstance->BanCache->AddHit(u->GetIPString(), this->type, line + "-Lined: " + this->reason, this->duration); + ServerInstance->BanCache->AddHit(u->GetIPString(), this->type, line + "-Lined: " + this->reason, (this->expiry - ServerInstance->Time())); else ServerInstance->BanCache->AddHit(u->GetIPString(), this->type, line + "-Lined: " + this->reason); } -- cgit v1.2.3