Skip to content

Commit fc1234f

Browse files
committed
fix: Enable Xauth access control for X11 sessions
Use Xauth instead of unsafe xhost +
1 parent 8530108 commit fc1234f

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

data/scripts/Xsetup

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
11
#!/bin/sh
22
# Xsetup - run as root before the login dialog appears
3-
4-
# Allow all client connect to the Xorg server. Since our X server is started as
5-
# root, but sessions are started as user.
6-
xhost +

src/helper/UserSession.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ namespace DDM {
8282
// If the Xorg display server was already started, write the passed
8383
// auth cookie to /tmp/xauth_XXXXXX. This is done in the parent process
8484
// so that it can clean up the file on session end.
85-
if (env.value(QStringLiteral("XDG_SESSION_TYPE")) == QLatin1String("x11")
86-
&& m_displayServerCmd.isEmpty()) {
85+
if (env.value(QStringLiteral("XDG_SESSION_TYPE")) == QLatin1String("x11")) {
8786
// Create the Xauthority file
8887
QByteArray cookie = helper->cookie();
8988
if (cookie.isEmpty()) {
@@ -111,9 +110,7 @@ namespace DDM {
111110

112111
env.insert(QStringLiteral("XAUTHORITY"), m_xauthFile.fileName());
113112
setProcessEnvironment(env);
114-
}
115113

116-
if (env.value(QStringLiteral("XDG_SESSION_TYPE")) == QLatin1String("x11")) {
117114
QString command;
118115
if (env.value(QStringLiteral("XDG_SESSION_CLASS")) == QLatin1String("greeter")) {
119116
command = m_path;

0 commit comments

Comments
 (0)