import gdm-40.0-1.el8

This commit is contained in:
CentOS Sources 2021-05-14 04:12:36 +00:00 committed by Andrew Lukoshko
commit e9fcf61042
21 changed files with 8129 additions and 0 deletions

1
.gdm.metadata Normal file
View File

@ -0,0 +1 @@
05c48de8765bde97768b6740417ad6c374c20763 SOURCES/gdm-40.0.tar.xz

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
SOURCES/gdm-40.0.tar.xz

View File

@ -0,0 +1,159 @@
From a447cd87b99868348ecf69479eb7958f20a318a2 Mon Sep 17 00:00:00 2001
From: Rui Matos <tiagomatos@gmail.com>
Date: Mon, 23 Jan 2017 20:19:51 +0100
Subject: [PATCH] Honor initial setup being disabled by distro installer
Sysadmins might want to disable any kind of initial setup for their
users, perhaps because they pre-configure their environments. We
already provide a configuration file option for this but distro
installers might have their own way of requesting this.
At least the anaconda installer provides an option to skip any kind
post-install setup tools so, for now we're only adding support for
that but more might be added in the future.
https://bugzilla.gnome.org/show_bug.cgi?id=777708
---
daemon/gdm-display.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/daemon/gdm-display.c b/daemon/gdm-display.c
index 687e7da4b..b3bdf066d 100644
--- a/daemon/gdm-display.c
+++ b/daemon/gdm-display.c
@@ -1591,103 +1591,132 @@ kernel_cmdline_initial_setup_force_state (gboolean *force_state)
GError *error = NULL;
gchar *contents = NULL;
gchar *setup_argument = NULL;
g_return_val_if_fail (force_state != NULL, FALSE);
if (!g_file_get_contents ("/proc/cmdline", &contents, NULL, &error)) {
g_debug ("GdmDisplay: Could not check kernel parameters, not forcing initial setup: %s",
error->message);
g_clear_error (&error);
return FALSE;
}
g_debug ("GdmDisplay: Checking kernel command buffer %s", contents);
if (!kernel_cmdline_initial_setup_argument (contents, &setup_argument, &error)) {
g_debug ("GdmDisplay: Failed to read kernel commandline: %s", error->message);
g_clear_pointer (&contents, g_free);
return FALSE;
}
g_clear_pointer (&contents, g_free);
/* Poor-man's check for truthy or falsey values */
*force_state = setup_argument[0] == '1';
g_free (setup_argument);
return TRUE;
}
+static gboolean
+initial_setup_disabled_by_anaconda (void)
+{
+ GKeyFile *key_file;
+ const gchar *file_name = SYSCONFDIR "/sysconfig/anaconda";
+ gboolean disabled = FALSE;
+ GError *error = NULL;
+
+ key_file = g_key_file_new ();
+ if (!g_key_file_load_from_file (key_file, file_name, G_KEY_FILE_NONE, &error)) {
+ if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT) &&
+ !g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND)) {
+ g_warning ("Could not read %s: %s", file_name, error->message);
+ }
+ g_error_free (error);
+ goto out;
+ }
+
+ disabled = g_key_file_get_boolean (key_file, "General",
+ "post_install_tools_disabled", NULL);
+ out:
+ g_key_file_unref (key_file);
+ return disabled;
+}
+
static gboolean
wants_initial_setup (GdmDisplay *self)
{
GdmDisplayPrivate *priv;
gboolean enabled = FALSE;
gboolean forced = FALSE;
priv = gdm_display_get_instance_private (self);
if (already_done_initial_setup_on_this_boot ()) {
return FALSE;
}
if (kernel_cmdline_initial_setup_force_state (&forced)) {
if (forced) {
g_debug ("GdmDisplay: Forcing gnome-initial-setup");
return TRUE;
}
g_debug ("GdmDisplay: Forcing no gnome-initial-setup");
return FALSE;
}
/* don't run initial-setup on remote displays
*/
if (!priv->is_local) {
return FALSE;
}
/* don't run if the system has existing users */
if (priv->have_existing_user_accounts) {
return FALSE;
}
/* don't run if initial-setup is unavailable */
if (!can_create_environment ("gnome-initial-setup")) {
return FALSE;
}
if (!gdm_settings_direct_get_boolean (GDM_KEY_INITIAL_SETUP_ENABLE, &enabled)) {
return FALSE;
}
+ if (initial_setup_disabled_by_anaconda ()) {
+ return FALSE;
+ }
+
return enabled;
}
void
gdm_display_start_greeter_session (GdmDisplay *self)
{
GdmDisplayPrivate *priv;
GdmSession *session;
char *display_name;
char *seat_id;
char *hostname;
char *auth_file = NULL;
priv = gdm_display_get_instance_private (self);
g_return_if_fail (g_strcmp0 (priv->session_class, "greeter") == 0);
g_debug ("GdmDisplay: Running greeter");
display_name = NULL;
seat_id = NULL;
hostname = NULL;
g_object_get (self,
"x11-display-name", &display_name,
"seat-id", &seat_id,
"remote-hostname", &hostname,
NULL);
if (priv->access_file != NULL) {
auth_file = gdm_display_access_file_get_path (priv->access_file);
}
--
2.28.0

View File

@ -0,0 +1,241 @@
From 911780e9980fe16b18d139f757ff795da1d1882d Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Wed, 5 May 2021 10:50:56 -0400
Subject: [PATCH] Revert "gdm-{wayland,x}-session: don't overwrite user env
with fallback vars"
This reverts commit ccecd9c975d04da80db4cd547b67a1a94fa83292.
---
daemon/gdm-wayland-session.c | 22 +---------------------
daemon/gdm-x-session.c | 22 +---------------------
2 files changed, 2 insertions(+), 42 deletions(-)
diff --git a/daemon/gdm-wayland-session.c b/daemon/gdm-wayland-session.c
index d0404d2c1..35679b194 100644
--- a/daemon/gdm-wayland-session.c
+++ b/daemon/gdm-wayland-session.c
@@ -262,112 +262,92 @@ on_session_finished (GSubprocess *subprocess,
state->session_exit_status = exit_status;
} else {
int signal_number;
signal_number = g_subprocess_get_term_sig (subprocess);
g_debug ("session was killed with status %d", signal_number);
}
g_clear_object (&state->session_subprocess);
out:
g_main_loop_quit (state->main_loop);
}
static gboolean
spawn_session (State *state,
GCancellable *cancellable)
{
GSubprocessLauncher *launcher = NULL;
GSubprocess *subprocess = NULL;
GError *error = NULL;
gboolean is_running = FALSE;
int ret;
char **argv = NULL;
static const char *session_variables[] = { "DISPLAY",
"XAUTHORITY",
"WAYLAND_DISPLAY",
"WAYLAND_SOCKET",
"GNOME_SHELL_SESSION_MODE",
NULL };
- /* The environment variables listed below are those we have set (or
- * received from our own execution environment) only as a fallback to
- * make things work, as opposed to a information directly pertaining to
- * the session about to be started. Variables listed here will not
- * overwrite the existing environment (possibly) imported from the
- * systemd --user instance.
- * As an example: We need a PATH for some of the launched subprocesses
- * to work, but if the user (or the distributor) has customized the PATH
- * via one of systemds user-environment-generators, that version should
- * be preferred. */
- static const char *fallback_variables[] = { "PATH", NULL };
g_debug ("Running wayland session");
ret = g_shell_parse_argv (state->session_command,
NULL,
&argv,
&error);
if (!ret) {
g_debug ("could not parse session arguments: %s", error->message);
goto out;
}
launcher = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_NONE);
if (state->environment != NULL) {
size_t i;
for (i = 0; state->environment[i] != NULL; i++) {
g_auto(GStrv) environment_entry = NULL;
if (state->environment[i][0] == '\0') {
continue;
}
environment_entry = g_strsplit (state->environment[i], "=", 2);
if (environment_entry[0] == NULL || environment_entry[1] == NULL) {
continue;
}
- /* Merge the environment block imported from systemd --user with the
- * environment we have set for ourselves (and thus pass on to the
- * launcher process). Variables we have set have precedence, as to not
- * import stale data from prior user sessions, with the exception of
- * those listed in fallback_variables. See the comment there for more
- * explanations. */
- g_subprocess_launcher_setenv (launcher,
- environment_entry[0],
- environment_entry[1],
- g_strv_contains (fallback_variables, environment_entry[0]));
+ g_subprocess_launcher_setenv (launcher, environment_entry[0], environment_entry[1], FALSE);
}
/* Don't allow session specific environment variables from earlier sessions to
* leak through */
for (i = 0; session_variables[i] != NULL; i++) {
if (g_getenv (session_variables[i]) == NULL) {
g_subprocess_launcher_unsetenv (launcher, session_variables[i]);
}
}
}
if (state->bus_address != NULL) {
g_subprocess_launcher_setenv (launcher, "DBUS_SESSION_BUS_ADDRESS", state->bus_address, TRUE);
}
subprocess = g_subprocess_launcher_spawnv (launcher,
(const char * const *) argv,
&error);
g_strfreev (argv);
if (subprocess == NULL) {
g_debug ("could not start session: %s", error->message);
goto out;
}
state->session_subprocess = g_object_ref (subprocess);
g_subprocess_wait_async (state->session_subprocess,
cancellable,
(GAsyncReadyCallback)
diff --git a/daemon/gdm-x-session.c b/daemon/gdm-x-session.c
index 5962da572..b15483614 100644
--- a/daemon/gdm-x-session.c
+++ b/daemon/gdm-x-session.c
@@ -588,102 +588,82 @@ on_session_finished (GSubprocess *subprocess,
state->session_exit_status = exit_status;
} else {
int signal_number;
signal_number = g_subprocess_get_term_sig (subprocess);
g_debug ("session was killed with status %d", signal_number);
}
g_clear_object (&state->session_subprocess);
out:
g_main_loop_quit (state->main_loop);
}
static gboolean
spawn_session (State *state,
gboolean run_script,
GCancellable *cancellable)
{
GSubprocessLauncher *launcher = NULL;
GSubprocess *subprocess = NULL;
GError *error = NULL;
gboolean is_running = FALSE;
const char *vt;
static const char *session_variables[] = { "DISPLAY",
"XAUTHORITY",
"WAYLAND_DISPLAY",
"WAYLAND_SOCKET",
"GNOME_SHELL_SESSION_MODE",
NULL };
- /* The environment variables listed below are those we have set (or
- * received from our own execution environment) only as a fallback to
- * make things work, as opposed to a information directly pertaining to
- * the session about to be started. Variables listed here will not
- * overwrite the existing environment (possibly) imported from the
- * systemd --user instance.
- * As an example: We need a PATH for some of the launched subprocesses
- * to work, but if the user (or the distributor) has customized the PATH
- * via one of systemds user-environment-generators, that version should
- * be preferred. */
- static const char *fallback_variables[] = { "PATH", NULL };
g_debug ("Running X session");
launcher = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_NONE);
if (state->environment != NULL) {
size_t i;
for (i = 0; state->environment[i] != NULL; i++) {
g_auto(GStrv) environment_entry = NULL;
if (state->environment[i][0] == '\0') {
continue;
}
environment_entry = g_strsplit (state->environment[i], "=", 2);
if (environment_entry[0] == NULL || environment_entry[1] == NULL) {
continue;
}
- /* Merge the environment block imported from systemd --user with the
- * environment we have set for ourselves (and thus pass on to the
- * launcher process). Variables we have set have precedence, as to not
- * import stale data from prior user sessions, with the exception of
- * those listed in fallback_variables. See the comment there for more
- * explanations. */
- g_subprocess_launcher_setenv (launcher,
- environment_entry[0],
- environment_entry[1],
- g_strv_contains (fallback_variables, environment_entry[0]));
+ g_subprocess_launcher_setenv (launcher, environment_entry[0], environment_entry[1], FALSE);
}
/* Don't allow session specific environment variables from earlier sessions to
* leak through */
for (i = 0; session_variables[i] != NULL; i++) {
if (g_getenv (session_variables[i]) == NULL) {
g_subprocess_launcher_unsetenv (launcher, session_variables[i]);
}
}
}
g_subprocess_launcher_setenv (launcher, "DISPLAY", state->display_name, TRUE);
g_subprocess_launcher_setenv (launcher, "XAUTHORITY", state->auth_file, TRUE);
if (state->bus_address != NULL) {
g_subprocess_launcher_setenv (launcher, "DBUS_SESSION_BUS_ADDRESS", state->bus_address, TRUE);
}
vt = g_getenv ("XDG_VTNR");
if (vt != NULL) {
g_subprocess_launcher_setenv (launcher, "WINDOWPATH", vt, TRUE);
}
if (run_script) {
subprocess = g_subprocess_launcher_spawn (launcher,
&error,
GDMCONFDIR "/Xsession",
state->session_command,
NULL);
--
2.31.1

View File

@ -0,0 +1,24 @@
From b1557adf711577c62609f8a784f11fad66eb54ef Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Wed, 31 Jul 2013 17:32:55 -0400
Subject: [PATCH] data: add system dconf databases to gdm profile
This way system settings can affect the login screen.
---
data/dconf/gdm.in | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/data/dconf/gdm.in b/data/dconf/gdm.in
index 4d8bf1748..9694078fb 100644
--- a/data/dconf/gdm.in
+++ b/data/dconf/gdm.in
@@ -1,2 +1,6 @@
user-db:user
+system-db:gdm
+system-db:local
+system-db:site
+system-db:distro
file-db:@DATADIR@/@PACKAGE@/greeter-dconf-defaults
--
2.28.0

View File

@ -0,0 +1,38 @@
From 53afc21a17f002730a53fe790de564f055c07352 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 11 Feb 2019 18:14:07 -0500
Subject: [PATCH] data: disable wayland on certain hardware
We're having issues with wayland on passthrough to virt
setups and with the vendor nvidia driver, so
disable it in those cases.
---
data/61-gdm.rules.in | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/data/61-gdm.rules.in b/data/61-gdm.rules.in
index b1da191f8..0230e5ca5 100644
--- a/data/61-gdm.rules.in
+++ b/data/61-gdm.rules.in
@@ -1,6 +1,15 @@
# disable Wayland on Hi1710 chipsets
-ATTR{vendor}=="0x19e5", ATTR{device}=="0x1711", RUN+="@libexecdir@/gdm-runtime-config set daemon WaylandEnable false"
+ATTR{vendor}=="0x19e5", ATTR{device}=="0x1711", RUN+="@libexecdir@/gdm-disable-wayland"
# disable Wayland when using the proprietary nvidia driver
-DRIVER=="nvidia", RUN+="@libexecdir@/gdm-runtime-config set daemon WaylandEnable false"
+DRIVER=="nvidia", RUN+="@libexecdir@/gdm-disable-wayland"
+
+# disable Wayland on passthrough graphics setups for now (assumes passthrough if
+# there is more than one card, and one of the cards is virt: cirrus, bochs, qxl)
+ATTR{vendor}=="0x1013", ATTR{device}=="0x00b8", ATTR{subsystem_vendor}=="0x1af4", ATTR{subsystem_device}=="0x1100", ENV{GDM_HAS_VIRTUAL_GPU}="1"
+ATTR{vendor}=="0x1b36", ATTR{device}=="0x0100", ENV{GDM_HAS_VIRTUAL_GPU}="1"
+ATTR{vendor}=="0x1234", ATTR{device}=="0x1111", ENV{GDM_HAS_VIRTUAL_GPU}="1"
+
+SUBSYSTEM=="drm", KERNEL=="card[1-9]*", ENV{GDM_HAS_VIRTUAL_GPU}=="1", RUN+="@libexecdir@/gdm-disable-wayland"
+
# disable Wayland if modesetting is disabled
-IMPORT{cmdline}="nomodeset", RUN+="@libexecdir@/gdm-runtime-config set daemon WaylandEnable false"
+IMPORT{cmdline}="nomodeset", RUN+="@libexecdir@/gdm-disable-wayland"
--
2.31.1

View File

@ -0,0 +1,55 @@
From 7f910ee7554703a2e775e73ace10ced5d7a0fe66 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Fri, 26 Jul 2019 14:06:16 -0400
Subject: [PATCH] data: reap gdm sessions on shutdown
If GDM gets shutdown we should make sure all sessions get shutdown too.
This is a bit of a safety net in case any processes in the session are
lingering after the orderly shutdown.
---
data/gdm.service.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/data/gdm.service.in b/data/gdm.service.in
index 17e8a8de8..195bd0fdc 100644
--- a/data/gdm.service.in
+++ b/data/gdm.service.in
@@ -1,33 +1,34 @@
[Unit]
Description=GNOME Display Manager
# replaces the getty
Conflicts=getty@tty${GDM_INITIAL_VT}.service
After=getty@tty${GDM_INITIAL_VT}.service
# replaces plymouth-quit since it quits plymouth on its own
Conflicts=${PLYMOUTH_QUIT_SERVICE}
After=${PLYMOUTH_QUIT_SERVICE}
# Needs all the dependencies of the services it's replacing
# pulled from getty@.service and ${PLYMOUTH_QUIT_SERVICE}
# (except for plymouth-quit-wait.service since it waits until
# plymouth is quit, which we do)
After=rc-local.service plymouth-start.service systemd-user-sessions.service
# GDM takes responsibility for stopping plymouth, so if it fails
# for any reason, make sure plymouth still stops
OnFailure=plymouth-quit.service
[Service]
ExecStart=${sbindir}/gdm
+ExecStopPost=-/usr/bin/bash -c 'for f in /run/systemd/sessions/*; do [ -f $f ] && /usr/bin/fgrep -q SERVICE=gdm $f && loginctl terminate-session $(basename $f); done'
KillMode=mixed
Restart=always
IgnoreSIGPIPE=no
BusName=org.gnome.DisplayManager
EnvironmentFile=-${LANG_CONFIG_FILE}
ExecReload=/bin/kill -SIGHUP $MAINPID
KeyringMode=shared
[Install]
Alias=display-manager.service
--
2.28.0

View File

@ -0,0 +1,155 @@
From f860f60771cd4f07ae1d06c56621a5aa8545e60b Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Tue, 1 Sep 2020 13:49:27 -0400
Subject: [PATCH] display: Handle failure before display registration
Normally, e.g., gdm-wayland-session would register its display
before starting the session. This display registration is how
the display moves to the "managed" state. We currently detect
session failure in gdm_display_unmanage. If gdm-wayland-session
is killed before it registers the display, gdm_display_unmanage
won't run, and failure won't be detected.
This commit make gdm_display_unmanage get called, even if the
display isn't yet fully managed.
---
daemon/gdm-display.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/daemon/gdm-display.c b/daemon/gdm-display.c
index 7c954ad24..3a260923a 100644
--- a/daemon/gdm-display.c
+++ b/daemon/gdm-display.c
@@ -648,62 +648,60 @@ gdm_display_disconnect (GdmDisplay *self)
/* resource_id_mask is the bits given to each client for
* addressing resources */
highest_client = (XID) ~unused_bits & ~setup->resource_id_mask;
client_increment = setup->resource_id_mask + 1;
/* Kill every client but ourselves, then close our own connection
*/
for (client = 0;
client <= highest_client;
client += client_increment) {
if (client != setup->resource_id_base)
xcb_kill_client (priv->xcb_connection, client);
}
xcb_flush (priv->xcb_connection);
g_clear_pointer (&priv->xcb_connection, xcb_disconnect);
}
gboolean
gdm_display_unmanage (GdmDisplay *self)
{
GdmDisplayPrivate *priv;
g_return_val_if_fail (GDM_IS_DISPLAY (self), FALSE);
priv = gdm_display_get_instance_private (self);
- g_debug ("GdmDisplay: unmanage display");
-
gdm_display_disconnect (self);
if (priv->user_access_file != NULL) {
gdm_display_access_file_close (priv->user_access_file);
g_object_unref (priv->user_access_file);
priv->user_access_file = NULL;
}
if (priv->access_file != NULL) {
gdm_display_access_file_close (priv->access_file);
g_object_unref (priv->access_file);
priv->access_file = NULL;
}
if (!priv->session_registered) {
g_warning ("GdmDisplay: Session never registered, failing");
_gdm_display_set_status (self, GDM_DISPLAY_FAILED);
} else {
_gdm_display_set_status (self, GDM_DISPLAY_UNMANAGED);
}
return TRUE;
}
gboolean
gdm_display_get_id (GdmDisplay *self,
char **id,
GError **error)
{
GdmDisplayPrivate *priv;
@@ -1446,63 +1444,63 @@ gdm_display_get_object_skeleton (GdmDisplay *self)
{
GdmDisplayPrivate *priv;
priv = gdm_display_get_instance_private (self);
return priv->object_skeleton;
}
static void
on_launch_environment_session_opened (GdmLaunchEnvironment *launch_environment,
GdmDisplay *self)
{
char *session_id;
g_debug ("GdmDisplay: Greeter session opened");
session_id = gdm_launch_environment_get_session_id (launch_environment);
_gdm_display_set_session_id (self, session_id);
g_free (session_id);
}
static void
on_launch_environment_session_started (GdmLaunchEnvironment *launch_environment,
GdmDisplay *self)
{
g_debug ("GdmDisplay: Greeter started");
}
static void
self_destruct (GdmDisplay *self)
{
g_object_ref (self);
- if (gdm_display_get_status (self) == GDM_DISPLAY_MANAGED) {
- gdm_display_unmanage (self);
- }
+
+ g_debug ("GdmDisplay: initiating display self-destruct");
+ gdm_display_unmanage (self);
if (gdm_display_get_status (self) != GDM_DISPLAY_FINISHED) {
queue_finish (self);
}
g_object_unref (self);
}
static void
on_launch_environment_session_stopped (GdmLaunchEnvironment *launch_environment,
GdmDisplay *self)
{
g_debug ("GdmDisplay: Greeter stopped");
self_destruct (self);
}
static void
on_launch_environment_session_exited (GdmLaunchEnvironment *launch_environment,
int code,
GdmDisplay *self)
{
g_debug ("GdmDisplay: Greeter exited: %d", code);
self_destruct (self);
}
static void
on_launch_environment_session_died (GdmLaunchEnvironment *launch_environment,
int signal,
GdmDisplay *self)
{
g_debug ("GdmDisplay: Greeter died: %d", signal);
--
2.31.1

View File

@ -0,0 +1,90 @@
From 89ec6e57e452c04ffc43ae224052c7ddeea66676 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 29 Oct 2018 06:57:59 -0400
Subject: [PATCH] local-display-factory: pause for a few seconds before falling
back to X
logind currently gets confused if a session is started immediately as
one is shutting down.
Workaround this problem by adding an artificial delay when falling
back to X.
http://bugzilla.redhat.com/1643874
---
daemon/gdm-local-display-factory.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c
index 8a4ef06cd..8554a0442 100644
--- a/daemon/gdm-local-display-factory.c
+++ b/daemon/gdm-local-display-factory.c
@@ -488,60 +488,65 @@ ensure_display_for_seat (GdmLocalDisplayFactory *factory,
g_critical ("Failed to query CanGraphical information for seat %s", seat_id);
return;
}
if (ret == 0) {
g_debug ("GdmLocalDisplayFactory: System doesn't currently support graphics");
seat_supports_graphics = FALSE;
} else {
g_debug ("GdmLocalDisplayFactory: System supports graphics");
seat_supports_graphics = TRUE;
}
if (g_strcmp0 (seat_id, "seat0") == 0) {
is_seat0 = TRUE;
/* If we've failed, or are explicitly told to, fall back to legacy X11 support
*/
if (factory->num_failures > 0 || !gdm_local_display_factory_use_wayland ()) {
session_type = NULL;
g_debug ("GdmLocalDisplayFactory: New displays on seat0 will use X11 fallback");
} else {
g_debug ("GdmLocalDisplayFactory: New displays on seat0 will use wayland");
}
} else {
is_seat0 = FALSE;
g_debug ("GdmLocalDisplayFactory: New displays on seat %s will use X11 fallback", seat_id);
/* Force legacy X11 for all auxiliary seats */
seat_supports_graphics = TRUE;
session_type = NULL;
+
+ /* workaround logind race for now
+ * bug 1643874
+ */
+ g_usleep (2 * G_USEC_PER_SEC);
}
/* For seat0, we have a fallback logic to still try starting it after
* SEAT0_GRAPHICS_CHECK_TIMEOUT seconds. i.e. we simply continue even if
* CanGraphical is unset.
* This is ugly, but it means we'll come up eventually in some
* scenarios where no master device is present.
* Note that we'll force an X11 fallback even though there might be
* cases where an wayland capable device is present and simply not marked as
* master-of-seat. In these cases, this should likely be fixed in the
* udev rules.
*
* At the moment, systemd always sets CanGraphical for non-seat0 seats.
* This is because non-seat0 seats are defined by having master-of-seat
* set. This means we can avoid the fallback check for non-seat0 seats,
* which simplifies the code.
*/
if (is_seat0) {
if (!seat_supports_graphics) {
if (!factory->seat0_graphics_check_timed_out) {
if (factory->seat0_graphics_check_timeout_id == 0) {
g_debug ("GdmLocalDisplayFactory: seat0 doesn't yet support graphics. Waiting %d seconds to try again.", SEAT0_GRAPHICS_CHECK_TIMEOUT);
factory->seat0_graphics_check_timeout_id = g_timeout_add_seconds (SEAT0_GRAPHICS_CHECK_TIMEOUT,
on_seat0_graphics_check_timeout,
factory);
} else {
/* It is not yet time to force X11 fallback. */
g_debug ("GdmLocalDisplayFactory: seat0 display requested when there is no graphics support before graphics check timeout.");
}
--
2.31.1

View File

@ -0,0 +1,344 @@
From d99f12385d6b04023cbe17f3f6fc2a917066c6e8 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Thu, 20 Dec 2018 14:51:38 -0500
Subject: [PATCH 1/3] manager: allow multiple xdmcp logins for the same user
---
common/gdm-settings-keys.h | 1 +
daemon/gdm-manager.c | 71 ++++++++++++++++++++++++++++----------
data/gdm.schemas.in | 5 +++
3 files changed, 59 insertions(+), 18 deletions(-)
diff --git a/common/gdm-settings-keys.h b/common/gdm-settings-keys.h
index f0059b5cf..33676a851 100644
--- a/common/gdm-settings-keys.h
+++ b/common/gdm-settings-keys.h
@@ -28,37 +28,38 @@ G_BEGIN_DECLS
#define GDM_KEY_USER "daemon/User"
#define GDM_KEY_GROUP "daemon/Group"
#define GDM_KEY_AUTO_LOGIN_ENABLE "daemon/AutomaticLoginEnable"
#define GDM_KEY_AUTO_LOGIN_USER "daemon/AutomaticLogin"
#define GDM_KEY_TIMED_LOGIN_ENABLE "daemon/TimedLoginEnable"
#define GDM_KEY_TIMED_LOGIN_USER "daemon/TimedLogin"
#define GDM_KEY_TIMED_LOGIN_DELAY "daemon/TimedLoginDelay"
#define GDM_KEY_INITIAL_SETUP_ENABLE "daemon/InitialSetupEnable"
#define GDM_KEY_WAYLAND_ENABLE "daemon/WaylandEnable"
#define GDM_KEY_DEBUG "debug/Enable"
#define GDM_KEY_INCLUDE "greeter/Include"
#define GDM_KEY_EXCLUDE "greeter/Exclude"
#define GDM_KEY_INCLUDE_ALL "greeter/IncludeAll"
#define GDM_KEY_DISALLOW_TCP "security/DisallowTCP"
#define GDM_KEY_ALLOW_REMOTE_AUTOLOGIN "security/AllowRemoteAutoLogin"
#define GDM_KEY_XDMCP_ENABLE "xdmcp/Enable"
#define GDM_KEY_SHOW_LOCAL_GREETER "xdmcp/ShowLocalGreeter"
#define GDM_KEY_MAX_PENDING "xdmcp/MaxPending"
#define GDM_KEY_MAX_SESSIONS "xdmcp/MaxSessions"
#define GDM_KEY_MAX_WAIT "xdmcp/MaxWait"
#define GDM_KEY_DISPLAYS_PER_HOST "xdmcp/DisplaysPerHost"
#define GDM_KEY_UDP_PORT "xdmcp/Port"
#define GDM_KEY_INDIRECT "xdmcp/HonorIndirect"
#define GDM_KEY_MAX_WAIT_INDIRECT "xdmcp/MaxWaitIndirect"
#define GDM_KEY_PING_INTERVAL "xdmcp/PingIntervalSeconds"
#define GDM_KEY_WILLING "xdmcp/Willing"
+#define GDM_KEY_ALLOW_MULTIPLE_SESSIONS_PER_USER "xdmcp/AllowMultipleSessionsPerUser"
#define GDM_KEY_MULTICAST "chooser/Multicast"
#define GDM_KEY_MULTICAST_ADDR "chooser/MulticastAddr"
G_END_DECLS
#endif /* _GDM_SETTINGS_KEYS_H */
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
index 9c10adff3..b96295ab6 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -566,93 +566,106 @@ get_display_and_details_for_bus_sender (GdmManager *self,
*out_tty = get_tty_for_session_id (session_id, &error);
if (error != NULL) {
g_debug ("GdmManager: Error while retrieving tty for session: %s",
error->message);
g_clear_error (&error);
}
}
display = gdm_display_store_find (self->priv->display_store,
lookup_by_session_id,
(gpointer) session_id);
out:
if (out_display != NULL) {
*out_display = display;
}
g_free (session_id);
}
static gboolean
switch_to_compatible_user_session (GdmManager *manager,
GdmSession *session,
gboolean fail_if_already_switched)
{
gboolean res;
gboolean ret;
const char *username;
const char *seat_id;
- const char *ssid_to_activate;
+ const char *ssid_to_activate = NULL;
GdmSession *existing_session;
ret = FALSE;
username = gdm_session_get_username (session);
seat_id = gdm_session_get_display_seat_id (session);
- if (!fail_if_already_switched) {
- session = NULL;
- }
+ if (!fail_if_already_switched)
+ ssid_to_activate = gdm_session_get_session_id (session);
- existing_session = find_session_for_user_on_seat (manager, username, seat_id, session);
+ if (ssid_to_activate == NULL) {
+ if (!seat_id || !sd_seat_can_multi_session (seat_id)) {
+ g_debug ("GdmManager: unable to activate existing sessions from login screen unless on seat0");
+ goto out;
+ }
- if (existing_session != NULL) {
- ssid_to_activate = gdm_session_get_session_id (existing_session);
- if (seat_id != NULL) {
- res = gdm_activate_session_by_id (manager->priv->connection, seat_id, ssid_to_activate);
- if (! res) {
- g_debug ("GdmManager: unable to activate session: %s", ssid_to_activate);
- goto out;
- }
+ if (!fail_if_already_switched) {
+ session = NULL;
}
- res = session_unlock (manager, ssid_to_activate);
- if (!res) {
- /* this isn't fatal */
- g_debug ("GdmManager: unable to unlock session: %s", ssid_to_activate);
+ existing_session = find_session_for_user_on_seat (manager, username, seat_id, session);
+
+ if (existing_session != NULL) {
+ ssid_to_activate = gdm_session_get_session_id (existing_session);
}
- } else {
+ }
+
+ if (ssid_to_activate == NULL) {
goto out;
}
+ if (seat_id != NULL) {
+ res = gdm_activate_session_by_id (manager->priv->connection, seat_id, ssid_to_activate);
+ if (! res) {
+ g_debug ("GdmManager: unable to activate session: %s", ssid_to_activate);
+ goto out;
+ }
+ }
+
+ res = session_unlock (manager, ssid_to_activate);
+ if (!res) {
+ /* this isn't fatal */
+ g_debug ("GdmManager: unable to unlock session: %s", ssid_to_activate);
+ }
+
ret = TRUE;
out:
return ret;
}
static GdmDisplay *
get_display_for_user_session (GdmSession *session)
{
return g_object_get_data (G_OBJECT (session), "gdm-display");
}
static GdmSession *
get_user_session_for_display (GdmDisplay *display)
{
if (display == NULL) {
return NULL;
}
return g_object_get_data (G_OBJECT (display), "gdm-user-session");
}
static gboolean
add_session_record (GdmManager *manager,
GdmSession *session,
GPid pid,
SessionRecord record)
{
const char *username;
char *display_name, *hostname, *display_device;
@@ -1089,92 +1102,114 @@ open_temporary_reauthentication_channel (GdmManager *self,
g_signal_connect (session,
"client-disconnected",
G_CALLBACK (on_reauthentication_client_disconnected),
self);
g_signal_connect (session,
"client-rejected",
G_CALLBACK (on_reauthentication_client_rejected),
self);
g_signal_connect (session,
"cancelled",
G_CALLBACK (on_reauthentication_cancelled),
self);
g_signal_connect (session,
"conversation-started",
G_CALLBACK (on_reauthentication_conversation_started),
self);
g_signal_connect (session,
"conversation-stopped",
G_CALLBACK (on_reauthentication_conversation_stopped),
self);
g_signal_connect (session,
"verification-complete",
G_CALLBACK (on_reauthentication_verification_complete),
self);
address = gdm_session_get_server_address (session);
return g_strdup (address);
}
+static gboolean
+remote_users_can_log_in_more_than_once (GdmManager *manager)
+{
+ gboolean enabled;
+
+ enabled = FALSE;
+
+ gdm_settings_direct_get_boolean (GDM_KEY_ALLOW_MULTIPLE_SESSIONS_PER_USER, &enabled);
+
+ g_debug ("GdmDisplay: Remote users allowed to log in more than once: %s", enabled? "yes" : "no");
+
+ return enabled;
+}
+
static gboolean
gdm_manager_handle_open_reauthentication_channel (GdmDBusManager *manager,
GDBusMethodInvocation *invocation,
const char *username)
{
GdmManager *self = GDM_MANAGER (manager);
const char *sender;
GdmDisplay *display = NULL;
GdmSession *session;
GDBusConnection *connection;
char *seat_id = NULL;
char *session_id = NULL;
GPid pid = 0;
uid_t uid = (uid_t) -1;
gboolean is_login_screen = FALSE;
gboolean is_remote = FALSE;
g_debug ("GdmManager: trying to open reauthentication channel for user %s", username);
sender = g_dbus_method_invocation_get_sender (invocation);
connection = g_dbus_method_invocation_get_connection (invocation);
get_display_and_details_for_bus_sender (self, connection, sender, &display, &seat_id, &session_id, NULL, &pid, &uid, &is_login_screen, &is_remote);
if (session_id == NULL || pid == 0 || uid == (uid_t) -1) {
g_dbus_method_invocation_return_error_literal (invocation,
G_DBUS_ERROR,
G_DBUS_ERROR_ACCESS_DENIED,
_("No session available"));
return TRUE;
}
+ if (is_login_screen && is_remote && remote_users_can_log_in_more_than_once (self)) {
+ g_dbus_method_invocation_return_error_literal (invocation,
+ G_DBUS_ERROR,
+ G_DBUS_ERROR_ACCESS_DENIED,
+ "Login screen creates new sessions for remote connections");
+ return TRUE;
+ }
+
if (is_login_screen) {
g_debug ("GdmManager: looking for login screen session for user %s on seat %s", username, seat_id);
session = find_session_for_user_on_seat (self,
username,
seat_id,
NULL);
} else {
g_debug ("GdmManager: looking for user session on display");
session = get_user_session_for_display (display);
}
if (session != NULL && gdm_session_is_running (session)) {
gdm_session_start_reauthentication (session, pid, uid);
g_hash_table_insert (self->priv->open_reauthentication_requests,
GINT_TO_POINTER (pid),
invocation);
} else if (is_login_screen) {
g_dbus_method_invocation_return_error_literal (invocation,
G_DBUS_ERROR,
G_DBUS_ERROR_ACCESS_DENIED,
"Login screen only allowed to open reauthentication channels for running sessions");
return TRUE;
} else {
char *address;
address = open_temporary_reauthentication_channel (self,
seat_id,
session_id,
pid,
uid,
is_remote);
diff --git a/data/gdm.schemas.in b/data/gdm.schemas.in
index 255bff023..86059c02e 100644
--- a/data/gdm.schemas.in
+++ b/data/gdm.schemas.in
@@ -102,33 +102,38 @@
<schema>
<key>xdmcp/DisplaysPerHost</key>
<signature>i</signature>
<default>1</default>
</schema>
<schema>
<key>xdmcp/Port</key>
<signature>i</signature>
<default>177</default>
</schema>
<schema>
<key>xdmcp/HonorIndirect</key>
<signature>b</signature>
<default>true</default>
</schema>
<schema>
<key>xdmcp/MaxWaitIndirect</key>
<signature>i</signature>
<default>30</default>
</schema>
<schema>
<key>xdmcp/PingIntervalSeconds</key>
<signature>i</signature>
<default>0</default>
</schema>
<schema>
<key>xdmcp/Willing</key>
<signature>s</signature>
<default>@gdmconfdir@/Xwilling</default>
</schema>
+ <schema>
+ <key>xdmcp/AllowMultipleSessionsPerUser</key>
+ <signature>b</signature>
+ <default>false</default>
+ </schema>
</schemalist>
</gdmschemafile>
--
2.31.1

View File

@ -0,0 +1,362 @@
From 7b5ee288d992f85eaefbfbc4dac663a29fcae446 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Wed, 5 May 2021 11:06:58 -0400
Subject: [PATCH] 0001-utils-Drop-gdm-screenshot.patch
---
utils/gdm-screenshot.c | 296 -----------------------------------------
utils/meson.build | 15 ---
2 files changed, 311 deletions(-)
delete mode 100644 utils/gdm-screenshot.c
diff --git a/utils/gdm-screenshot.c b/utils/gdm-screenshot.c
deleted file mode 100644
index 5d20929a3..000000000
--- a/utils/gdm-screenshot.c
+++ /dev/null
@@ -1,296 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2008 William Jon McCann <jmccann@redhat.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <locale.h>
-
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-#include <canberra-gtk.h>
-
-#include <X11/Xatom.h>
-#include <gdk/gdkx.h>
-
-#define SELECTION_NAME "_GDM_SCREENSHOT"
-static GtkWidget *selection_window;
-
-static gboolean debug_in;
-
-/* Keep all config options for compatibility even if they are noops */
-GOptionEntry options [] = {
- { "debug", 'd', 0, G_OPTION_ARG_NONE, &debug_in, N_("Debugging output"), NULL },
- { NULL }
-};
-
-/* To make sure there is only one screenshot taken at a time,
- * (Imagine key repeat for the print screen key) we hold a selection
- * until we are done taking the screenshot
- */
-/* * Copyright (C) 2001-2006 Jonathan Blandford <jrb@alum.mit.edu> */
-static gboolean
-screenshot_grab_lock (void)
-{
- Atom selection_atom;
- GdkCursor *cursor;
- gboolean result = FALSE;
-
- selection_atom = gdk_x11_get_xatom_by_name (SELECTION_NAME);
- XGrabServer (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
- if (XGetSelectionOwner (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), selection_atom) != None) {
- goto out;
- }
-
- selection_window = gtk_invisible_new ();
- gtk_widget_show (selection_window);
-
- if (!gtk_selection_owner_set (selection_window,
- gdk_atom_intern (SELECTION_NAME, FALSE),
- GDK_CURRENT_TIME)) {
- gtk_widget_destroy (selection_window);
- selection_window = NULL;
- goto out;
- }
-
- cursor = gdk_cursor_new_for_display (gdk_display_get_default (), GDK_WATCH);
- gdk_pointer_grab (gtk_widget_get_window (selection_window), FALSE, 0, NULL,
- cursor, GDK_CURRENT_TIME);
- g_object_unref (cursor);
-
- result = TRUE;
-
- out:
- XUngrabServer (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
- gdk_flush ();
-
- return result;
-}
-
-/* * Copyright (C) 2001-2006 Jonathan Blandford <jrb@alum.mit.edu> */
-static void
-screenshot_release_lock (void)
-{
- if (selection_window != NULL) {
- gtk_widget_destroy (selection_window);
- selection_window = NULL;
- }
- gdk_flush ();
-}
-
-/* * Copyright (C) 2001-2006 Jonathan Blandford <jrb@alum.mit.edu> */
-static GdkPixbuf *
-screenshot_get_pixbuf (Window w)
-{
- GdkWindow *window;
- GdkWindow *root;
- GdkPixbuf *screenshot;
- int x_real_orig;
- int y_real_orig;
- int x_orig;
- int y_orig;
- int real_width;
- int real_height;
- int width;
- int height;
-
- window = gdk_x11_window_foreign_new_for_display (gdk_display_get_default (), w);
- if (window == NULL) {
- return NULL;
- }
-
- root = gdk_x11_window_foreign_new_for_display (gdk_display_get_default (), GDK_ROOT_WINDOW ());
- gdk_window_get_geometry (window, NULL, NULL, &real_width, &real_height);
- gdk_window_get_origin (window, &x_real_orig, &y_real_orig);
-
- x_orig = x_real_orig;
- y_orig = y_real_orig;
- width = real_width;
- height = real_height;
-
- if (x_orig < 0) {
- width = width + x_orig;
- x_orig = 0;
- }
- if (y_orig < 0) {
- height = height + y_orig;
- y_orig = 0;
- }
-
- if (x_orig + width > gdk_screen_width ()) {
- width = gdk_screen_width () - x_orig;
- }
- if (y_orig + height > gdk_screen_height ()) {
- height = gdk_screen_height () - y_orig;
- }
-
- screenshot = gdk_pixbuf_get_from_window (root,
- x_orig,
- y_orig,
- width,
- height);
-
- return screenshot;
-}
-
-static char *
-screenshot_save (GdkPixbuf *pixbuf)
-{
- char *filename;
- gboolean res;
- GError *error;
-
- filename = g_build_filename (GDM_SCREENSHOT_DIR,
- "GDM-Screenshot.png",
- NULL);
-
- error = NULL;
- res = gdk_pixbuf_save (pixbuf,
- filename,
- "png",
- &error,
- "tEXt::CREATOR", "gdm-screenshot",
- NULL);
- if (! res) {
- g_warning ("Unable to save screenshot: %s", error->message);
- g_error_free (error);
- g_free (filename);
- filename = NULL;
- }
-
- return filename;
-}
-
-static void
-sound_effect_finished (ca_context *c,
- uint32_t id,
- int error_code,
- void *userdata)
-{
-}
-
-static void
-play_sound_effect (Window xid)
-{
- ca_context *c;
- ca_proplist *p;
- int res;
-
- c = ca_gtk_context_get ();
-
- p = NULL;
- res = ca_proplist_create (&p);
- if (res < 0) {
- goto done;
- }
-
- res = ca_proplist_sets (p, CA_PROP_EVENT_ID, "screen-capture");
- if (res < 0) {
- goto done;
- }
-
- res = ca_proplist_sets (p, CA_PROP_EVENT_DESCRIPTION, _("Screenshot taken"));
- if (res < 0) {
- goto done;
- }
-
- res = ca_proplist_setf (p,
- CA_PROP_WINDOW_X11_XID,
- "%lu",
- (unsigned long) xid);
- if (res < 0) {
- goto done;
- }
-
- ca_context_play_full (c, 0, p, sound_effect_finished, NULL);
-
- done:
- if (p != NULL) {
- ca_proplist_destroy (p);
- }
-
-}
-
-static void
-prepare_screenshot (void)
-{
- Window win;
- GdkPixbuf *screenshot;
- char *filename;
-
- if (!screenshot_grab_lock ()) {
- exit (EXIT_SUCCESS);
- }
-
- win = GDK_ROOT_WINDOW ();
-
- screenshot = screenshot_get_pixbuf (win);
-
- screenshot_release_lock ();
-
- if (screenshot == NULL) {
- /* FIXME: dialog? */
- exit (EXIT_FAILURE);
- }
-
- play_sound_effect (win);
-
- filename = screenshot_save (screenshot);
- if (filename != NULL) {
- g_print ("Wrote %s\n", filename);
- /* FIXME: show a dialog or something */
- g_free (filename);
- }
-}
-
-int
-main (int argc, char *argv[])
-{
- GOptionContext *ctx;
- gboolean res;
- GError *error;
-
- bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
- setlocale (LC_ALL, "");
-
- /* Option parsing */
- ctx = g_option_context_new (N_("Take a picture of the screen"));
- g_option_context_set_translation_domain (ctx, GETTEXT_PACKAGE);
- g_option_context_add_main_entries (ctx, options, NULL);
- g_option_context_add_group (ctx, gtk_get_option_group (TRUE));
- error = NULL;
- res = g_option_context_parse (ctx, &argc, &argv, &error);
- g_option_context_free (ctx);
-
- if (! res) {
- g_warning ("%s", error->message);
- g_error_free (error);
- exit (EXIT_FAILURE);
- }
-
- prepare_screenshot ();
-
- return 1;
-}
diff --git a/utils/meson.build b/utils/meson.build
index d59f167b0..1edd7bce4 100644
--- a/utils/meson.build
+++ b/utils/meson.build
@@ -1,41 +1,26 @@
# gdm-flexiserver
gdm_flexiserver_deps = [
glib_dep,
libgdmcommon_dep,
]
gdm_flexiserver = executable('gdmflexiserver',
'gdmflexiserver.c',
dependencies: gdm_flexiserver_deps,
include_directories: config_h_dir,
install: true,
)
-# gdm-screenshot
-gdm_screenshot_deps = [
- glib_dep,
- gtk_dep,
- x_deps,
- libcanberra_gtk_dep,
-]
-
-gdm_screenshot = executable('gdm-screenshot',
- 'gdm-screenshot.c',
- dependencies: gdm_screenshot_deps,
- include_directories: config_h_dir,
- install: true,
-)
-
# gdm-runtime-config
gdm_runtime_config_deps = [
glib_dep,
]
gdm_runtime_config = executable('gdm-runtime-config',
'gdm-runtime-config.c',
dependencies: gdm_runtime_config_deps,
include_directories: config_h_dir,
install: true,
install_dir: get_option('libexecdir'),
)
--
2.31.1

View File

@ -0,0 +1,565 @@
From 4fde9e7882e5d2e42a4ed5a0d71943d5ea966131 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Wed, 15 Aug 2018 10:48:16 -0400
Subject: [PATCH 1/5] worker: don't load user settings for program sessions
We don't need or want the login greeter to access accountsservice
for its session name
---
daemon/gdm-session-worker.c | 37 ++++++++++++++++++++++++++-----------
1 file changed, 26 insertions(+), 11 deletions(-)
diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c
index 774298b95..88fe36c16 100644
--- a/daemon/gdm-session-worker.c
+++ b/daemon/gdm-session-worker.c
@@ -400,103 +400,108 @@ gdm_session_execute (const char *file,
*/
static gboolean
gdm_session_worker_get_username (GdmSessionWorker *worker,
char **username)
{
gconstpointer item;
g_assert (worker->priv->pam_handle != NULL);
if (pam_get_item (worker->priv->pam_handle, PAM_USER, &item) == PAM_SUCCESS) {
if (username != NULL) {
*username = g_strdup ((char *) item);
g_debug ("GdmSessionWorker: username is '%s'",
*username != NULL ? *username : "<unset>");
}
if (worker->priv->auditor != NULL) {
gdm_session_auditor_set_username (worker->priv->auditor, (char *)item);
}
return TRUE;
}
return FALSE;
}
static void
attempt_to_load_user_settings (GdmSessionWorker *worker,
const char *username)
{
+ if (worker->priv->user_settings == NULL)
+ return;
+
+ if (gdm_session_settings_is_loaded (worker->priv->user_settings))
+ return;
+
g_debug ("GdmSessionWorker: attempting to load user settings");
gdm_session_settings_load (worker->priv->user_settings,
username);
}
static void
gdm_session_worker_update_username (GdmSessionWorker *worker)
{
char *username;
gboolean res;
username = NULL;
res = gdm_session_worker_get_username (worker, &username);
if (res) {
g_debug ("GdmSessionWorker: old-username='%s' new-username='%s'",
worker->priv->username != NULL ? worker->priv->username : "<unset>",
username != NULL ? username : "<unset>");
gdm_session_auditor_set_username (worker->priv->auditor, worker->priv->username);
if ((worker->priv->username == username) ||
((worker->priv->username != NULL) && (username != NULL) &&
(strcmp (worker->priv->username, username) == 0)))
goto out;
g_debug ("GdmSessionWorker: setting username to '%s'", username);
g_free (worker->priv->username);
worker->priv->username = username;
username = NULL;
gdm_dbus_worker_emit_username_changed (GDM_DBUS_WORKER (worker),
worker->priv->username);
/* We have a new username to try. If we haven't been able to
* read user settings up until now, then give it a go now
* (see the comment in do_setup for rationale on why it's useful
* to keep trying to read settings)
*/
if (worker->priv->username != NULL &&
- worker->priv->username[0] != '\0' &&
- !gdm_session_settings_is_loaded (worker->priv->user_settings)) {
+ worker->priv->username[0] != '\0') {
attempt_to_load_user_settings (worker, worker->priv->username);
}
}
out:
g_free (username);
}
static gboolean
gdm_session_worker_ask_question (GdmSessionWorker *worker,
const char *question,
char **answerp)
{
return gdm_dbus_worker_manager_call_info_query_sync (worker->priv->manager,
worker->priv->service,
question,
answerp,
NULL,
NULL);
}
static gboolean
gdm_session_worker_ask_for_secret (GdmSessionWorker *worker,
const char *question,
char **answerp)
{
return gdm_dbus_worker_manager_call_secret_info_query_sync (worker->priv->manager,
worker->priv->service,
question,
answerp,
@@ -2600,87 +2605,89 @@ gdm_session_worker_get_property (GObject *object,
g_value_set_boolean (value, self->priv->is_reauth_session);
break;
case PROP_STATE:
g_value_set_enum (value, self->priv->state);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static gboolean
gdm_session_worker_handle_set_environment_variable (GdmDBusWorker *object,
GDBusMethodInvocation *invocation,
const char *key,
const char *value)
{
GdmSessionWorker *worker = GDM_SESSION_WORKER (object);
gdm_session_worker_set_environment_variable (worker, key, value);
gdm_dbus_worker_complete_set_environment_variable (object, invocation);
return TRUE;
}
static gboolean
gdm_session_worker_handle_set_session_name (GdmDBusWorker *object,
GDBusMethodInvocation *invocation,
const char *session_name)
{
GdmSessionWorker *worker = GDM_SESSION_WORKER (object);
g_debug ("GdmSessionWorker: session name set to %s", session_name);
- gdm_session_settings_set_session_name (worker->priv->user_settings,
- session_name);
+ if (worker->priv->user_settings != NULL)
+ gdm_session_settings_set_session_name (worker->priv->user_settings,
+ session_name);
gdm_dbus_worker_complete_set_session_name (object, invocation);
return TRUE;
}
static gboolean
gdm_session_worker_handle_set_session_display_mode (GdmDBusWorker *object,
GDBusMethodInvocation *invocation,
const char *str)
{
GdmSessionWorker *worker = GDM_SESSION_WORKER (object);
g_debug ("GdmSessionWorker: session display mode set to %s", str);
worker->priv->display_mode = gdm_session_display_mode_from_string (str);
gdm_dbus_worker_complete_set_session_display_mode (object, invocation);
return TRUE;
}
static gboolean
gdm_session_worker_handle_set_language_name (GdmDBusWorker *object,
GDBusMethodInvocation *invocation,
const char *language_name)
{
GdmSessionWorker *worker = GDM_SESSION_WORKER (object);
g_debug ("GdmSessionWorker: language name set to %s", language_name);
- gdm_session_settings_set_language_name (worker->priv->user_settings,
- language_name);
+ if (worker->priv->user_settings != NULL)
+ gdm_session_settings_set_language_name (worker->priv->user_settings,
+ language_name);
gdm_dbus_worker_complete_set_language_name (object, invocation);
return TRUE;
}
static void
on_saved_language_name_read (GdmSessionWorker *worker)
{
char *language_name;
language_name = gdm_session_settings_get_language_name (worker->priv->user_settings);
g_debug ("GdmSessionWorker: Saved language is %s", language_name);
gdm_dbus_worker_emit_saved_language_name_read (GDM_DBUS_WORKER (worker),
language_name);
g_free (language_name);
}
static void
on_saved_session_name_read (GdmSessionWorker *worker)
{
char *session_name;
session_name = gdm_session_settings_get_session_name (worker->priv->user_settings);
g_debug ("GdmSessionWorker: Saved session is %s", session_name);
gdm_dbus_worker_emit_saved_session_name_read (GDM_DBUS_WORKER (worker),
session_name);
g_free (session_name);
}
@@ -2758,110 +2765,113 @@ do_authorize (GdmSessionWorker *worker)
g_dbus_method_invocation_take_error (worker->priv->pending_invocation, error);
}
worker->priv->pending_invocation = NULL;
}
static void
do_accredit (GdmSessionWorker *worker)
{
GError *error;
gboolean res;
/* get kerberos tickets, setup group lists, etc
*/
error = NULL;
res = gdm_session_worker_accredit_user (worker, &error);
if (res) {
gdm_dbus_worker_complete_establish_credentials (GDM_DBUS_WORKER (worker), worker->priv->pending_invocation);
} else {
g_dbus_method_invocation_take_error (worker->priv->pending_invocation, error);
}
worker->priv->pending_invocation = NULL;
}
static void
save_account_details_now (GdmSessionWorker *worker)
{
g_assert (worker->priv->state == GDM_SESSION_WORKER_STATE_ACCREDITED);
g_debug ("GdmSessionWorker: saving account details for user %s", worker->priv->username);
+
gdm_session_worker_set_state (worker, GDM_SESSION_WORKER_STATE_ACCOUNT_DETAILS_SAVED);
- if (!gdm_session_settings_save (worker->priv->user_settings,
- worker->priv->username)) {
- g_warning ("could not save session and language settings");
+ if (worker->priv->user_settings != NULL) {
+ if (!gdm_session_settings_save (worker->priv->user_settings,
+ worker->priv->username)) {
+ g_warning ("could not save session and language settings");
+ }
}
queue_state_change (worker);
}
static void
on_settings_is_loaded_changed (GdmSessionSettings *user_settings,
GParamSpec *pspec,
GdmSessionWorker *worker)
{
if (!gdm_session_settings_is_loaded (worker->priv->user_settings)) {
return;
}
/* These signal handlers should be disconnected after the loading,
* so that gdm_session_settings_set_* APIs don't cause the emitting
* of Saved*NameRead D-Bus signals any more.
*/
g_signal_handlers_disconnect_by_func (worker->priv->user_settings,
G_CALLBACK (on_saved_session_name_read),
worker);
g_signal_handlers_disconnect_by_func (worker->priv->user_settings,
G_CALLBACK (on_saved_language_name_read),
worker);
if (worker->priv->state == GDM_SESSION_WORKER_STATE_NONE) {
g_debug ("GdmSessionWorker: queuing setup for user: %s %s",
worker->priv->username, worker->priv->display_device);
queue_state_change (worker);
} else if (worker->priv->state == GDM_SESSION_WORKER_STATE_ACCREDITED) {
save_account_details_now (worker);
} else {
return;
}
g_signal_handlers_disconnect_by_func (G_OBJECT (worker->priv->user_settings),
G_CALLBACK (on_settings_is_loaded_changed),
worker);
}
static void
do_save_account_details_when_ready (GdmSessionWorker *worker)
{
g_assert (worker->priv->state == GDM_SESSION_WORKER_STATE_ACCREDITED);
- if (!gdm_session_settings_is_loaded (worker->priv->user_settings)) {
+ if (worker->priv->user_settings != NULL && !gdm_session_settings_is_loaded (worker->priv->user_settings)) {
g_signal_connect (G_OBJECT (worker->priv->user_settings),
"notify::is-loaded",
G_CALLBACK (on_settings_is_loaded_changed),
worker);
g_debug ("GdmSessionWorker: user %s, not fully loaded yet, will save account details later",
worker->priv->username);
gdm_session_settings_load (worker->priv->user_settings,
worker->priv->username);
return;
}
save_account_details_now (worker);
}
static void
do_open_session (GdmSessionWorker *worker)
{
GError *error;
gboolean res;
error = NULL;
res = gdm_session_worker_open_session (worker, &error);
if (res) {
char *session_id = worker->priv->session_id;
if (session_id == NULL) {
session_id = "";
}
gdm_dbus_worker_complete_open (GDM_DBUS_WORKER (worker), worker->priv->pending_invocation, session_id);
@@ -3105,155 +3115,161 @@ gdm_session_worker_handle_initialize (GdmDBusWorker *object,
if (g_strcmp0 (key, "service") == 0) {
worker->priv->service = g_variant_dup_string (value, NULL);
} else if (g_strcmp0 (key, "extensions") == 0) {
worker->priv->extensions = filter_extensions (g_variant_get_strv (value, NULL));
} else if (g_strcmp0 (key, "username") == 0) {
worker->priv->username = g_variant_dup_string (value, NULL);
} else if (g_strcmp0 (key, "is-program-session") == 0) {
worker->priv->is_program_session = g_variant_get_boolean (value);
} else if (g_strcmp0 (key, "log-file") == 0) {
worker->priv->log_file = g_variant_dup_string (value, NULL);
} else if (g_strcmp0 (key, "x11-display-name") == 0) {
worker->priv->x11_display_name = g_variant_dup_string (value, NULL);
} else if (g_strcmp0 (key, "x11-authority-file") == 0) {
worker->priv->x11_authority_file = g_variant_dup_string (value, NULL);
} else if (g_strcmp0 (key, "console") == 0) {
worker->priv->display_device = g_variant_dup_string (value, NULL);
} else if (g_strcmp0 (key, "seat-id") == 0) {
worker->priv->display_seat_id = g_variant_dup_string (value, NULL);
} else if (g_strcmp0 (key, "hostname") == 0) {
worker->priv->hostname = g_variant_dup_string (value, NULL);
} else if (g_strcmp0 (key, "display-is-local") == 0) {
worker->priv->display_is_local = g_variant_get_boolean (value);
} else if (g_strcmp0 (key, "display-is-initial") == 0) {
worker->priv->display_is_initial = g_variant_get_boolean (value);
}
}
worker->priv->pending_invocation = invocation;
if (!worker->priv->is_program_session) {
+ worker->priv->user_settings = gdm_session_settings_new ();
+
g_signal_connect_swapped (worker->priv->user_settings,
"notify::language-name",
G_CALLBACK (on_saved_language_name_read),
worker);
g_signal_connect_swapped (worker->priv->user_settings,
"notify::session-name",
G_CALLBACK (on_saved_session_name_read),
worker);
if (worker->priv->username) {
wait_for_settings = !gdm_session_settings_load (worker->priv->user_settings,
worker->priv->username);
}
}
if (wait_for_settings) {
/* Load settings from accounts daemon before continuing
*/
g_signal_connect (G_OBJECT (worker->priv->user_settings),
"notify::is-loaded",
G_CALLBACK (on_settings_is_loaded_changed),
worker);
} else {
queue_state_change (worker);
}
return TRUE;
}
static gboolean
gdm_session_worker_handle_setup (GdmDBusWorker *object,
GDBusMethodInvocation *invocation,
const char *service,
const char *x11_display_name,
const char *x11_authority_file,
const char *console,
const char *seat_id,
const char *hostname,
gboolean display_is_local,
gboolean display_is_initial)
{
GdmSessionWorker *worker = GDM_SESSION_WORKER (object);
validate_and_queue_state_change (worker, invocation, GDM_SESSION_WORKER_STATE_SETUP_COMPLETE);
worker->priv->service = g_strdup (service);
worker->priv->x11_display_name = g_strdup (x11_display_name);
worker->priv->x11_authority_file = g_strdup (x11_authority_file);
worker->priv->display_device = g_strdup (console);
worker->priv->display_seat_id = g_strdup (seat_id);
worker->priv->hostname = g_strdup (hostname);
worker->priv->display_is_local = display_is_local;
worker->priv->display_is_initial = display_is_initial;
worker->priv->username = NULL;
+ worker->priv->user_settings = gdm_session_settings_new ();
+
g_signal_connect_swapped (worker->priv->user_settings,
"notify::language-name",
G_CALLBACK (on_saved_language_name_read),
worker);
g_signal_connect_swapped (worker->priv->user_settings,
"notify::session-name",
G_CALLBACK (on_saved_session_name_read),
worker);
return TRUE;
}
static gboolean
gdm_session_worker_handle_setup_for_user (GdmDBusWorker *object,
GDBusMethodInvocation *invocation,
const char *service,
const char *username,
const char *x11_display_name,
const char *x11_authority_file,
const char *console,
const char *seat_id,
const char *hostname,
gboolean display_is_local,
gboolean display_is_initial)
{
GdmSessionWorker *worker = GDM_SESSION_WORKER (object);
if (!validate_state_change (worker, invocation, GDM_SESSION_WORKER_STATE_SETUP_COMPLETE))
return TRUE;
worker->priv->service = g_strdup (service);
worker->priv->x11_display_name = g_strdup (x11_display_name);
worker->priv->x11_authority_file = g_strdup (x11_authority_file);
worker->priv->display_device = g_strdup (console);
worker->priv->display_seat_id = g_strdup (seat_id);
worker->priv->hostname = g_strdup (hostname);
worker->priv->display_is_local = display_is_local;
worker->priv->display_is_initial = display_is_initial;
worker->priv->username = g_strdup (username);
+ worker->priv->user_settings = gdm_session_settings_new ();
+
g_signal_connect_swapped (worker->priv->user_settings,
"notify::language-name",
G_CALLBACK (on_saved_language_name_read),
worker);
g_signal_connect_swapped (worker->priv->user_settings,
"notify::session-name",
G_CALLBACK (on_saved_session_name_read),
worker);
/* Load settings from accounts daemon before continuing
*/
worker->priv->pending_invocation = invocation;
if (gdm_session_settings_load (worker->priv->user_settings, username)) {
queue_state_change (worker);
} else {
g_signal_connect (G_OBJECT (worker->priv->user_settings),
"notify::is-loaded",
G_CALLBACK (on_settings_is_loaded_changed),
worker);
}
return TRUE;
}
static gboolean
gdm_session_worker_handle_setup_for_program (GdmDBusWorker *object,
GDBusMethodInvocation *invocation,
const char *service,
const char *username,
@@ -3591,61 +3607,60 @@ static void
reauthentication_request_free (ReauthenticationRequest *request)
{
g_signal_handlers_disconnect_by_func (request->session,
G_CALLBACK (on_reauthentication_client_connected),
request);
g_signal_handlers_disconnect_by_func (request->session,
G_CALLBACK (on_reauthentication_client_disconnected),
request);
g_signal_handlers_disconnect_by_func (request->session,
G_CALLBACK (on_reauthentication_cancelled),
request);
g_signal_handlers_disconnect_by_func (request->session,
G_CALLBACK (on_reauthentication_conversation_started),
request);
g_signal_handlers_disconnect_by_func (request->session,
G_CALLBACK (on_reauthentication_conversation_stopped),
request);
g_signal_handlers_disconnect_by_func (request->session,
G_CALLBACK (on_reauthentication_verification_complete),
request);
g_clear_object (&request->session);
g_slice_free (ReauthenticationRequest, request);
}
static void
gdm_session_worker_init (GdmSessionWorker *worker)
{
worker->priv = GDM_SESSION_WORKER_GET_PRIVATE (worker);
- worker->priv->user_settings = gdm_session_settings_new ();
worker->priv->reauthentication_requests = g_hash_table_new_full (NULL,
NULL,
NULL,
(GDestroyNotify)
reauthentication_request_free);
}
static void
gdm_session_worker_unwatch_child (GdmSessionWorker *worker)
{
if (worker->priv->child_watch_id == 0)
return;
g_source_remove (worker->priv->child_watch_id);
worker->priv->child_watch_id = 0;
}
static void
gdm_session_worker_finalize (GObject *object)
{
GdmSessionWorker *worker;
g_return_if_fail (object != NULL);
g_return_if_fail (GDM_IS_SESSION_WORKER (object));
worker = GDM_SESSION_WORKER (object);
g_return_if_fail (worker->priv != NULL);
--
2.31.1

View File

@ -0,0 +1,151 @@
From 81efb06506456a260d63b77e3dda1216041b5bb3 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Wed, 5 Feb 2020 15:20:48 -0500
Subject: [PATCH 2/3] gdm-x-session: run session bus on non-seat0 seats
GNOME doesn't deal very well with multiple sessions
running on a multiple seats at the moment.
Until that's fixed, ensure sessions run on auxillary
seats get their own session bus.
---
daemon/gdm-session.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
index 5c5903a49..c891fb577 100644
--- a/daemon/gdm-session.c
+++ b/daemon/gdm-session.c
@@ -2811,119 +2811,128 @@ on_start_program_cb (GdmDBusWorker *worker,
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CLOSED) ||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
return;
self = conversation->session;
service_name = conversation->service_name;
if (worked) {
self->session_pid = pid;
self->session_conversation = conversation;
g_debug ("GdmSession: Emitting 'session-started' signal with pid '%d'", pid);
g_signal_emit (self, signals[SESSION_STARTED], 0, service_name, pid);
} else {
gdm_session_stop_conversation (self, service_name);
g_debug ("GdmSession: Emitting 'session-start-failed' signal");
g_signal_emit (self, signals[SESSION_START_FAILED], 0, service_name, error->message);
}
}
void
gdm_session_start_session (GdmSession *self,
const char *service_name)
{
GdmSessionConversation *conversation;
GdmSessionDisplayMode display_mode;
gboolean is_x11 = TRUE;
gboolean run_launcher = FALSE;
gboolean allow_remote_connections = FALSE;
+ gboolean run_separate_bus = FALSE;
char *command;
char *program;
gboolean register_session;
g_return_if_fail (GDM_IS_SESSION (self));
g_return_if_fail (self->session_conversation == NULL);
conversation = find_conversation_by_name (self, service_name);
if (conversation == NULL) {
g_warning ("GdmSession: Tried to start session of "
"nonexistent conversation %s", service_name);
return;
}
stop_all_other_conversations (self, conversation, FALSE);
display_mode = gdm_session_get_display_mode (self);
#ifdef ENABLE_WAYLAND_SUPPORT
is_x11 = g_strcmp0 (self->session_type, "wayland") != 0;
#endif
if (display_mode == GDM_SESSION_DISPLAY_MODE_LOGIND_MANAGED ||
display_mode == GDM_SESSION_DISPLAY_MODE_NEW_VT) {
run_launcher = TRUE;
}
register_session = !gdm_session_session_registers (self);
+ if (g_strcmp0 (priv->display_seat_id, "seat0") != 0 && !run_launcher) {
+ run_separate_bus = TRUE;
+ }
+
if (self->selected_program == NULL) {
gboolean run_xsession_script;
command = get_session_command (self);
run_xsession_script = !gdm_session_bypasses_xsession (self);
if (self->display_is_local) {
gboolean disallow_tcp = TRUE;
gdm_settings_direct_get_boolean (GDM_KEY_DISALLOW_TCP, &disallow_tcp);
allow_remote_connections = !disallow_tcp;
} else {
allow_remote_connections = TRUE;
}
if (run_launcher) {
if (is_x11) {
program = g_strdup_printf (LIBEXECDIR "/gdm-x-session %s%s %s\"%s\"",
register_session ? "--register-session " : "",
run_xsession_script? "--run-script " : "",
allow_remote_connections? "--allow-remote-connections " : "",
command);
} else {
program = g_strdup_printf (LIBEXECDIR "/gdm-wayland-session %s\"%s\"",
register_session ? "--register-session " : "",
command);
}
} else if (run_xsession_script) {
- program = g_strdup_printf (GDMCONFDIR "/Xsession \"%s\"", command);
+ if (run_separate_bus) {
+ program = g_strdup_printf ("dbus-run-session -- " GDMCONFDIR "/Xsession \"%s\"", command);
+ } else {
+ program = g_strdup_printf (GDMCONFDIR "/Xsession \"%s\"", command);
+ }
} else {
program = g_strdup (command);
}
g_free (command);
} else {
/* FIXME:
* Always use a separate DBus bus for each greeter session.
* Firstly, this means that if we run multiple greeter session
* (which we really should not do, but have to currently), then
* each one will get its own DBus session bus.
* But, we also explicitly do this for seat0, because that way
* it cannot make use of systemd to run the GNOME session. This
* prevents the session lookup logic from getting confused.
* This has a similar effect as passing --builtin to gnome-session.
*
* We really should not be doing this. But the fix is to use
* separate dynamically created users and that requires some
* major refactorings.
*/
if (run_launcher) {
if (is_x11) {
program = g_strdup_printf (LIBEXECDIR "/gdm-x-session %s\"dbus-run-session -- %s\"",
register_session ? "--register-session " : "",
self->selected_program);
} else {
program = g_strdup_printf (LIBEXECDIR "/gdm-wayland-session %s\"dbus-run-session -- %s\"",
register_session ? "--register-session " : "",
self->selected_program);
}
--
2.31.1

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,531 @@
From 35e2d1d298607c3fdb2cbbfb1cf878dc9cbbf546 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 20 Aug 2018 14:30:59 -0400
Subject: [PATCH 3/5] daemon: save os-release in accountsservice
It can be useful to know what OS a user was running
when they logged in (to detect upgrades).
This commit saves that information in accountsservice.
---
.../com.redhat.AccountsServiceUser.System.xml | 10 ++
daemon/gdm-session-settings.c | 98 +++++++++++++++++++
daemon/meson.build | 8 ++
3 files changed, 116 insertions(+)
create mode 100644 daemon/com.redhat.AccountsServiceUser.System.xml
diff --git a/daemon/com.redhat.AccountsServiceUser.System.xml b/daemon/com.redhat.AccountsServiceUser.System.xml
new file mode 100644
index 000000000..67f5f302c
--- /dev/null
+++ b/daemon/com.redhat.AccountsServiceUser.System.xml
@@ -0,0 +1,10 @@
+<node>
+ <interface name="com.redhat.AccountsServiceUser.System">
+
+ <annotation name="org.freedesktop.Accounts.VendorExtension" value="true"/>
+
+ <property name="id" type="s" access="readwrite"/>
+ <property name="version-id" type="s" access="readwrite"/>
+
+ </interface>
+</node>
diff --git a/daemon/gdm-session-settings.c b/daemon/gdm-session-settings.c
index 5b64cb65b..5bcfdc14f 100644
--- a/daemon/gdm-session-settings.c
+++ b/daemon/gdm-session-settings.c
@@ -1,70 +1,77 @@
/* gdm-session-settings.c - Loads session and language from ~/.dmrc
*
* Copyright (C) 2008 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
* Written by: Ray Strode <rstrode@redhat.com>
*/
#include "config.h"
#include "gdm-session-settings.h"
+#include "gdm-common.h"
+
+#include "com.redhat.AccountsServiceUser.System.h"
#include <errno.h>
#include <pwd.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <glib.h>
#include <glib-object.h>
#include <glib/gi18n.h>
#include <act/act-user-manager.h>
struct _GdmSessionSettingsPrivate
{
ActUserManager *user_manager;
ActUser *user;
+
+ /* used for retrieving the last OS user logged in with */
+ GdmAccountsServiceUserSystem *user_system_proxy;
+
char *session_name;
char *session_type;
char *language_name;
};
static void gdm_session_settings_finalize (GObject *object);
static void gdm_session_settings_class_install_properties (GdmSessionSettingsClass *
settings_class);
static void gdm_session_settings_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gdm_session_settings_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
enum {
PROP_0 = 0,
PROP_SESSION_NAME,
PROP_SESSION_TYPE,
PROP_LANGUAGE_NAME,
PROP_IS_LOADED
};
G_DEFINE_TYPE_WITH_PRIVATE (GdmSessionSettings,
gdm_session_settings,
G_TYPE_OBJECT)
@@ -107,60 +114,62 @@ gdm_session_settings_class_install_properties (GdmSessionSettingsClass *settings
g_object_class_install_property (object_class, PROP_LANGUAGE_NAME, param_spec);
param_spec = g_param_spec_boolean ("is-loaded", NULL, NULL,
FALSE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_IS_LOADED, param_spec);
}
static void
gdm_session_settings_init (GdmSessionSettings *settings)
{
settings->priv = G_TYPE_INSTANCE_GET_PRIVATE (settings,
GDM_TYPE_SESSION_SETTINGS,
GdmSessionSettingsPrivate);
settings->priv->user_manager = act_user_manager_get_default ();
}
static void
gdm_session_settings_finalize (GObject *object)
{
GdmSessionSettings *settings;
GObjectClass *parent_class;
settings = GDM_SESSION_SETTINGS (object);
if (settings->priv->user != NULL) {
g_object_unref (settings->priv->user);
}
+ g_clear_object (&settings->priv->user_system_proxy);
+
g_free (settings->priv->session_name);
g_free (settings->priv->language_name);
parent_class = G_OBJECT_CLASS (gdm_session_settings_parent_class);
if (parent_class->finalize != NULL) {
parent_class->finalize (object);
}
}
void
gdm_session_settings_set_language_name (GdmSessionSettings *settings,
const char *language_name)
{
g_return_if_fail (GDM_IS_SESSION_SETTINGS (settings));
if (settings->priv->language_name == NULL ||
strcmp (settings->priv->language_name, language_name) != 0) {
settings->priv->language_name = g_strdup (language_name);
g_object_notify (G_OBJECT (settings), "language-name");
}
}
void
gdm_session_settings_set_session_name (GdmSessionSettings *settings,
const char *session_name)
{
g_return_if_fail (GDM_IS_SESSION_SETTINGS (settings));
if (settings->priv->session_name == NULL ||
@@ -261,69 +270,86 @@ gdm_session_settings_get_property (GObject *object,
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
GdmSessionSettings *
gdm_session_settings_new (void)
{
GdmSessionSettings *settings;
settings = g_object_new (GDM_TYPE_SESSION_SETTINGS,
NULL);
return settings;
}
gboolean
gdm_session_settings_is_loaded (GdmSessionSettings *settings)
{
if (settings->priv->user == NULL) {
return FALSE;
}
return act_user_is_loaded (settings->priv->user);
}
static void
load_settings_from_user (GdmSessionSettings *settings)
{
+ const char *object_path;
const char *session_name;
const char *session_type;
const char *language_name;
if (!act_user_is_loaded (settings->priv->user)) {
g_warning ("GdmSessionSettings: trying to load user settings from unloaded user");
return;
}
+ object_path = act_user_get_object_path (settings->priv->user);
+
+ if (object_path != NULL) {
+ g_autoptr (GError) error = NULL;
+ settings->priv->user_system_proxy = gdm_accounts_service_user_system_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ "org.freedesktop.Accounts",
+ object_path,
+ NULL,
+ &error);
+ if (error != NULL) {
+ g_debug ("GdmSessionSettings: couldn't retrieve user system proxy from accountsservice: %s",
+ error->message);
+ }
+ }
+
/* if the user doesn't have saved state, they don't have any settings worth reading */
if (!act_user_get_saved (settings->priv->user))
goto out;
session_type = act_user_get_session_type (settings->priv->user);
session_name = act_user_get_session (settings->priv->user);
g_debug ("GdmSessionSettings: saved session is %s (type %s)", session_name, session_type);
if (session_type != NULL && session_type[0] != '\0') {
gdm_session_settings_set_session_type (settings, session_type);
}
if (session_name != NULL && session_name[0] != '\0') {
gdm_session_settings_set_session_name (settings, session_name);
}
language_name = act_user_get_language (settings->priv->user);
g_debug ("GdmSessionSettings: saved language is %s", language_name);
if (language_name != NULL && language_name[0] != '\0') {
gdm_session_settings_set_language_name (settings, language_name);
}
out:
g_object_notify (G_OBJECT (settings), "is-loaded");
}
static void
on_user_is_loaded_changed (ActUser *user,
@@ -349,64 +375,136 @@ gdm_session_settings_load (GdmSessionSettings *settings,
g_return_val_if_fail (!gdm_session_settings_is_loaded (settings), FALSE);
if (settings->priv->user != NULL) {
old_user = settings->priv->user;
g_signal_handlers_disconnect_by_func (G_OBJECT (settings->priv->user),
G_CALLBACK (on_user_is_loaded_changed),
settings);
} else {
old_user = NULL;
}
settings->priv->user = act_user_manager_get_user (settings->priv->user_manager,
username);
g_clear_object (&old_user);
if (!act_user_is_loaded (settings->priv->user)) {
g_signal_connect (settings->priv->user,
"notify::is-loaded",
G_CALLBACK (on_user_is_loaded_changed),
settings);
return FALSE;
}
load_settings_from_user (settings);
return TRUE;
}
+static void
+save_os_release (GdmSessionSettings *settings,
+ ActUser *user)
+{
+ g_autoptr(GFile) file = NULL;
+ g_autoptr(GError) error = NULL;
+ g_autofree char *contents = NULL;
+ g_auto(GStrv) lines = NULL;
+ size_t i;
+
+ if (settings->priv->user_system_proxy == NULL) {
+ g_debug ("GdmSessionSettings: not saving OS version to user account because accountsservice doesn't support it");
+ return;
+ }
+
+ file = g_file_new_for_path ("/etc/os-release");
+
+ if (!g_file_load_contents (file, NULL, &contents, NULL, NULL, &error)) {
+ g_debug ("GdmSessionSettings: couldn't load /etc/os-release: %s", error->message);
+ return;
+ }
+
+ lines = g_strsplit (contents, "\n", -1);
+ for (i = 0; lines[i] != NULL; i++) {
+ char *p, *name, *name_end, *value, *value_end;
+
+ p = lines[i];
+
+ while (g_ascii_isspace (*p))
+ p++;
+
+ if (*p == '#' || *p == '\0')
+ continue;
+ name = p;
+ while (gdm_shell_var_is_valid_char (*p, p == name))
+ p++;
+ name_end = p;
+ while (g_ascii_isspace (*p))
+ p++;
+ if (name == name_end || *p != '=') {
+ continue;
+ }
+ *name_end = '\0';
+
+ p++;
+
+ while (g_ascii_isspace (*p))
+ p++;
+
+ value = p;
+ value_end = value + strlen(value) - 1;
+
+ if (value != value_end && *value == '"' && *value_end == '"') {
+ value++;
+ *value_end = '\0';
+ }
+
+ if (strcmp (name, "ID") == 0) {
+ gdm_accounts_service_user_system_set_id (settings->priv->user_system_proxy,
+ value);
+ g_debug ("GdmSessionSettings: setting system OS for user to '%s'", value);
+ } else if (strcmp (name, "VERSION_ID") == 0) {
+ gdm_accounts_service_user_system_set_version_id (settings->priv->user_system_proxy,
+ value);
+ g_debug ("GdmSessionSettings: setting system OS version for user to '%s'", value);
+ }
+ }
+}
+
gboolean
gdm_session_settings_save (GdmSessionSettings *settings,
const char *username)
{
ActUser *user;
g_return_val_if_fail (GDM_IS_SESSION_SETTINGS (settings), FALSE);
g_return_val_if_fail (username != NULL, FALSE);
g_return_val_if_fail (gdm_session_settings_is_loaded (settings), FALSE);
user = act_user_manager_get_user (settings->priv->user_manager,
username);
if (!act_user_is_loaded (user)) {
g_object_unref (user);
return FALSE;
}
if (settings->priv->session_name != NULL) {
act_user_set_session (user, settings->priv->session_name);
}
if (settings->priv->session_type != NULL) {
act_user_set_session_type (user, settings->priv->session_type);
}
if (settings->priv->language_name != NULL) {
act_user_set_language (user, settings->priv->language_name);
}
+
+ save_os_release (settings, user);
+
g_object_unref (user);
return TRUE;
}
diff --git a/daemon/meson.build b/daemon/meson.build
index 2e61b6447..71c650398 100644
--- a/daemon/meson.build
+++ b/daemon/meson.build
@@ -15,114 +15,122 @@ local_display_dbus_gen = gnome.gdbus_codegen('gdm-local-display-glue',
'gdm-local-display.xml',
namespace: 'GdmDBus',
interface_prefix: 'org.gnome.DisplayManager',
autocleanup: 'all',
)
local_display_factory_dbus_gen = gnome.gdbus_codegen('gdm-local-display-factory-glue',
'gdm-local-display-factory.xml',
namespace: 'GdmDBus',
interface_prefix: 'org.gnome.DisplayManager',
autocleanup: 'all',
)
manager_dbus_gen = gnome.gdbus_codegen('gdm-manager-glue',
'gdm-manager.xml',
namespace: 'GdmDBus',
interface_prefix: 'org.gnome.DisplayManager',
autocleanup: 'all',
)
session_dbus_gen = gnome.gdbus_codegen('gdm-session-glue',
'gdm-session.xml',
namespace: 'GdmDBus',
interface_prefix: 'org.gnome.DisplayManager',
autocleanup: 'all',
)
session_worker_dbus_gen = gnome.gdbus_codegen('gdm-session-worker-glue',
'gdm-session-worker.xml',
namespace: 'GdmDBus',
interface_prefix: 'org.gnome.DisplayManager',
autocleanup: 'all',
)
+accountsservice_system_user_dbus_gen = gnome.gdbus_codegen('com.redhat.AccountsServiceUser.System',
+ 'com.redhat.AccountsServiceUser.System.xml',
+ namespace: 'Gdm',
+ interface_prefix: 'com.redhat',
+ autocleanup: 'all',
+)
+
gdm_session_enums = gnome.mkenums('gdm-session-enum-types',
h_template: 'gdm-session-enum-types.h.in',
c_template: 'gdm-session-enum-types.c.in',
sources: 'gdm-session.h',
)
gdm_session_worker_enums = gnome.mkenums('gdm-session-worker-enum-types',
h_template: 'gdm-session-worker-enum-types.h.in',
c_template: 'gdm-session-worker-enum-types.c.in',
sources: 'gdm-session-worker.h',
)
# Daemons deps
gdm_daemon_deps = [
libgdmcommon_dep,
accountsservice_dep,
gobject_dep,
gio_dep,
gio_unix_dep,
libpam_dep,
x_deps,
xcb_dep,
]
if xdmcp_dep.found() and get_option('tcp-wrappers')
gdm_daemon_deps += libwrap_dep
endif
# test-session-client
test_session_client_src = [
'test-session-client.c',
session_dbus_gen,
manager_dbus_gen,
]
test_session_client = executable('test-session-client',
test_session_client_src,
dependencies: gdm_daemon_deps,
include_directories: config_h_dir,
)
# Session worker
gdm_session_worker_src = [
'session-worker-main.c',
'gdm-session.c',
'gdm-session-settings.c',
'gdm-session-auditor.c',
'gdm-session-record.c',
'gdm-session-worker.c',
'gdm-session-worker-job.c',
'gdm-session-worker-common.c',
'gdm-dbus-util.c',
dbus_gen,
session_dbus_gen,
session_worker_dbus_gen,
+ accountsservice_system_user_dbus_gen,
gdm_session_enums,
gdm_session_worker_enums,
]
gdm_session_worker_deps = [
gdm_daemon_deps,
]
gdm_session_worker_includes = [
config_h_dir,
]
if pam_extensions_supported
gdm_session_worker_src += '../pam-extensions/gdm-pam-extensions.h'
gdm_session_worker_includes += pam_extensions_inc
endif
if libaudit_dep.found()
gdm_session_worker_deps += libaudit_dep
gdm_session_worker_src += [
'gdm-session-linux-auditor.c',
]
endif
if have_adt
gdm_session_worker_src += 'gdm-session-solaris-auditor.c'
endif
gdm_session_worker = executable('gdm-session-worker',
--
2.31.1

View File

@ -0,0 +1,105 @@
From 9a2de416bc13fc40a6d7f2e4e6cb9cf64be2854f Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 11 Feb 2019 10:32:55 -0500
Subject: [PATCH 3/3] session: ensure login screen over XDMCP connects to its
session
Right now GTK preferentially picks the wayland display over an
X11 display if it finds one.
That causes a problem for XDMCP sessions, since there may be a
wayland display running on the local console for the GDM user.
This commit addresses the issue by forcing the X11 backend if
the session is X11.
---
daemon/gdm-session.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
index c891fb577..d95cef905 100644
--- a/daemon/gdm-session.c
+++ b/daemon/gdm-session.c
@@ -2686,60 +2686,79 @@ set_up_session_environment (GdmSession *self)
}
static void
send_display_mode (GdmSession *self,
GdmSessionConversation *conversation)
{
GdmSessionDisplayMode mode;
mode = gdm_session_get_display_mode (self);
gdm_dbus_worker_call_set_session_display_mode (conversation->worker_proxy,
gdm_session_display_mode_to_string (mode),
conversation->worker_cancellable,
NULL, NULL);
}
static void
send_session_type (GdmSession *self,
GdmSessionConversation *conversation)
{
const char *session_type = "x11";
if (self->session_type != NULL) {
session_type = self->session_type;
}
gdm_dbus_worker_call_set_environment_variable (conversation->worker_proxy,
"XDG_SESSION_TYPE",
session_type,
conversation->worker_cancellable,
NULL, NULL);
+
+ /* If the session type is x11, then set GDK_BACKEND to x11 as well.
+ * This is so gnome-session-check-accelerated from an XDMCP connection doesn't
+ * try to use the wayland display running on the local console for the gdm
+ * user login screen session.
+ *
+ * That's the only case where we let a user log in more than once, so it's
+ * the only situation that matters.
+ *
+ * We can drop this code if we ever switch the login screen to use systemd's
+ * DynamicUser feature.
+ */
+ if (g_strcmp0 (session_type, "x11") == 0) {
+ gdm_dbus_worker_call_set_environment_variable (conversation->worker_proxy,
+ "GDK_BACKEND",
+ "x11",
+ conversation->worker_cancellable,
+ NULL, NULL);
+ }
}
void
gdm_session_open_session (GdmSession *self,
const char *service_name)
{
GdmSessionConversation *conversation;
g_return_if_fail (GDM_IS_SESSION (self));
conversation = find_conversation_by_name (self, service_name);
if (conversation != NULL) {
send_display_mode (self, conversation);
send_session_type (self, conversation);
gdm_dbus_worker_call_open (conversation->worker_proxy,
conversation->worker_cancellable,
(GAsyncReadyCallback) on_opened, conversation);
}
}
static void
stop_all_other_conversations (GdmSession *self,
GdmSessionConversation *conversation_to_keep,
gboolean now)
{
GHashTableIter iter;
gpointer key, value;
--
2.31.1

View File

@ -0,0 +1,138 @@
From 234fdc6e4bd4d4c19fefba27495db5bdc9642217 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 20 Aug 2018 14:30:59 -0400
Subject: [PATCH 4/5] daemon: handle upgrades from RHEL 7
RHEL 7 users need to stay on X if they were using X,
and they need to stay on gnome-classic if they were using
gnome-classic.
This commit examines the user's config to deduce whether
or not they were using RHEL 7 and in the event they were
try to get the right settings.
---
daemon/gdm-session-settings.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/daemon/gdm-session-settings.c b/daemon/gdm-session-settings.c
index 5bcfdc14f..a7eaa8b2f 100644
--- a/daemon/gdm-session-settings.c
+++ b/daemon/gdm-session-settings.c
@@ -270,95 +270,114 @@ gdm_session_settings_get_property (GObject *object,
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
GdmSessionSettings *
gdm_session_settings_new (void)
{
GdmSessionSettings *settings;
settings = g_object_new (GDM_TYPE_SESSION_SETTINGS,
NULL);
return settings;
}
gboolean
gdm_session_settings_is_loaded (GdmSessionSettings *settings)
{
if (settings->priv->user == NULL) {
return FALSE;
}
return act_user_is_loaded (settings->priv->user);
}
static void
load_settings_from_user (GdmSessionSettings *settings)
{
+ const char *system_id = NULL, *system_version_id = NULL;
const char *object_path;
const char *session_name;
const char *session_type;
const char *language_name;
if (!act_user_is_loaded (settings->priv->user)) {
g_warning ("GdmSessionSettings: trying to load user settings from unloaded user");
return;
}
object_path = act_user_get_object_path (settings->priv->user);
if (object_path != NULL) {
g_autoptr (GError) error = NULL;
settings->priv->user_system_proxy = gdm_accounts_service_user_system_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_NONE,
"org.freedesktop.Accounts",
object_path,
NULL,
&error);
if (error != NULL) {
g_debug ("GdmSessionSettings: couldn't retrieve user system proxy from accountsservice: %s",
error->message);
+ } else {
+ system_id = gdm_accounts_service_user_system_get_id (settings->priv->user_system_proxy);
+ system_version_id = gdm_accounts_service_user_system_get_version_id (settings->priv->user_system_proxy);
}
}
/* if the user doesn't have saved state, they don't have any settings worth reading */
if (!act_user_get_saved (settings->priv->user))
goto out;
session_type = act_user_get_session_type (settings->priv->user);
session_name = act_user_get_session (settings->priv->user);
g_debug ("GdmSessionSettings: saved session is %s (type %s)", session_name, session_type);
+ if (system_id == NULL || (g_strcmp0 (system_id, "rhel") == 0 && g_str_has_prefix (system_version_id, "7."))) {
+ /* if there's also no session name in the file and we're coming from RHEL 7,
+ * then we should assume classic session
+ */
+ if (session_name == NULL || session_name[0] == '\0')
+ session_name = "gnome-classic";
+
+ /* only presume wayland if the user specifically picked it in RHEL 7
+ */
+ if (g_strcmp0 (session_name, "gnome-wayland") == 0)
+ session_type = "wayland";
+ else
+ session_type = "x11";
+ }
+
if (session_type != NULL && session_type[0] != '\0') {
gdm_session_settings_set_session_type (settings, session_type);
}
if (session_name != NULL && session_name[0] != '\0') {
gdm_session_settings_set_session_name (settings, session_name);
}
language_name = act_user_get_language (settings->priv->user);
g_debug ("GdmSessionSettings: saved language is %s", language_name);
if (language_name != NULL && language_name[0] != '\0') {
gdm_session_settings_set_language_name (settings, language_name);
}
out:
g_object_notify (G_OBJECT (settings), "is-loaded");
}
static void
on_user_is_loaded_changed (ActUser *user,
GParamSpec *pspec,
GdmSessionSettings *settings)
{
if (act_user_is_loaded (settings->priv->user)) {
load_settings_from_user (settings);
g_signal_handlers_disconnect_by_func (G_OBJECT (settings->priv->user),
G_CALLBACK (on_user_is_loaded_changed),
settings);
}
--
2.31.1

View File

@ -0,0 +1,221 @@
From 4862efc8bb38e97a785bd9c368d9b701c2acba68 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Sun, 15 Dec 2019 14:51:44 -0500
Subject: [PATCH 5/5] daemon: fix wayland detection when deciding to bypass
Xsession
At the moment if there's a session file with the same name in
both /usr/share/xsessions and /usr/share/wayland-sessions, GDM
will think the wayland is getting used when deciding whether or
not to bypass the /etc/gdm/Xsession script, even if wayland is
explicitly being ignored.
This commit fixes the check.
---
daemon/gdm-session.c | 31 +++++++++++++++----------------
1 file changed, 15 insertions(+), 16 deletions(-)
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
index 2d471ec46..38a32fdab 100644
--- a/daemon/gdm-session.c
+++ b/daemon/gdm-session.c
@@ -2898,61 +2898,61 @@ gdm_session_start_session (GdmSession *self,
char *command;
char *program;
gboolean register_session;
g_return_if_fail (GDM_IS_SESSION (self));
g_return_if_fail (self->session_conversation == NULL);
conversation = find_conversation_by_name (self, service_name);
if (conversation == NULL) {
g_warning ("GdmSession: Tried to start session of "
"nonexistent conversation %s", service_name);
return;
}
stop_all_other_conversations (self, conversation, FALSE);
display_mode = gdm_session_get_display_mode (self);
#ifdef ENABLE_WAYLAND_SUPPORT
is_x11 = g_strcmp0 (self->session_type, "wayland") != 0;
#endif
if (display_mode == GDM_SESSION_DISPLAY_MODE_LOGIND_MANAGED ||
display_mode == GDM_SESSION_DISPLAY_MODE_NEW_VT) {
run_launcher = TRUE;
}
register_session = !gdm_session_session_registers (self);
- if (g_strcmp0 (priv->display_seat_id, "seat0") != 0 && !run_launcher) {
+ if (g_strcmp0 (self->display_seat_id, "seat0") != 0 && !run_launcher) {
run_separate_bus = TRUE;
}
if (self->selected_program == NULL) {
gboolean run_xsession_script;
command = get_session_command (self);
run_xsession_script = !gdm_session_bypasses_xsession (self);
if (self->display_is_local) {
gboolean disallow_tcp = TRUE;
gdm_settings_direct_get_boolean (GDM_KEY_DISALLOW_TCP, &disallow_tcp);
allow_remote_connections = !disallow_tcp;
} else {
allow_remote_connections = TRUE;
}
if (run_launcher) {
if (is_x11) {
program = g_strdup_printf (LIBEXECDIR "/gdm-x-session %s%s %s\"%s\"",
register_session ? "--register-session " : "",
run_xsession_script? "--run-script " : "",
allow_remote_connections? "--allow-remote-connections " : "",
command);
} else {
program = g_strdup_printf (LIBEXECDIR "/gdm-wayland-session %s\"%s\"",
register_session ? "--register-session " : "",
command);
}
@@ -3192,119 +3192,118 @@ gdm_session_get_session_id (GdmSession *self)
return conversation->session_id;
}
const char *
gdm_session_get_conversation_session_id (GdmSession *self,
const char *service_name)
{
GdmSessionConversation *conversation;
g_return_val_if_fail (GDM_IS_SESSION (self), NULL);
conversation = find_conversation_by_name (self, service_name);
if (conversation == NULL) {
return NULL;
}
return conversation->session_id;
}
static char *
get_session_filename (GdmSession *self)
{
return g_strdup_printf ("%s.desktop", get_session_name (self));
}
#ifdef ENABLE_WAYLAND_SUPPORT
static gboolean
gdm_session_is_wayland_session (GdmSession *self)
{
- GKeyFile *key_file;
+ g_autoptr (GKeyFile) key_file = NULL;
gboolean is_wayland_session = FALSE;
- char *filename;
- char *full_path = NULL;
+ g_autofree char *filename = NULL;
+ g_autofree char *full_path = NULL;
g_return_val_if_fail (self != NULL, FALSE);
g_return_val_if_fail (GDM_IS_SESSION (self), FALSE);
filename = get_session_filename (self);
- key_file = load_key_file_for_file (self, filename, "wayland", &full_path);
+ if (!self->ignore_wayland) {
+ key_file = load_key_file_for_file (self, filename, "wayland", &full_path);
- if (key_file == NULL) {
- goto out;
- }
+ if (key_file == NULL) {
+ goto out;
+ }
- if (full_path != NULL && strstr (full_path, "/wayland-sessions/") != NULL) {
- is_wayland_session = TRUE;
+ if (full_path != NULL && strstr (full_path, "/wayland-sessions/") != NULL) {
+ is_wayland_session = TRUE;
+ }
}
- g_debug ("GdmSession: checking if file '%s' is wayland session: %s", filename, is_wayland_session? "yes" : "no");
out:
- g_clear_pointer (&key_file, g_key_file_free);
- g_free (filename);
+ g_debug ("GdmSession: checking if file '%s' is wayland session: %s", filename, is_wayland_session? "yes" : "no");
return is_wayland_session;
}
#endif
static void
update_session_type (GdmSession *self)
{
#ifdef ENABLE_WAYLAND_SUPPORT
gboolean is_wayland_session = FALSE;
- if (!self->ignore_wayland)
- is_wayland_session = gdm_session_is_wayland_session (self);
+ is_wayland_session = gdm_session_is_wayland_session (self);
if (is_wayland_session) {
set_session_type (self, "wayland");
} else {
set_session_type (self, NULL);
}
#endif
}
gboolean
gdm_session_session_registers (GdmSession *self)
{
g_autoptr(GError) error = NULL;
g_autoptr(GKeyFile) key_file = NULL;
gboolean session_registers = FALSE;
g_autofree char *filename = NULL;
g_return_val_if_fail (self != NULL, FALSE);
g_return_val_if_fail (GDM_IS_SESSION (self), FALSE);
filename = get_session_filename (self);
- key_file = load_key_file_for_file (self, filename, NULL);
+ key_file = load_key_file_for_file (self, filename, NULL, NULL);
session_registers = g_key_file_get_boolean (key_file,
G_KEY_FILE_DESKTOP_GROUP,
"X-GDM-SessionRegisters",
&error);
if (!session_registers &&
error != NULL &&
!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND)) {
g_warning ("GdmSession: Couldn't read session file '%s'", filename);
return FALSE;
}
g_debug ("GdmSession: '%s' %s self", filename,
session_registers ? "registers" : "does not register");
return session_registers;
}
gboolean
gdm_session_bypasses_xsession (GdmSession *self)
{
GError *error;
GKeyFile *key_file;
gboolean res;
gboolean bypasses_xsession = FALSE;
char *filename = NULL;
g_return_val_if_fail (self != NULL, FALSE);
g_return_val_if_fail (GDM_IS_SESSION (self), FALSE);
--
2.31.1

View File

@ -0,0 +1,10 @@
load-module module-device-restore
load-module module-card-restore
load-module module-udev-detect
load-module module-native-protocol-unix
load-module module-default-device-restore
load-module module-rescue-streams
load-module module-always-sink
load-module module-intended-roles
load-module module-suspend-on-idle
load-module module-position-event-sounds

View File

@ -0,0 +1,3 @@
[org.gnome.login-screen]
logo='/usr/share/pixmaps/fedora-gdm-logo.png'
enable-smartcard-authentication=false

3240
SPECS/gdm.spec Normal file

File diff suppressed because it is too large Load Diff