* [PATCH pmg-api] fix #3991: record changes to the smtp-welcomelist and reload postfix
@ 2026-03-13 20:13 Stoiko Ivanov
2026-06-02 23:44 ` applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Stoiko Ivanov @ 2026-03-13 20:13 UTC (permalink / raw)
To: pmg-devel
adding an entry to the postfix welcomelist needs a reload of postfix,
in order to become effective immediately.
the writer sub already reflects if a change happened in its return
value, we simply did not track that when deciding if postfix needs
reloading.
PMG::RuleDB::reload_ruledb is called with an argument only for the
smtp-welcomelist (which is a special case of ruledb object), for
regular objects it's called without (the API calls are generated in
all cases via PMG::RuleDB::Object::register_api).
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
src/PMG/Config.pm | 13 ++++++++-----
src/PMG/DBTools.pm | 3 ++-
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/PMG/Config.pm b/src/PMG/Config.pm
index 495fe702..1ded3bac 100644
--- a/src/PMG/Config.pm
+++ b/src/PMG/Config.pm
@@ -1837,10 +1837,13 @@ sub rewrite_postfix_welcomelist {
}
}
- $write_smtp_welcomelist->("/etc/postfix/senderaccess", $fromlist);
- $write_smtp_welcomelist->("/etc/postfix/rcptaccess", $tolist);
- $write_smtp_welcomelist->("/etc/postfix/clientaccess", $clientlist);
- $write_smtp_welcomelist->("/etc/postfix/postscreen_access", $clientlist, 'permit');
+ my $changes = 0;
+ $changes ||= $write_smtp_welcomelist->("/etc/postfix/senderaccess", $fromlist);
+ $changes ||= $write_smtp_welcomelist->("/etc/postfix/rcptaccess", $tolist);
+ $changes ||= $write_smtp_welcomelist->("/etc/postfix/clientaccess", $clientlist);
+ $changes ||= $write_smtp_welcomelist->("/etc/postfix/postscreen_access", $clientlist, 'permit');
+
+ return $changes;
}
# rewrite /etc/postfix/*
@@ -1868,7 +1871,7 @@ sub rewrite_config_postfix {
postmap_tls_policy();
postmap_tls_inbound_domains();
- rewrite_postfix_welcomelist($rulecache) if $rulecache;
+ $changes ||= rewrite_postfix_welcomelist($rulecache) if $rulecache;
# make sure aliases.db is up to date
system('/usr/bin/newaliases');
diff --git a/src/PMG/DBTools.pm b/src/PMG/DBTools.pm
index ff54acb3..01bde582 100644
--- a/src/PMG/DBTools.pm
+++ b/src/PMG/DBTools.pm
@@ -1419,7 +1419,8 @@ sub reload_ruledb {
if (defined($ruledb)) {
eval {
my $rulecache = PMG::RuleCache->new($ruledb);
- PMG::Config::rewrite_postfix_welcomelist($rulecache);
+ my $changed = PMG::Config::rewrite_postfix_welcomelist($rulecache);
+ PMG::Utils::service_cmd('postfix', 'reload') if $changed;
};
warn "problems updating SMTP welcomelist - $@" if $@;
}
--
2.47.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* applied: [PATCH pmg-api] fix #3991: record changes to the smtp-welcomelist and reload postfix
2026-03-13 20:13 [PATCH pmg-api] fix #3991: record changes to the smtp-welcomelist and reload postfix Stoiko Ivanov
@ 2026-06-02 23:44 ` Thomas Lamprecht
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2026-06-02 23:44 UTC (permalink / raw)
To: pmg-devel, Stoiko Ivanov
On Fri, 13 Mar 2026 21:13:34 +0100, Stoiko Ivanov wrote:
> adding an entry to the postfix welcomelist needs a reload of postfix,
> in order to become effective immediately.
>
> the writer sub already reflects if a change happened in its return
> value, we simply did not track that when deciding if postfix needs
> reloading.
>
> [...]
Applied, thanks!
[1/1] fix #3991: record changes to the smtp-welcomelist and reload postfix
commit: de0ba6851b2dfc14ae89d124f0bb07aef6f38d18
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-02 23:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-13 20:13 [PATCH pmg-api] fix #3991: record changes to the smtp-welcomelist and reload postfix Stoiko Ivanov
2026-06-02 23:44 ` 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