From 95804bd3e6514118fcddff2f99eb19ef9f99cb00 Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Tue, 13 Sep 2022 22:09:33 +0200 Subject: [PATCH] do not run systemd commands during leapp upgrade (#2119385) Resolves: #2119385 --- dovecot.spec | 46 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/dovecot.spec b/dovecot.spec index 7aade21..26605a9 100644 --- a/dovecot.spec +++ b/dovecot.spec @@ -6,7 +6,7 @@ Name: dovecot Epoch: 1 Version: 2.3.16 %global prever %{nil} -Release: 7%{?dist} +Release: 8%{?dist} #dovecot itself is MIT, a few sources are PD, pigeonhole is LGPLv2 License: MIT and LGPLv2 @@ -275,11 +275,16 @@ popd #dovecot uid and gid are reserved, see /usr/share/doc/setup-*/uidgid %sysusers_create_compat %{SOURCE16} -# do not let dovecot run during upgrade rhbz#134325 -if [ "$1" = "2" ]; then - rm -f %restart_flag - /bin/systemctl is-active %{name}.service >/dev/null 2>&1 && touch %restart_flag ||: - /bin/systemctl stop %{name}.service >/dev/null 2>&1 +if [ -z "$LEAPP_IPU_IN_PROGRESS" ] +then + # during LEAPP upgrade, services are not running anyway + + # do not let dovecot run during upgrade rhbz#134325 + if [ "$1" = "2" ]; then + rm -f %restart_flag + /bin/systemctl is-active %{name}.service >/dev/null 2>&1 && touch %restart_flag ||: + /bin/systemctl stop %{name}.service >/dev/null 2>&1 + fi fi %post @@ -302,19 +307,29 @@ if [ $1 = 0 ]; then fi %postun -/bin/systemctl daemon-reload >/dev/null 2>&1 || : +if [ -z "$LEAPP_IPU_IN_PROGRESS" ] +then + # during LEAPP upgrade, services are not running anyway + /bin/systemctl daemon-reload >/dev/null 2>&1 || : -if [ "$1" -ge "1" -a -e %restart_flag ]; then - /bin/systemctl start dovecot.service >/dev/null 2>&1 || : -rm -f %restart_flag + if [ "$1" -ge "1" -a -e %restart_flag ]; then + /bin/systemctl start dovecot.service >/dev/null 2>&1 || : + rm -f %restart_flag + fi fi %posttrans -# dovecot should be started again in %%postun, but it's not executed on reinstall -# if it was already started, restart_flag won't be here, so it's ok to test it again -if [ -e %restart_flag ]; then + +if [ -z "$LEAPP_IPU_IN_PROGRESS" ] +then + # during LEAPP upgrade, services are not running anyway + + # dovecot should be started again in %%postun, but it's not executed on reinstall + # if it was already started, restart_flag won't be here, so it's ok to test it again + if [ -e %restart_flag ]; then /bin/systemctl start dovecot.service >/dev/null 2>&1 || : -rm -f %restart_flag + rm -f %restart_flag + fi fi %check @@ -468,6 +483,9 @@ make check %{_libdir}/%{name}/dict/libdriver_pgsql.so %changelog +* Tue Sep 13 2022 Michal Hlavinka - 1:2.3.16-8 +- do not run systemd commands during leapp upgrade (#2119385) + * Tue Jul 12 2022 Michal Hlavinka - 1:2.3.16-7 - fix possible privilege escalation when similar master and non-master passdbs are used (#2106232)