epel9
Rex Dieter 9 years ago
parent 3da914019c
commit 4e1916d48e

@ -0,0 +1,38 @@
From 72f3702dbe6cf15c06dc13da2c99c864e9022a58 Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <aacid@kde.org>
Date: Sat, 21 May 2016 17:48:36 +0200
Subject: [PATCH 2/2] Fix race in which the file containing the X11 cookie has
the wrong permissions for a small while
if someone is very fast can watch the file between the open and the setPermissions
REVIEW: 127973
Acked-by: mpyne
---
src/kdeinit/kinit.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/kdeinit/kinit.cpp b/src/kdeinit/kinit.cpp
index 19e38b8..216c87e 100644
--- a/src/kdeinit/kinit.cpp
+++ b/src/kdeinit/kinit.cpp
@@ -1530,13 +1530,15 @@ static void setupX()
+ QString::number(getuid()) + QLatin1Char('-') + QString::fromLocal8Bit(display);
QSaveFile xauthfile(xauth);
QFile xauthfrom(QFile::decodeName(qgetenv("XAUTHORITY")));
+ // Set umask to make sure the file permissions of xauthfile are correct
+ mode_t oldMask = umask(S_IRGRP | S_IROTH | S_IWGRP | S_IWOTH);
if (!xauthfrom.open(QFile::ReadOnly) || !xauthfile.open(QFile::WriteOnly)
- || !xauthfile.setPermissions(QFile::ReadOwner | QFile::WriteOwner)
|| xauthfile.write(xauthfrom.readAll()) != xauthfrom.size() || !xauthfile.commit()) {
// error
} else {
qputenv("XAUTHORITY", QFile::encodeName(xauth));
}
+ umask(oldMask);
}
}
--
2.7.4
Loading…
Cancel
Save