]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Fix BanCache entries existing after X-line expiry.
authorMatt Schatz <genius3000@g3k.solutions>
Sun, 10 Mar 2019 08:22:00 +0000 (01:22 -0700)
committerPeter Powell <petpow@saberuk.com>
Sun, 10 Mar 2019 10:27:12 +0000 (10:27 +0000)
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

index fbb4f0c8b47aeb6045e77b56f74e979c5b83378d..bf61d76ea480b63cc0689baa7ab2ad830926245e 100644 (file)
@@ -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));
        }
 }