Modify the server wrapper to not always start the server as root.

Callers of the server which start it in a way which is compatible with the
  server running without root rights can now set a XORG_RUN_AS_USER_OK env
  variable and then the wrapper will behave as if needs_root_rights = auto
  is specified, unless overriden from Xwrapper.config
This commit is contained in:
Hans de Goede 2015-03-18 12:03:10 +01:00
parent 5a00d433eb
commit aaf1923ce2
2 changed files with 21 additions and 15 deletions

View File

@ -1,8 +1,8 @@
From 17830918f1bebf3696c6660f602de84d3efeb1ac Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Thu, 17 Apr 2014 15:50:44 +0200
Subject: [PATCH] Fedora hack: Make the suid-root wrapper always start the
server with root rights
Subject: [PATCH] Fedora hack: Make the suid-root wrapper start the server
with root rights
Do NOT upstream.
@ -10,14 +10,12 @@ Since most display managers are not ready yet to start Xorg in way which will
keep it working without root-rights, see:
https://fedoraproject.org/wiki/Changes/XorgWithoutRootRights
Just keep starting X as root for now, but do it through the wrapper. This
allows people who want to test Xorg without root rights to create a
/etc/X11/Xwrapper.config file with:
Just keep starting X as root for now, but do it through the wrapper, by
overriding the needs_root_rights = -1 (auto) default and setting it to 1.
needs_root_rights = auto
In there to test XorgWithoutRootRights without breaking people's setups due
to non ready display-managers.
We set a special environment variable when starting X in a way where root
rights are not needed (from gdm and startx) and keep the upstream
needs_root_rights = -1 (auto) default in that case.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
@ -28,15 +26,16 @@ diff --git a/hw/xfree86/xorg-wrapper.c b/hw/xfree86/xorg-wrapper.c
index 90c8c11..539bfe4 100644
--- a/hw/xfree86/xorg-wrapper.c
+++ b/hw/xfree86/xorg-wrapper.c
@@ -153,7 +153,7 @@ int main(int argc, char *argv[])
int kms_cards = 0;
int total_cards = 0;
@@ -191,6 +191,9 @@ int main(int argc, char *argv[])
int allowed = CONSOLE_ONLY;
- int needs_root_rights = -1;
+ int needs_root_rights = 1;
int needs_root_rights = -1;
+ if (getenv("XORG_RUN_AS_USER_OK") == NULL)
+ needs_root_rights = 1;
+
progname = argv[0];
parse_config(&allowed, &needs_root_rights);
--
1.9.0

View File

@ -45,7 +45,7 @@
Summary: X.Org X11 X server
Name: xorg-x11-server
Version: 1.17.1
Release: 6%{?gitdate:.%{gitdate}}%{dist}
Release: 7%{?gitdate:.%{gitdate}}%{dist}
URL: http://www.x.org
License: MIT
Group: User Interface/X
@ -640,6 +640,13 @@ find %{inst_srcdir}/hw/xfree86 -name \*.c -delete
%changelog
* Wed Mar 18 2015 Hans de Goede <hdegoede@redhat.com> - 1.17.1-7
- Modify the server wrapper to not always start the server as root.
Callers of the server which start it in a way which is compatible with the
server running without root rights can now set a XORG_RUN_AS_USER_OK env
variable and then the wrapper will behave as if needs_root_rights = auto
is specified, unless overriden from Xwrapper.config
* Wed Mar 04 2015 Adam Jackson <ajax@redhat.com> 1.17.1-6
- Fix int10 interrupt vector setup