]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Fix expired xlines being treated as live ones in XLineManager::AddLine()
authorattilamolnar <attilamolnar@hush.com>
Wed, 5 Dec 2012 18:59:34 +0000 (19:59 +0100)
committerattilamolnar <attilamolnar@hush.com>
Wed, 5 Dec 2012 20:47:54 +0000 (21:47 +0100)
This fixes ADDLINEs not being propagated and /gline etc. failing for already existing but expired xlines

Special thanks to @JDowny (TinMan) for his detailed report and cooperation that made this fix possible

Fixes #306 reported by @TurkDesk
Fixes #379 reported by @JDowny

src/xline.cpp

index 6501a7f6d921c239e5950298186205d6e431dac4..66d24f439a6b12b600033a17bf40ef3b72ba6efd 100644 (file)
@@ -262,7 +262,12 @@ bool XLineManager::AddLine(XLine* line, User* user)
                LookupIter i = x->second.find(line->Displayable());
                if (i != x->second.end())
                {
-                       return false;
+                       // XLine propagation bug was here, if the line to be added already exists and
+                       // it's expired then expire it and add the new one instead of returning false
+                       if ((!i->second->duration) || (ServerInstance->Time() < i->second->expiry))
+                               return false;
+
+                       ExpireLine(x, i);
                }
        }