public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Mira Limbeck <m.limbeck@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH log-tracker] fix #3758: fix `to` filter with empty NoqueueEntry `to` field
Date: Wed,  1 Dec 2021 16:41:57 +0100	[thread overview]
Message-ID: <20211201154158.322637-1-m.limbeck@proxmox.com> (raw)

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>
---
contains 2 rustfmt changes that are unrelated to the issue

 src/main.rs | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/main.rs b/src/main.rs
index b1d4f8c..62e5ea1 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -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;
                 }
-- 
2.30.2





             reply	other threads:[~2021-12-01 15:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-01 15:41 Mira Limbeck [this message]
2021-12-01 15:41 ` [pmg-devel] [PATCH api] fix #3758: allow empty `to` in noqueue case Mira Limbeck
2021-12-01 18:13   ` [pmg-devel] applied: " Stoiko Ivanov
2021-12-01 18:19     ` Thomas Lamprecht
2021-12-01 18:21 ` [pmg-devel] applied: [PATCH log-tracker] fix #3758: fix `to` filter with empty NoqueueEntry `to` field Stoiko Ivanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211201154158.322637-1-m.limbeck@proxmox.com \
    --to=m.limbeck@proxmox.com \
    --cc=pmg-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal