Add latest session type propagation fixes from upstream

Related: #2009044
This commit is contained in:
Ray Strode 2021-10-13 13:01:50 -04:00
parent a3e00efd60
commit 7d29b260c0
4 changed files with 327 additions and 1 deletions

View File

@ -0,0 +1,122 @@
From 984690b76527baae0f7da0af00467669b49886ef Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Tue, 14 Sep 2021 11:00:33 -0400
Subject: [PATCH 1/3] xdmcp-display-factory: Set supported session types for
XDMCP displays
The lower levels of GDM now expect the session types supported by a
display to be specified up front.
This commit makes sure XDMCP displays do that.
---
daemon/gdm-xdmcp-display-factory.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/daemon/gdm-xdmcp-display-factory.c b/daemon/gdm-xdmcp-display-factory.c
index ce8f026e..abb58fae 100644
--- a/daemon/gdm-xdmcp-display-factory.c
+++ b/daemon/gdm-xdmcp-display-factory.c
@@ -2104,94 +2104,100 @@ on_display_status_changed (GdmDisplay *display,
break;
case GDM_DISPLAY_MANAGED:
if (session != NULL) {
g_signal_connect_object (G_OBJECT (session),
"client-disconnected",
G_CALLBACK (on_client_disconnected),
display, G_CONNECT_SWAPPED);
g_signal_connect_object (G_OBJECT (session),
"disconnected",
G_CALLBACK (on_client_disconnected),
display, G_CONNECT_SWAPPED);
}
break;
default:
g_assert_not_reached ();
break;
}
g_clear_object (&launch_environment);
}
static GdmDisplay *
gdm_xdmcp_display_create (GdmXdmcpDisplayFactory *factory,
const char *hostname,
GdmAddress *address,
int displaynum)
{
GdmDisplay *display;
GdmDisplayStore *store;
gboolean use_chooser;
+ const char *session_types[] = { "x11", NULL };
g_debug ("GdmXdmcpDisplayFactory: Creating xdmcp display for %s:%d",
hostname ? hostname : "(null)", displaynum);
use_chooser = FALSE;
if (factory->honor_indirect) {
IndirectClient *ic;
ic = indirect_client_lookup (factory, address);
/* This was an indirect thingie and nothing was yet chosen,
* use a chooser */
if (ic != NULL && ic->chosen_address == NULL) {
use_chooser = TRUE;
}
}
if (use_chooser) {
display = gdm_xdmcp_chooser_display_new (hostname,
displaynum,
address,
get_next_session_serial (factory));
g_signal_connect (display, "hostname-selected", G_CALLBACK (on_hostname_selected), factory);
} else {
display = gdm_xdmcp_display_new (hostname,
displaynum,
address,
get_next_session_serial (factory));
}
if (display == NULL) {
goto out;
}
+ g_object_set (G_OBJECT (display),
+ "session-type", session_types[0],
+ "supported-session-types", session_types,
+ NULL);
+
if (! gdm_display_prepare (display)) {
gdm_display_unmanage (display);
g_object_unref (display);
display = NULL;
goto out;
}
g_signal_connect_after (display,
"notify::status",
G_CALLBACK (on_display_status_changed),
factory);
store = gdm_display_factory_get_display_store (GDM_DISPLAY_FACTORY (factory));
gdm_display_store_add (store, display);
factory->num_pending_sessions++;
out:
return display;
}
static void
gdm_xdmcp_send_accept (GdmXdmcpDisplayFactory *factory,
GdmAddress *address,
CARD32 session_id,
ARRAY8Ptr authentication_name,
ARRAY8Ptr authentication_data,
ARRAY8Ptr authorization_name,
ARRAY8Ptr authorization_data)
{
--
2.31.1

View File

@ -0,0 +1,109 @@
From 1e877db3a4a8cb8e4eb4fbdaef3f6a7434e6a57d Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 6 Sep 2021 08:40:46 -0400
Subject: [PATCH 2/3] daemon: Don't update session type if no saved session
At the moment we always set the session type when the session name
is read. But users don't always have a session type specified.
If they don't, then don't set the session type.
https://gitlab.gnome.org/GNOME/gdm/-/merge_requests/153
---
daemon/gdm-session.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
index 2b941e5e..b54687d5 100644
--- a/daemon/gdm-session.c
+++ b/daemon/gdm-session.c
@@ -995,73 +995,76 @@ worker_on_reauthenticated (GdmDBusWorker *worker,
static void
worker_on_saved_language_name_read (GdmDBusWorker *worker,
const char *language_name,
GdmSessionConversation *conversation)
{
GdmSession *self = conversation->session;
if (strlen (language_name) > 0) {
g_free (self->saved_language);
self->saved_language = g_strdup (language_name);
if (self->greeter_interface != NULL) {
gdm_dbus_greeter_emit_default_language_name_changed (self->greeter_interface,
language_name);
}
}
}
static void
worker_on_saved_session_name_read (GdmDBusWorker *worker,
const char *session_name,
GdmSessionConversation *conversation)
{
GdmSession *self = conversation->session;
if (! get_session_command_for_name (self, session_name, self->saved_session_type, NULL)) {
/* ignore sessions that don't exist */
g_debug ("GdmSession: not using invalid .dmrc session: %s", session_name);
g_free (self->saved_session);
self->saved_session = NULL;
- } else if (strcmp (session_name,
- get_default_session_name (self)) != 0) {
- g_free (self->saved_session);
- self->saved_session = g_strdup (session_name);
-
- if (self->greeter_interface != NULL) {
- gdm_dbus_greeter_emit_default_session_name_changed (self->greeter_interface,
- session_name);
+ update_session_type (self);
+ } else {
+ if (strcmp (session_name,
+ get_default_session_name (self)) != 0) {
+ g_free (self->saved_session);
+ self->saved_session = g_strdup (session_name);
+
+ if (self->greeter_interface != NULL) {
+ gdm_dbus_greeter_emit_default_session_name_changed (self->greeter_interface,
+ session_name);
+ }
}
+ if (self->saved_session_type != NULL)
+ set_session_type (self, self->saved_session_type);
}
- update_session_type (self);
-
}
static void
worker_on_saved_session_type_read (GdmDBusWorker *worker,
const char *session_type,
GdmSessionConversation *conversation)
{
GdmSession *self = conversation->session;
g_free (self->saved_session_type);
self->saved_session_type = g_strdup (session_type);
}
static GdmSessionConversation *
find_conversation_by_pid (GdmSession *self,
GPid pid)
{
GHashTableIter iter;
gpointer key, value;
g_hash_table_iter_init (&iter, self->conversations);
while (g_hash_table_iter_next (&iter, &key, &value)) {
GdmSessionConversation *conversation;
conversation = (GdmSessionConversation *) value;
if (conversation->worker_pid == pid) {
return conversation;
}
}
--
2.31.1

View File

@ -0,0 +1,87 @@
From 3eea287750d63cfe94fe777111e1cd04141eecb3 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Wed, 29 Sep 2021 11:03:41 -0400
Subject: [PATCH 3/3] daemon: Infer session type from desktop file if user has
no saved session type
The accountsservice user cache file can specify a session type
associated with the saved session. This is optional though. If one
isn't specified GDM needs to figure out the session type based on the
list of preferred session types for the system and the session file
itself.
It was failing to do the latter, though. This commit fixes that.
---
daemon/gdm-session.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
index b54687d5..a65fa0f9 100644
--- a/daemon/gdm-session.c
+++ b/daemon/gdm-session.c
@@ -1009,60 +1009,62 @@ worker_on_saved_language_name_read (GdmDBusWorker *worker,
}
}
}
static void
worker_on_saved_session_name_read (GdmDBusWorker *worker,
const char *session_name,
GdmSessionConversation *conversation)
{
GdmSession *self = conversation->session;
if (! get_session_command_for_name (self, session_name, self->saved_session_type, NULL)) {
/* ignore sessions that don't exist */
g_debug ("GdmSession: not using invalid .dmrc session: %s", session_name);
g_free (self->saved_session);
self->saved_session = NULL;
update_session_type (self);
} else {
if (strcmp (session_name,
get_default_session_name (self)) != 0) {
g_free (self->saved_session);
self->saved_session = g_strdup (session_name);
if (self->greeter_interface != NULL) {
gdm_dbus_greeter_emit_default_session_name_changed (self->greeter_interface,
session_name);
}
}
if (self->saved_session_type != NULL)
set_session_type (self, self->saved_session_type);
+ else
+ update_session_type (self);
}
}
static void
worker_on_saved_session_type_read (GdmDBusWorker *worker,
const char *session_type,
GdmSessionConversation *conversation)
{
GdmSession *self = conversation->session;
g_free (self->saved_session_type);
self->saved_session_type = g_strdup (session_type);
}
static GdmSessionConversation *
find_conversation_by_pid (GdmSession *self,
GPid pid)
{
GHashTableIter iter;
gpointer key, value;
g_hash_table_iter_init (&iter, self->conversations);
while (g_hash_table_iter_next (&iter, &key, &value)) {
GdmSessionConversation *conversation;
conversation = (GdmSessionConversation *) value;
if (conversation->worker_pid == pid) {
return conversation;
--
2.31.1

View File

@ -11,7 +11,7 @@
Name: gdm
Epoch: 1
Version: 40.1
Release: 7%{?dist}
Release: 8%{?dist}
Summary: The GNOME Display Manager
License: GPLv2+
@ -25,6 +25,10 @@ Source5: default.pa-for-gdm
# Upstream backports
Patch10001: 0001-local-display-factory-Provide-more-flexibility-for-c.patch
Patch20001: 0001-xdmcp-display-factory-Set-supported-session-types-fo.patch
Patch20002: 0002-daemon-Don-t-update-session-type-if-no-saved-session.patch
Patch20003: 0003-daemon-Infer-session-type-from-desktop-file-if-user-.patch
# Downstream patches
Patch70001: 0001-data-disable-wayland-on-certain-hardware.patch
Patch80001: 0001-Honor-initial-setup-being-disabled-by-distro-install.patch
@ -311,6 +315,10 @@ dconf update || :
%{_libdir}/pkgconfig/gdm-pam-extensions.pc
%changelog
* Wed Oct 13 2021 Ray Strode <rstrode@redhat.com> - 40.1-8
- Add latest session type propagation fixes from upstream
Related: #2009044
* Mon Aug 23 2021 Ray Strode <rstrode@redhat.com> - 40.1-7
- Don't use gdm-disable-wayland binary in udev rules.
It doesn't exist anymore.