]> git.proxmox.com Git - pmg-log-tracker.git/commitdiff
fix #3758: fix `to` filter with empty NoqueueEntry `to` field
authorMira Limbeck <m.limbeck@proxmox.com>
Wed, 1 Dec 2021 15:41:57 +0000 (16:41 +0100)
committerStoiko Ivanov <s.ivanov@proxmox.com>
Wed, 1 Dec 2021 17:57:15 +0000 (18:57 +0100)
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>
src/main.rs

index b1d4f8ce91f509b12028467bf30ec5b979792895..62e5ea1abcde129912c9ec2150c772a432d3b860 100644 (file)
@@ -762,7 +762,6 @@ fn handle_cleanup_message(msg: &[u8], parser: &mut Parser, complete_line: &[u8])
         }
         qe.borrow_mut().cleanup = true;
 
-
         // does not work correctly if there's a duplicate message id in the logfiles
         if let Some(q) = parser.msgid_lookup.remove(msgid) {
             let q_clone = Weak::clone(&q);
@@ -776,8 +775,7 @@ fn handle_cleanup_message(msg: &[u8], parser: &mut Parser, complete_line: &[u8])
                     q.borrow_mut().aq_qentry = Some(Rc::downgrade(&qe));
                 }
             }
-        }
-        else {
+        } else {
             parser.msgid_lookup.insert(msgid.into(), Rc::downgrade(&qe));
         }
     }
@@ -908,8 +906,9 @@ impl SEntry {
                     || (parser.options.exclude_greylist && nq.dstatus == DStatus::Greylist)
                     || (parser.options.exclude_ndr && nq.from.is_empty())
                     || (!parser.options.to.is_empty()
-                        && !nq.to.is_empty()
-                        && find_lowercase(&nq.to, parser.options.to.as_bytes()).is_none())
+                        && ((!nq.to.is_empty()
+                            && find_lowercase(&nq.to, parser.options.to.as_bytes()).is_none())
+                            || nq.to.is_empty()))
                 {
                     nq.dstatus = DStatus::Invalid;
                 }