regex change to exclude comma from sasl_username (#2074)

as proposed in #2071 by @jvolkenant
This commit is contained in:
Arno Hautala 2021-12-19 08:33:59 -05:00 committed by github@kiekerjan.isdronken.nl
parent 2f86aa4eee
commit 464c36ee3d
1 changed files with 3 additions and 2 deletions

View File

@ -549,8 +549,9 @@ def scan_postfix_submission_line(date, log, collector):
"""
# Match both the 'plain' and 'login' sasl methods, since both authentication methods are
# allowed by Dovecot
m = re.match("([A-Z0-9]+): client=(\S+), sasl_method=(PLAIN|LOGIN), sasl_username=(\S+)", log)
# allowed by Dovecot. Exclude trailing comma after the username when additional fields
# follow after.
m = re.match("([A-Z0-9]+): client=(\S+), sasl_method=(PLAIN|LOGIN), sasl_username=(\S+)(?<!,)", log)
if m:
_, client, method, user = m.groups()