summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatt Schatz <genius3000@g3k.solutions>2019-03-09 18:20:20 -0700
committerPeter Powell <petpow@saberuk.com>2019-03-10 18:00:01 +0000
commit95c5aa91953db978879ec21c236a871257fe7036 (patch)
tree7474acac0c2e2d1228e1fa807d36308923ca3225 /src
parent6fb7354568807d444ab2f8d28d352cc1de993a8b (diff)
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 (limited to 'src')
-rw-r--r--src/xline.cpp2
1 files changed, 1 insertions, 1 deletions
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);
}