since we now calculate the time in UTC rather than local time, the time
values of each test had to be touched. those should differ by `E10`
(3600 seconds) in most cases since we set the TZ to Europe/Vienna for
the tests.
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
`expected` and `command` are more helpful than `new` and `old`.
the order of `expected` and `command` should now always be the same:
expected before command
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
for this test `faketime` is not required since the year is part of the
timestamp
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
noticed when building with sbuild, which uses UTC as timezone:
Due to the parsing of traditional syslog time information (which does
not contain timezone information) the testcases passing
unix-timestamps as arguments failed.
Explicitly setting TZ to Europe/Vienna fixes the tests (and makes the
assumption visible)
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Because of the relay before lmtp issue we now add and remove QEntrys
based on their message-id. But if the cleanup line containing the
message-id appears twice in the log for the same QEntry it keeps a weak
reference to itself which leads to a panic because of a mutable borrow
while it is already mutably borrowed in the 'finalize' function.
To circumvent this we check after the lookup if it is the same QEntry
and if so, insert it again with that message-id in the lookup table and
don't add the weak reference.
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Tested-By: Aaron Lauterer <a.lauterer@proxmox.com>
This is a best effort try to add the outgoing TLS connection information
to the output of pmg-log-tracker. The only thing we can match on is the
PID of the 'smtp' process. In the code we asumme that the TLS log entry
always happens before the actual smtp send entry that has a QID. This means
we save the TLS log entry in a map with the PID as key and then, once the
send entry happens, we look it up and add the log entry to the QEntry's
logs.
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
We only have the month, day, hours, minutes and seconds available to us,
but not the year. Because of this we assume the logs are always relative
to the current year. This means when running the log tracker the CTIME
is calculated based on the current year and once a new year starts, all
old tests have to be updated to match the new year.
To work around this issue, use 'faketime' to set the time to 2020-12-31
23:59:59 as all tests assume 2020 as the year.
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
With the rewrite from C to Rust the search string match was changed to
be case sensitive by accident. Fix this by comparing the lowercase values
of both the input and the search string.
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Messages like the following
'proxy-reject: END-OF-MESSAGE: 501 5.5.2 Syntax: MAIL FROM: <address>;'
can happen if an EHLO keyword is announced which is not handled by
pmg-smtp-filter (see #2795). This patch adds output to the log tracker
so this mail shows up as 'rejected' in the GUI instead of silently
ignoring it.
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com>
The testcase contains a mail that is accepted for one address, blocked
for another and quarantined for a third address.
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Updates the other test outputs' line numbers so the tests don't fail
because of an addition in between.
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Currently the status of a before queue filtered mail is the status of the
downstream delivery in case the downstream rejects or defers a mail.
This information is too little to distinguish between a mail which went
through the rule-system, and a locally generated one
(e.g. bounce or spamreport).
By introducing 3 new distinct dstatus values we can use the information to
correctly display the status of a mail in the GUI.
Reviewed-By: Mira Limbeck <m.limbeck@proxmox.com>
Tested-By: Mira Limbeck <m.limbeck@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
we want to show mails that were blocked by the rule-system as 'Blocked'
in the ui, so we have to use the dstatus of the to entry, and not
'NOQUEUE'
mails rejected by postscreen, etc. still show 'rejected'
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Add a before queue test case to test recipient filtering. Previously
all SEntry filter entries were printed because filtering failed. Now
test that it only prints the specified ones.
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Add tests for some command line options. Not all have a test yet, but at
least most of the ones used by the GUI (-s, -e, -q, -x). '-g' and '-n' are
currently still missing.
The tests will only be valid until end of January 31st 2021 because of
missing year info in the syslog.
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>