Fixes #682 - mail log parsing regex character group

The mail log parsing regex was incorrectly using a character group of `\A`
This commit is contained in:
Christian Schiffler
2019-05-13 19:53:55 +02:00
committed by GitHub
parent 72016a5735
commit e2d69c664a

View File

@@ -101,13 +101,13 @@ class MailLogParser
$timestamp = $this->getLogTimestamp($line); $timestamp = $this->getLogTimestamp($line);
if ($this->startTime < $timestamp) { if ($this->startTime < $timestamp) {
if (preg_match("/postfix\/qmgr.*(?::|\])\s([A-Z\d]+).*from=<?(?:.*\@([a-z\A-Z\d\.\-]+))?>?, size=(\d+),/", $line, $matches)) { if (preg_match("/postfix\/qmgr.*(?::|\])\s([A-Z\d]+).*from=<?(?:.*\@([a-zA-Z\d\.\-]+))?>?, size=(\d+),/", $line, $matches)) {
// Postfix from // Postfix from
$this->mails[$matches[1]] = array( $this->mails[$matches[1]] = array(
"domainFrom" => strtolower($matches[2]), "domainFrom" => strtolower($matches[2]),
"size" => $matches[3] "size" => $matches[3]
); );
} elseif (preg_match("/postfix\/(?:pipe|smtp).*(?::|\])\s([A-Z\d]+).*to=<?(?:.*\@([a-z\A-Z\d\.\-]+))?>?,/", $line, $matches)) { } elseif (preg_match("/postfix\/(?:pipe|smtp).*(?::|\])\s([A-Z\d]+).*to=<?(?:.*\@([a-zA-Z\d\.\-]+))?>?,/", $line, $matches)) {
// Postfix to // Postfix to
if (array_key_exists($matches[1], $this->mails)) { if (array_key_exists($matches[1], $this->mails)) {
$this->mails[$matches[1]]["domainTo"] = strtolower($matches[2]); $this->mails[$matches[1]]["domainTo"] = strtolower($matches[2]);