all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [PATCH pmg-api] config: smtp-welcomelist: avoid short-circuiting due to side-effects
Date: Wed, 10 Jun 2026 11:13:53 +0200	[thread overview]
Message-ID: <20260610091356.958395-1-s.ivanov@proxmox.com> (raw)

the version with the post-if also reads a bit nicer to me.

a similar issue was fixed in 2022:
991d8f1c ("pmg-daily: avoid short-circuting update of local channels")

minimally tested by:
* removing all smtp-welcomelist files in /etc/postfix and their
  postmap .db result (senderaccess rcptaccess clientaccess
  postscreen_access)
* manually modifying /etc/postfix/master.cf (adding a -v to smtpd)
* adding an entry to the Mail Proxy Welcomelist in the GUI
* checking that all files were created and that postfix was reloaded

Fixes: 17f17bce ("config: do not shortcircuit smtp-welcomelist generation")
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
 src/PMG/Config.pm | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/PMG/Config.pm b/src/PMG/Config.pm
index 9b22b676..83d687bd 100644
--- a/src/PMG/Config.pm
+++ b/src/PMG/Config.pm
@@ -1878,15 +1878,10 @@ sub rewrite_postfix_welcomelist {
     }
 
     my $changes = 0;
-    my $ret;
-    $ret = $write_smtp_welcomelist->("/etc/postfix/senderaccess", $fromlist);
-    $changes ||= $ret;
-    $ret = $write_smtp_welcomelist->("/etc/postfix/rcptaccess", $tolist);
-    $changes ||= $ret;
-    $ret = $write_smtp_welcomelist->("/etc/postfix/clientaccess", $clientlist);
-    $changes ||= $ret;
-    $ret = $write_smtp_welcomelist->("/etc/postfix/postscreen_access", $clientlist, 'permit');
-    $changes ||= $ret;
+    $changes = 1 if $write_smtp_welcomelist->("/etc/postfix/senderaccess", $fromlist);
+    $changes = 1 if $write_smtp_welcomelist->("/etc/postfix/rcptaccess", $tolist);
+    $changes = 1 if $write_smtp_welcomelist->("/etc/postfix/clientaccess", $clientlist);
+    $changes = 1 if $write_smtp_welcomelist->("/etc/postfix/postscreen_access", $clientlist, 'permit');
 
     return $changes;
 }
-- 
2.47.3





             reply	other threads:[~2026-06-10  9:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-10  9:13 Stoiko Ivanov [this message]
2026-06-10  9:57 ` applied: [PATCH pmg-api] config: smtp-welcomelist: avoid short-circuiting due to side-effects Thomas Lamprecht

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=20260610091356.958395-1-s.ivanov@proxmox.com \
    --to=s.ivanov@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal