inspircd

A modular C++ IRC daemon (ircd). https://www.inspircd.org/
Log | Files | Refs | README

commit f87b72b76f9ef198bdbbb01f9ca409501666c6a2
parent 42c7f479b2aebdec4fd190ba06097b7c5bca42a9
Author: Matt Schatz <genius3000@g3k.solutions>
Date:   Sun, 10 Mar 2019 01:22:00 -0700

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.

Diffstat:
Msrc/xline.cpp | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 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)); } }