From f87b72b76f9ef198bdbbb01f9ca409501666c6a2 Mon Sep 17 00:00:00 2001 From: Matt Schatz Date: Sun, 10 Mar 2019 01:22:00 -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(-) diff --git a/src/xline.cpp b/src/xline.cpp index fbb4f0c8b..bf61d76ea 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -560,7 +560,7 @@ void XLine::DefaultApply(User* u, const std::string &line, bool bancache) if (bancache) { ServerInstance->Logs->Log("BANCACHE", LOG_DEBUG, "BanCache: Adding positive hit (" + line + ") for " + u->GetIPString()); - ServerInstance->BanCache.AddHit(u->GetIPString(), this->type, banReason, this->duration); + ServerInstance->BanCache.AddHit(u->GetIPString(), this->type, banReason, (this->duration > 0 ? (this->expiry - ServerInstance->Time()) : 0)); } } -- cgit v1.2.3