import gdm-3.28.3-20.el8

This commit is contained in:
CentOS Sources 2019-05-07 01:30:10 -04:00 committed by Andrew Lukoshko
commit d267cceb47
19 changed files with 7134 additions and 0 deletions

1
.gdm.metadata Normal file
View File

@ -0,0 +1 @@
3c619c91941b2df0362a67b905669f8852106bf5 SOURCES/gdm-3.28.3.tar.xz

1
.gitignore vendored Normal file
View File

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

View File

@ -0,0 +1,82 @@
From fa5733788ae5f8e8caeb07e956be370e96f9b6b1 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/Makefile.am | 1 +
daemon/gdm-display.c | 29 +++++++++++++++++++++++++++++
2 files changed, 30 insertions(+)
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index ab5dda0..786e0c5 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -14,6 +14,7 @@ AM_CPPFLAGS = \
-DLOCALSTATEDIR=\"$(localstatedir)\" \
-DLOGDIR=\"$(logdir)\" \
-DSBINDIR=\"$(sbindir)\" \
+ -DSYSCONFDIR=\"$(sysconfdir)\" \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-DGDM_RUN_DIR=\"$(GDM_RUN_DIR)\" \
-DGDM_XAUTH_DIR=\"$(GDM_XAUTH_DIR)\" \
diff --git a/daemon/gdm-display.c b/daemon/gdm-display.c
index 0057e2c..2af8e13 100644
--- a/daemon/gdm-display.c
+++ b/daemon/gdm-display.c
@@ -1456,6 +1456,31 @@ can_create_environment (const char *session_id)
}
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)
{
gboolean enabled = FALSE;
@@ -1480,6 +1505,10 @@ wants_initial_setup (GdmDisplay *self)
return FALSE;
}
+ if (initial_setup_disabled_by_anaconda ()) {
+ return FALSE;
+ }
+
return enabled;
}
--
2.9.3

View File

@ -0,0 +1,31 @@
From 84eac5437175efc3804e8a6133c06484d6016b26 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Fri, 4 Jan 2019 16:40:07 -0500
Subject: [PATCH] data: disable wayland for legacy QXL VMs
There are a number of issues right now with the QXL driver that
prevent it from working well with wayland.
These days QXL is deprecated in favor of virtio anyway.
This commit forces Xorg fallback for QXL VMs.
---
data/61-gdm.rules.in | 3 +++
1 file changed, 3 insertions(+)
diff --git a/data/61-gdm.rules.in b/data/61-gdm.rules.in
index 26cf9cf51..ec19aa447 100644
--- a/data/61-gdm.rules.in
+++ b/data/61-gdm.rules.in
@@ -1,5 +1,8 @@
# disable Wayland on Cirrus chipsets
ATTR{vendor}=="0x1013", ATTR{device}=="0x00b8", ATTR{subsystem_vendor}=="0x1af4", ATTR{subsystem_device}=="0x1100", RUN+="@libexecdir@/gdm-disable-wayland"
+# disable Wayland on legacy QXL virtual machines
+ATTR{vendor}=="0x1b36", ATTR{device}=="0x0100", RUN+="@libexecdir@/gdm-disable-wayland"
+
# disable Wayland when using the proprietary nvidia driver
DRIVER=="nvidia", RUN+="@libexecdir@/gdm-disable-wayland"
--
2.17.1

View File

@ -0,0 +1,28 @@
From f2ac0603854c7933ecea4a13876fa7e72fd66d1a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Thu, 6 Sep 2018 10:14:08 -0400
Subject: [PATCH] data: disable wayland for proprietary nvidia machines
At the moment GLX applications don't work well when the
proprietary nvidia driver is used with a wayland session.
For now, disable wayland on that hardware, and users who
want to opt in can just edit the udev rule.
(or add their own that overrides it)
---
data/61-gdm.rules.in | 3 +++
1 file changed, 3 insertions(+)
diff --git a/data/61-gdm.rules.in b/data/61-gdm.rules.in
index de8e17903..26cf9cf51 100644
--- a/data/61-gdm.rules.in
+++ b/data/61-gdm.rules.in
@@ -1,2 +1,5 @@
# disable Wayland on Cirrus chipsets
ATTR{vendor}=="0x1013", ATTR{device}=="0x00b8", ATTR{subsystem_vendor}=="0x1af4", ATTR{subsystem_device}=="0x1100", RUN+="@libexecdir@/gdm-disable-wayland"
+
+# disable Wayland when using the proprietary nvidia driver
+DRIVER=="nvidia", RUN+="@libexecdir@/gdm-disable-wayland"
--
2.20.1

View File

@ -0,0 +1,47 @@
From 21be64e1ba86bd57a4257a7526c9b4ee430bfdaa 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 server chips and dual gpu setups
We're still having a variety of issues on server chips and
dual gpu/hybrid graphics setups.
This commit forces Xorg for those cases.
---
data/61-gdm.rules.in | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/data/61-gdm.rules.in b/data/61-gdm.rules.in
index ec19aa447..1c308d511 100644
--- a/data/61-gdm.rules.in
+++ b/data/61-gdm.rules.in
@@ -1,8 +1,26 @@
# disable Wayland on Cirrus chipsets
ATTR{vendor}=="0x1013", ATTR{device}=="0x00b8", ATTR{subsystem_vendor}=="0x1af4", ATTR{subsystem_device}=="0x1100", RUN+="@libexecdir@/gdm-disable-wayland"
+# disable Wayland on Matrox chipsets
+ATTR{vendor}=="0x102b", ATTR{device}=="0x0522", RUN+="@libexecdir@/gdm-disable-wayland"
+ATTR{vendor}=="0x102b", ATTR{device}=="0x0524", RUN+="@libexecdir@/gdm-disable-wayland"
+ATTR{vendor}=="0x102b", ATTR{device}=="0x0530", RUN+="@libexecdir@/gdm-disable-wayland"
+ATTR{vendor}=="0x102b", ATTR{device}=="0x0532", RUN+="@libexecdir@/gdm-disable-wayland"
+ATTR{vendor}=="0x102b", ATTR{device}=="0x0533", RUN+="@libexecdir@/gdm-disable-wayland"
+ATTR{vendor}=="0x102b", ATTR{device}=="0x0534", RUN+="@libexecdir@/gdm-disable-wayland"
+ATTR{vendor}=="0x102b", ATTR{device}=="0x0536", RUN+="@libexecdir@/gdm-disable-wayland"
+ATTR{vendor}=="0x102b", ATTR{device}=="0x0538", RUN+="@libexecdir@/gdm-disable-wayland"
+
+# disable Wayland on aspeed chipsets
+ATTR{vendor}=="0x1a03", ATTR{device}=="0x2010", RUN+="@libexecdir@/gdm-disable-wayland"
+ATTR{vendor}=="0x1a03", ATTR{device}=="0x2000", RUN+="@libexecdir@/gdm-disable-wayland"
+
# disable Wayland on legacy QXL virtual machines
ATTR{vendor}=="0x1b36", ATTR{device}=="0x0100", RUN+="@libexecdir@/gdm-disable-wayland"
# disable Wayland when using the proprietary nvidia driver
DRIVER=="nvidia", RUN+="@libexecdir@/gdm-disable-wayland"
+
+# disable Wayland on hybrid graphics setups for now
+SUBSYSTEM=="drm", KERNEL=="card[1-9]*", RUN+="@libexecdir@/gdm-disable-wayland"
+
--
2.18.1

View File

@ -0,0 +1,206 @@
From fb55ec1c2e2957eb4c11a220874e5089fd357286 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Wed, 16 May 2018 14:06:29 -0400
Subject: [PATCH] display-access-file: drop unused function
gdm_display_access_file_remove_display is unused.
This commit drops it.
https://bugzilla.gnome.org/show_bug.cgi?id=796176
---
daemon/gdm-display-access-file.c | 79 --------------------------------
daemon/gdm-display-access-file.h | 3 --
2 files changed, 82 deletions(-)
diff --git a/daemon/gdm-display-access-file.c b/daemon/gdm-display-access-file.c
index 9bf818d2a..c1f0f17a8 100644
--- a/daemon/gdm-display-access-file.c
+++ b/daemon/gdm-display-access-file.c
@@ -536,139 +536,60 @@ gdm_display_access_file_add_display_with_cookie (GdmDisplayAccessFile *file,
|| fflush (file->priv->fp) == EOF) {
g_set_error (error,
G_FILE_ERROR,
g_file_error_from_errno (errno),
"%s", g_strerror (errno));
display_added = FALSE;
} else {
display_added = TRUE;
}
/* If we wrote a FamilyLocal entry, we still want a FamilyWild
* entry, because it's more resiliant against hostname changes
*
*/
if (auth_entry.family == FamilyLocal) {
auth_entry.family = FamilyWild;
if (XauWriteAuth (file->priv->fp, &auth_entry)
&& fflush (file->priv->fp) != EOF) {
display_added = TRUE;
}
}
g_free (auth_entry.address);
g_free (auth_entry.number);
g_free (auth_entry.name);
return display_added;
}
-gboolean
-gdm_display_access_file_remove_display (GdmDisplayAccessFile *file,
- GdmDisplay *display,
- GError **error)
-{
- Xauth *auth_entry;
- unsigned short family;
- unsigned short address_length;
- char *address;
- unsigned short number_length;
- char *number;
- unsigned short name_length;
- char *name;
-
- gboolean result = FALSE;
-
- g_return_val_if_fail (file != NULL, FALSE);
- g_return_val_if_fail (file->priv->path != NULL, FALSE);
-
- _get_auth_info_for_display (file, display,
- &family,
- &address_length,
- &address,
- &number_length,
- &number,
- &name_length,
- &name);
-
- auth_entry = XauGetAuthByAddr (family,
- address_length,
- address,
- number_length,
- number,
- name_length,
- name);
- g_free (address);
- g_free (number);
- g_free (name);
-
- if (auth_entry != NULL) {
- XauDisposeAuth (auth_entry);
- result = TRUE;
- }
-
- /* If FamilyLocal, we also added a FamilyWild entry,
- * so we need to clean that up too
- */
- if (family == FamilyLocal) {
- auth_entry = XauGetAuthByAddr (FamilyWild,
- address_length,
- address,
- number_length,
- number,
- name_length,
- name);
-
- if (auth_entry != NULL) {
- XauDisposeAuth (auth_entry);
- result = TRUE;
- }
- }
-
-
- if (result == FALSE) {
- g_set_error (error,
- GDM_DISPLAY_ACCESS_FILE_ERROR,
- GDM_DISPLAY_ACCESS_FILE_ERROR_FINDING_AUTH_ENTRY,
- "could not find authorization entry");
- } else if (fflush (file->priv->fp) == EOF) {
- g_set_error (error,
- G_FILE_ERROR,
- g_file_error_from_errno (errno),
- "%s", g_strerror (errno));
- result = FALSE;
- }
-
- return result;
-}
-
void
gdm_display_access_file_close (GdmDisplayAccessFile *file)
{
char *auth_dir;
g_return_if_fail (file != NULL);
g_return_if_fail (file->priv->fp != NULL);
g_return_if_fail (file->priv->path != NULL);
errno = 0;
if (g_unlink (file->priv->path) != 0) {
g_warning ("GdmDisplayAccessFile: Unable to remove X11 authority database '%s': %s",
file->priv->path,
g_strerror (errno));
}
/* still try to remove dir even if file remove failed,
may have already been removed by someone else */
/* we own the parent directory too */
auth_dir = g_path_get_dirname (file->priv->path);
if (auth_dir != NULL) {
errno = 0;
if (g_rmdir (auth_dir) != 0) {
g_warning ("GdmDisplayAccessFile: Unable to remove X11 authority directory '%s': %s",
auth_dir,
g_strerror (errno));
}
g_free (auth_dir);
}
diff --git a/daemon/gdm-display-access-file.h b/daemon/gdm-display-access-file.h
index cc7de9e35..eff8dd011 100644
--- a/daemon/gdm-display-access-file.h
+++ b/daemon/gdm-display-access-file.h
@@ -50,39 +50,36 @@ struct _GdmDisplayAccessFile
GdmDisplayAccessFilePrivate *priv;
};
struct _GdmDisplayAccessFileClass
{
GObjectClass parent_class;
};
enum _GdmDisplayAccessFileError
{
GDM_DISPLAY_ACCESS_FILE_ERROR_GENERAL = 0,
GDM_DISPLAY_ACCESS_FILE_ERROR_FINDING_AUTH_ENTRY
};
GQuark gdm_display_access_file_error_quark (void);
GType gdm_display_access_file_get_type (void);
GdmDisplayAccessFile *gdm_display_access_file_new (const char *username);
gboolean gdm_display_access_file_open (GdmDisplayAccessFile *file,
GError **error);
gboolean gdm_display_access_file_add_display (GdmDisplayAccessFile *file,
GdmDisplay *display,
char **cookie,
gsize *cookie_size,
GError **error);
gboolean gdm_display_access_file_add_display_with_cookie (GdmDisplayAccessFile *file,
GdmDisplay *display,
const char *cookie,
gsize cookie_size,
GError **error);
-gboolean gdm_display_access_file_remove_display (GdmDisplayAccessFile *file,
- GdmDisplay *display,
- GError **error);
void gdm_display_access_file_close (GdmDisplayAccessFile *file);
char *gdm_display_access_file_get_path (GdmDisplayAccessFile *file);
G_END_DECLS
#endif /* __GDM_DISPLAY_ACCESS_FILE_H__ */
--
2.17.1

View File

@ -0,0 +1,90 @@
From f9662449f0f7dbb452ba11fe85a3c81b386f6dab 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 403921d32..ab7e12e91 100644
--- a/daemon/gdm-local-display-factory.c
+++ b/daemon/gdm-local-display-factory.c
@@ -283,60 +283,65 @@ on_display_status_changed (GdmDisplay *display,
/* if this is a local display, do a full resync. Only
* seats without displays will get created anyway. This
* ensures we get a new login screen when the user logs out,
* if there isn't one.
*/
if (is_local) {
/* reset num failures */
factory->priv->num_failures = 0;
gdm_local_display_factory_sync_seats (factory);
}
break;
case GDM_DISPLAY_FAILED:
/* leave the display number in factory->priv->used_display_numbers
so that it doesn't get reused */
gdm_display_store_remove (store, display);
/* Create a new equivalent display if it was static */
if (is_local) {
factory->priv->num_failures++;
if (factory->priv->num_failures > MAX_DISPLAY_FAILURES) {
/* oh shit */
g_warning ("GdmLocalDisplayFactory: maximum number of X display failures reached: check X server log for errors");
} else {
#ifdef ENABLE_WAYLAND_SUPPORT
if (g_strcmp0 (session_type, "wayland") == 0) {
g_free (session_type);
session_type = NULL;
+
+ /* workaround logind race for now
+ * bug 1643874
+ */
+ sleep (2);
}
#endif
create_display (factory, seat_id, session_type, is_initial);
}
}
break;
case GDM_DISPLAY_UNMANAGED:
break;
case GDM_DISPLAY_PREPARED:
break;
case GDM_DISPLAY_MANAGED:
break;
default:
g_assert_not_reached ();
break;
}
g_free (seat_id);
g_free (session_type);
}
static gboolean
lookup_by_seat_id (const char *id,
GdmDisplay *display,
gpointer user_data)
{
const char *looking_for = user_data;
char *current;
gboolean res;
--
2.19.1

View File

@ -0,0 +1,198 @@
From 4b2db2cf52be75e2eec4aa29f8ee082392ded410 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Thu, 1 Nov 2018 13:03:37 -0400
Subject: [PATCH] manager: ensure is-initial is transfered to autologin display
At the moment, we don't handle transferring the is-initial property to
the autologin display.
That prevents autologin from working if wayland fails and X falls back,
since autologin currently requires an initial display.
This commit makes sure we properly transfer is-initial from greeter to
user display.
---
daemon/gdm-manager.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
index 1943d89e4..2118c5834 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -1740,90 +1740,93 @@ start_user_session (GdmManager *manager,
g_object_get (G_OBJECT (display), "is-connected", &is_connected, NULL);
if (is_connected) {
auth_file = NULL;
username = gdm_session_get_username (operation->session);
gdm_display_add_user_authorization (display,
username,
&auth_file,
NULL);
g_assert (auth_file != NULL);
g_object_set (operation->session,
"user-x11-authority-file", auth_file,
NULL);
g_free (auth_file);
}
}
gdm_session_start_session (operation->session,
operation->service_name);
destroy_start_user_session_operation (operation);
}
static void
create_display_for_user_session (GdmManager *self,
GdmSession *session,
- const char *session_id)
+ const char *session_id,
+ gboolean is_initial)
{
GdmDisplay *display;
/* at the moment we only create GdmLocalDisplay objects on seat0 */
const char *seat_id = "seat0";
display = gdm_local_display_new ();
g_object_set (G_OBJECT (display),
"session-class", "user",
"seat-id", seat_id,
"session-id", session_id,
+ "is-initial", is_initial,
NULL);
gdm_display_store_add (self->priv->display_store,
display);
g_object_set_data (G_OBJECT (session), "gdm-display", display);
g_object_set_data_full (G_OBJECT (display),
"gdm-user-session",
g_object_ref (session),
(GDestroyNotify)
clean_user_session);
}
static gboolean
on_start_user_session (StartUserSessionOperation *operation)
{
GdmManager *self = operation->manager;
gboolean migrated;
gboolean fail_if_already_switched = TRUE;
gboolean doing_initial_setup = FALSE;
+ gboolean should_be_initial = FALSE;
gboolean starting_user_session_right_away = TRUE;
GdmDisplay *display;
const char *session_id;
g_debug ("GdmManager: start or jump to session");
/* If there's already a session running, jump to it.
* If the only session running is the one we just opened,
* start a session on it.
*/
migrated = switch_to_compatible_user_session (operation->manager, operation->session, fail_if_already_switched);
g_debug ("GdmManager: migrated: %d", migrated);
if (migrated) {
/* We don't stop the manager here because
when Xorg exits it switches to the VT it was
started from. That interferes with fast
user switching. */
gdm_session_reset (operation->session);
destroy_start_user_session_operation (operation);
goto out;
}
display = get_display_for_user_session (operation->session);
g_object_get (G_OBJECT (display), "doing-initial-setup", &doing_initial_setup, NULL);
session_id = gdm_session_get_conversation_session_id (operation->session,
operation->service_name);
@@ -1839,70 +1842,77 @@ on_start_user_session (StartUserSessionOperation *operation)
} else {
uid_t allowed_uid;
g_object_ref (display);
if (doing_initial_setup) {
g_debug ("GdmManager: closing down initial setup display");
gdm_display_stop_greeter_session (display);
gdm_display_unmanage (display);
gdm_display_finish (display);
/* We can't start the user session until the finished display
* starts to respawn (since starting an X server and bringing
* one down at the same time is a no go)
*/
g_assert (self->priv->initial_login_operation == NULL);
self->priv->initial_login_operation = operation;
starting_user_session_right_away = FALSE;
} else {
g_debug ("GdmManager: session has its display server, reusing our server for another login screen");
}
/* The user session is going to follow the session worker
* into the new display. Untie it from this display and
* create a new session for a future user login. */
allowed_uid = gdm_session_get_allowed_user (operation->session);
g_object_set_data (G_OBJECT (display), "gdm-user-session", NULL);
g_object_set_data (G_OBJECT (operation->session), "gdm-display", NULL);
create_user_session_for_display (operation->manager, display, allowed_uid);
if (g_strcmp0 (operation->service_name, "gdm-autologin") == 0) {
+ gboolean was_initial = FALSE;
+
+ g_object_get (G_OBJECT (display), "is-initial", &was_initial, NULL);
+
/* remove the unused prepared greeter display since we're not going
* to have a greeter */
gdm_display_store_remove (self->priv->display_store, display);
g_object_unref (display);
+
+ should_be_initial = was_initial;
}
/* Give the user session a new display object for bookkeeping purposes */
create_display_for_user_session (operation->manager,
operation->session,
- session_id);
+ session_id,
+ should_be_initial);
}
if (starting_user_session_right_away) {
start_user_session (operation->manager, operation);
}
out:
return G_SOURCE_REMOVE;
}
static void
queue_start_user_session (GdmManager *manager,
GdmSession *session,
const char *service_name)
{
StartUserSessionOperation *operation;
operation = g_slice_new0 (StartUserSessionOperation);
operation->manager = manager;
operation->session = g_object_ref (session);
operation->service_name = g_strdup (service_name);
operation->idle_id = g_idle_add ((GSourceFunc) on_start_user_session, operation);
g_object_set_data (G_OBJECT (session), "start-user-session-operation", operation);
}
static void
start_user_session_if_ready (GdmManager *manager,
GdmSession *session,
const char *service_name)
--
2.19.1

View File

@ -0,0 +1,105 @@
From b8c942b5f191eaa39ac1e578fa019b32a516cd5c Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 11 Feb 2019 10:32:55 -0500
Subject: [PATCH] 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 e6640aac7..0f821e390 100644
--- a/daemon/gdm-session.c
+++ b/daemon/gdm-session.c
@@ -2614,60 +2614,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->priv->session_type != NULL) {
session_type = self->priv->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.18.1

View File

@ -0,0 +1,161 @@
From 14656db42a6b4d4d48cf74127f3187dfe85607ec Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 21 May 2018 15:03:29 +0000
Subject: [PATCH] utils: add new gdm-disable-wayland binary
We currently disable wayland for cirrus by calling printf
from a udev rule. This works, but it's a little too open
coded to easily write SELinux policy for.
This commit introduces a new program, gdm-disable-wayland,
that does the same thing, but in a dedicated binary.
A future commit will change the udev rule to use the binary.
https://bugzilla.gnome.org/show_bug.cgi?id=796315
(cherry picked from commit 2dc57da31781dedfe374ce353b0f5fd6aa9da56f)
---
utils/Makefile.am | 14 ++++++++++
utils/gdm-disable-wayland.c | 53 +++++++++++++++++++++++++++++++++++++
2 files changed, 67 insertions(+)
create mode 100644 utils/gdm-disable-wayland.c
diff --git a/utils/Makefile.am b/utils/Makefile.am
index ae3cc01fb..babe890b9 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -1,56 +1,70 @@
NULL =
AM_CPPFLAGS = \
-I$(srcdir) \
-I$(builddir) \
-I$(top_srcdir) \
-I$(top_builddir) \
-I$(top_srcdir)/common \
-I$(top_builddir)/common \
-DDATADIR=\"$(datadir)\" \
-DGDMCONFDIR=\"$(gdmconfdir)\" \
-DLOCALSTATEDIR=\""$(localstatedir)"\" \
+ -DGDM_RUN_DIR=\"$(GDM_RUN_DIR)\" \
+ -DGDM_RUNTIME_CONF=\"$(GDM_RUNTIME_CONF)\" \
-DGDM_SCREENSHOT_DIR=\""$(GDM_SCREENSHOT_DIR)"\"\
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
$(UTILS_CFLAGS) \
$(CANBERRA_GTK_CFLAGS) \
$(GTK_CFLAGS) \
$(XLIB_CFLAGS) \
$(SYSTEMD_CFLAGS) \
$(COMMON_CFLAGS) \
$(NULL)
edit = sed \
-e 's|@sbindir[@]|$(sbindir)|g' \
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
-e 's|@localstatedir[@]|$(localstatedir)|g' \
-e 's|@GDM_PID_FILE[@]|$(GDM_PID_FILE)|g'
bin_PROGRAMS = \
gdmflexiserver \
gdm-screenshot \
$(NULL)
+libexec_PROGRAMS = \
+ gdm-disable-wayland \
+ $(NULL)
+
gdmflexiserver_LDADD = \
$(top_builddir)/common/libgdmcommon.la \
$(GTK_LIBS) \
$(COMMON_LIBS) \
$(SYSTEMD_LIBS) \
$(NULL)
gdm_screenshot_SOURCES = \
gdm-screenshot.c \
$(NULL)
gdm_screenshot_LDADD = \
$(GTK_LIBS) \
$(CANBERRA_GTK_LIBS) \
$(XLIB_LIBS) \
$(COMMON_LIBS) \
$(NULL)
+gdm_disable_wayland_LDADD = \
+ $(COMMON_LIBS) \
+ $(NULL)
+
+gdm_disable_wayland_SOURCES = \
+ gdm-disable-wayland.c \
+ $(NULL)
+
CLEANFILES = \
$(NULL)
DISTCLEANFILES = \
$(NULL)
diff --git a/utils/gdm-disable-wayland.c b/utils/gdm-disable-wayland.c
new file mode 100644
index 000000000..be61c4d8f
--- /dev/null
+++ b/utils/gdm-disable-wayland.c
@@ -0,0 +1,53 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2018 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 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 <locale.h>
+#include <stdlib.h>
+#include <sysexits.h>
+
+#include <glib.h>
+
+int
+main (int argc, char *argv[])
+{
+ g_autoptr(GKeyFile) key_file = NULL;
+ g_autoptr(GError) error = NULL;
+ gboolean saved_okay;
+
+ setlocale (LC_ALL, "");
+
+ key_file = g_key_file_new ();
+
+ g_key_file_set_boolean (key_file, "daemon", "WaylandEnable", FALSE);
+
+ g_mkdir_with_parents (GDM_RUN_DIR, 0711);
+
+ saved_okay = g_key_file_save_to_file (key_file, GDM_RUNTIME_CONF, &error);
+
+ if (!saved_okay) {
+ g_printerr ("gdm-disable-wayland: unable to disable wayland: %s",
+ error->message);
+ return EX_CANTCREAT;
+ }
+
+ return EX_OK;
+}
--
2.17.1

View File

@ -0,0 +1,601 @@
From a45b3f26e1f1f4ffc8870ebf073698d5eecf587b 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/4] 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 | 38 +++++++++++++++++++++++++------------
1 file changed, 26 insertions(+), 12 deletions(-)
diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c
index c1d89cab2..e79073996 100644
--- a/daemon/gdm-session-worker.c
+++ b/daemon/gdm-session-worker.c
@@ -409,103 +409,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,
@@ -2475,87 +2480,89 @@ gdm_session_worker_get_property (GObject *object,
g_value_set_string (value, self->priv->server_address);
break;
case PROP_IS_REAUTH_SESSION:
g_value_set_boolean (value, self->priv->is_reauth_session);
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);
}
@@ -2634,109 +2641,111 @@ do_authorize (GdmSessionWorker *worker)
}
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);
worker->priv->state = 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);
@@ -2980,155 +2989,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,
@@ -3459,98 +3474,97 @@ 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);
gdm_session_worker_unwatch_child (worker);
if (worker->priv->child_pid > 0) {
gdm_signal_pid (worker->priv->child_pid, SIGTERM);
gdm_wait_on_pid (worker->priv->child_pid);
}
- g_object_unref (worker->priv->user_settings);
+ g_clear_object (&worker->priv->user_settings);
g_free (worker->priv->service);
g_free (worker->priv->x11_display_name);
g_free (worker->priv->x11_authority_file);
g_free (worker->priv->display_device);
g_free (worker->priv->display_seat_id);
g_free (worker->priv->hostname);
g_free (worker->priv->username);
g_free (worker->priv->server_address);
g_strfreev (worker->priv->arguments);
g_strfreev (worker->priv->extensions);
g_hash_table_unref (worker->priv->reauthentication_requests);
G_OBJECT_CLASS (gdm_session_worker_parent_class)->finalize (object);
}
GdmSessionWorker *
gdm_session_worker_new (const char *address,
gboolean is_reauth_session)
{
GObject *object;
object = g_object_new (GDM_TYPE_SESSION_WORKER,
"server-address", address,
"is-reauth-session", is_reauth_session,
NULL);
return GDM_SESSION_WORKER (object);
}
--
2.17.1

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,624 @@
From f12d17a6f4f76ba037e9126113684777a070a8f4 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/4] 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.
---
daemon/Makefile.am | 10 ++
daemon/gdm-session-settings.c | 98 +++++++++++++++++++
data/Makefile.am | 2 +
.../com.redhat.AccountsServiceUser.System.xml | 10 ++
4 files changed, 120 insertions(+)
create mode 100644 data/com.redhat.AccountsServiceUser.System.xml
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 3b1b15122..b77c9276e 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -14,137 +14,147 @@ AM_CPPFLAGS = \
-DLIBEXECDIR=\"$(libexecdir)\" \
-DLOCALSTATEDIR=\"$(localstatedir)\" \
-DLOGDIR=\"$(logdir)\" \
-DSBINDIR=\"$(sbindir)\" \
-DSYSCONFDIR=\"$(sysconfdir)\" \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-DGDM_RUN_DIR=\"$(GDM_RUN_DIR)\" \
-DGDM_XAUTH_DIR=\"$(GDM_XAUTH_DIR)\" \
-DGDM_SCREENSHOT_DIR=\"$(GDM_SCREENSHOT_DIR)\" \
-DGDM_CACHE_DIR=\""$(localstatedir)/cache/gdm"\" \
-DGDM_SESSION_DEFAULT_PATH=\"$(GDM_SESSION_DEFAULT_PATH)\" \
$(DISABLE_DEPRECATED_CFLAGS) \
$(DAEMON_CFLAGS) \
$(XLIB_CFLAGS) \
$(WARN_CFLAGS) \
$(DEBUG_CFLAGS) \
$(SYSTEMD_CFLAGS) \
$(JOURNALD_CFLAGS) \
$(LIBSELINUX_CFLAGS) \
-DLANG_CONFIG_FILE=\"$(LANG_CONFIG_FILE)\" \
$(NULL)
BUILT_SOURCES = \
gdm-display-glue.h \
gdm-manager-glue.h \
gdm-local-display-glue.h \
gdm-local-display-factory-glue.h \
gdm-session-glue.h \
gdm-session-worker-glue.h \
gdm-session-enum-types.h \
+ com.redhat.AccountsServiceUser.System.h \
$(NULL)
gdm-session-enum-types.h: gdm-session-enum-types.h.in gdm-session.h
$(AM_V_GEN) glib-mkenums --template $^ > $@
gdm-session-enum-types.c: gdm-session-enum-types.c.in gdm-session.h
$(AM_V_GEN) glib-mkenums --template $^ > $@
gdm-display-glue.c gdm-display-glue.h: gdm-display.xml Makefile.am
$(AM_V_GEN)gdbus-codegen \
--c-namespace=GdmDBus \
--interface-prefix=org.gnome.DisplayManager \
--generate-c-code=gdm-display-glue \
$(srcdir)/gdm-display.xml
gdm-local-display-glue.c gdm-local-display-glue.h: gdm-local-display.xml Makefile.am
$(AM_V_GEN)gdbus-codegen \
--c-namespace=GdmDBus \
--interface-prefix=org.gnome.DisplayManager \
--generate-c-code=gdm-local-display-glue \
$(srcdir)/gdm-local-display.xml
gdm-local-display-factory-glue.c gdm-local-display-factory-glue.h : gdm-local-display-factory.xml Makefile.am
$(AM_V_GEN)gdbus-codegen \
--c-namespace=GdmDBus \
--interface-prefix=org.gnome.DisplayManager \
--generate-c-code=gdm-local-display-factory-glue \
$(srcdir)/gdm-local-display-factory.xml
gdm-manager-glue.c gdm-manager-glue.h : gdm-manager.xml Makefile.am
$(AM_V_GEN)gdbus-codegen \
--c-namespace=GdmDBus \
--interface-prefix=org.gnome.DisplayManager \
--generate-c-code=gdm-manager-glue \
$(srcdir)/gdm-manager.xml
gdm-session-glue.c gdm-session-glue.h : gdm-session.xml Makefile.am
$(AM_V_GEN)gdbus-codegen \
--c-namespace=GdmDBus \
--interface-prefix=org.gnome.DisplayManager \
--generate-c-code=gdm-session-glue \
$(srcdir)/gdm-session.xml
gdm-session-worker-glue.c gdm-session-worker-glue.h : gdm-session-worker.xml Makefile.am
$(AM_V_GEN)gdbus-codegen \
--c-namespace=GdmDBus \
--interface-prefix=org.gnome.DisplayManager \
--generate-c-code=gdm-session-worker-glue \
$(srcdir)/gdm-session-worker.xml
+com.redhat.AccountsServiceUser.System.c com.redhat.AccountsServiceUser.System.h: $(top_srcdir)/data/com.redhat.AccountsServiceUser.System.xml Makefile.am
+ $(AM_V_GEN)gdbus-codegen \
+ --c-namespace=Gdm \
+ --interface-prefix=com.redhat \
+ --generate-c-code=com.redhat.AccountsServiceUser.System \
+ $(top_srcdir)/data/com.redhat.AccountsServiceUser.System.xml
+
noinst_PROGRAMS = \
test-session-client \
$(NULL)
test_session_client_SOURCES = \
test-session-client.c \
$(NULL)
nodist_test_session_client_SOURCES = \
gdm-session-glue.h \
gdm-session-glue.c \
gdm-manager-glue.h \
gdm-manager-glue.c \
$(NULL)
test_session_client_LDADD = \
$(DAEMON_LIBS) \
$(NULL)
libexec_PROGRAMS = \
gdm-session-worker \
gdm-wayland-session \
gdm-x-session \
$(NULL)
gdm_session_worker_SOURCES = \
session-worker-main.c \
+ com.redhat.AccountsServiceUser.System.h \
+ com.redhat.AccountsServiceUser.System.c \
gdm-session.c \
gdm-session.h \
gdm-session-settings.h \
gdm-session-settings.c \
gdm-session-auditor.h \
gdm-session-auditor.c \
gdm-session-record.c \
gdm-session-record.h \
gdm-session-worker.h \
gdm-session-worker.c \
gdm-session-worker-job.c \
gdm-session-worker-common.c \
gdm-session-worker-common.h \
gdm-dbus-util.c \
gdm-dbus-util.h \
$(NULL)
if SUPPORTS_PAM_EXTENSIONS
gdm_session_worker_SOURCES += $(top_srcdir)/pam-extensions/gdm-pam-extensions.h
endif
nodist_gdm_session_worker_SOURCES = \
gdm-session-glue.h \
gdm-session-glue.c \
gdm-session-worker-glue.c \
gdm-session-worker-glue.h \
gdm-session-enum-types.c \
gdm-session-enum-types.h \
$(NULL)
diff --git a/daemon/gdm-session-settings.c b/daemon/gdm-session-settings.c
index 8463fad32..921e4d501 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 (GdmSessionSettings, gdm_session_settings, G_TYPE_OBJECT)
static void
gdm_session_settings_class_init (GdmSessionSettingsClass *settings_class)
@@ -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_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/data/Makefile.am b/data/Makefile.am
index 192dfa052..d69021985 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -8,60 +8,62 @@ SUBDIRS = \
$(NULL)
initdir = $(gdmconfdir)/Init
postdir = $(gdmconfdir)/PostSession
predir = $(gdmconfdir)/PreSession
postlogindir = $(gdmconfdir)/PostLogin
workingdir = $(GDM_WORKING_DIR)
xauthdir = $(GDM_XAUTH_DIR)
screenshotdir = $(GDM_SCREENSHOT_DIR)
cachedir = $(localstatedir)/cache/gdm
Init: $(srcdir)/Init.in
sed -e 's,[@]X_PATH[@],$(X_PATH),g' \
<$(srcdir)/Init.in >Init
PreSession: $(srcdir)/PreSession.in
sed -e 's,[@]X_PATH[@],$(X_PATH),g' \
<$(srcdir)/PreSession.in >PreSession
PostSession: $(srcdir)/PostSession.in
sed -e 's,[@]X_PATH[@],$(X_PATH),g' \
<$(srcdir)/PostSession.in >PostSession
gdm.conf-custom: $(srcdir)/gdm.conf-custom.in
sed -e 's,[@]GDM_DEFAULTS_CONF[@],$(GDM_DEFAULTS_CONF),g' \
<$(srcdir)/gdm.conf-custom.in >gdm.conf-custom
dbusconfdir = $(DBUS_SYS_DIR)
dbusconf_in_files = gdm.conf.in
dbusconf_DATA = $(dbusconf_in_files:.conf.in=.conf)
+EXTRA_DIST += com.redhat.AccountsServiceUser.System.xml
+
@INTLTOOL_SCHEMAS_RULE@
@INTLTOOL_XML_NOMERGE_RULE@
# dconf database and profile
dconf_db_files = \
dconf/defaults/00-upstream-settings \
dconf/defaults/locks/00-upstream-settings-locks
dconfdbdir = $(pkgdatadir)
dconfdb_DATA = greeter-dconf-defaults
greeter-dconf-defaults: $(dconf_db_files)
$(AM_V_GEN) dconf compile $@ $(srcdir)/dconf/defaults
dconfprofiledir = $(DATADIR)/dconf/profile
dconfprofile_DATA = dconf/gdm
gsettings_SCHEMAS = org.gnome.login-screen.gschema.xml
@GSETTINGS_RULES@
schemasdir = $(pkgdatadir)
schemas_in_files = gdm.schemas.in
schemas_DATA = $(schemas_in_files:.schemas.in=.schemas)
gdm.schemas.in: $(srcdir)/gdm.schemas.in.in
sed -e 's,[@]GDMPREFETCHCMD[@],$(GDMPREFETCHCMD),g' \
-e 's,[@]GDM_CUSTOM_CONF[@],$(GDM_CUSTOM_CONF),g' \
-e 's,[@]GDM_USER_PATH[@],$(GDM_USER_PATH),g' \
-e 's,[@]GDM_USERNAME[@],$(GDM_USERNAME),g' \
-e 's,[@]GDM_GROUPNAME[@],$(GDM_GROUPNAME),g' \
-e 's,[@]HALT_COMMAND[@],$(HALT_COMMAND),g' \
diff --git a/data/com.redhat.AccountsServiceUser.System.xml b/data/com.redhat.AccountsServiceUser.System.xml
new file mode 100644
index 000000000..67f5f302c
--- /dev/null
+++ b/data/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>
--
2.17.1

View File

@ -0,0 +1,138 @@
From c673a7dd781da5ae0d64e13eb83c17e130231931 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/4] 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 921e4d501..0ce2e7de2 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.17.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

View File

@ -0,0 +1,22 @@
From 29d374ce6781df6f3b168a8c57163ddb582c998a 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 4d8bf174..9694078f 100644
--- a/data/dconf/gdm.in
+++ b/data/dconf/gdm.in
@@ -1,2 +1,5 @@
user-db:user
+system-db:local
+system-db:site
+system-db:distro
file-db:@DATADIR@/@PACKAGE@/greeter-dconf-defaults
--
2.11.1

3145
SPECS/gdm.spec Normal file

File diff suppressed because it is too large Load Diff