From 5b090b95859238e7ab24ee50b3c436beafb64c5c Mon Sep 17 00:00:00 2001
From: Sebastião Guerra <sebastiao.luiz.guerra@gmail.com>
Date: Sat, 3 Oct 2026 20:09:41 -0300
Subject: openSUSE: preserve SGID mode for tdesud
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Upstream installs tdesud with mode 2755, but the openSUSE RPM spec overrides it
to 0755. This causes tdesu to reject the daemon as unsafe.

Use the openSUSE permissions framework to preserve mode 2755 for normal
profiles and honor the paranoid profile, then verify the installed mode.

Signed-off-by: Sebastião Guerra <sebastiao.luiz.guerra@gmail.com>
---
 redhat/core/tdebase/tdebase.spec | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/redhat/core/tdebase/tdebase.spec b/redhat/core/tdebase/tdebase.spec
index e0c52d169..f4fff2a41 100644
--- a/redhat/core/tdebase/tdebase.spec
+++ b/redhat/core/tdebase/tdebase.spec
@@ -1350,7 +1350,13 @@ TDE applications, particularly those in the TDE base module.
 %{tde_bindir}/kcminit_startup
 %{tde_bindir}/kdcop
 %{tde_bindir}/tdesu
+%if 0%{?suse_version}
+%verify(not mode) %attr(2755,root,root) %{tde_bindir}/tdesud
+%{_datadir}/permissions/packages.d/trinity-tdebase
+%{_datadir}/permissions/packages.d/trinity-tdebase.paranoid
+%else
 %attr(0755,root,root) %{tde_bindir}/tdesud
+%endif
 %{tde_bindir}/kdialog
 %{tde_bindir}/khotkeys
 %{tde_bindir}/knetattach
@@ -1461,6 +1467,7 @@ TDE applications, particularly those in the TDE base module.
 %{?with_tsak:%set_permissions %{tde_bindir}/%{tdm}tsak}
 %set_permissions %{tde_bindir}/kcheckpass
 %{?with_kbdledsync:%set_permissions %{tde_bindir}/tdekbdledsync}
+%set_permissions %{tde_bindir}/tdesud
 %endif
 
 ##########
@@ -3705,6 +3712,15 @@ for i in ksysguard tde-kcontrol tdefontview showdesktop; do
   echo "OnlyShowIn=TDE;" >>"%{?buildroot}%{tde_tdeappdir}/${i}.desktop"
 done
 
+%if 0%{?suse_version}
+# Preserve tdesud's SGID mode through openSUSE permission handling.
+mkdir -p "%{?buildroot}%{_datadir}/permissions/packages.d"
+echo "%{tde_bindir}/tdesud root:root 02755" \
+  > "%{?buildroot}%{_datadir}/permissions/packages.d/trinity-tdebase"
+echo "%{tde_bindir}/tdesud root:root 0755" \
+  > "%{?buildroot}%{_datadir}/permissions/packages.d/trinity-tdebase.paranoid"
+%endif
+
 # Remove setuid bit on some binaries.
 %{?with_tsak:chmod 0511 "%{?buildroot}%{tde_bindir}/%{tdm}tsak"}
 chmod 0755 "%{?buildroot}%{tde_bindir}/kcheckpass"
@@ -3736,6 +3752,7 @@ chmod 0755 "%{?buildroot}%{tde_tdedocdir}/HTML/en/khelpcenter/glossary/checkxref
 %{?with_tsak:%verify_permissions -e %{tde_bindir}/%{tdm}tsak}
 %verify_permissions -e %{tde_bindir}/kcheckpass
 %{?with_kbdledsync:%verify_permissions -e %{tde_bindir}/tdekbdledsync}
+%verify_permissions -e %{tde_bindir}/tdesud
 %endif
 
 
-- 
cgit v1.2.3

