Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Factory
gdm
gdm-add-runtime-option-to-disable-starting-X-se...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File gdm-add-runtime-option-to-disable-starting-X-server-as-u.patch of Package gdm
From a19b51ad9e446948ba60c359641f6c4c14fec1da Mon Sep 17 00:00:00 2001 From: Michal Srb <msrb@suse.com> Date: Fri, 26 Jan 2018 10:49:18 +0100 Subject: [PATCH] Add runtime option to disable starting X server as user If the environmental variable GDM_DISABLE_USER_DISPLAY_SERVER is defined, the X server will be started under root. The same way as if gdm was built with --disable-user-display-server option. This allows system to run X server under root if and only-if necessary. Index: gdm-45.0.1/daemon/gdm-local-display-factory.c =================================================================== --- gdm-45.0.1.orig/daemon/gdm-local-display-factory.c +++ gdm-45.0.1/daemon/gdm-local-display-factory.c @@ -384,6 +384,7 @@ gdm_local_display_factory_create_transie preferred_display_server = get_preferred_display_server (factory); #ifdef ENABLE_USER_DISPLAY_SERVER + if (getenv ("GDM_DISABLE_USER_DISPLAY_SERVER") == NULL ) { if (g_strcmp0 (preferred_display_server, "wayland") == 0 || g_strcmp0 (preferred_display_server, "xorg") == 0) { g_auto(GStrv) session_types = NULL; @@ -405,8 +406,9 @@ gdm_local_display_factory_create_transie NULL); is_initial = TRUE; } + } #endif - if (g_strcmp0 (preferred_display_server, "legacy-xorg") == 0) { + //if (g_strcmp0 (preferred_display_server, "legacy-xorg") == 0) { if (display == NULL) { guint32 num; @@ -414,7 +416,7 @@ gdm_local_display_factory_create_transie display = gdm_legacy_display_new (num); } - } + //} if (display == NULL) { g_set_error_literal (error, @@ -928,6 +930,7 @@ ensure_display_for_seat (GdmLocalDisplay g_debug ("GdmLocalDisplayFactory: Adding display on seat %s", seat_id); #ifdef ENABLE_USER_DISPLAY_SERVER + if (getenv ("GDM_DISABLE_USER_DISPLAY_SERVER") == NULL ) { if (g_strcmp0 (preferred_display_server, "wayland") == 0 || g_strcmp0 (preferred_display_server, "xorg") == 0) { display = gdm_local_display_new (); @@ -936,6 +939,7 @@ ensure_display_for_seat (GdmLocalDisplay "supported-session-types", session_types, NULL); } + } #endif if (display == NULL) { @@ -1252,6 +1256,10 @@ on_vt_changed (GIOChannel *source, g_debug ("GdmLocalDisplayFactory: VT changed from %u to %u", previous_vt, factory->active_vt); + if (getenv ("GDM_DISABLE_USER_DISPLAY_SERVER") != NULL) { + return G_SOURCE_CONTINUE; + } + store = gdm_display_factory_get_display_store (GDM_DISPLAY_FACTORY (factory)); /* if the old VT was running a wayland login screen kill it @@ -1393,6 +1401,7 @@ gdm_local_display_factory_start_monitor #endif #if defined(ENABLE_USER_DISPLAY_SERVER) + if (getenv ("GDM_DISABLE_USER_DISPLAY_SERVER") == NULL ) { io_channel = g_io_channel_new_file ("/sys/class/tty/tty0/active", "r", NULL); if (io_channel != NULL) { @@ -1403,6 +1412,7 @@ gdm_local_display_factory_start_monitor on_vt_changed, factory); } + } #endif } Index: gdm-45.0.1/daemon/gdm-manager.c =================================================================== --- gdm-45.0.1.orig/daemon/gdm-manager.c +++ gdm-45.0.1/daemon/gdm-manager.c @@ -1355,6 +1355,8 @@ set_up_automatic_login_session (GdmManag "supported-session-types", supported_session_types, NULL); + if (getenv ("GDM_DISABLE_USER_DISPLAY_SERVER") != NULL) + manager->did_automatic_login = TRUE; g_debug ("GdmManager: Starting automatic login conversation"); gdm_session_start_conversation (session, "gdm-autologin"); } Index: gdm-45.0.1/daemon/gdm-server.c =================================================================== --- gdm-45.0.1.orig/daemon/gdm-server.c +++ gdm-45.0.1/daemon/gdm-server.c @@ -238,9 +238,9 @@ gdm_server_init_command (GdmServer *serv /* For systemd, we don't have a log file but instead log to stdout, so set it to the xserver's built-in default verbosity */ if (debug) - verbosity = "7 -logfile /dev/null"; + verbosity = "7"; else - verbosity = "3 -logfile /dev/null"; + verbosity = "3"; #endif if (g_access (SYSTEMD_X_SERVER, X_OK) < 0) { @@ -749,7 +749,7 @@ gdm_server_start (GdmServer *server) g_return_val_if_fail (GDM_IS_SERVER (server), FALSE); /* Hardcode the VT for the initial X server, but nothing else */ - if (server->is_initial) { + if (server->is_initial && g_strcmp0 (server->display_name, ":0") == 0) { vtarg = "vt" G_STRINGIFY (GDM_INITIAL_VT); } Index: gdm-45.0.1/daemon/gdm-session.c =================================================================== --- gdm-45.0.1.orig/daemon/gdm-session.c +++ gdm-45.0.1/daemon/gdm-session.c @@ -3436,6 +3436,7 @@ gdm_session_get_display_mode (GdmSession } #ifdef ENABLE_USER_DISPLAY_SERVER + if (getenv ("GDM_DISABLE_USER_DISPLAY_SERVER") == NULL ) { /* All other cases (wayland login screen, X login screen, * wayland user session, X user session) use the NEW_VT * display mode. That display mode means that GDM allocates @@ -3458,7 +3459,8 @@ gdm_session_get_display_mode (GdmSession * are paused when handed out. */ return GDM_SESSION_DISPLAY_MODE_NEW_VT; -#else +//#else + } else { #ifdef ENABLE_WAYLAND_SUPPORT /* Wayland sessions are for now assumed to run in a @@ -3469,6 +3471,7 @@ gdm_session_get_display_mode (GdmSession } #endif return GDM_SESSION_DISPLAY_MODE_REUSE_VT; + } #endif }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor