From 7cd39d230c22f25bd7904359fa98f644f959d9c1 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 10 May 2022 03:17:55 -0400 Subject: [PATCH] import dbus-1.12.8-18.el8 --- SOURCES/dbus-kill-process-with-session | 17 +++++++++++++++++ SOURCES/ssh-x-forwarding.csh | 6 +++++- SOURCES/ssh-x-forwarding.sh | 11 ++++++++--- SPECS/dbus.spec | 23 +++++++++++++++++++++-- 4 files changed, 51 insertions(+), 6 deletions(-) create mode 100644 SOURCES/dbus-kill-process-with-session diff --git a/SOURCES/dbus-kill-process-with-session b/SOURCES/dbus-kill-process-with-session new file mode 100644 index 0000000..f999a4d --- /dev/null +++ b/SOURCES/dbus-kill-process-with-session @@ -0,0 +1,17 @@ +#!/bin/bash +# This script ensures the dbus-daemon is killed when the session closes. +# It's used by SSH sessions that have X forwarding (since the X display +# may outlive the session in those cases) +[ $# != 1 ] && exit 1 + +exec >& /dev/null + +trap "kill -TERM $1" EXIT + +export GVFS_DISABLE_FUSE=1 +coproc SESSION_MONITOR (gio monitor -f "/run/systemd/sessions/${XDG_SESSION_ID}") + +while grep -q ^State=active <(loginctl show-session $XDG_SESSION_ID) +do + read -u ${SESSION_MONITOR[0]} +done diff --git a/SOURCES/ssh-x-forwarding.csh b/SOURCES/ssh-x-forwarding.csh index 393a36c..10d87ed 100644 --- a/SOURCES/ssh-x-forwarding.csh +++ b/SOURCES/ssh-x-forwarding.csh @@ -3,4 +3,8 @@ if ( $?SSH_CONNECTION == 0 ) exit if ( $?DISPLAY == 0 ) exit if ( $SHLVL > 1 ) exit setenv GDK_BACKEND x11 -eval `dbus-launch --auto-syntax --exit-with-x11` + +eval `dbus-launch --csh-syntax` + +if ( $?DBUS_SESSION_BUS_PID == 0 ) exit +setsid -f /usr/libexec/dbus-1/dbus-kill-process-with-session $DBUS_SESSION_BUS_PID diff --git a/SOURCES/ssh-x-forwarding.sh b/SOURCES/ssh-x-forwarding.sh index 1846121..37c48f4 100644 --- a/SOURCES/ssh-x-forwarding.sh +++ b/SOURCES/ssh-x-forwarding.sh @@ -1,7 +1,12 @@ # DBus session bus over SSH with X11 forwarding [ -z "$SSH_CONNECTION" ] && return [ -z "$DISPLAY" ] && return -[ "$SHLVL" -gt 1 ] && return +[ "${DISPLAY:0:1}" = ":" ] && return +[ "$SHLVL" -ne 1 ] && return -GDK_BACKEND=x11; export GDK_BACKEND -eval $(dbus-launch --sh-syntax --exit-with-x11) +export GDK_BACKEND=x11 + +eval `dbus-launch --sh-syntax` + +[ -z "$DBUS_SESSION_BUS_PID" ] && return +setsid -f /usr/libexec/dbus-1/dbus-kill-process-with-session "$DBUS_SESSION_BUS_PID" diff --git a/SPECS/dbus.spec b/SPECS/dbus.spec index 7f8dd8e..cf7a5c6 100644 --- a/SPECS/dbus.spec +++ b/SPECS/dbus.spec @@ -19,7 +19,7 @@ Name: dbus Epoch: 1 Version: 1.12.8 -Release: 14%{?dist} +Release: 18%{?dist} Summary: D-BUS message bus Group: System Environment/Libraries @@ -32,6 +32,7 @@ Source0: https://dbus.freedesktop.org/releases/%{name}/%{name}-%{version}.tar.gz Source1: 00-start-message-bus.sh Source2: ssh-x-forwarding.csh Source3: ssh-x-forwarding.sh +Source4: dbus-kill-process-with-session Patch0: 0001-tools-Use-Python3-for-GetAllMatchRules.patch # https://bugzilla.redhat.com/show_bug.cgi?id=1725570 Patch1: dbus-1.12.8-fix-CVE-2019-12749.patch @@ -87,6 +88,7 @@ per-user-login-session messaging facility. Summary: D-BUS message bus configuration Group: System Environment/Libraries BuildArch: noarch +Requires: /usr/bin/systemctl %description common The %{name}-common package provides the configuration and setup files for D-Bus @@ -148,6 +150,8 @@ Summary: X11-requiring add-ons for D-BUS Group: Development/Libraries # The server package can be a different architecture. Requires: %{name}-daemon = %{epoch}:%{version}-%{release} +# Used by SSH daemon helper script. +Requires: /usr/bin/gio %description x11 D-BUS contains some tools that require Xlib to be installed, those are @@ -207,6 +211,7 @@ rm -rf %{buildroot}%{_libdir}/cmake install -Dp -m755 %{SOURCE1} %{buildroot}%{_sysconfdir}/X11/xinit/xinitrc.d/00-start-message-bus.sh install -Dp -m644 %{SOURCE2} %{buildroot}%{_sysconfdir}/profile.d/ssh-x-forwarding.csh install -p -m644 %{SOURCE3} %{buildroot}%{_sysconfdir}/profile.d/ +install -Dp -m755 %{SOURCE4} %{buildroot}%{_libexecdir}/dbus-1/dbus-kill-process-with-session # Obsolete, but still widely used, for drop-in configuration snippets. install --directory %{buildroot}%{_sysconfdir}/dbus-1/session.d @@ -389,6 +394,7 @@ popd %files x11 %{_bindir}/dbus-launch +%{_libexecdir}/dbus-1/dbus-kill-process-with-session %{_mandir}/man1/dbus-launch.1* %{_sysconfdir}/profile.d/ssh-x-forwarding.* %{_sysconfdir}/X11/xinit/xinitrc.d/00-start-message-bus.sh @@ -404,8 +410,21 @@ popd %{_libdir}/pkgconfig/dbus-1.pc %{_includedir}/* - %changelog +* Mon Dec 06 2021 Ray Strode - 1.12.8-18 +- Ensure session bus started for SSH sessions gets used by those + sessions. + Related: #1940067 + +* Mon Nov 08 2021 David King - 1:1.12.8-17 +- Improve SSH session bus starting (#1940067) + +* Thu Jun 10 2021 David King - 1:1.12.8-16 +- Add Conflicts on older redhat-release versions (#1941642) + +* Wed May 26 2021 David King - 1:1.12.8-15 +- Packaging updates from Fedora (#1941642) + * Tue Apr 27 2021 David King - 1:1.12.8-14 - Fix dbus-launch call in sh snippet (#1940348)