From 747d4683221b5584f9663695fb48145689b42ceb Mon Sep 17 00:00:00 2001 From: sebres Date: Mon, 4 Jan 2021 02:42:38 +0100 Subject: [PATCH] fixes century selector of %ExY and %Exy in datepattern for tests, considering interval from 2005 (alternate now) to now; + better grouping algorithm for resulting century RE --- fail2ban/server/strptime.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/fail2ban/server/strptime.py b/fail2ban/server/strptime.py index 1464a96d1f..39fc795865 100644 --- a/fail2ban/server/strptime.py +++ b/fail2ban/server/strptime.py @@ -36,10 +36,30 @@ def _getYearCentRE(cent=(0,3), distance=3, now=(MyTime.now(), MyTime.alternateNo Thereby respect possible run in the test-cases (alternate date used there) """ cent = lambda year, f=cent[0], t=cent[1]: str(year)[f:t] + def grp(exprset): + c = None + if len(exprset) > 1: + for i in exprset: + if c is None or i[0:-1] == c: + c = i[0:-1] + else: + c = None + break + if not c: + for i in exprset: + if c is None or i[0] == c: + c = i[0] + else: + c = None + break + if c: + return "%s%s" % (c, grp([i[len(c):] for i in exprset])) + return ("(?:%s)" % "|".join(exprset) if len(exprset[0]) > 1 else "[%s]" % "".join(exprset)) \ + if len(exprset) > 1 else "".join(exprset) exprset = set( cent(now[0].year + i) for i in (-1, distance) ) if len(now) and now[1]: - exprset |= set( cent(now[1].year + i) for i in (-1, distance) ) - return "(?:%s)" % "|".join(exprset) if len(exprset) > 1 else "".join(exprset) + exprset |= set( cent(now[1].year + i) for i in xrange(-1, now[0].year-now[1].year+1, distance) ) + return grp(sorted(list(exprset))) timeRE = TimeRE() /option>
path: root/gnu/machine
AgeCommit message (Expand)Author
2020-03-23machine: ssh: Better report missing initrd modules....* gnu/machine/ssh.scm (machine-check-initrd-modules): Improve message upon module mismatch. Ludovic Courtès
2020-03-23machine: ssh: Make sanity checks in a single round trip....* gnu/machine/ssh.scm (<remote-assertion>): New record type. (remote-let): New macro. (machine-check-file-system-availability): Rewrite to use 'remote-let' instead of 'mlet' and 'machine-remote-eval'. (machine-check-initrd-modules): Likewise. (machine-check-building-for-appropriate-system): Make non-monadic. (check-deployment-sanity): Rewrite to gather all the assertions as a single gexp and pass it to 'machine-remote-eval'. Ludovic Courtès
2020-02-09Update e-mail address for Jakob L. Kreuze....As requested here: <https://lists.gnu.org/archive/html/guix-devel/2020-02/msg00128.html>. * .mailmap: Add an entry for Jakob. * gnu/machine.scm, gnu/machine/digital-ocean.scm, gnu/machine/ssh.scm, gnu/packages/admin.scm, gnu/packages/i2p.scm, gnu/packages/music.scm, gnu/packages/web.scm, gnu/tests/reconfigure.scm, guix/scripts/deploy.scm, guix/scripts/system/reconfigure.scm: Update their e-mail address. Tobias Geerinckx-Rice
2019-12-08machine: Remove unnecessary record self-referencing bindings....'this-machine' and 'this-machine-ssh-configuration' were useless given that there are no thunked fields. * gnu/machine.scm (<machine>)[this-machine]: Remove. * gnu/machine/ssh.scm (<machine-ssh-configuration>) [this-machine-ssh-configuration]: Remove. Ludovic Courtès
2019-12-07machine: ssh: Deprecate missing 'host-key' field....* gnu/machine/ssh.scm (machine-ssh-session): Warn about missing host key. Ludovic Courtès
2019-12-04machine: ssh: <machine-ssh-configuration> can include the host key....* gnu/machine/ssh.scm (<machine-ssh-configuration>)[host-key]: New field. (machine-ssh-session): Pass #:host-key to 'open-ssh-session'. * doc/guix.texi (Invoking guix deploy): Document it. Ludovic Courtès
2019-10-22machine: digital-ocean: Rename 'enable-ipv6' to 'enable-ipv6?'....* gnu/machine/digital-ocean.scm (<digital-ocean-configuration>)[enable-ipv6]: Rename to... [enable-ipv6?]: ... this. (deploy-digital-ocean): Adjust accordingly. * doc/guix.texi (Invoking guix deploy): Adjust accordingly. Ludovic Courtès
2019-10-22machine: Implement 'digital-ocean-environment-type'....* gnu/machine/digital-ocean.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * doc/guix.texi (Invoking guix deploy): Add documentation for 'digital-ocean-configuration'. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Jakob L. Kreuze