public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH pmg-api] config: smtp-welcomelist: avoid short-circuiting due to side-effects
@ 2026-06-10  9:13 Stoiko Ivanov
  2026-06-10  9:57 ` applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Stoiko Ivanov @ 2026-06-10  9:13 UTC (permalink / raw)
  To: pmg-devel

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





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* applied: [PATCH pmg-api] config: smtp-welcomelist: avoid short-circuiting due to side-effects
  2026-06-10  9:13 [PATCH pmg-api] config: smtp-welcomelist: avoid short-circuiting due to side-effects Stoiko Ivanov
@ 2026-06-10  9:57 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2026-06-10  9:57 UTC (permalink / raw)
  To: pmg-devel, Stoiko Ivanov

On Wed, 10 Jun 2026 11:13:53 +0200, Stoiko Ivanov wrote:
> 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
> 
> [...]

Applied, thanks!

[1/1] config: smtp-welcomelist: avoid short-circuiting due to side-effects
      commit: 02f0186c63e984e2b423f21fec3419eba35efebd




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-10  9:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-10  9:13 [PATCH pmg-api] config: smtp-welcomelist: avoid short-circuiting due to side-effects Stoiko Ivanov
2026-06-10  9:57 ` applied: " Thomas Lamprecht

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