]> 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 01:20:20 +0000 (18:20 -0700)
committerPeter Powell <petpow@saberuk.com>
Sun, 10 Mar 2019 18:00:01 +0000 (18:00 +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 586c7342ac2197094cdb947316627adc5a11875e..ba8a446e3d956b7848f079aa1a807f232bb1fd59 100644 (file)
@@ -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);
        }