]> git.proxmox.com Git - pmg-log-tracker.git/log
pmg-log-tracker.git
22 months agocode cleanup: avoid some bload on match return
Thomas Lamprecht [Wed, 13 Jul 2022 09:46:19 +0000 (11:46 +0200)]
code cleanup: avoid some bload on match return

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
22 months agoclippy fixes
Thomas Lamprecht [Wed, 13 Jul 2022 09:42:00 +0000 (11:42 +0200)]
clippy fixes

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
22 months agocargo: relaxe libc dependency to minor 0.2 version
Thomas Lamprecht [Wed, 13 Jul 2022 09:35:04 +0000 (11:35 +0200)]
cargo: relaxe libc dependency to minor 0.2 version

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
22 months agocargo: update clap to 2.33
Thomas Lamprecht [Wed, 13 Jul 2022 09:34:44 +0000 (11:34 +0200)]
cargo: update clap to 2.33

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
22 months agotree wide cargo fmt
Thomas Lamprecht [Wed, 13 Jul 2022 09:30:26 +0000 (11:30 +0200)]
tree wide cargo fmt

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodrop 'time' dependency
Wolfgang Bumiller [Tue, 4 Jan 2022 13:57:23 +0000 (14:57 +0100)]
drop 'time' dependency

We're using a very old version of it and the functions we
actually use are available in glibc anyway.

The only difference I found was that the result of
glibc's `strptime()`'s `%s` does *not* want an additional
`.to_local()` call anymore...

... which was weird anyway.

As a minor optimization I pass the format string as `&CStr`
to avoid the memcpy.

(The CString::new() call in `strptime()` only happens during
parameter parsing)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
[dropped left-over and fixed FIXME]
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2 years agoadd tests for DST change and year change
Stoiko Ivanov [Wed, 9 Feb 2022 11:31:58 +0000 (12:31 +0100)]
add tests for DST change and year change

based on our outbound production logs but anonymized

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2 years agobuildsys: fix reference to DBG_DEB
Thomas Lamprecht [Tue, 1 Feb 2022 13:06:28 +0000 (14:06 +0100)]
buildsys: fix reference to DBG_DEB

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobuildsys: use only one parenthesis style
Thomas Lamprecht [Tue, 1 Feb 2022 13:06:11 +0000 (14:06 +0100)]
buildsys: use only one parenthesis style

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 2.3.1-1
Thomas Lamprecht [Tue, 1 Feb 2022 12:32:06 +0000 (13:32 +0100)]
bump version to 2.3.1-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofix logfile counting in months != january
Stoiko Ivanov [Tue, 1 Feb 2022 09:48:52 +0000 (10:48 +0100)]
fix logfile counting in months != january

the changes introduced in 1cdbebe57b2ddc255db240d7dbaf2165c482986d

changed the date handling to have current_month and current_year
represent the month and year at time of invocation.
This change was not carried over to the logfile collecting, which set
the current month to january.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Mira Limbeck <m.limbeck@proxmox.com>
2 years agobump d/control
Wolfgang Bumiller [Tue, 4 Jan 2022 15:02:18 +0000 (16:02 +0100)]
bump d/control

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agobump version to 2.3.0-1
Wolfgang Bumiller [Tue, 4 Jan 2022 14:55:53 +0000 (15:55 +0100)]
bump version to 2.3.0-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agostick to time_t for time
Wolfgang Bumiller [Mon, 3 Jan 2022 14:02:14 +0000 (15:02 +0100)]
stick to time_t for time

especially those u32 conversions are simply completely wrong

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Stoiko Ivanov <s.ivanov@proxmox.com>
[rebased]
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2 years agodo not assume constant year based on file index
Stoiko Ivanov [Mon, 3 Jan 2022 16:09:54 +0000 (17:09 +0100)]
do not assume constant year based on file index

rather start with the current time at invocation and if the month in
the log is larger assume a year-wrap happened between logwriting and
invocation.

the old logic is flawed (but that can be said about parsing
traditional syslog timestamps (w/o year) in general) - it got worse
with the change in bullseye of rotating syslog weekly by default -
resulting in users losing one week of logs per day in the new year as
reported in https://forum.proxmox.com/threads/.102322/

Reviewed-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2 years agoadd .gitignore file
Wolfgang Bumiller [Mon, 3 Jan 2022 13:56:08 +0000 (14:56 +0100)]
add .gitignore file

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agobump edition to 2021
Wolfgang Bumiller [Mon, 3 Jan 2022 12:22:12 +0000 (13:22 +0100)]
bump edition to 2021

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoswitch to anyhow, don't use old style imports
Wolfgang Bumiller [Mon, 3 Jan 2022 12:21:13 +0000 (13:21 +0100)]
switch to anyhow, don't use old style imports

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoclippy fixups
Wolfgang Bumiller [Mon, 3 Jan 2022 10:45:59 +0000 (11:45 +0100)]
clippy fixups

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoadd test for empty to (dnsbl reject)
Stoiko Ivanov [Wed, 1 Dec 2021 18:02:30 +0000 (19:02 +0100)]
add test for empty to (dnsbl reject)

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2 years agofix #3758: fix `to` filter with empty NoqueueEntry `to` field
Mira Limbeck [Wed, 1 Dec 2021 15:41:57 +0000 (16:41 +0100)]
fix #3758: fix `to` filter with empty NoqueueEntry `to` field

We only compared the filter `to` with the Noqueue `to` when both were
not empty, and in turn set the nq.dstatus to DStatus::Invalid when they
didn't match.
But in the case of an empty Noqueue `to`, we have to skip it as well if
the filter `to` is not empty.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2 years agodebcargo: track updates
Thomas Lamprecht [Mon, 28 Jun 2021 15:04:06 +0000 (17:04 +0200)]
debcargo: track updates

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobuildsys: upload to bullseye
Thomas Lamprecht [Mon, 28 Jun 2021 15:00:36 +0000 (17:00 +0200)]
buildsys: upload to bullseye

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 2.2.0-1
Thomas Lamprecht [Tue, 11 May 2021 14:01:43 +0000 (16:01 +0200)]
bump version to 2.2.0-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix mutable borrow panic on duplicate msgid
Mira Limbeck [Thu, 29 Apr 2021 13:25:08 +0000 (15:25 +0200)]
fix mutable borrow panic on duplicate msgid

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>
3 years agocargo: more flexible versioned dependencies
Thomas Lamprecht [Wed, 24 Mar 2021 11:15:03 +0000 (12:15 +0100)]
cargo: more flexible versioned dependencies

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agod/cargo: use HTTPs for homepage
Thomas Lamprecht [Wed, 24 Mar 2021 11:10:26 +0000 (12:10 +0100)]
d/cargo: use HTTPs for homepage

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 2.1.9-1
Thomas Lamprecht [Wed, 24 Mar 2021 11:08:23 +0000 (12:08 +0100)]
bump version to 2.1.9-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 2.1.9-1
Stoiko Ivanov [Wed, 24 Mar 2021 10:49:58 +0000 (11:49 +0100)]
bump version to 2.1.9-1

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agoadd test case for relay removed before lmtp
Mira Limbeck [Tue, 23 Mar 2021 14:28:23 +0000 (15:28 +0100)]
add test case for relay removed before lmtp

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
3 years agoafter-queue: fix wrong DStatus if relay is 'removed' before 'lmtp' line
Mira Limbeck [Tue, 23 Mar 2021 14:28:22 +0000 (15:28 +0100)]
after-queue: fix wrong DStatus if relay is 'removed' before 'lmtp' line

We only match a QEntry with the relay Qentry in the after-queue case
when we get to the 'lmtp' line. This is because it contains a reference
from the first QEntry to the filter, and the filter contains a reference
to the relay QEntry.

If the relay log entries are finished before the 'lmtp' line, there's no
way to match the relay to the first QEntry and we still assume it is
before-queue filtered.

To fix this we try to match the QEntries via message-id and add weak
references to each other. Then we wait with finalizing either until the
other is also 'removed' (finished).

The message-id matching might break if the same message-id is used for
different entries, so this is rather a 'hack' than a nice solution, but
there's no other info in the logs we could use to match both QEntries.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
3 years agoclose #2106: show outgoing TLS connection in tracking center
Mira Limbeck [Tue, 23 Mar 2021 11:05:31 +0000 (12:05 +0100)]
close #2106: show outgoing TLS connection in tracking center

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>
3 years agochange tests to use faketime
Mira Limbeck [Mon, 22 Mar 2021 13:06:18 +0000 (14:06 +0100)]
change tests to use faketime

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>
3 years agodebcargo: fix maintainer directive
Fabian Grünbichler [Mon, 1 Feb 2021 10:22:56 +0000 (11:22 +0100)]
debcargo: fix maintainer directive

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agobuild: track d/control
Fabian Grünbichler [Wed, 2 Dec 2020 12:18:52 +0000 (13:18 +0100)]
build: track d/control

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agobump version to 2.1.8-1
Thomas Lamprecht [Wed, 18 Nov 2020 18:29:27 +0000 (19:29 +0100)]
bump version to 2.1.8-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agochange case sensitive string match to case insensitive
Mira Limbeck [Mon, 9 Nov 2020 14:18:46 +0000 (15:18 +0100)]
change case sensitive string match to case insensitive

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>
3 years agobump version to 2.1.7-1
Thomas Lamprecht [Thu, 3 Sep 2020 15:41:46 +0000 (17:41 +0200)]
bump version to 2.1.7-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoadd output for proxy-reject with 'Syntax:' message
Mira Limbeck [Fri, 28 Aug 2020 10:19:51 +0000 (12:19 +0200)]
add output for proxy-reject with 'Syntax:' message

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>
3 years agoparse_number: prevent panic on empty input
Fabian Grünbichler [Wed, 10 Jun 2020 13:22:53 +0000 (15:22 +0200)]
parse_number: prevent panic on empty input

if data is empty or the caller requested 0 digits, we can return early.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoparse_time: prevent panic on truncated input
Fabian Grünbichler [Wed, 10 Jun 2020 13:22:52 +0000 (15:22 +0200)]
parse_time: prevent panic on truncated input

'advancing' a slice by one is only a good idea if there is more data.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agobump version to 2.1.6-1
Thomas Lamprecht [Tue, 19 May 2020 16:05:02 +0000 (18:05 +0200)]
bump version to 2.1.6-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoadd testcase for mixed '-t' and '-x' options in before-queue filtering
Mira Limbeck [Tue, 19 May 2020 13:31:07 +0000 (15:31 +0200)]
add testcase for mixed '-t' and '-x' options in before-queue filtering

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
4 years agofix ToEntrys in FEntrys not being considered for 'to' filtering
Mira Limbeck [Tue, 19 May 2020 13:31:06 +0000 (15:31 +0200)]
fix ToEntrys in FEntrys not being considered for 'to' filtering

When a 'to' filter is specified and a mail has multiple 'to's with at
least one being accepted, the others blocked or quarantined and the
'to' for the accepted mail does not match, the entries in the filter
will be ignored even if one of them would match.
To fix it the filter ToEntrys are now considered in the 'to' check.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
4 years agofix before-queue filter string_match check
Mira Limbeck [Tue, 19 May 2020 13:31:05 +0000 (15:31 +0200)]
fix before-queue filter string_match check

In before-queue filtering a filter can be set on the SEntry. When a
search-string is set, we have to check both the SEntry and the attached
filter for a match, not just the SEntry. Otherwise some entries are not shown.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
4 years agoadd testcase for accepted/blocked/quarantined mail
Mira Limbeck [Fri, 15 May 2020 14:49:06 +0000 (16:49 +0200)]
add testcase for accepted/blocked/quarantined mail

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>
4 years agoprint blocked/quarantined entries if accepted mail exists
Mira Limbeck [Fri, 15 May 2020 14:49:05 +0000 (16:49 +0200)]
print blocked/quarantined entries if accepted mail exists

In the case of before-queue filtering we have the separation 'QEntry'
for accepted mails, as those are the only ones with a queue. And
'SEntry' for blocked and quarantined mails. But if a mail is accepted
for one address, but at the same time blocked or quarantined for another
address we previously discarded those entries. To fix it we now print it
in the 'QEntry' if the attached filter contains blocked and/or
quarantined mails.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
4 years agomake QID parsing more robust
Mira Limbeck [Fri, 15 May 2020 14:49:04 +0000 (16:49 +0200)]
make QID parsing more robust

As a user had the problem that 'fa' of 'fatal' matched for a QID,
increase the number of characters that have to match. The QID always has
at least 5 characters for the microseconds, so increase it to 5.

See http://www.postfix.org/postconf.5.html#enable_long_queue_ids

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
4 years agobump version to 2.1.5-1
Thomas Lamprecht [Thu, 14 May 2020 15:34:02 +0000 (17:34 +0200)]
bump version to 2.1.5-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agodebcargo: add vcs links
Thomas Lamprecht [Wed, 6 May 2020 12:17:11 +0000 (14:17 +0200)]
debcargo: add vcs links

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoadd test case for 'from' and 'to' together
Mira Limbeck [Fri, 24 Apr 2020 15:21:50 +0000 (17:21 +0200)]
add test case for 'from' and 'to' together

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>
4 years agoadd test for before queue dstatus
Stoiko Ivanov [Thu, 30 Apr 2020 15:01:50 +0000 (17:01 +0200)]
add test for before queue dstatus

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>
4 years agoIntroduce before queue dstatus
Stoiko Ivanov [Thu, 30 Apr 2020 15:01:49 +0000 (17:01 +0200)]
Introduce before queue dstatus

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>
4 years agobump version to 2.1.4-1
Thomas Lamprecht [Fri, 24 Apr 2020 17:29:11 +0000 (19:29 +0200)]
bump version to 2.1.4-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofix from entries being shown even with a from filter
Mira Limbeck [Fri, 24 Apr 2020 15:21:49 +0000 (17:21 +0200)]
fix from entries being shown even with a from filter

When a 'from' and 'to' filter were set, we used a 'from || to' test to
see if we should print it or not. This patch changes this to a 'from &&
to' test. This gets rid of entries from unrelated senders ('from') when
a 'from filter did not match but the 'to' filter matched.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
4 years agobump version to 2.1.3-1
Thomas Lamprecht [Fri, 24 Apr 2020 10:17:21 +0000 (12:17 +0200)]
bump version to 2.1.3-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobefore-queue: set 'B' status for rule-system blocked mails
Dominik Csapak [Fri, 24 Apr 2020 09:26:50 +0000 (11:26 +0200)]
before-queue: set 'B' status for rule-system blocked mails

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>
4 years agoset dist to buster in upload target
Wolfgang Bumiller [Mon, 6 Apr 2020 10:23:15 +0000 (12:23 +0200)]
set dist to buster in upload target

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agouse -X in upload
Wolfgang Bumiller [Mon, 6 Apr 2020 10:16:46 +0000 (12:16 +0200)]
use -X in upload

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump version to 2.1.2-1
Wolfgang Bumiller [Mon, 6 Apr 2020 10:08:10 +0000 (12:08 +0200)]
bump version to 2.1.2-1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoadd a test case for recipient filtering
Mira Limbeck [Thu, 2 Apr 2020 14:57:14 +0000 (16:57 +0200)]
add a test case for recipient filtering

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>
4 years agofix wrong order of arguments
Mira Limbeck [Thu, 2 Apr 2020 14:57:13 +0000 (16:57 +0200)]
fix wrong order of arguments

This fixes the output in the case of a failed assert. Exptected and
Command were swapped.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
4 years agofix filter_matches() if condition
Mira Limbeck [Thu, 2 Apr 2020 14:57:12 +0000 (16:57 +0200)]
fix filter_matches() if condition

We need to check the filter entries when either the 'from' or 'to'
options are set. Also remove the && is_filtered as it is superfluous.

The !is_filtered check lead to all filter entries being printed all the
time.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
4 years agobump version to 2.1.1-1
Thomas Lamprecht [Tue, 24 Mar 2020 11:34:46 +0000 (12:34 +0100)]
bump version to 2.1.1-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoadd test for the exclude_greylist fix
Mira Limbeck [Fri, 20 Mar 2020 12:08:29 +0000 (13:08 +0100)]
add test for the exclude_greylist fix

This tests the before queue case with both '-g' and 'n' options set.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
4 years agofix SEntry filter in before-queue case
Mira Limbeck [Fri, 20 Mar 2020 12:08:28 +0000 (13:08 +0100)]
fix SEntry filter in before-queue case

With before-queue filtering if we don't accept the mail (e.g.
quarantine), we don't have a queue which means we don't have a QEntry,
so the SEntry has to handle the filter entries (ToEntrys).

This means we can't just return from print() when either a 'from' or 'to'
filter is set or we exclude greylist entries or NDRs and no Noqueue entries
exist or no entry matches any of the filters.

So continue printing if there is no filter parameter set, but an FEntry
reference in the SEntry. If there's an FEntry reference, compare all ToEntrys
to the filter parameter and return if there is no match at all.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
4 years agoadd filter() and qentry() helper methods
Mira Limbeck [Fri, 20 Mar 2020 12:08:27 +0000 (13:08 +0100)]
add filter() and qentry() helper methods

This simplifies access to the structs by cloning and then upgrading them
if possible and returning an Option<Rc<>> instead of an Option<Weak<>>.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
4 years agobuildsys: clean more
Thomas Lamprecht [Mon, 9 Mar 2020 13:20:21 +0000 (14:20 +0100)]
buildsys: clean more

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobuildsys: drop writing rust-toolchain into build dir
Thomas Lamprecht [Mon, 9 Mar 2020 13:14:12 +0000 (14:14 +0100)]
buildsys: drop writing rust-toolchain into build dir

breaks source package generation

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobuildsys: add rust- prefix to dsc name
Thomas Lamprecht [Mon, 9 Mar 2020 13:13:24 +0000 (14:13 +0100)]
buildsys: add rust- prefix to dsc name

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years ago2.1.0-1 build commit
Wolfgang Bumiller [Fri, 28 Feb 2020 11:50:50 +0000 (12:50 +0100)]
2.1.0-1 build commit

The actual package was built after the packaging cleanup.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agopackaging cleanup
Fabian Grünbichler [Fri, 28 Feb 2020 10:58:09 +0000 (11:58 +0100)]
packaging cleanup

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agobump version to 2.1.0-1
Wolfgang Bumiller [Fri, 28 Feb 2020 08:34:09 +0000 (09:34 +0100)]
bump version to 2.1.0-1

note that the source package now has a rust- prefix

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoswitch to using debcargo
Wolfgang Bumiller [Fri, 28 Feb 2020 08:30:47 +0000 (09:30 +0100)]
switch to using debcargo

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoCargo.toml: add license, description, homepage and excludes
Wolfgang Bumiller [Fri, 28 Feb 2020 08:34:03 +0000 (09:34 +0100)]
Cargo.toml: add license, description, homepage and excludes

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoadd .cargo/config and rustfmt.toml
Wolfgang Bumiller [Fri, 28 Feb 2020 08:22:15 +0000 (09:22 +0100)]
add .cargo/config and rustfmt.toml

.cargo/config since we build with debian packages as
dependencies by default

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoadd tests
Mira Limbeck [Tue, 18 Feb 2020 15:36:39 +0000 (16:36 +0100)]
add tests

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>
4 years agoadd before queue filter support
Mira Limbeck [Tue, 18 Feb 2020 15:36:38 +0000 (16:36 +0100)]
add before queue filter support

Initial before queue filter support. Requires a patch to pmg-api to add
the pmg-smtp-filter ID to the replies on a reject to correctly match the
pmg-smtp-filter to the smtpd.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoremove C source code
Mira Limbeck [Tue, 18 Feb 2020 15:36:37 +0000 (16:36 +0100)]
remove C source code

Remove src/pmg-log-tracker.c and src/Makefile as they are no longer
required.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agorewrite in rust
Mira Limbeck [Tue, 18 Feb 2020 15:36:36 +0000 (16:36 +0100)]
rewrite in rust

pmg-log-tracker has been rewritten in Rust. Functionality is the same.
Output sometimes has a different order than the pmg-log-tracker in C.
This only happens when the time of the entries match.

There's one change regarding the interface. In addition to the short
versions of arguments also long versions exist.

The implementation uses Rc<>, Weak<> and RefCell<> to make holding mutable
cross-references possible, without having to change the original logic
completely. This allowed for easier translation from C to Rust.

The file debian/cargo-checksum.json is required by dh-cargo, otherwise
it won't compile. The cargo-checksum.json should contain the upstream
.crate file which does not exist in this case, so we just create an
empty one with the required keys. (see 'Library package structure' in
https://wiki.debian.org/Teams/RustPackaging/Policy)

The change to the minimum version of debhelper required was done
according to other rust packages (rust-clap, rust-bindgen, rust-ripgrep).

Adds a README that provides an overview of the stages a mail passes
through and what we can use to match those together for a single mail.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump version to 2.0-1
Thomas Lamprecht [Mon, 22 Jul 2019 13:30:48 +0000 (15:30 +0200)]
bump version to 2.0-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobump version to 1.0-2
Thomas Lamprecht [Mon, 22 Jul 2019 06:34:32 +0000 (08:34 +0200)]
bump version to 1.0-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agorework build and packaging, add debian source package
Thomas Lamprecht [Mon, 22 Jul 2019 06:28:27 +0000 (08:28 +0200)]
rework build and packaging, add debian source package

diffoscope shows that the only real changes is the new SOURCE file we
ship in docs, like other packages.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 years agofix trailing whitespace
Dominik Csapak [Thu, 21 Feb 2019 08:42:07 +0000 (09:42 +0100)]
fix trailing whitespace

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
5 years agoreplace static const int with #define
Dominik Csapak [Thu, 21 Feb 2019 08:42:06 +0000 (09:42 +0100)]
replace static const int with #define

using a static const int as array size is technically a
variable length array, so we should not use it that way

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
5 years agoremove unused parameters
Dominik Csapak [Thu, 21 Feb 2019 08:42:05 +0000 (09:42 +0100)]
remove unused parameters

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
5 years agominor type fixes
Dominik Csapak [Thu, 21 Feb 2019 08:42:04 +0000 (09:42 +0100)]
minor type fixes

log->linenr is an unsigned long, we want to log it as a whole
mygzgetc returns a char anyway so change it to reflect that

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
5 years agouse less magic numbers
Dominik Csapak [Thu, 21 Feb 2019 08:42:03 +0000 (09:42 +0100)]
use less magic numbers

use #defines or characters instead

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
5 years agofix csum calculation and update checksums
Dominik Csapak [Thu, 21 Feb 2019 08:42:02 +0000 (09:42 +0100)]
fix csum calculation and update checksums

it was intended to be a rol instead of a simple left shift which changes the
checksums for the various programs (like 'proxprox', 'postfix/postscreen',
etc.) so we update those and use defines instead of the hardcoded hex values.
this makes it much more readable and less error prone

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
5 years agoadd -i option for specifying an external file
Dominik Csapak [Thu, 21 Feb 2019 08:42:01 +0000 (09:42 +0100)]
add -i option for specifying an external file

where '-' is stdin

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
5 years agoremove unused -I parameter
Dominik Csapak [Thu, 21 Feb 2019 08:42:00 +0000 (09:42 +0100)]
remove unused -I parameter

it was neither documented nor in use

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
6 years agofix upload target (--product pmg)
Dietmar Maurer [Thu, 21 Sep 2017 09:58:03 +0000 (11:58 +0200)]
fix upload target (--product pmg)

6 years agoavoid compiler warnings
Dietmar Maurer [Thu, 21 Sep 2017 09:53:42 +0000 (11:53 +0200)]
avoid compiler warnings

6 years agouse CLIENT instead of CONNECT
Dietmar Maurer [Wed, 20 Sep 2017 07:54:45 +0000 (09:54 +0200)]
use CLIENT instead of CONNECT

6 years agoonly print CONNECT if we do not have a CLIENT
Dietmar Maurer [Wed, 20 Sep 2017 07:51:04 +0000 (09:51 +0200)]
only print CONNECT if we do not have a CLIENT

6 years agoprint smtp connect for qentry
Dietmar Maurer [Wed, 20 Sep 2017 06:14:53 +0000 (08:14 +0200)]
print smtp connect for qentry

6 years agolog smtp entries with ID - "SMTP: <ID>"
Dietmar Maurer [Wed, 20 Sep 2017 06:07:15 +0000 (08:07 +0200)]
log smtp entries with ID -  "SMTP: <ID>"

6 years agoimprove usage info
Dietmar Maurer [Wed, 20 Sep 2017 06:05:10 +0000 (08:05 +0200)]
improve usage info

6 years agocorrectly print newlines to separate entries
Dietmar Maurer [Mon, 18 Sep 2017 09:50:52 +0000 (11:50 +0200)]
correctly print newlines to separate entries

6 years agoallow to match smtp entries by time and rel_line_nr, allow multiple '-q' options
Dietmar Maurer [Mon, 18 Sep 2017 06:55:32 +0000 (08:55 +0200)]
allow to match smtp entries by time and rel_line_nr, allow multiple '-q' options

Note: SMTP only entries do not have a valid qmgr ID