]> git.proxmox.com Git - pmg-log-tracker.git/commitdiff
before-queue: set 'B' status for rule-system blocked mails
authorDominik Csapak <d.csapak@proxmox.com>
Fri, 24 Apr 2020 09:26:50 +0000 (11:26 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 24 Apr 2020 09:57:13 +0000 (11:57 +0200)
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>
src/main.rs
tests/test_output_before_queue
tests/test_output_before_queue_host
tests/test_output_before_queue_search_string

index fa75f01c1a2ae665315c5b8583648dd4d9773eed..6c5291bdbd9f11929db697a4e1060d9d0822dd01 100644 (file)
@@ -976,19 +976,11 @@ impl SEntry {
         let print_filter_to_entries_fn =
             |fe: &Rc<RefCell<FEntry>>,
              parser: &mut Parser,
-             se: &SEntry,
-             dstatus: Option<DStatus>| {
-                let mut dstatus = match dstatus {
-                    Some(d) => d,
-                    None => DStatus::Invalid,
-                };
+             se: &SEntry| {
                 for to in fe.borrow().to_entries.iter().rev() {
-                    if dstatus == DStatus::Invalid {
-                        dstatus = to.dstatus;
-                    }
                     parser.write_all_ok(format!(
                         "TO:{:X}:T{:08X}L{:08X}:{}: from <",
-                        to.timestamp as i32, se.timestamp as i32, se.rel_line_nr, dstatus,
+                        to.timestamp as i32, se.timestamp as i32, se.rel_line_nr, to.dstatus,
                     ));
                     parser.write_all_ok(&se.bq_from);
                     parser.write_all_ok(b"> to <");
@@ -1002,10 +994,8 @@ impl SEntry {
         if let Some(fe) = &self.filter() {
             // limited to !fe.is_accepted because otherwise we would have
             // a QEntry with all required information instead
-            if fe.borrow().is_bq && !fe.borrow().is_accepted && self.is_bq_accepted {
-                print_filter_to_entries_fn(&fe, parser, self, None);
-            } else if fe.borrow().is_bq && !fe.borrow().is_accepted && self.is_bq_rejected {
-                print_filter_to_entries_fn(&fe, parser, self, Some(DStatus::Noqueue));
+            if fe.borrow().is_bq && !fe.borrow().is_accepted && (self.is_bq_accepted || self.is_bq_rejected) {
+                print_filter_to_entries_fn(&fe, parser, self);
             }
         }
 
index b9d82afbd78d801b8c0cdf5a0c83a0af5fa0c508..46e90dc80e040587a9c3c9e60a986471a051a1c7 100644 (file)
@@ -7,7 +7,7 @@
 SMTPD: T5FDCC4EFL00000000
 CTIME: 5FDCC4EF
 CLIENT: pmg.localhost[192.168.22.40]
-TO:5FDCC4EF:T5FDCC4EFL00000000:N: from <mailtestsender2@localhost.localdomain> to <pmgtest@localhost.localdomain>
+TO:5FDCC4EF:T5FDCC4EFL00000000:B: from <mailtestsender2@localhost.localdomain> to <pmgtest@localhost.localdomain>
 LOGS:
 L00000002 Dec 18 15:04:15 pmg postfix/smtpd[21842]: connect from pmg.localhost[192.168.22.40]
 L00000003 Dec 18 15:04:15 pmg postfix/smtpd[21842]: NOQUEUE: client=pmg.localhost[192.168.22.40]
index d595c2185166bb6ff9f22fdedd4d5c3d955ec8fc..31d70bf5f97d3ba8b694cf65d0451fa275d2d92f 100644 (file)
@@ -8,7 +8,7 @@
 SMTPD: T5FDCC4EFL00000000
 CTIME: 5FDCC4EF
 CLIENT: pmg.localhost[192.168.22.40]
-TO:5FDCC4EF:T5FDCC4EFL00000000:N: from <mailtestsender2@localhost.localdomain> to <pmgtest@localhost.localdomain>
+TO:5FDCC4EF:T5FDCC4EFL00000000:B: from <mailtestsender2@localhost.localdomain> to <pmgtest@localhost.localdomain>
 LOGS:
 L00000002 Dec 18 15:04:15 pmg postfix/smtpd[21842]: connect from pmg.localhost[192.168.22.40]
 L00000003 Dec 18 15:04:15 pmg postfix/smtpd[21842]: NOQUEUE: client=pmg.localhost[192.168.22.40]
index a6725e0dadb216be6c4ac236448f4d44fe1b5ea0..17d769fbef3c4369af81cef8b3f297ba10972305 100644 (file)
@@ -8,7 +8,7 @@
 SMTPD: T5FDCC4EFL00000000
 CTIME: 5FDCC4EF
 CLIENT: pmg.localhost[192.168.22.40]
-TO:5FDCC4EF:T5FDCC4EFL00000000:N: from <mailtestsender2@localhost.localdomain> to <pmgtest@localhost.localdomain>
+TO:5FDCC4EF:T5FDCC4EFL00000000:B: from <mailtestsender2@localhost.localdomain> to <pmgtest@localhost.localdomain>
 LOGS:
 L00000002 Dec 18 15:04:15 pmg postfix/smtpd[21842]: connect from pmg.localhost[192.168.22.40]
 L00000003 Dec 18 15:04:15 pmg postfix/smtpd[21842]: NOQUEUE: client=pmg.localhost[192.168.22.40]