Commit Graph

155 Commits

Author SHA1 Message Date
Mira Limbeck
5dc82f8ed2 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>
2020-03-24 11:40:15 +01:00
Mira Limbeck
00b849aeb0 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>
2020-03-24 11:40:07 +01:00
Thomas Lamprecht
813c465711 buildsys: clean more
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-03-09 14:20:21 +01:00
Thomas Lamprecht
5c49ce005f buildsys: drop writing rust-toolchain into build dir
breaks source package generation

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-03-09 14:14:14 +01:00
Thomas Lamprecht
0594496c8e buildsys: add rust- prefix to dsc name
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-03-09 14:13:24 +01:00
Wolfgang Bumiller
21dac5056e 2.1.0-1 build commit
The actual package was built after the packaging cleanup.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-02-28 12:51:04 +01:00
Fabian Grünbichler
abd7fe2d82 packaging cleanup
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-02-28 11:58:09 +01:00
Wolfgang Bumiller
0fff9ce39f 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>
2020-02-28 09:44:21 +01:00
Wolfgang Bumiller
e029c60dff switch to using debcargo
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-02-28 09:44:21 +01:00
Wolfgang Bumiller
d06ac89c35 Cargo.toml: add license, description, homepage and excludes
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-02-28 09:43:15 +01:00
Wolfgang Bumiller
cb622ca252 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>
2020-02-28 09:22:16 +01:00
Mira Limbeck
aee1def7c3 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>
2020-02-21 09:47:37 +01:00
Mira Limbeck
f41b809a8e 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>
2020-02-21 09:47:35 +01:00
Mira Limbeck
04fc98b88e 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>
2020-02-21 09:47:33 +01:00
Mira Limbeck
457d833549 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>
2020-02-21 09:47:30 +01:00
Thomas Lamprecht
490b6e739a bump version to 2.0-1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-07-22 15:30:48 +02:00
Thomas Lamprecht
d5128fc797 bump version to 1.0-2
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-07-22 08:34:32 +02:00
Thomas Lamprecht
e5f30e2ed8 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>
2019-07-22 08:30:30 +02:00
Dominik Csapak
ee33f65005 fix trailing whitespace
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-02-22 13:13:38 +01:00
Dominik Csapak
48eebf537f 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>
2019-02-22 13:13:27 +01:00
Dominik Csapak
516305b73a remove unused parameters
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-02-22 13:12:55 +01:00
Dominik Csapak
325abffb96 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>
2019-02-22 13:12:23 +01:00
Dominik Csapak
e3b39992d4 use less magic numbers
use #defines or characters instead

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-02-22 13:12:09 +01:00
Dominik Csapak
bdbaa97f1d 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>
2019-02-22 13:11:24 +01:00
Dominik Csapak
8e21bad78b add -i option for specifying an external file
where '-' is stdin

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-02-22 13:10:19 +01:00
Dominik Csapak
f1d11beeb1 remove unused -I parameter
it was neither documented nor in use

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-02-22 13:09:15 +01:00
Dietmar Maurer
bead5ba936 fix upload target (--product pmg) 2017-09-21 11:58:03 +02:00
Dietmar Maurer
e9b9b5c04b avoid compiler warnings 2017-09-21 11:53:42 +02:00
Dietmar Maurer
aebd55f459 use CLIENT instead of CONNECT 2017-09-20 09:54:45 +02:00
Dietmar Maurer
b1ff2f1351 only print CONNECT if we do not have a CLIENT 2017-09-20 09:51:04 +02:00
Dietmar Maurer
87f77e910c print smtp connect for qentry 2017-09-20 08:14:53 +02:00
Dietmar Maurer
0098fbce1d log smtp entries with ID - "SMTP: <ID>" 2017-09-20 08:07:15 +02:00
Dietmar Maurer
3324d2b0ed improve usage info 2017-09-20 08:05:10 +02:00
Dietmar Maurer
207eb01b55 correctly print newlines to separate entries 2017-09-18 11:50:52 +02:00
Dietmar Maurer
a101f17a59 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
2017-09-18 09:01:58 +02:00
Dietmar Maurer
e600e0f1bd fix MAX_LOGFILES 2017-09-18 07:26:22 +02:00
Dietmar Maurer
119813ce59 implement verbose mode with/without logs 2017-09-15 16:17:08 +02:00
Dietmar Maurer
13021db8b9 add line number to logs - so that we can order them correctly 2017-09-15 10:46:37 +02:00
Dietmar Maurer
bf47294945 re-add support for old log (for testing) 2017-09-15 09:28:01 +02:00
Dietmar Maurer
34b471435e include local relayed mails (mail to root) 2017-09-14 12:22:55 +02:00
Dietmar Maurer
087c7e7b56 remove unused code 2017-09-14 08:13:19 +02:00
Dietmar Maurer
0d4bb4a034 include pmg-smtp-filter logs 2017-09-13 11:52:58 +02:00
Dietmar Maurer
5db269884c add correct AGPL3 header 2017-09-13 10:55:20 +02:00
Dietmar Maurer
2e62093ca4 parse output from postfix/error 2017-09-13 09:35:56 +02:00
Dietmar Maurer
61b8223f3c create debian package 2017-09-13 08:37:37 +02:00
Dietmar Maurer
ae7d477801 use -Wpedantic 2017-09-12 13:22:43 +02:00
Dietmar Maurer
53616b4f1b use gzFile instead of gzFile* 2017-09-12 12:23:04 +02:00
Dietmar Maurer
952866a348 do not access element outside array bounds 2017-09-12 12:16:34 +02:00
Dietmar Maurer
d488e03bb0 avoid compiler warning about unused var 2017-09-12 12:12:11 +02:00
Dietmar Maurer
f614639134 avoid use of depreciated GMemChunk
use newer g_slice allocator instead.
2017-09-12 12:06:12 +02:00