- Add patch to not move XAUTHORITY around if not required (boo#1084798):

* 0001-Only-move-XAUTHORITY-if-it-s-temporary.patch

OBS-URL: https://build.opensuse.org/package/show/KDE:Frameworks5/kinit?expand=0&rev=156
This commit is contained in:
Fabian Vogt 2018-03-14 13:22:28 +00:00 committed by Git OBS Bridge
parent 81119fada3
commit 5374224beb
3 changed files with 48 additions and 1 deletions

View File

@ -0,0 +1,39 @@
From 8040d22c25eb950e8206af7ff20dcd958267de10 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Tue, 13 Mar 2018 18:54:26 +0100
Subject: [PATCH] Only move XAUTHORITY if it's temporary
References: boo#1084798
If kdeinit is started within a session spawned by kdesu or similiar, it has
a temporary file as $XAUTHORITY. As kdeinit is persistent, the used .Xauthority
file must persist as well otherwise launched child process would have no access
to X. kdeinit works around the file's volatileness by copying it to a known
location. Unfortunately the chosen location (/tmp) gets cleared regularly which
means it's even more volatile than the source...
Even more unfortunately, this workaround is applied WAY to broad. Even when
$XAUTHORITY points to a static file, like in a normal user session, it moves
.Xauthority around.
Work around this issue by only applying it if $XAUTHORITY is in /tmp, where
kdesu places it.
---
src/kdeinit/kinit.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/kdeinit/kinit.cpp b/src/kdeinit/kinit.cpp
index 0c2c35a..54a390f 100644
--- a/src/kdeinit/kinit.cpp
+++ b/src/kdeinit/kinit.cpp
@@ -1483,7 +1483,7 @@ static void setupX()
as well, point XAUTHORITY there and never remove the file (except for possible
tmp cleanup).
*/
- if (!qEnvironmentVariableIsEmpty("XAUTHORITY")) {
+ if (!qEnvironmentVariableIsEmpty("XAUTHORITY") && qgetenv("XAUTHORITY").startsWith("/tmp/")) {
QByteArray display = qgetenv(displayEnvVarName_c());
int i;
if ((i = display.lastIndexOf('.')) > display.lastIndexOf(':') && i >= 0) {
--
2.16.2

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed Mar 14 13:21:57 UTC 2018 - fabian@ritter-vogt.de
- Add patch to not move XAUTHORITY around if not required (boo#1084798):
* 0001-Only-move-XAUTHORITY-if-it-s-temporary.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Mar 12 23:29:41 CET 2018 - lbeltrame@kde.org Mon Mar 12 23:29:41 CET 2018 - lbeltrame@kde.org

View File

@ -54,6 +54,8 @@ Source: http://download.kde.org/stable/frameworks/%{_tar_path}/%{name}-%
Source1: baselibs.conf Source1: baselibs.conf
# PATCH-FIX-OPENSUSE fpie.patch -- add -(f)pie link flags to start_kdeinit target # PATCH-FIX-OPENSUSE fpie.patch -- add -(f)pie link flags to start_kdeinit target
Patch0: fpie.patch Patch0: fpie.patch
# PATCH-FIX-OPENSUSE
Patch1: 0001-Only-move-XAUTHORITY-if-it-s-temporary.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description %description
@ -72,7 +74,7 @@ booting UNIX. Development files.
%lang_package %lang_package
%prep %prep
%setup -q %setup -q
%patch0 -p1 %autopatch -p1
%build %build
%cmake_kf5 -d build %cmake_kf5 -d build