summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaroslav Halchenko <debian@onerussian.com>2012-01-28 12:39:17 -0500
committerYaroslav Halchenko <debian@onerussian.com>2012-01-28 12:44:51 -0500
commitdcc35a0fab1941eaadf20bab59e55ca865cb59f3 (patch)
treed8cc80ffd3094ab13539c8501d23cb1195ada603
parentb257be4cd1832916aa170d85a38c4a69747f991e (diff)
downloadfail2ban-_tent/robust_datematching.tar.gz
comments/notes on relevant places_tent/robust_datematching
-rw-r--r--server/datedetector.py9
-rw-r--r--server/datetemplate.py5
2 files changed, 14 insertions, 0 deletions
diff --git a/server/datedetector.py b/server/datedetector.py
index 7301ec91..48499596 100644
--- a/server/datedetector.py
+++ b/server/datedetector.py
@@ -167,6 +167,15 @@ class DateDetector:
def getTime(self, line):
self.__lock.acquire()
try:
+ # TODO: collect all matches and choose the one most
+ # appropriate
+ # TODO (OPT): make it smarter and converging
+ # on 1 specific pattern for each jail/file
+ # so we don't need to cycle all over again and again
+ # wasting cpu cycles and possibly confusing multiple
+ # matching patterns (might need to be an option, if
+ # someone wants to monitor some file without strict
+ # date pattern -- are there such?)
for template in self.__templates:
try:
date = template.getDate(line)
diff --git a/server/datetemplate.py b/server/datetemplate.py
index f663862e..45aa1288 100644
--- a/server/datetemplate.py
+++ b/server/datetemplate.py
@@ -61,7 +61,12 @@ class DateTemplate:
return self.__hits
def matchDate(self, line):
+ # TODO be more aggressive and match optional ms
dateMatch = self.__cRegex.search(line)
+ # XXX also now for each matching dateline it would be
+ # invoked twice since in filter.py:284 processLine
+ # it first matches time to discover its string location
+ # and then it processes it to obtain actual time
if not dateMatch == None:
self.__hits += 1
return dateMatch