diff options
author | Neel Chauhan <nc@FreeBSD.org> | 2022-01-28 22:51:56 +0000 |
---|---|---|
committer | Neel Chauhan <nc@FreeBSD.org> | 2022-01-31 21:06:19 +0000 |
commit | a69eab30db5aa908c31f17217000bd16a44b2496 (patch) | |
tree | 03e4995b5bec985fc81f946616fb7373fa3e5751 /x11/gdm | |
parent | e3d90bd7b88a0470f53b880dee7914433eb0ba99 (diff) | |
download | ports-a69eab30db5aa908c31f17217000bd16a44b2496.tar.gz ports-a69eab30db5aa908c31f17217000bd16a44b2496.zip |
Diffstat (limited to 'x11/gdm')
54 files changed, 1558 insertions, 2914 deletions
diff --git a/x11/gdm/Makefile b/x11/gdm/Makefile index 58603bb0d607..95758917e2e8 100644 --- a/x11/gdm/Makefile +++ b/x11/gdm/Makefile @@ -1,10 +1,9 @@ # Created by: Joe Marcus Clarke <marcus@FreeBSD.org> PORTNAME= gdm -PORTVERSION= 3.28.4 -PORTREVISION= 6 +PORTVERSION= 41.3 CATEGORIES= x11 gnome -MASTER_SITES= GNOME +MASTER_SITES= GNOME/sources/${PORTNAME}/${PORTVERSION:C/^([0-9]+)\..*/\1/} DIST_SUBDIR= gnome MAINTAINER= gnome@FreeBSD.org @@ -13,28 +12,28 @@ COMMENT= GNOME 3 display manager LICENSE= GPLv2 LICENSE_FILE= ${WRKSRC}/COPYING -BUILD_DEPENDS= zenity>=3.0.0:x11/zenity \ +BUILD_DEPENDS= iso-codes>=0:misc/iso-codes \ itstool:textproc/itstool \ - iso-codes>=0:misc/iso-codes -LIB_DEPENDS= libck-connector.so:sysutils/consolekit2 \ - libaccountsservice.so:sysutils/accountsservice \ - libfribidi.so:converters/fribidi \ + zenity>=3.0.0:x11/zenity +LIB_DEPENDS= libaccountsservice.so:sysutils/accountsservice \ + libcanberra-gtk3.so:audio/libcanberra-gtk3 \ libcanberra.so:audio/libcanberra \ - libcanberra-gtk3.so:audio/libcanberra-gtk3 -RUN_DEPENDS= zenity>=3.0.0:x11/zenity \ - gnome-settings-daemon>=3.0.0:sysutils/gnome-settings-daemon \ + libck-connector.so:sysutils/consolekit2 \ + libfribidi.so:converters/fribidi +RUN_DEPENDS= at-spi2-core>=0:accessibility/at-spi2-core \ + gnome-icon-theme-symbolic>=0:x11-themes/gnome-icon-theme-symbolic \ gnome-keyring-3:security/gnome-keyring \ gnome-session>=3.0.0:x11/gnome-session \ - gnome-icon-theme-symbolic>=0:x11-themes/gnome-icon-theme-symbolic \ + gnome-settings-daemon>=3.0.0:sysutils/gnome-settings-daemon \ + iso-codes>=0:misc/iso-codes \ polkit-gnome>=0.105:sysutils/polkit-gnome \ - at-spi2-core>=0:accessibility/at-spi2-core \ - iso-codes>=0:misc/iso-codes + zenity>=3.0.0:x11/zenity # used in scripts -RUN_DEPENDS+= xrdb:x11/xrdb \ - setxkbmap:x11/setxkbmap \ - xsetroot:x11/xsetroot \ +RUN_DEPENDS+= setxkbmap:x11/setxkbmap \ xhost:x11/xhost \ xmodmap:x11/xmodmap \ + xrdb:x11/xrdb \ + xsetroot:x11/xsetroot \ xterm:x11/xterm USERS= gdm @@ -42,7 +41,8 @@ GROUPS= gdm video PORTSCOUT= limitw:1,even -USES= cpe gettext gmake gnome libtool localbase:ldflags pathfix pkgconfig tar:xz xorg +USES= cpe gettext gnome libtool localbase:ldflags meson pathfix \ + pkgconfig tar:xz xorg CPE_VENDOR= gnome CPE_PRODUCT= gnome_display_manager USE_GNOME= cairo dconf gtk30 intltool introspection @@ -50,43 +50,35 @@ USE_LDCONFIG= yes USE_XORG= x11 xau xcb xdmcp xorgproto USE_RC_SUBR= gdm USE_GNOME_SUBR= yes -GNU_CONFIGURE= yes GLIB_SCHEMAS= org.gnome.login-screen.gschema.xml -CONFIGURE_ARGS= --disable-static \ - --mandir=${PREFIX}/man \ - --with-lang-file=${PREFIX}/etc/gdm/locale.conf \ - --with-at-spi-registryd-directory=${LOCALBASE}/libexec \ - --with-custom-conf=${PREFIX}/etc/gdm/custom.conf \ - --with-dbus-sys=${PREFIX}/etc/dbus-1/system.d \ - --with-log-dir=/var/log/gdm \ - --localstatedir=/var \ - --without-selinux \ - --without-libaudit \ - --with-console-kit \ - --with-working-directory=${PREFIX}/etc/gdm/home \ - --with-sysconfsubdir=gdm \ - --with-pid-file=/var/run/gdm.pid \ - --with-dmconfdir=${LOCALBASE}/share/xsessions \ - --with-screenshot-dir=/var/run/gdm/greeter \ - --enable-authentication-scheme=pam \ - --without-plymouth \ - --without-systemd \ - --with-user=gdm \ - --with-group=gdm \ - --with-initial-vt=09 \ - --enable-gdm-xsession \ - --disable-wayland-support \ - --with-systemd=no +MESON_ARGS= -Dat-spi-registryd-dir=${PREFIX}/libexec \ + -Dcustom-conf=${PREFIX}/etc/gdm/custom.conf \ + -Ddbus-sys=${PREFIX}/etc/dbus-1/system.d \ + -Ddefault-pam-config=none \ + -Ddmconfdir=${PREFIX}/share/xsessions \ + -Dgdm-xsession=true \ + -Dgroup=gdm \ + -Dinitial-vt=05 \ + -Dlang-file=${PREFIX}/etc/gdm/locale.conf \ + -Dlibaudit=disabled \ + -Dlog-dir=/var/log/gdm \ + -Dpid-file=/var/run/gdm.pid \ + -Dplymouth=disabled \ + -Dscreenshot-dir=/var/run/gdm/greeter \ + -Dselinux=disabled \ + -Dsysconfsubdir=gdm \ + -Dsystemd-journal=false \ + -Duser-display-server=false \ + -Duser=gdm \ + -Dwayland-support=false \ + -Dworking-dir=/var/db/gdm \ + -Dxauth-dir=/var/run/gdm # this is a hack until we can get our own pam dir and dir in order. -CONFIGURE_ARGS+=--with-default-pam-config=redhat -CPPFLAGS+= -DHAS_SA_LEN +CPPFLAGS+= -DHAS_SA_LEN -DWITH_CONSOLE_KIT=1 INSTALL_TARGET= install-strip -SUB_FILES+= gdm-launch-environment \ - gdm-password \ - gdm-autologin \ - client.conf \ +SUB_FILES+= client.conf gdm-autologin gdm-launch-environment gdm-password \ locale.conf GDMDIR?= ${PREFIX}/etc/gdm @@ -95,17 +87,11 @@ GNOME_LOCALSTATEDIR= /var OPTIONS_DEFINE= IPV6 -IPV6_CONFIGURE_ENABLE= ipv6 +IPV6_MESON_ENABLE= ipv6 .include <bsd.port.options.mk> -.if defined(WITH_DEBUG) -CONFIGURE_ARGS+= --enable-debug -.endif - post-patch: - @${REINPLACE_CMD} -e 's|root:root|root:wheel|g' \ - ${WRKSRC}/data/Makefile.in @${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|g' \ -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \ -e 's|/bin/bash|/bin/sh|g' \ @@ -113,7 +99,7 @@ post-patch: @${REINPLACE_CMD} -e 's|/usr/X11R6|${LOCALBASE}|g' \ -e 's|/usr/bin/X|${LOCALBASE}/bin/X|g' \ -e 's|/usr/bin/Xorg|${LOCALBASE}/bin/Xorg|g' \ - ${WRKSRC}/configure ${WRKSRC}/daemon/*.c ${WRKSRC}/po/*.po + ${WRKSRC}/meson.build ${WRKSRC}/daemon/*.c ${WRKSRC}/po/*.po @${REINPLACE_CMD} -e 's|/at-spi-registryd|/at-spi2-registryd|g' \ ${WRKSRC}/chooser/gdm-host-chooser.c \ ${WRKSRC}/chooser/chooser-main.c @@ -128,9 +114,8 @@ post-patch: ${WRKSRC}/data/applications/gnome-shell.desktop \ post-install: - ${INSTALL_DATA} ${WRKSRC}/data/gdm.conf-custom \ + ${MV} ${STAGEDIR}${PREFIX}/etc/gdm/custom.conf \ ${STAGEDIR}${PREFIX}/etc/gdm/custom.conf.sample - @${RM} ${STAGEDIR}${PREFIX}/etc/gdm/custom.conf ${MV} ${STAGEDIR}${PREFIX}/etc/gdm/PostSession/Default \ ${STAGEDIR}${PREFIX}/etc/gdm/PostSession/Default.sample ${MV} ${STAGEDIR}${PREFIX}/etc/gdm/PreSession/Default \ @@ -162,6 +147,11 @@ post-install: ${INSTALL_DATA} ${WRKDIR}/locale.conf \ ${STAGEDIR}${PREFIX}/etc/gdm/locale.conf.sample + ${MKDIR} ${STAGEDIR}/var/cache/gdm + ${MKDIR} ${STAGEDIR}/var/log/gdm + ${MKDIR} ${STAGEDIR}/var/run/gdm + ${MKDIR} ${STAGEDIR}/var/run/gdm/greeter + @${RM} ${STAGEDIR}${PREFIX}/lib/udev/rules.d/61-gdm.rules @${RMDIR} ${STAGEDIR}${PREFIX}/lib/udev/rules.d @${RMDIR} ${STAGEDIR}${PREFIX}/lib/udev diff --git a/x11/gdm/distinfo b/x11/gdm/distinfo index 4b458637a880..01635d103c86 100644 --- a/x11/gdm/distinfo +++ b/x11/gdm/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1538669234 -SHA256 (gnome/gdm-3.28.4.tar.xz) = 799f524278eb1a663c1d693589878c12ce8fad2293a66ef336e9626e1f933a3b -SIZE (gnome/gdm-3.28.4.tar.xz) = 1133508 +TIMESTAMP = 1643405191 +SHA256 (gnome/gdm-41.3.tar.xz) = bb0b650a7cea90f09a33284fbd02975315407efc18e814009852d1bcad3437d4 +SIZE (gnome/gdm-41.3.tar.xz) = 807452 diff --git a/x11/gdm/files/gdm-launch-environment.in b/x11/gdm/files/gdm-launch-environment.in index f2de8abe8311..506f08d89ffb 100644 --- a/x11/gdm/files/gdm-launch-environment.in +++ b/x11/gdm/files/gdm-launch-environment.in @@ -1,12 +1,11 @@ -# $OpenBSD: gdm-launch-environment,v 1.3 2012/10/10 08:47:14 ajacoutot Exp $ +# $OpenBSD: gdm-launch-environment,v 1.5 2016/04/26 08:59:48 ajacoutot Exp $ # # gdm-launch-environment settings for pam(3) auth required pam_permit.so -account required pam_nologin.so -account include system +account required pam_permit.so -password include system +password required pam_permit.so session include system diff --git a/x11/gdm/files/gdm-password.in b/x11/gdm/files/gdm-password.in index f0ac0cfe9eb3..01ca683c7967 100644 --- a/x11/gdm/files/gdm-password.in +++ b/x11/gdm/files/gdm-password.in @@ -3,8 +3,6 @@ # gdm-password settings for pam(3) auth include system -auth optional %%LOCALBASE%%/lib/pam_ck_connector.so -auth optional %%LOCALBASE%%/lib/pam_gnome_keyring.so account required pam_nologin.so account include system @@ -12,4 +10,3 @@ account include system password include system session include system -session optional %%LOCALBASE%%/lib/pam_gnome_keyring.so auto_start diff --git a/x11/gdm/files/patch-Makefile.in b/x11/gdm/files/patch-Makefile.in deleted file mode 100644 index 1589e0c8ed27..000000000000 --- a/x11/gdm/files/patch-Makefile.in +++ /dev/null @@ -1,20 +0,0 @@ ---- Makefile.in.orig 2018-01-14 11:27:57.277621000 +0100 -+++ Makefile.in 2018-01-14 11:28:53.422079000 +0100 -@@ -162,7 +162,7 @@ - ETAGS = etags - CTAGS = ctags - CSCOPE = cscope --DIST_SUBDIRS = data common pam-extensions daemon libgdm utils pam_gdm \ -+DIST_SUBDIRS = data common pam-extensions daemon libgdm utils \ - po tests chooser docs - am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ - $(top_srcdir)/data/dconf/gdm.in AUTHORS COPYING ChangeLog \ -@@ -472,7 +472,7 @@ - top_builddir = @top_builddir@ - top_srcdir = @top_srcdir@ - NULL = --SUBDIRS = data common pam-extensions daemon libgdm utils pam_gdm po \ -+SUBDIRS = data common pam-extensions daemon libgdm utils po \ - tests $(NULL) $(am__append_1) $(am__append_2) - ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} - EXTRA_DIST = \ diff --git a/x11/gdm/files/patch-common_Makefile.in b/x11/gdm/files/patch-common_Makefile.in deleted file mode 100644 index 87f2cc911408..000000000000 --- a/x11/gdm/files/patch-common_Makefile.in +++ /dev/null @@ -1,10 +0,0 @@ ---- common/Makefile.in.orig 2014-03-21 08:15:10.657611891 +0000 -+++ common/Makefile.in 2014-03-21 08:17:08.641605278 +0000 -@@ -548,6 +548,7 @@ - $(NULL) - - libgdmcommon_la_LIBADD = \ -+ -lexecinfo \ - $(SYSTEMD_LIBS) \ - $(NULL) - diff --git a/x11/gdm/files/patch-common_gdm-address.c b/x11/gdm/files/patch-common_gdm-address.c deleted file mode 100644 index 9a4e620ba8d3..000000000000 --- a/x11/gdm/files/patch-common_gdm-address.c +++ /dev/null @@ -1,27 +0,0 @@ ---- common/gdm-address.c.orig 2010-01-13 17:32:59.000000000 +0000 -+++ common/gdm-address.c 2010-01-17 12:55:48.000000000 +0000 -@@ -29,6 +29,8 @@ - #include <stropts.h> - #endif - #include <string.h> -+#include <sys/types.h> -+#include <sys/param.h> - #ifdef HAVE_SYS_SOCKET_H - #include <sys/socket.h> - #endif -@@ -37,7 +39,6 @@ - #endif - #include <netdb.h> - #include <sys/ioctl.h> --#include <net/if.h> - - #ifndef G_OS_WIN32 - #include <sys/select.h> -@@ -47,6 +48,7 @@ - #include <winsock2.h> - #include <ws2tcpip.h> - #endif -+#include <net/if.h> - - #include <glib-object.h> - diff --git a/x11/gdm/files/patch-common_gdm-common.c b/x11/gdm/files/patch-common_gdm-common.c index 567c0853796e..cb4900ae4994 100644 --- a/x11/gdm/files/patch-common_gdm-common.c +++ b/x11/gdm/files/patch-common_gdm-common.c @@ -1,22 +1,8 @@ -$OpenBSD: patch-common_gdm-common_c,v 1.4 2015/10/18 13:25:54 ajacoutot Exp $ - -REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) -From 9be58c9ec9a3a411492a5182ac4b0d51fdc3a323 Mon Sep 17 00:00:00 2001 -From: Ray Strode <rstrode@redhat.com> -Date: Fri, 12 Jun 2015 13:48:52 -0400 -Subject: require logind support - -REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) -From 1ac67f522f5690c27023d98096ca817f12f7eb88 Mon Sep 17 00:00:00 2001 -From: Ray Strode <rstrode@redhat.com> -Date: Fri, 12 Jun 2015 13:28:01 -0400 -Subject: drop consolekit support - ---- common/gdm-common.c.orig Sun Oct 18 14:26:27 2015 -+++ common/gdm-common.c Sun Oct 18 14:24:34 2015 -@@ -39,12 +39,25 @@ - #include "mkdtemp.h" - #endif +--- common/gdm-common.c.orig 2022-01-12 14:15:56 UTC ++++ common/gdm-common.c +@@ -36,7 +36,9 @@ + + #include "gdm-common.h" +#ifdef WITH_SYSTEMD #include <systemd/sd-login.h> @@ -24,390 +10,485 @@ Subject: drop consolekit support #define GDM_DBUS_NAME "org.gnome.DisplayManager" #define GDM_DBUS_LOCAL_DISPLAY_FACTORY_PATH "/org/gnome/DisplayManager/LocalDisplayFactory" - #define GDM_DBUS_LOCAL_DISPLAY_FACTORY_INTERFACE "org.gnome.DisplayManager.LocalDisplayFactory" - -+#ifdef WITH_CONSOLE_KIT -+#define CK_NAME "org.freedesktop.ConsoleKit" -+#define CK_PATH "/org/freedesktop/ConsoleKit" -+#define CK_INTERFACE "org.freedesktop.ConsoleKit" -+ -+#define CK_MANAGER_PATH "/org/freedesktop/ConsoleKit/Manager" -+#define CK_MANAGER_INTERFACE "org.freedesktop.ConsoleKit.Manager" -+#define CK_SEAT_INTERFACE "org.freedesktop.ConsoleKit.Seat" -+#define CK_SESSION_INTERFACE "org.freedesktop.ConsoleKit.Session" -+#endif -+ - G_DEFINE_QUARK (gdm-common-error, gdm_common_error); - - const char * -@@ -343,15 +356,306 @@ create_transient_display (GDBusConnection *connection, +@@ -352,6 +354,412 @@ create_transient_display (GDBusConnection *connection, return TRUE; } +#ifdef WITH_CONSOLE_KIT ++int ++sd_seat_can_graphical(const char *seat) ++{ ++ // XXX ++ return 1; ++} + - static gboolean --activate_session_id (GDBusConnection *connection, -- const char *seat_id, -- const char *session_id) -+get_current_session_id (GDBusConnection *connection, -+ char **session_id) - { - GError *local_error = NULL; - GVariant *reply; - - reply = g_dbus_connection_call_sync (connection, ++int ++sd_session_get_service(const char *session, ++ char **service) ++{ ++ GError *local_error = NULL; ++ GVariant *reply; ++ const char *value; ++ g_autoptr(GDBusConnection) connection = NULL; ++ ++ if (session == NULL || !g_variant_is_object_path (session)) ++ return -ENXIO; ++ ++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error); ++ if (connection == NULL) { ++ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message); ++ return -ENXIO; ++ } ++ ++ reply = g_dbus_connection_call_sync (connection, + CK_NAME, -+ CK_MANAGER_PATH, -+ CK_MANAGER_INTERFACE, -+ "GetCurrentSession", -+ NULL, /* parameters */ -+ G_VARIANT_TYPE ("(o)"), ++ session, ++ CK_SESSION_INTERFACE, ++ "GetSessionService", ++ NULL, ++ G_VARIANT_TYPE ("(s)"), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, &local_error); + if (reply == NULL) { -+ g_warning ("Unable to determine session: %s", local_error->message); ++ g_warning ("Unable to determine session service: %s", local_error ? local_error->message : ""); + g_error_free (local_error); -+ return FALSE; ++ return -ENXIO; + } + -+ g_variant_get (reply, "(o)", session_id); ++ g_variant_get (reply, "(s)", &value); + g_variant_unref (reply); + -+ return TRUE; ++ *service = g_strdup (value); ++ ++ return 0; +} + -+static gboolean -+get_seat_id_for_session (GDBusConnection *connection, -+ const char *session_id, -+ char **seat_id) ++int ++sd_session_get_uid(const char *session, ++ uid_t *uid) +{ + GError *local_error = NULL; + GVariant *reply; ++ g_autoptr(GDBusConnection) connection = NULL; ++ uid_t local_uid; ++ ++ if (session == NULL || !g_variant_is_object_path (session)) ++ return -ENXIO; ++ ++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error); ++ if (connection == NULL) { ++ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message); ++ return -ENXIO; ++ } + + reply = g_dbus_connection_call_sync (connection, + CK_NAME, -+ session_id, ++ session, + CK_SESSION_INTERFACE, -+ "GetSeatId", -+ NULL, /* parameters */ -+ G_VARIANT_TYPE ("(o)"), ++ "GetUnixUser", ++ NULL, ++ G_VARIANT_TYPE ("(u)"), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, &local_error); + if (reply == NULL) { -+ g_warning ("Unable to determine seat: %s", local_error->message); ++ g_warning ("Unable to get session for unix service: %s", local_error ? local_error->message : ""); + g_error_free (local_error); -+ return FALSE; ++ return -ENXIO; + } + -+ g_variant_get (reply, "(o)", seat_id); ++ g_variant_get (reply, "(u)", &local_uid); + g_variant_unref (reply); + -+ return TRUE; -+} -+ -+static char * -+get_current_seat_id (GDBusConnection *connection) -+{ -+ gboolean res; -+ char *session_id; -+ char *seat_id; ++ *uid = local_uid; + -+ session_id = NULL; -+ seat_id = NULL; -+ -+ res = get_current_session_id (connection, &session_id); -+ if (res) { -+ res = get_seat_id_for_session (connection, session_id, &seat_id); -+ } -+ g_free (session_id); -+ -+ return seat_id; ++ return 0; +} + -+static gboolean -+activate_session_id_for_ck (GDBusConnection *connection, -+ const char *seat_id, -+ const char *session_id) ++int ++sd_seat_get_sessions(const char *seat, ++ char ***sessions, ++ uid_t **uid, ++ unsigned int *n_uids) +{ + GError *local_error = NULL; + GVariant *reply; ++ GVariantIter *iter; ++ gchar *value = NULL; ++ glong nchild; ++ g_autoptr(GDBusConnection) connection = NULL; ++ ++ if (seat == NULL || !g_variant_is_object_path (seat)) ++ return -ENXIO; ++ ++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error); ++ if (connection == NULL) { ++ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message); ++ return -ENXIO; ++ } + + reply = g_dbus_connection_call_sync (connection, + CK_NAME, -+ seat_id, ++ seat, + CK_SEAT_INTERFACE, -+ "ActivateSession", -+ g_variant_new ("(o)", session_id), ++ "GetSessions", + NULL, ++ G_VARIANT_TYPE ("(ao)"), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, &local_error); + if (reply == NULL) { -+ g_warning ("Unable to activate session: %s", local_error->message); ++ g_warning ("Unable to list sessions: %s", local_error->message); + g_error_free (local_error); -+ return FALSE; ++ return -ENXIO; + } + ++ g_variant_get (reply, "(ao)", &iter); + g_variant_unref (reply); + -+ return TRUE; ++ nchild = g_variant_iter_n_children(iter); ++ *sessions = calloc(nchild, sizeof(gchar *)); ++ if (*sessions == NULL) { ++ g_warning ("Unable to allocate memory for sessions array: %s", g_strerror(errno)); ++ return -ENOMEM; ++ } ++ ++ while (g_variant_iter_next (iter, "o", &value)) { ++ (*sessions)[nchild - 1] = g_strdup(value); ++ } ++ (*sessions)[nchild] = NULL; ++ ++ g_variant_iter_free (iter); ++ ++ return 0; +} + -+static gboolean -+session_is_login_window (GDBusConnection *connection, -+ const char *session_id) ++int ++sd_session_get_seat(const char *session, ++ char **seat) +{ + GError *local_error = NULL; + GVariant *reply; + const char *value; -+ gboolean ret; ++ g_autoptr(GDBusConnection) connection = NULL; ++ ++ if (session == NULL || !g_variant_is_object_path (session)) ++ return -ENXIO; ++ ++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error); ++ if (connection == NULL) { ++ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message); ++ return -ENXIO; ++ } + + reply = g_dbus_connection_call_sync (connection, + CK_NAME, -+ session_id, ++ session, + CK_SESSION_INTERFACE, -+ "GetSessionType", -+ NULL, -+ G_VARIANT_TYPE ("(s)"), ++ "GetSeatId", ++ NULL, /* parameters */ ++ G_VARIANT_TYPE ("(o)"), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, &local_error); + if (reply == NULL) { -+ g_warning ("Unable to determine session type: %s", local_error->message); ++ g_warning ("Unable to determine seat: %s", local_error ? local_error->message : ""); + g_error_free (local_error); -+ return FALSE; -+ } -+ -+ g_variant_get (reply, "(&s)", &value); -+ -+ if (value == NULL || value[0] == '\0' || strcmp (value, "LoginWindow") != 0) { -+ ret = FALSE; -+ } else { -+ ret = TRUE; ++ return -ENXIO; + } + ++ g_variant_get (reply, "(o)", &value); + g_variant_unref (reply); + -+ return ret; ++ *seat = g_strdup(value); ++ ++ return 0; +} + -+static gboolean -+seat_can_activate_sessions (GDBusConnection *connection, -+ const char *seat_id) ++int ++sd_pid_get_session(pid_t pid, char **session) +{ + GError *local_error = NULL; + GVariant *reply; -+ gboolean ret; ++ const char *value; ++ g_autoptr(GDBusConnection) connection = NULL; ++ ++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error); ++ if (connection == NULL) { ++ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message); ++ return -ENXIO; ++ } + + reply = g_dbus_connection_call_sync (connection, + CK_NAME, -+ seat_id, -+ CK_SEAT_INTERFACE, -+ "CanActivateSessions", -+ NULL, -+ G_VARIANT_TYPE ("(b)"), ++ CK_MANAGER_PATH, ++ CK_MANAGER_INTERFACE, ++ "GetSessionForUnixProcess", ++ g_variant_new ("(u)", pid), ++ G_VARIANT_TYPE ("(o)"), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, &local_error); + if (reply == NULL) { -+ g_warning ("Unable to determine if can activate sessions: %s", local_error->message); ++ g_warning ("Unable to list sessions: %s", local_error ? local_error->message : ""); + g_error_free (local_error); -+ return FALSE; ++ return -ENXIO; + } + -+ g_variant_get (reply, "(b)", &ret); ++ g_variant_get (reply, "(o)", &value); + g_variant_unref (reply); + -+ return ret; ++ *session = g_strdup (value); ++ ++ return 0; +} + -+static const char ** -+seat_get_sessions (GDBusConnection *connection, -+ const char *seat_id) ++int ++sd_session_get_type(const char *session, char **type) +{ + GError *local_error = NULL; + GVariant *reply; -+ const char **value; ++ const char *value; ++ g_autoptr(GDBusConnection) connection = NULL; ++ ++ if (session == NULL || !g_variant_is_object_path (session)) ++ return -ENXIO; ++ ++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error); ++ if (connection == NULL) { ++ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message); ++ return -ENXIO; ++ } + + reply = g_dbus_connection_call_sync (connection, + CK_NAME, -+ seat_id, -+ CK_SEAT_INTERFACE, -+ "GetSessions", ++ session, ++ CK_SESSION_INTERFACE, ++ "GetSessionType", + NULL, -+ G_VARIANT_TYPE ("(ao)"), ++ G_VARIANT_TYPE ("(s)"), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, &local_error); + if (reply == NULL) { -+ g_warning ("Unable to list sessions: %s", local_error->message); ++ g_warning ("Unable to determine session type: %s", local_error ? local_error->message : ""); + g_error_free (local_error); -+ return FALSE; ++ return -ENXIO; + } + -+ g_variant_get (reply, "(^ao)", &value); ++ g_variant_get (reply, "(s)", &value); + g_variant_unref (reply); + -+ return value; ++ *type = g_strdup (value); ++ ++ return 0; +} + -+static gboolean -+get_login_window_session_id_for_ck (GDBusConnection *connection, -+ const char *seat_id, -+ char **session_id) ++int ++sd_session_get_class(const char *session, char **class) +{ -+ gboolean can_activate_sessions; -+ const char **sessions; -+ int i; -+ -+ *session_id = NULL; -+ sessions = NULL; ++ GError *local_error = NULL; ++ GVariant *reply; ++ const gchar *value; ++ g_autoptr(GDBusConnection) connection = NULL; + -+ g_debug ("checking if seat can activate sessions"); ++ if (session == NULL || !g_variant_is_object_path (session)) ++ return -ENXIO; + -+ can_activate_sessions = seat_can_activate_sessions (connection, seat_id); -+ if (! can_activate_sessions) { -+ g_debug ("seat is unable to activate sessions"); -+ return FALSE; ++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error); ++ if (connection == NULL) { ++ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message); ++ return -ENXIO; + } + -+ sessions = seat_get_sessions (connection, seat_id); -+ for (i = 0; sessions [i] != NULL; i++) { -+ const char *ssid; ++ reply = g_dbus_connection_call_sync (connection, ++ CK_NAME, ++ session, ++ CK_SESSION_INTERFACE, ++ "GetSessionClass", ++ NULL, ++ G_VARIANT_TYPE ("(s)"), ++ G_DBUS_CALL_FLAGS_NONE, ++ -1, ++ NULL, &local_error); ++ if (reply == NULL) { ++ g_warning ("Unable to determine session class: %s", local_error ? local_error->message : ""); ++ g_error_free (local_error); ++ return -ENXIO; ++ } + -+ ssid = sessions [i]; ++ g_variant_get (reply, "(s)", &value); ++ g_variant_unref (reply); + -+ if (session_is_login_window (connection, ssid)) { -+ *session_id = g_strdup (ssid); -+ break; -+ } -+ } -+ g_free (sessions); ++ *class = g_strdup(value); + -+ return TRUE; ++ return 0; +} + -+static gboolean -+goto_login_session_for_ck (GDBusConnection *connection, -+ GError **error) ++int ++sd_session_get_state(const char *session, char **state) +{ -+ gboolean ret; -+ gboolean res; -+ char *session_id; -+ char *seat_id; ++ GError *local_error = NULL; ++ GVariant *reply; ++ const char *value; ++ g_autoptr(GDBusConnection) connection = NULL; + -+ ret = FALSE; ++ if (session == NULL || !g_variant_is_object_path (session)) ++ return -ENXIO; + -+ /* First look for any existing LoginWindow sessions on the seat. -+ If none are found, create a new one. */ ++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error); ++ if (connection == NULL) { ++ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message); ++ return -ENXIO; ++ } + -+ seat_id = get_current_seat_id (connection); -+ if (seat_id == NULL || seat_id[0] == '\0') { -+ g_debug ("seat id is not set; can't switch sessions"); -+ g_set_error (error, GDM_COMMON_ERROR, 0, _("Could not identify the current session.")); ++ reply = g_dbus_connection_call_sync (connection, ++ CK_NAME, ++ session, ++ CK_SESSION_INTERFACE, ++ "GetSessionState", ++ NULL, ++ G_VARIANT_TYPE ("(s)"), ++ G_DBUS_CALL_FLAGS_NONE, ++ -1, ++ NULL, &local_error); ++ if (reply == NULL) { ++ g_warning ("Unable to determine session state: %s", local_error ? local_error->message : ""); ++ g_error_free (local_error); ++ return -ENXIO; ++ } + -+ return FALSE; ++ g_variant_get (reply, "(s)", &value); ++ g_variant_unref (reply); ++ ++ *state = g_strdup (value); ++ ++ return 0; ++} ++ ++int ++sd_uid_get_sessions(uid_t uid, int require_active, char ***sessions) ++{ ++ GError *local_error = NULL; ++ GVariant *reply; ++ GVariantIter *iter; ++ gchar *value = NULL; ++ glong nchild; ++ g_autoptr(GDBusConnection) connection = NULL; ++ ++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error); ++ if (connection == NULL) { ++ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message); ++ return -ENXIO; + } + -+ res = get_login_window_session_id_for_ck (connection, seat_id, &session_id); -+ if (! res) { -+ g_set_error (error, GDM_COMMON_ERROR, 1, _("User unable to switch sessions.")); -+ return FALSE; ++ reply = g_dbus_connection_call_sync (connection, ++ CK_NAME, ++ CK_MANAGER_PATH, ++ CK_MANAGER_INTERFACE, ++ "GetSessionsForUnixUser", ++ g_variant_new ("(u)", uid), ++ G_VARIANT_TYPE ("(ao)"), ++ G_DBUS_CALL_FLAGS_NONE, ++ -1, ++ NULL, &local_error); ++ if (reply == NULL) { ++ g_warning ("Unable to list sessions: %s", local_error ? local_error->message : ""); ++ g_error_free (local_error); ++ return -ENXIO; + } + -+ if (session_id != NULL) { -+ res = activate_session_id_for_ck (connection, seat_id, session_id); -+ if (res) { -+ ret = TRUE; -+ } ++ g_variant_get (reply, "(ao)", &iter); ++ g_variant_unref (reply); ++ ++ nchild = g_variant_iter_n_children(iter); ++ *sessions = calloc(nchild, sizeof(gchar *)); ++ if (*sessions == NULL) { ++ g_warning ("Unable to allocate memory for sessions array: %s", g_strerror(errno)); ++ return -ENOMEM; + } + -+ if (! ret && g_strcmp0 (seat_id, "/org/freedesktop/ConsoleKit/Seat1") == 0) { -+ res = create_transient_display (connection, error); -+ if (res) { -+ ret = TRUE; -+ } ++ while (g_variant_iter_next (iter, "o", &value)) { ++ (*sessions)[nchild - 1] = g_strdup(value); + } ++ (*sessions)[nchild] = NULL; + -+ return ret; ++ g_variant_iter_free (iter); ++ ++ return 0; +} +#endif + -+#ifdef WITH_SYSTEMD + gboolean + gdm_activate_session_by_id (GDBusConnection *connection, + const char *seat_id, +@@ -360,6 +768,7 @@ gdm_activate_session_by_id (GDBusConnection *connectio + GError *local_error = NULL; + GVariant *reply; + ++#if defined(WITH_SYSTEMD) + reply = g_dbus_connection_call_sync (connection, + "org.freedesktop.login1", + "/org/freedesktop/login1", +@@ -370,7 +779,41 @@ gdm_activate_session_by_id (GDBusConnection *connectio + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, &local_error); ++#elif defined(WITH_CONSOLE_KIT) ++ gboolean ret; + -+static gboolean -+activate_session_id_for_systemd (GDBusConnection *connection, -+ const char *seat_id, -+ const char *session_id) -+{ -+ GError *local_error = NULL; -+ GVariant *reply; ++ reply = g_dbus_connection_call_sync (connection, ++ CK_NAME, ++ seat_id, ++ CK_SEAT_INTERFACE, ++ "CanActivateSessions", ++ NULL, ++ G_VARIANT_TYPE ("(b)"), ++ G_DBUS_CALL_FLAGS_NONE, ++ -1, ++ NULL, &local_error); + if (reply == NULL) { ++ g_warning ("Unable to determine if can activate sessions: %s", local_error ? local_error->message : ""); ++ g_error_free (local_error); ++ return FALSE; ++ } ++ ++ g_variant_get (reply, "(b)", &ret); ++ if (ret != TRUE) ++ return ret; + + reply = g_dbus_connection_call_sync (connection, - "org.freedesktop.login1", - "/org/freedesktop/login1", - "org.freedesktop.login1.Manager", -@@ -373,8 +677,8 @@ activate_session_id (GDBusConnection *connection, - } - - static gboolean --get_login_window_session_id (const char *seat_id, -- char **session_id) -+get_login_window_session_id_for_systemd (const char *seat_id, -+ char **session_id) - { - gboolean ret; - int res, i; -@@ -442,8 +746,8 @@ out: - } - - static gboolean --goto_login_session (GDBusConnection *connection, -- GError **error) -+goto_login_session_for_systemd (GDBusConnection *connection, -+ GError **error) - { - gboolean ret; - int res; -@@ -497,9 +801,9 @@ goto_login_session (GDBusConnection *connection, ++ CK_NAME, ++ seat_id, ++ CK_SEAT_INTERFACE, ++ "ActivateSession", ++ g_variant_new ("(o)", session_id), ++ NULL, ++ G_DBUS_CALL_FLAGS_NONE, ++ -1, ++ NULL, &local_error); ++#endif ++ if (reply == NULL) { + g_warning ("Unable to activate session: %s", local_error->message); + g_error_free (local_error); return FALSE; +@@ -521,7 +964,7 @@ goto_login_session (GDBusConnection *connection, + } } -- res = get_login_window_session_id (seat_id, &session_id); -+ res = get_login_window_session_id_for_systemd (seat_id, &session_id); - if (res && session_id != NULL) { -- res = activate_session_id (connection, seat_id, session_id); -+ res = activate_session_id_for_systemd (connection, seat_id, session_id); - +- if (! ret && g_strcmp0 (seat_id, "seat0") == 0) { ++ if (! ret && g_strcmp0 (seat_id, SEAT_ID) == 0) { + res = create_transient_display (connection, error); if (res) { ret = TRUE; -@@ -518,6 +822,7 @@ goto_login_session (GDBusConnection *connection, +@@ -907,7 +1350,9 @@ gdm_find_display_session (GPid pid, - return ret; - } + return TRUE; + } else { ++#ifdef ENODATA + if (res != -ENODATA) +#endif - - gboolean - gdm_goto_login_session (GError **error) -@@ -533,7 +838,17 @@ gdm_goto_login_session (GError **error) - return FALSE; + g_warning ("GdmCommon: Failed to retrieve session information for pid %d: %s", + pid, strerror (-res)); } - -- return goto_login_session (connection, error); -+#ifdef WITH_SYSTEMD -+ if (LOGIND_RUNNING()) { -+ return goto_login_session_for_systemd (connection, error); -+ } -+#endif -+ -+#ifdef WITH_CONSOLE_KIT -+ return goto_login_session_for_ck (connection, error); -+#else -+ return FALSE; -+#endif - } - - static void diff --git a/x11/gdm/files/patch-common_gdm-common.h b/x11/gdm/files/patch-common_gdm-common.h index bcc6ec09f739..cfd935a1119f 100644 --- a/x11/gdm/files/patch-common_gdm-common.h +++ b/x11/gdm/files/patch-common_gdm-common.h @@ -1,20 +1,53 @@ -$OpenBSD: patch-common_gdm-common_h,v 1.2 2016/04/15 14:11:09 ajacoutot Exp $ - -REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) -From 9be58c9ec9a3a411492a5182ac4b0d51fdc3a323 Mon Sep 17 00:00:00 2001 -From: Ray Strode <rstrode@redhat.com> -Date: Fri, 12 Jun 2015 13:48:52 -0400 -Subject: require logind support - ---- common/gdm-common.h.orig Thu Apr 14 07:27:26 2016 -+++ common/gdm-common.h Fri Apr 15 15:05:26 2016 -@@ -31,6 +31,9 @@ - expr; \ - } while G_UNLIKELY (errno == EINTR); +--- common/gdm-common.h.orig 2022-01-12 14:15:56 UTC ++++ common/gdm-common.h +@@ -29,6 +29,50 @@ -+/* check if logind is running */ -+#define LOGIND_RUNNING() (access("/run/systemd/seats/", F_OK) >= 0) -+ - GQuark gdm_common_error_quark (void); - #define GDM_COMMON_ERROR gdm_common_error_quark() + #define REGISTER_SESSION_TIMEOUT 10 ++#if defined(WITH_SYSTEMD) ++#define SEAT_ID "seat0" ++#elif defined(WITH_CONSOLE_KIT) ++#define CK_NAME "org.freedesktop.ConsoleKit" ++#define CK_PATH "/org/freedesktop/ConsoleKit" ++#define CK_INTERFACE "org.freedesktop.ConsoleKit" ++ ++#define CK_MANAGER_PATH "/org/freedesktop/ConsoleKit/Manager" ++#define CK_MANAGER_INTERFACE "org.freedesktop.ConsoleKit.Manager" ++#define CK_SEAT_INTERFACE "org.freedesktop.ConsoleKit.Seat" ++#define CK_SESSION_INTERFACE "org.freedesktop.ConsoleKit.Session" ++#define SEAT_ID "/org/freedesktop/ConsoleKit/Seat1" ++ ++int ++sd_pid_get_session(pid_t pid, char **session); ++ ++int ++sd_session_get_uid(const char *session, ++ uid_t *uid); ++ ++int ++sd_session_get_class(const char *session, char **class); ++ ++int ++sd_session_get_seat(const char *session, ++ char **seat); ++ ++int ++sd_seat_get_sessions(const char *seat, ++ char ***sessions, ++ uid_t **uid, ++ unsigned int *n_uids); ++ ++int ++sd_session_get_state(const char *session, char **state); ++ ++int ++sd_session_get_service(const char *session, ++ char **service); ++ ++int ++sd_seat_can_graphical(const char *seat); ++#endif ++ + #define VE_IGNORE_EINTR(expr) \ + do { \ + errno = 0; \ diff --git a/x11/gdm/files/patch-common_gdm-log.c b/x11/gdm/files/patch-common_gdm-log.c index be0bb062fe82..c3e7b623501f 100644 --- a/x11/gdm/files/patch-common_gdm-log.c +++ b/x11/gdm/files/patch-common_gdm-log.c @@ -1,13 +1,5 @@ -$OpenBSD: patch-common_gdm-log_c,v 1.1 2015/10/18 13:25:54 ajacoutot Exp $ - -REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) -From 9be58c9ec9a3a411492a5182ac4b0d51fdc3a323 Mon Sep 17 00:00:00 2001 -From: Ray Strode <rstrode@redhat.com> -Date: Fri, 12 Jun 2015 13:48:52 -0400 -Subject: require logind support - ---- common/gdm-log.c.orig 2018-02-19 19:16:32.000000000 +0100 -+++ common/gdm-log.c 2018-04-05 21:59:25.290775000 +0200 +--- common/gdm-log.c.orig 2022-01-12 14:15:56 UTC ++++ common/gdm-log.c @@ -30,7 +30,9 @@ #include <unistd.h> @@ -18,39 +10,24 @@ Subject: require logind support #include <glib.h> #include <glib/gstdio.h> -@@ -125,12 +127,35 @@ gdm_log_set_debug (gboolean debug) - void - gdm_log_init (void) - { -+ const char *prg_name; -+ int options; -+ - if (initialized) - return; - +@@ -131,6 +133,20 @@ gdm_log_init (void) initialized = TRUE; -+#ifdef WITH_SYSTEMD -+ is_sd_booted = sd_booted () > 0; -+#endif -+ g_log_set_default_handler (gdm_log_default_handler, NULL); + ++#ifndef WITH_SYSTEMD + /* Only set up syslog if !systemd, otherwise with systemd + * enabled, we keep the default GLib log handler which goes to + * stderr, which is routed to the appropriate place in the + * systemd service file. + */ -+ if (!is_sd_booted) { -+ prg_name = g_get_prgname (); -+ -+ options = LOG_PID; ++ const char *prg_name = g_get_prgname (); ++ int options = LOG_PID; +#ifdef LOG_PERROR -+ options |= LOG_PERROR; ++ options |= LOG_PERROR; ++#endif ++ openlog (prg_name, options, LOG_DAEMON); +#endif -+ -+ openlog (prg_name, options, LOG_DAEMON); -+ } } void diff --git a/x11/gdm/files/patch-config.h.in b/x11/gdm/files/patch-config.h.in deleted file mode 100644 index ff945d66ca43..000000000000 --- a/x11/gdm/files/patch-config.h.in +++ /dev/null @@ -1,69 +0,0 @@ ---- config.h.in.orig 2018-01-14 13:03:01.638908000 +0100 -+++ config.h.in 2018-01-14 13:03:20.000000000 +0100 -@@ -113,6 +113,9 @@ - /* Define to 1 if you have the <execinfo.h> header file. */ - #undef HAVE_EXECINFO_H - -+/* Define to 1 if you have the `getttyent' function. */ -+#undef HAVE_GETTTYENT -+ - /* Define to 1 if you have the `getutxent' function. */ - #undef HAVE_GETUTXENT - -@@ -128,21 +131,12 @@ - /* Define if we have libgen.h */ - #undef HAVE_LIBGEN_H - --/* Define to 1 if you have the <libutil.h> header file. */ --#undef HAVE_LIBUTIL_H -- - /* Define if have libxdmcp */ - #undef HAVE_LIBXDMCP - --/* Define if have login */ --#undef HAVE_LOGIN -- - /* Define if we have logincap */ - #undef HAVE_LOGINCAP - --/* Define if have logout */ --#undef HAVE_LOGOUT -- - /* Define if have logwtmp */ - #undef HAVE_LOGWTMP - -@@ -167,9 +161,6 @@ - /* Define to 1 if you have the <security/pam_ext.h> header file. */ - #undef HAVE_SECURITY_PAM_EXT_H - --/* Define to 1 if you have the <security/pam_modules.h> header file. */ --#undef HAVE_SECURITY_PAM_MODULES_H -- - /* Define to 1 if you have the <security/pam_modutil.h> header file. */ - #undef HAVE_SECURITY_PAM_MODUTIL_H - -@@ -239,6 +230,9 @@ - /* Define to 1 if you have the `updwtmpx' function. */ - #undef HAVE_UPDWTMPX - -+/* Define to 1 if you have the <util.h> header file. */ -+#undef HAVE_UTIL_H -+ - /* Define to 1 if you have the <utmpx.h> header file. */ - #undef HAVE_UTMPX_H - -@@ -372,8 +366,14 @@ - /* Version number of package */ - #undef VERSION - -+/* Define to enable ConsoleKit support */ -+#undef WITH_CONSOLE_KIT -+ - /* Define to enable plymouth support */ - #undef WITH_PLYMOUTH -+ -+/* Define to enable systemd support */ -+#undef WITH_SYSTEMD - - /* Define xevie option */ - #undef XEVIE_OPTION diff --git a/x11/gdm/files/patch-configure b/x11/gdm/files/patch-configure deleted file mode 100644 index c683d50161f5..000000000000 --- a/x11/gdm/files/patch-configure +++ /dev/null @@ -1,431 +0,0 @@ ---- configure.orig 2018-01-14 13:01:10.629609000 +0100 -+++ configure 2018-01-14 13:02:06.272152000 +0100 -@@ -677,6 +677,7 @@ HAVE_ADT_TRUE - XEVIE_OPTION - CHECK_ACCELERATED_DIR - GNOME_SETTINGS_DAEMON_DIR -+CONSOLEKIT_DIR - GDM_OLD_CONF - GDM_CUSTOM_CONF - GDM_DEFAULTS_CONF -@@ -697,6 +698,9 @@ JOURNALD_LIBS - JOURNALD_CFLAGS - SYSTEMD_LIBS - SYSTEMD_CFLAGS -+WITH_CONSOLE_KIT -+WITH_CONSOLE_KIT_FALSE -+WITH_CONSOLE_KIT_TRUE - XINERAMA_LIBS - LIBWRAP_LIBS - OS_SOLARIS_FALSE -@@ -983,6 +987,8 @@ enable_authentication_scheme - with_xinerama - with_xdmcp - with_tcp_wrappers -+with_console_kit -+with_systemd - with_systemdsystemunitdir - enable_systemd_journal - enable_wayland_support -@@ -1002,6 +1008,7 @@ with_log_dir - with_at_bindir - with_defaults_conf - with_custom_conf -+with_consolekit_directory - with_gnome_settings_daemon_directory - with_check_accelerated_directory - with_xevie -@@ -1748,6 +1755,8 @@ Optional Packages: - --with-xinerama Add Xinerama support [default=auto] - --with-xdmcp Add XDMCP (remote login) support [default=auto] - --with-tcp-wrappers Use TCP Wrappers [default=auto] -+ --with-console-kit Add ConsoleKit support [default=auto] -+ --with-systemd Add systemd support [default=auto] - --with-systemdsystemunitdir=DIR - Directory for systemd service files - --with-plymouth Add plymouth support [default=yes] -@@ -1776,6 +1785,9 @@ Optional Packages: - --with-custom-conf=<FILENAME> - FILENAME to give to custom configuration file - [default=GDMCONFDIR/custom.conf] -+ --with-consolekit-directory -+ Specify the directory of ck-get-x11-display-device -+ [default=libexecdir] - --with-gnome-settings-daemon-directory - Specify the directory of gnome-settings-daemon used - by the chooser [default=libexecdir] -@@ -20860,24 +20872,6 @@ else - fi - - --for ac_header in security/pam_modules.h security/pam_modutil.h security/pam_ext.h --do : -- as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` --ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" --if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : -- cat >>confdefs.h <<_ACEOF --#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 --_ACEOF -- have_pam=yes --else -- if test "x$have_pam" = xyes ; then -- as_fn_error $? "PAM development files not found." "$LINENO" 5 -- fi --fi -- --done -- -- - # Check whether --enable-console-helper was given. - if test "${enable_console_helper+set}" = set; then : - enableval=$enable_console_helper; -@@ -20922,7 +20916,23 @@ fi - - - -+# Check whether --with-console-kit was given. -+if test "${with_console_kit+set}" = set; then : -+ withval=$with_console_kit; -+else -+ with_console_kit=no -+fi - -+ -+ -+# Check whether --with-systemd was given. -+if test "${with_systemd+set}" = set; then : -+ withval=$with_systemd; with_systemd=$withval -+else -+ with_systemd=auto -+fi -+ -+ - # Check whether --with-systemdsystemunitdir was given. - if test "${with_systemdsystemunitdir+set}" = set; then : - withval=$with_systemdsystemunitdir; with_systemdsystemunitdir=$withval -@@ -21764,8 +21774,17 @@ fi - - $as_echo "#define SUPPORTS_PAM_EXTENSIONS 1" >>confdefs.h - -+else -+ if false; then -+ SUPPORTS_PAM_EXTENSIONS_TRUE= -+ SUPPORTS_PAM_EXTENSIONS_FALSE='#' -+else -+ SUPPORTS_PAM_EXTENSIONS_TRUE='#' -+ SUPPORTS_PAM_EXTENSIONS_FALSE= - fi - -+fi -+ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for keyctl_read in -lkeyutils" >&5 - $as_echo_n "checking for keyctl_read in -lkeyutils... " >&6; } - if ${ac_cv_lib_keyutils_keyctl_read+:} false; then : -@@ -22008,7 +22027,7 @@ fi - - - --for ac_header in utmp.h utmpx.h libutil.h sys/param.h -+for ac_header in utmp.h utmpx.h util.h sys/param.h - do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` - ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -@@ -22021,7 +22040,7 @@ fi - - done - --for ac_func in getutxent updwtmpx updwtmp -+for ac_func in getutxent getttyent updwtmpx updwtmp - do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` - ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -@@ -22033,94 +22052,6 @@ _ACEOF - fi - done - --{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for login in -lutil" >&5 --$as_echo_n "checking for login in -lutil... " >&6; } --if ${ac_cv_lib_util_login+:} false; then : -- $as_echo_n "(cached) " >&6 --else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-lutil $LIBS" --cat confdefs.h - <<_ACEOF >conftest.$ac_ext --/* end confdefs.h. */ -- --/* Override any GCC internal prototype to avoid an error. -- Use char because int might match the return type of a GCC -- builtin and then its argument prototype would still apply. */ --#ifdef __cplusplus --extern "C" --#endif --char login (); --int --main () --{ --return login (); -- ; -- return 0; --} --_ACEOF --if ac_fn_c_try_link "$LINENO"; then : -- ac_cv_lib_util_login=yes --else -- ac_cv_lib_util_login=no --fi --rm -f core conftest.err conftest.$ac_objext \ -- conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS --fi --{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_login" >&5 --$as_echo "$ac_cv_lib_util_login" >&6; } --if test "x$ac_cv_lib_util_login" = xyes; then : -- -- --$as_echo "#define HAVE_LOGIN 1" >>confdefs.h -- -- EXTRA_DAEMON_LIBS="$EXTRA_DAEMON_LIBS -lutil" --fi -- --{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for logout in -lutil" >&5 --$as_echo_n "checking for logout in -lutil... " >&6; } --if ${ac_cv_lib_util_logout+:} false; then : -- $as_echo_n "(cached) " >&6 --else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-lutil $LIBS" --cat confdefs.h - <<_ACEOF >conftest.$ac_ext --/* end confdefs.h. */ -- --/* Override any GCC internal prototype to avoid an error. -- Use char because int might match the return type of a GCC -- builtin and then its argument prototype would still apply. */ --#ifdef __cplusplus --extern "C" --#endif --char logout (); --int --main () --{ --return logout (); -- ; -- return 0; --} --_ACEOF --if ac_fn_c_try_link "$LINENO"; then : -- ac_cv_lib_util_logout=yes --else -- ac_cv_lib_util_logout=no --fi --rm -f core conftest.err conftest.$ac_objext \ -- conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS --fi --{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_logout" >&5 --$as_echo "$ac_cv_lib_util_logout" >&6; } --if test "x$ac_cv_lib_util_logout" = xyes; then : -- -- --$as_echo "#define HAVE_LOGOUT 1" >>confdefs.h -- -- EXTRA_DAEMON_LIBS="$EXTRA_DAEMON_LIBS -lutil" --fi -- - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for logwtmp in -lutil" >&5 - $as_echo_n "checking for logwtmp in -lutil... " >&6; } - if ${ac_cv_lib_util_logwtmp+:} false; then : -@@ -23207,7 +23138,25 @@ fi - CPPFLAGS="$xinerama_save_cppflags" - - -+use_console_kit=no -+if test "x$with_console_kit" != "xno" ; then -+ use_console_kit=yes - -+$as_echo "#define WITH_CONSOLE_KIT 1" >>confdefs.h -+ -+fi -+ if test x$use_console_kit = xyes; then -+ WITH_CONSOLE_KIT_TRUE= -+ WITH_CONSOLE_KIT_FALSE='#' -+else -+ WITH_CONSOLE_KIT_TRUE='#' -+ WITH_CONSOLE_KIT_FALSE= -+fi -+ -+ -+ -+ -+ - pkg_failed=no - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SYSTEMD" >&5 - $as_echo_n "checking for SYSTEMD... " >&6; } -@@ -23216,12 +23165,12 @@ if test -n "$SYSTEMD_CFLAGS"; then - pkg_cv_SYSTEMD_CFLAGS="$SYSTEMD_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ -- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsystemd\""; } >&5 -- ($PKG_CONFIG --exists --print-errors "libsystemd") 2>&5 -+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsystemd-login >= 186 libsystemd-daemon\""; } >&5 -+ ($PKG_CONFIG --exists --print-errors "libsystemd-login >= 186 libsystemd-daemon") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then -- pkg_cv_SYSTEMD_CFLAGS=`$PKG_CONFIG --cflags "libsystemd" 2>/dev/null` -+ pkg_cv_SYSTEMD_CFLAGS=`$PKG_CONFIG --cflags "libsystemd-login >= 186 libsystemd-daemon" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes - else - pkg_failed=yes -@@ -23233,12 +23182,12 @@ if test -n "$SYSTEMD_LIBS"; then - pkg_cv_SYSTEMD_LIBS="$SYSTEMD_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ -- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsystemd\""; } >&5 -- ($PKG_CONFIG --exists --print-errors "libsystemd") 2>&5 -+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsystemd-login >= 186 libsystemd-daemon\""; } >&5 -+ ($PKG_CONFIG --exists --print-errors "libsystemd-login >= 186 libsystemd-daemon") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then -- pkg_cv_SYSTEMD_LIBS=`$PKG_CONFIG --libs "libsystemd" 2>/dev/null` -+ pkg_cv_SYSTEMD_LIBS=`$PKG_CONFIG --libs "libsystemd-login >= 186 libsystemd-daemon" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes - else - pkg_failed=yes -@@ -23259,50 +23208,49 @@ else - _pkg_short_errors_supported=no - fi - if test $_pkg_short_errors_supported = yes; then -- SYSTEMD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libsystemd" 2>&1` -+ SYSTEMD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libsystemd-login >= 186 libsystemd-daemon" 2>&1` - else -- SYSTEMD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libsystemd" 2>&1` -+ SYSTEMD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libsystemd-login >= 186 libsystemd-daemon" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$SYSTEMD_PKG_ERRORS" >&5 - -- as_fn_error $? "Package requirements (libsystemd) were not met: -- --$SYSTEMD_PKG_ERRORS -- --Consider adjusting the PKG_CONFIG_PATH environment variable if you --installed software in a non-standard prefix. -- --Alternatively, you may set the environment variables SYSTEMD_CFLAGS --and SYSTEMD_LIBS to avoid the need to call pkg-config. --See the pkg-config man page for more details." "$LINENO" 5 -+ have_systemd=no - elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 - $as_echo "no" >&6; } -- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 --$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} --as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it --is in your PATH or set the PKG_CONFIG environment variable to the full --path to pkg-config. -- --Alternatively, you may set the environment variables SYSTEMD_CFLAGS --and SYSTEMD_LIBS to avoid the need to call pkg-config. --See the pkg-config man page for more details. -- --To get pkg-config, see <http://pkg-config.freedesktop.org/>. --See \`config.log' for more details" "$LINENO" 5; } -+ have_systemd=no - else - SYSTEMD_CFLAGS=$pkg_cv_SYSTEMD_CFLAGS - SYSTEMD_LIBS=$pkg_cv_SYSTEMD_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 - $as_echo "yes" >&6; } -+ have_systemd=yes -+fi - -+if test "x$with_systemd" = "xauto" ; then -+ if test x$have_systemd = xno ; then -+ use_systemd=no -+ else -+ use_systemd=yes -+ fi -+else -+ use_systemd="$with_systemd" - fi - -+if test "x$use_systemd" != "xno" ; then -+ if test "x$have_systemd" = "xno"; then -+ as_fn_error $? "Systemd support explicitly required, but systemd not found" "$LINENO" 5 -+ fi - - -+$as_echo "#define WITH_SYSTEMD 1" >>confdefs.h - -+fi - -+ -+ -+ - pkg_failed=no - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JOURNALD" >&5 - $as_echo_n "checking for JOURNALD... " >&6; } -@@ -23727,6 +23675,18 @@ GDM_OLD_CONF='${gdmconfdir}/gdm.conf' - - - -+# Check whether --with-consolekit-directory was given. -+if test "${with_consolekit_directory+set}" = set; then : -+ withval=$with_consolekit_directory; -+else -+ with_consolekit_directory="\${libexecdir}" -+fi -+ -+ -+CONSOLEKIT_DIR=$with_consolekit_directory -+ -+ -+ - # Check whether --with-gnome-settings-daemon-directory was given. - if test "${with_gnome_settings_daemon_directory+set}" = set; then : - withval=$with_gnome_settings_daemon_directory; -@@ -24829,6 +24789,10 @@ if test -z "${SUPPORTS_PAM_EXTENSIONS_TRUE}" && test - - as_fn_error $? "conditional \"SUPPORTS_PAM_EXTENSIONS\" was never defined. - Usually this means the macro was only invoked conditionally." "$LINENO" 5 - fi -+if test -z "${SUPPORTS_PAM_EXTENSIONS_TRUE}" && test -z "${SUPPORTS_PAM_EXTENSIONS_FALSE}"; then -+ as_fn_error $? "conditional \"SUPPORTS_PAM_EXTENSIONS\" was never defined. -+Usually this means the macro was only invoked conditionally." "$LINENO" 5 -+fi - if test -z "${XDMCP_SUPPORT_TRUE}" && test -z "${XDMCP_SUPPORT_FALSE}"; then - as_fn_error $? "conditional \"XDMCP_SUPPORT\" was never defined. - Usually this means the macro was only invoked conditionally." "$LINENO" 5 -@@ -24841,6 +24805,10 @@ if test -z "${OS_SOLARIS_TRUE}" && test -z "${OS_SOLAR - as_fn_error $? "conditional \"OS_SOLARIS\" was never defined. - Usually this means the macro was only invoked conditionally." "$LINENO" 5 - fi -+if test -z "${WITH_CONSOLE_KIT_TRUE}" && test -z "${WITH_CONSOLE_KIT_FALSE}"; then -+ as_fn_error $? "conditional \"WITH_CONSOLE_KIT\" was never defined. -+Usually this means the macro was only invoked conditionally." "$LINENO" 5 -+fi - if test -z "${INSTALL_SYSTEMD_UNITS_TRUE}" && test -z "${INSTALL_SYSTEMD_UNITS_FALSE}"; then - as_fn_error $? "conditional \"INSTALL_SYSTEMD_UNITS\" was never defined. - Usually this means the macro was only invoked conditionally." "$LINENO" 5 -@@ -27325,6 +27293,7 @@ echo " - dmconfdir: ${dmconfdir} - localstatedir: ${localstatedir} - datadir: ${datadir} -+ consolekit location: ${with_consolekit_directory} - gnome-settings-daemon location: ${with_gnome_settings_daemon_directory} - gnome-session-check-accel location: ${with_check_accelerated_directory} - source code location: ${srcdir} -@@ -27354,6 +27323,8 @@ echo \ - " Xinerama support: ${XINERAMA_SUPPORT} - XDMCP support: ${XDMCP_SUPPORT} - SELinux support: ${use_selinux} -+ ConsoleKit support: ${use_console_kit} -+ systemd support: ${use_systemd} - systemd unit dir: ${with_systemdsystemunitdir} - plymouth support: ${use_plymouth} - wayland support: ${enable_wayland_support} -@@ -27362,3 +27333,4 @@ echo \ - Enable documentation: ${enable_documentation} - Install GDM's Xsession: ${enable_gdm_xsession} - " -+ diff --git a/x11/gdm/files/patch-daemon_Makefile.in b/x11/gdm/files/patch-daemon_Makefile.in deleted file mode 100644 index 91ba64a88646..000000000000 --- a/x11/gdm/files/patch-daemon_Makefile.in +++ /dev/null @@ -1,94 +0,0 @@ ---- daemon/Makefile.in.orig 2018-01-14 12:25:16.930784000 +0100 -+++ daemon/Makefile.in 2018-01-14 12:25:17.007460000 +0100 -@@ -101,6 +101,7 @@ libexec_PROGRAMS = gdm-session-worker$(EXEEXT) \ - - sbin_PROGRAMS = gdm$(EXEEXT) $(am__EXEEXT_1) - @XDMCP_SUPPORT_TRUE@am__append_4 = $(XDMCP_SOURCES) -+@WITH_CONSOLE_KIT_TRUE@am__append_5 = $(CONSOLE_KIT_SOURCES) - subdir = daemon - ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 - am__aclocal_m4_deps = $(top_srcdir)/m4/intltool.m4 \ -@@ -139,6 +140,8 @@ am__objects_2 = gdm-xdmcp-display-factory.$(OBJEXT) \ - gdm-xdmcp-display.$(OBJEXT) \ - gdm-xdmcp-chooser-display.$(OBJEXT) $(am__objects_1) - @XDMCP_SUPPORT_TRUE@am__objects_3 = $(am__objects_2) -+am__objects_4 = $(am__objects_1) -+@WITH_CONSOLE_KIT_TRUE@am__objects_5 = $(am__objects_4) - am_gdm_OBJECTS = main.$(OBJEXT) gdm-display-access-file.$(OBJEXT) \ - gdm-display-store.$(OBJEXT) gdm-display-factory.$(OBJEXT) \ - gdm-local-display-factory.$(OBJEXT) gdm-display.$(OBJEXT) \ -@@ -148,7 +151,7 @@ am_gdm_OBJECTS = main.$(OBJEXT) gdm-display-access-fil - gdm-session-record.$(OBJEXT) \ - gdm-session-worker-common.$(OBJEXT) \ - gdm-session-worker-job.$(OBJEXT) gdm-dbus-util.$(OBJEXT) \ -- $(am__objects_1) $(am__objects_3) -+ $(am__objects_1) $(am__objects_3) $(am__objects_5) - nodist_gdm_OBJECTS = gdm-display-glue.$(OBJEXT) \ - gdm-local-display-factory-glue.$(OBJEXT) \ - gdm-manager-glue.$(OBJEXT) gdm-local-display-glue.$(OBJEXT) \ -@@ -175,16 +178,16 @@ am__gdm_session_worker_SOURCES_DIST = session-worker-m - $(top_srcdir)/pam-extensions/gdm-pam-extensions.h \ - gdm-session-linux-auditor.h gdm-session-linux-auditor.c \ - gdm-session-solaris-auditor.h gdm-session-solaris-auditor.c --@HAVE_LIBAUDIT_TRUE@am__objects_4 = \ -+@HAVE_LIBAUDIT_TRUE@am__objects_6 = \ - @HAVE_LIBAUDIT_TRUE@ gdm-session-linux-auditor.$(OBJEXT) --@HAVE_ADT_TRUE@am__objects_5 = gdm-session-solaris-auditor.$(OBJEXT) -+@HAVE_ADT_TRUE@am__objects_7 = gdm-session-solaris-auditor.$(OBJEXT) - am_gdm_session_worker_OBJECTS = session-worker-main.$(OBJEXT) \ - gdm-session.$(OBJEXT) gdm-session-settings.$(OBJEXT) \ - gdm-session-auditor.$(OBJEXT) gdm-session-record.$(OBJEXT) \ - gdm-session-worker.$(OBJEXT) gdm-session-worker-job.$(OBJEXT) \ - gdm-session-worker-common.$(OBJEXT) gdm-dbus-util.$(OBJEXT) \ -- $(am__objects_1) $(am__objects_1) $(am__objects_4) \ -- $(am__objects_5) -+ $(am__objects_1) $(am__objects_1) $(am__objects_6) \ -+ $(am__objects_7) - nodist_gdm_session_worker_OBJECTS = gdm-session-glue.$(OBJEXT) \ - gdm-session-worker-glue.$(OBJEXT) \ - gdm-session-enum-types.$(OBJEXT) $(am__objects_1) -@@ -310,6 +313,7 @@ CHECK_CFLAGS = @CHECK_CFLAGS@ - CHECK_LIBS = @CHECK_LIBS@ - COMMON_CFLAGS = @COMMON_CFLAGS@ - COMMON_LIBS = @COMMON_LIBS@ -+CONSOLEKIT_DIR = @CONSOLEKIT_DIR@ - CPP = @CPP@ - CPPFLAGS = @CPPFLAGS@ - CXX = @CXX@ -@@ -466,6 +470,7 @@ SYSTEMD_X_SERVER = @SYSTEMD_X_SERVER@ - USE_NLS = @USE_NLS@ - VERSION = @VERSION@ - WARN_CFLAGS = @WARN_CFLAGS@ -+WITH_CONSOLE_KIT = @WITH_CONSOLE_KIT@ - XDMCP_LIBS = @XDMCP_LIBS@ - XEVIE_OPTION = @XEVIE_OPTION@ - XGETTEXT = @XGETTEXT@ -@@ -571,6 +576,7 @@ AM_CPPFLAGS = \ - -DGDM_SCREENSHOT_DIR=\"$(GDM_SCREENSHOT_DIR)\" \ - -DGDM_CACHE_DIR=\""$(localstatedir)/cache/gdm"\" \ - -DGDM_SESSION_DEFAULT_PATH=\"$(GDM_SESSION_DEFAULT_PATH)\" \ -+ -DCONSOLEKIT_DIR=\"$(CONSOLEKIT_DIR)\" \ - $(DISABLE_DEPRECATED_CFLAGS) \ - $(DAEMON_CFLAGS) \ - $(XLIB_CFLAGS) \ -@@ -674,7 +680,8 @@ gdm_SOURCES = main.c gdm-display-access-file.c \ - gdm-session-record.c gdm-session-record.h \ - gdm-session-worker-common.c gdm-session-worker-common.h \ - gdm-session-worker-job.c gdm-session-worker-job.h \ -- gdm-dbus-util.c gdm-dbus-util.h $(NULL) $(am__append_4) -+ gdm-dbus-util.c gdm-dbus-util.h $(NULL) $(am__append_4) \ -+ $(am__append_5) - nodist_gdm_SOURCES = \ - gdm-display-glue.h \ - gdm-display-glue.c \ -@@ -701,8 +708,8 @@ XDMCP_SOURCES = \ - gdm-xdmcp-chooser-display.h \ - $(NULL) - --EXTRA_gdm_SOURCES = \ -- $(XDMCP_SOURCES) \ -+EXTRA_gdm_SOURCES = $(XDMCP_SOURCES) $(NULL) $(CONSOLE_KIT_SOURCES) -+CONSOLE_KIT_SOURCES = \ - $(NULL) - - gdm_LDADD = \ diff --git a/x11/gdm/files/patch-daemon_gdm-display-access-file.c b/x11/gdm/files/patch-daemon_gdm-display-access-file.c new file mode 100644 index 000000000000..78a78f5096b4 --- /dev/null +++ b/x11/gdm/files/patch-daemon_gdm-display-access-file.c @@ -0,0 +1,36 @@ +--- daemon/gdm-display-access-file.c.orig 2022-01-12 14:15:56 UTC ++++ daemon/gdm-display-access-file.c +@@ -337,9 +337,18 @@ _create_xauth_file_for_user (const char *username, + g_debug ("GdmDisplayAccessFile: creating %s", auth_filename); + /* mode 00600 */ + errno = 0; +- fd = g_open (auth_filename, +- O_RDWR | O_CREAT | O_EXCL | O_BINARY, +- S_IRUSR | S_IWUSR); ++#if defined(__OpenBSD__) ++ if (uid == 676) { ++ fd = g_open (auth_filename, ++ O_RDWR | O_CREAT | O_EXCL | O_BINARY, ++ S_IRUSR | S_IWUSR | S_IRGRP); ++ } else ++#endif ++ { ++ fd = g_open (auth_filename, ++ O_RDWR | O_CREAT | O_EXCL | O_BINARY, ++ S_IRUSR | S_IWUSR); ++ } + + if (fd < 0) { + g_set_error (error, +@@ -441,9 +450,9 @@ _get_auth_info_for_display (GdmDisplayAccessFile *file + * + * https://bugs.freedesktop.org/show_bug.cgi?id=43425 + */ +- char localhost[HOST_NAME_MAX + 1] = ""; ++ char localhost[256] = ""; + *family = FamilyLocal; +- if (gethostname (localhost, HOST_NAME_MAX) == 0) { ++ if (gethostname (localhost, 255) == 0) { + *address = g_strdup (localhost); + } else { + *address = g_strdup ("localhost"); diff --git a/x11/gdm/files/patch-daemon_gdm-display.c b/x11/gdm/files/patch-daemon_gdm-display.c new file mode 100644 index 000000000000..152072231efa --- /dev/null +++ b/x11/gdm/files/patch-daemon_gdm-display.c @@ -0,0 +1,16 @@ +--- daemon/gdm-display.c.orig 2022-01-12 14:15:56 UTC ++++ daemon/gdm-display.c +@@ -245,8 +245,13 @@ setup_xhost_auth (XHostAddress *host_entr + host_entries[1].address = "localuser\0" GDM_USERNAME; + host_entries[1].length = sizeof ("localuser\0" GDM_USERNAME); + host_entries[2].family = FamilyServerInterpreted; ++#if defined(__OpenBSD__) ++ host_entries[2].address = "localuser\0_gnome-initial-setup"; ++ host_entries[2].length = sizeof ("localuser\0_gnome-initial-setup"); ++#else + host_entries[2].address = "localuser\0gnome-initial-setup"; + host_entries[2].length = sizeof ("localuser\0gnome-initial-setup"); ++#endif + } + + gboolean diff --git a/x11/gdm/files/patch-daemon_gdm-launch-environment.c b/x11/gdm/files/patch-daemon_gdm-launch-environment.c deleted file mode 100644 index cd14eaa21b58..000000000000 --- a/x11/gdm/files/patch-daemon_gdm-launch-environment.c +++ /dev/null @@ -1,37 +0,0 @@ -$OpenBSD: patch-daemon_gdm-launch-environment_c,v 1.8 2017/04/17 13:17:07 ajacoutot Exp $ - -XXX fix+push upstream - -REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) -From 1ac67f522f5690c27023d98096ca817f12f7eb88 Mon Sep 17 00:00:00 2001 -From: Ray Strode <rstrode@redhat.com> -Date: Fri, 12 Jun 2015 13:28:01 -0400 -Subject: drop consolekit support - -REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) -From a9cacb929470eb82582396984c61d5b611bfeb1a Mon Sep 17 00:00:00 2001 -From: Ray Strode <rstrode@redhat.com> -Date: Fri, 12 Jun 2015 14:33:40 -0400 -Subject: session: drop session-type property - ---- daemon/gdm-launch-environment.c.orig Wed Apr 12 15:47:09 2017 -+++ daemon/gdm-launch-environment.c Mon Apr 17 14:17:28 2017 -@@ -197,6 +197,9 @@ build_launch_environment (GdmLaunchEnvironment *launch - char *seat_id; - - seat_id = launch_environment->priv->x11_display_seat_id; -+ if (g_str_has_prefix (seat_id, "/org/freedesktop/ConsoleKit/")) { -+ seat_id += strlen ("/org/freedesktop/ConsoleKit/"); -+ } - - g_hash_table_insert (hash, g_strdup ("GDM_SEAT_ID"), g_strdup (seat_id)); - } -@@ -224,6 +227,8 @@ on_session_setup_complete (GdmSession *session, - gdm_session_set_environment_variable (launch_environment->priv->session, key, value); - } - g_hash_table_destroy (hash); -+ -+ gdm_session_select_session_type (launch_environment->priv->session, "LoginWindow"); - } - - static void diff --git a/x11/gdm/files/patch-daemon_gdm-local-display-factory.c b/x11/gdm/files/patch-daemon_gdm-local-display-factory.c index 8ed9f5e00239..d9b65326ca26 100644 --- a/x11/gdm/files/patch-daemon_gdm-local-display-factory.c +++ b/x11/gdm/files/patch-daemon_gdm-local-display-factory.c @@ -1,29 +1,16 @@ -$OpenBSD: patch-daemon_gdm-local-display-factory_c,v 1.6 2017/03/03 13:01:26 ajacoutot Exp $ - -REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) -From 1ac67f522f5690c27023d98096ca817f12f7eb88 Mon Sep 17 00:00:00 2001 -From: Ray Strode <rstrode@redhat.com> -Date: Fri, 12 Jun 2015 13:28:01 -0400 -Subject: drop consolekit support - -REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) -From 9be58c9ec9a3a411492a5182ac4b0d51fdc3a323 Mon Sep 17 00:00:00 2001 -From: Ray Strode <rstrode@redhat.com> -Date: Fri, 12 Jun 2015 13:48:52 -0400 -Subject: require logind support - ---- daemon/gdm-local-display-factory.c.orig Wed Mar 1 16:58:36 2017 -+++ daemon/gdm-local-display-factory.c Fri Mar 3 12:00:56 2017 -@@ -42,6 +42,8 @@ - - #define GDM_LOCAL_DISPLAY_FACTORY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_LOCAL_DISPLAY_FACTORY, GdmLocalDisplayFactoryPrivate)) - -+#define CK_SEAT1_PATH "/org/freedesktop/ConsoleKit/Seat1" -+ - #define GDM_DBUS_PATH "/org/gnome/DisplayManager" - #define GDM_LOCAL_DISPLAY_FACTORY_DBUS_PATH GDM_DBUS_PATH "/LocalDisplayFactory" - #define GDM_MANAGER_DBUS_NAME "org.gnome.DisplayManager.LocalDisplayFactory" -@@ -57,8 +59,10 @@ struct GdmLocalDisplayFactoryPrivate +--- daemon/gdm-local-display-factory.c.orig 2022-01-12 14:15:56 UTC ++++ daemon/gdm-local-display-factory.c +@@ -28,7 +28,9 @@ + #include <glib-object.h> + #include <gio/gio.h> + ++#ifdef WITH_SYSTEMD + #include <systemd/sd-login.h> ++#endif + + #include "gdm-common.h" + #include "gdm-manager.h" +@@ -61,8 +63,10 @@ struct _GdmLocalDisplayFactory /* FIXME: this needs to be per seat? */ guint num_failures; @@ -31,102 +18,189 @@ Subject: require logind support guint seat_new_id; guint seat_removed_id; +#endif + guint seat_properties_changed_id; + + gboolean seat0_graphics_check_timed_out; +@@ -94,9 +98,11 @@ static void on_display_status_changed + + static gboolean gdm_local_display_factory_sync_seats (GdmLocalDisplayFactory *factory); + static gpointer local_display_factory_object = NULL; ++#ifdef WITH_SYSTEMD + static gboolean lookup_by_session_id (const char *id, + GdmDisplay *display, + gpointer user_data); ++#endif + + G_DEFINE_TYPE (GdmLocalDisplayFactory, gdm_local_display_factory, GDM_TYPE_DISPLAY_FACTORY) + +@@ -233,9 +239,9 @@ struct GdmDisplayServerConfiguration { + const char *session_type; + } display_server_configuration[] = { + #ifdef ENABLE_WAYLAND_SUPPORT +- { "wayland", GDM_KEY_WAYLAND_ENABLE, "/usr/bin/Xwayland", "wayland" }, ++ { "wayland", GDM_KEY_WAYLAND_ENABLE, "/usr/local/bin/Xwayland", "wayland" }, + #endif +- { "xorg", GDM_KEY_XORG_ENABLE, "/usr/bin/Xorg", "x11" }, ++ { "xorg", GDM_KEY_XORG_ENABLE, X_SERVER, "x11" }, + { NULL, NULL, NULL }, }; - enum { -@@ -206,8 +210,10 @@ gdm_local_display_factory_create_transient_display (Gd - - g_debug ("GdmLocalDisplayFactory: Creating transient display"); - --#ifdef ENABLE_USER_DISPLAY_SERVER -- display = gdm_local_display_new (); -+#if defined ENABLE_USER_DISPLAY_SERVER && defined WITH_SYSTEMD -+ if (LOGIND_RUNNING() > 0) { -+ display = gdm_local_display_new (); -+ } - #else - if (display == NULL) { - guint32 num; -@@ -289,7 +295,7 @@ on_display_status_changed (GdmDisplay *dis +@@ -439,6 +445,7 @@ gdm_local_display_factory_create_transient_display (Gd + return ret; + } + ++#ifdef WITH_SYSTEMD + static void + finish_display_on_seat_if_waiting (GdmDisplayStore *display_store, + GdmDisplay *display, +@@ -493,6 +500,7 @@ on_session_registered_cb (GObject *gobject, + + finish_waiting_displays_on_seat (factory, "seat0"); + } ++#endif + + static void + on_display_status_changed (GdmDisplay *display, +@@ -540,7 +548,7 @@ on_display_status_changed (GdmDisplay *dis + * if there isn't one. + */ + if (is_local && +- (g_strcmp0 (session_class, "greeter") != 0 || factory->active_vt == GDM_INITIAL_VT)) { ++ (g_strcmp0 (session_class, "greeter") != 0)) { /* reset num failures */ - factory->priv->num_failures = 0; + factory->num_failures = 0; + +@@ -649,7 +657,9 @@ ensure_display_for_seat (GdmLocalDisplayFactory *facto + const char *legacy_session_types[] = { "x11", NULL }; + GdmDisplayStore *store; + GdmDisplay *display = NULL; ++#ifdef WITH_SYSTEMD + g_autofree char *login_session_id = NULL; ++#endif + gboolean wayland_enabled = FALSE, xorg_enabled = FALSE; + g_autofree gchar *preferred_display_server = NULL; + gboolean falling_back = FALSE; +@@ -679,7 +689,7 @@ ensure_display_for_seat (GdmLocalDisplayFactory *facto + seat_supports_graphics = TRUE; + } + +- if (g_strcmp0 (seat_id, "seat0") == 0) { ++ if (g_strcmp0 (seat_id, SEAT_ID) == 0) { + is_seat0 = TRUE; + + falling_back = factory->num_failures > 0; +@@ -767,6 +777,7 @@ ensure_display_for_seat (GdmLocalDisplayFactory *facto + return; + } -- gdm_local_display_factory_sync_seats (factory); -+ create_display (factory, seat_id, session_type, is_initial); ++#ifdef WITH_SYSTEMD + /* If we already have a login window, switch to it */ + if (gdm_get_login_window_session_id (seat_id, &login_session_id)) { + GdmDisplay *display; +@@ -784,6 +795,7 @@ ensure_display_for_seat (GdmLocalDisplayFactory *facto + return; } - break; - case GDM_DISPLAY_FAILED: -@@ -368,7 +374,7 @@ create_display (GdmLocalDisplayFactory *factory, + } ++#endif g_debug ("GdmLocalDisplayFactory: Adding display on seat %s", seat_id); --#ifdef ENABLE_USER_DISPLAY_SERVER -+#if defined ENABLE_USER_DISPLAY_SERVER && defined WITH_SYSTEMD - if (g_strcmp0 (seat_id, "seat0") == 0) { - display = gdm_local_display_new (); - if (session_type != NULL) { -@@ -400,6 +406,8 @@ create_display (GdmLocalDisplayFactory *factory, - return display; +@@ -827,6 +839,7 @@ ensure_display_for_seat (GdmLocalDisplayFactory *facto + return; } +#ifdef WITH_SYSTEMD -+ static void delete_display (GdmLocalDisplayFactory *factory, const char *seat_id) { -@@ -536,6 +544,7 @@ gdm_local_display_factory_stop_monitor (GdmLocalDispla - factory->priv->seat_removed_id = 0; - } +@@ -838,6 +851,7 @@ delete_display (GdmLocalDisplayFactory *factory, + store = gdm_display_factory_get_display_store (GDM_DISPLAY_FACTORY (factory)); + gdm_display_store_foreach_remove (store, lookup_by_seat_id, (gpointer) seat_id); } +#endif - static void - on_display_added (GdmDisplayStore *display_store, -@@ -576,6 +585,7 @@ static gboolean - gdm_local_display_factory_start (GdmDisplayFactory *base_factory) - { - GdmLocalDisplayFactory *factory = GDM_LOCAL_DISPLAY_FACTORY (base_factory); -+ GdmDisplay *display; - GdmDisplayStore *store; - - g_return_val_if_fail (GDM_IS_LOCAL_DISPLAY_FACTORY (factory), FALSE); -@@ -594,8 +604,17 @@ gdm_local_display_factory_start (GdmDisplayFactory *ba - factory, - 0); + static gboolean + gdm_local_display_factory_sync_seats (GdmLocalDisplayFactory *factory) +@@ -849,6 +863,8 @@ gdm_local_display_factory_sync_seats (GdmLocalDisplayF + const char *seat; -- gdm_local_display_factory_start_monitor (factory); -- return gdm_local_display_factory_sync_seats (factory); + g_debug ("GdmLocalDisplayFactory: enumerating seats from logind"); ++ +#ifdef WITH_SYSTEMD -+ if (LOGIND_RUNNING()) { -+ gdm_local_display_factory_start_monitor (factory); -+ return gdm_local_display_factory_sync_seats (factory); -+ } + result = g_dbus_connection_call_sync (factory->connection, + "org.freedesktop.login1", + "/org/freedesktop/login1", +@@ -859,6 +875,18 @@ gdm_local_display_factory_sync_seats (GdmLocalDisplayF + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, &error); ++#elif defined(WITH_CONSOLE_KIT) ++ result = g_dbus_connection_call_sync (factory->connection, ++ CK_NAME, ++ CK_MANAGER_PATH, ++ CK_MANAGER_INTERFACE, ++ "ListSeats", ++ NULL, ++ G_VARIANT_TYPE ("(a(so))"), ++ G_DBUS_CALL_FLAGS_NONE, ++ -1, ++ NULL, &error); +#endif -+ -+ /* On ConsoleKit just create Seat1, and that's it. */ -+ display = create_display (factory, CK_SEAT1_PATH, NULL, TRUE); -+ -+ return display != NULL; + + if (!result) { + g_warning ("GdmLocalDisplayFactory: Failed to issue method call: %s", error->message); +@@ -878,6 +906,7 @@ gdm_local_display_factory_sync_seats (GdmLocalDisplayF + return TRUE; } - static gboolean -@@ -606,7 +625,9 @@ gdm_local_display_factory_stop (GdmDisplayFactory *bas ++#ifdef WITH_SYSTEMD + static void + on_seat_new (GDBusConnection *connection, + const gchar *sender_name, +@@ -989,6 +1018,7 @@ lookup_by_tty (const char *id, + + return g_strcmp0 (tty_to_check, tty_to_find) == 0; + } ++#endif - g_return_val_if_fail (GDM_IS_LOCAL_DISPLAY_FACTORY (factory), FALSE); + #if defined(ENABLE_USER_DISPLAY_SERVER) + static void +@@ -1166,6 +1196,7 @@ on_vt_changed (GIOChannel *source, + } + #endif +#ifdef WITH_SYSTEMD - gdm_local_display_factory_stop_monitor (factory); + static void + gdm_local_display_factory_start_monitor (GdmLocalDisplayFactory *factory) + { +@@ -1215,10 +1246,12 @@ gdm_local_display_factory_start_monitor (GdmLocalDispl + } + #endif + } +#endif - store = gdm_display_factory_get_display_store (GDM_DISPLAY_FACTORY (factory)); - -@@ -762,7 +783,9 @@ gdm_local_display_factory_finalize (GObject *object) + static void + gdm_local_display_factory_stop_monitor (GdmLocalDisplayFactory *factory) + { ++#ifdef WITH_SYSTEMD + if (factory->seat_new_id) { + g_dbus_connection_signal_unsubscribe (factory->connection, + factory->seat_new_id); +@@ -1244,6 +1277,7 @@ gdm_local_display_factory_stop_monitor (GdmLocalDispla + factory->wait_to_finish_timeout_id = 0; + } + #endif ++#endif + } - g_hash_table_destroy (factory->priv->used_display_numbers); + static void +@@ -1298,7 +1332,9 @@ gdm_local_display_factory_start (GdmDisplayFactory *ba + factory, + 0); +#ifdef WITH_SYSTEMD - gdm_local_display_factory_stop_monitor (factory); + gdm_local_display_factory_start_monitor (factory); +#endif - - G_OBJECT_CLASS (gdm_local_display_factory_parent_class)->finalize (object); + return gdm_local_display_factory_sync_seats (factory); } + diff --git a/x11/gdm/files/patch-daemon_gdm-manager.c b/x11/gdm/files/patch-daemon_gdm-manager.c index af1ada894ddd..3082318a5166 100644 --- a/x11/gdm/files/patch-daemon_gdm-manager.c +++ b/x11/gdm/files/patch-daemon_gdm-manager.c @@ -1,32 +1,5 @@ -$OpenBSD: patch-daemon_gdm-manager_c,v 1.14 2017/05/10 10:18:15 ajacoutot Exp $ - -REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) -From 21905303afbd508f3bf599ad219c9209413c53a2 Mon Sep 17 00:00:00 2001 -From: Ray Strode <rstrode@redhat.com> -Date: Wed, 5 Apr 2017 12:11:20 -0400 -Subject: manager: stop transient greeter session when done with it - -REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) -From 22c332baaf8ad6d7082c5b01250bae70934c2fd1 Mon Sep 17 00:00:00 2001 -From: Ray Strode <rstrode@redhat.com> -Date: Tue, 4 Apr 2017 17:07:04 -0400 -Subject: manager: make sure we end up on a login screen - -REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) -From 1ac67f522f5690c27023d98096ca817f12f7eb88 Mon Sep 17 00:00:00 2001 -From: Ray Strode <rstrode@redhat.com> -Date: Fri, 12 Jun 2015 13:28:01 -0400 -Subject: drop consolekit support - -REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) -From 9be58c9ec9a3a411492a5182ac4b0d51fdc3a323 Mon Sep 17 00:00:00 2001 -From: Ray Strode <rstrode@redhat.com> -Date: Fri, 12 Jun 2015 13:48:52 -0400 -Subject: require logind support - - ---- daemon/gdm-manager.c.orig 2017-10-24 21:33:58.000000000 +0200 -+++ daemon/gdm-manager.c 2018-01-14 13:33:21.588929000 +0100 +--- daemon/gdm-manager.c.orig 2022-01-12 14:15:56 UTC ++++ daemon/gdm-manager.c @@ -36,7 +36,9 @@ #include <act/act-user-manager.h> @@ -37,348 +10,28 @@ Subject: require logind support #include "gdm-common.h" -@@ -63,6 +65,15 @@ +@@ -61,7 +63,7 @@ + #define GDM_MANAGER_PATH GDM_DBUS_PATH "/Manager" + #define GDM_MANAGER_DISPLAYS_PATH GDM_DBUS_PATH "/Displays" - #define INITIAL_SETUP_USERNAME "gnome-initial-setup" +-#define INITIAL_SETUP_USERNAME "gnome-initial-setup" ++#define INITIAL_SETUP_USERNAME "_gnome-initial-setup" + #define ALREADY_RAN_INITIAL_SETUP_ON_THIS_BOOT GDM_RUN_DIR "/gdm.ran-initial-setup" -+#define CK_NAME "org.freedesktop.ConsoleKit" -+#define CK_PATH "/org/freedesktop/ConsoleKit" -+#define CK_INTERFACE "org.freedesktop.ConsoleKit" -+ -+#define CK_MANAGER_PATH "/org/freedesktop/ConsoleKit/Manager" -+#define CK_MANAGER_INTERFACE "org.freedesktop.ConsoleKit.Manager" -+#define CK_SEAT_INTERFACE "org.freedesktop.ConsoleKit.Seat" -+#define CK_SESSION_INTERFACE "org.freedesktop.ConsoleKit.Session" -+ typedef struct - { - GdmManager *manager; -@@ -206,9 +217,10 @@ plymouth_quit_without_transition (void) - } - #endif - -+#ifdef WITH_SYSTEMD - static char * --get_session_id_for_pid (pid_t pid, -- GError **error) -+get_session_id_for_pid_systemd (pid_t pid, -+ GError **error) - { - char *session, *gsession; - int ret; -@@ -233,11 +245,61 @@ get_session_id_for_pid (pid_t pid, - return NULL; - } - } -+#endif - -+#ifdef WITH_CONSOLE_KIT -+static char * -+get_session_id_for_pid_consolekit (GDBusConnection *connection, -+ pid_t pid, -+ GError **error) -+{ -+ GVariant *reply; -+ char *retval; -+ -+ reply = g_dbus_connection_call_sync (connection, -+ "org.freedesktop.ConsoleKit", -+ "/org/freedesktop/ConsoleKit/Manager", -+ "org.freedesktop.ConsoleKit.Manager", -+ "GetSessionForUnixProcess", -+ g_variant_new ("(u)", pid), -+ G_VARIANT_TYPE ("(o)"), -+ G_DBUS_CALL_FLAGS_NONE, -+ -1, -+ NULL, error); -+ if (reply == NULL) { -+ return NULL; -+ } -+ -+ g_variant_get (reply, "(o)", &retval); -+ g_variant_unref (reply); -+ -+ return retval; -+} -+#endif -+ -+static char * -+get_session_id_for_pid (GDBusConnection *connection, -+ pid_t pid, -+ GError **error) -+{ -+#ifdef WITH_SYSTEMD -+ if (LOGIND_RUNNING()) { -+ return get_session_id_for_pid_systemd (pid, error); -+ } -+#endif -+ -+#ifdef WITH_CONSOLE_KIT -+ return get_session_id_for_pid_consolekit (connection, pid, error); -+#endif -+ -+ return NULL; -+} -+ -+#ifdef WITH_SYSTEMD - static gboolean --get_uid_for_session_id (const char *session_id, -- uid_t *uid, -- GError **error) -+get_uid_for_systemd_session_id (const char *session_id, -+ uid_t *uid, -+ GError **error) - { - int ret; +@@ -304,6 +306,7 @@ session_unlock (GdmManager *manager, -@@ -254,8 +316,62 @@ get_uid_for_session_id (const char *session_id, - - return TRUE; - } -+#endif + g_debug ("Unlocking session %s", ssid); -+#ifdef WITH_CONSOLE_KIT - static gboolean -+get_uid_for_consolekit_session_id (GDBusConnection *connection, -+ const char *session_id, -+ uid_t *out_uid, -+ GError **error) -+{ -+ GVariant *reply; -+ guint32 uid; -+ -+ reply = g_dbus_connection_call_sync (connection, -+ "org.freedesktop.ConsoleKit", -+ session_id, -+ "org.freedesktop.ConsoleKit.Session", -+ "GetUnixUser", -+ NULL, -+ G_VARIANT_TYPE ("(u)"), -+ G_DBUS_CALL_FLAGS_NONE, -+ -1, -+ NULL, -+ error); -+ if (reply == NULL) { -+ return FALSE; -+ } -+ -+ g_variant_get (reply, "(u)", &uid); -+ g_variant_unref (reply); -+ -+ *out_uid = (uid_t) uid; -+ -+ return TRUE; -+} -+#endif -+ -+static gboolean -+get_uid_for_session_id (GDBusConnection *connection, -+ const char *session_id, -+ uid_t *uid, -+ GError **error) -+{ -+#ifdef WITH_SYSTEMD -+ if (LOGIND_RUNNING()) { -+ return get_uid_for_systemd_session_id (session_id, uid, error); -+ } -+#endif -+ -+#ifdef WITH_CONSOLE_KIT -+ return get_uid_for_consolekit_session_id (connection, session_id, uid, error); -+#endif -+ -+ return FALSE; -+} -+ -+static gboolean - lookup_by_session_id (const char *id, - GdmDisplay *display, - gpointer user_data) -@@ -267,11 +383,51 @@ lookup_by_session_id (const char *id, - return g_strcmp0 (current, looking_for) == 0; - } - -+#ifdef WITH_CONSOLE_KIT - static gboolean --is_login_session (GdmManager *self, -- const char *session_id, -- GError **error) -+is_consolekit_login_session (GdmManager *self, -+ GDBusConnection *connection, -+ const char *session_id, -+ GError **error) - { -+ GVariant *reply; -+ char *session_type = NULL; -+ -+ reply = g_dbus_connection_call_sync (connection, -+ "org.freedesktop.ConsoleKit", -+ session_id, -+ "org.freedesktop.ConsoleKit.Session", -+ "GetSessionType", -+ NULL, -+ G_VARIANT_TYPE ("(s)"), -+ G_DBUS_CALL_FLAGS_NONE, -+ -1, -+ NULL, -+ error); -+ if (reply == NULL) { -+ return FALSE; -+ } -+ -+ g_variant_get (reply, "(s)", &session_type); -+ g_variant_unref (reply); -+ -+ if (g_strcmp0 (session_type, "LoginWindow") != 0) { -+ g_free (session_type); -+ -+ return FALSE; -+ } -+ -+ g_free (session_type); -+ return TRUE; -+} -+#endif -+ -+#ifdef WITH_SYSTEMD -+static gboolean -+is_systemd_login_session (GdmManager *self, -+ const char *session_id, -+ GError **error) -+{ - char *session_class = NULL; - int ret; - -@@ -295,12 +451,33 @@ is_login_session (GdmManager *self, - g_free (session_class); - return TRUE; - } -+#endif - - static gboolean --activate_session_id (GdmManager *manager, -- const char *seat_id, -- const char *session_id) -+is_login_session (GdmManager *self, -+ GDBusConnection *connection, -+ const char *session_id, -+ GError **error) - { -+#ifdef WITH_SYSTEMD -+ if (LOGIND_RUNNING()) { -+ return is_systemd_login_session (self, session_id, error); -+ } -+#endif -+ -+#ifdef WITH_CONSOLE_KIT -+ return is_consolekit_login_session (self, connection, session_id, error); -+#endif -+ -+ return FALSE; -+} -+ -+#ifdef WITH_SYSTEMD -+static gboolean -+activate_session_id_for_systemd (GdmManager *manager, -+ const char *seat_id, -+ const char *session_id) -+{ - GError *error = NULL; - GVariant *reply; - -@@ -326,16 +503,75 @@ activate_session_id (GdmManager *manager, - - return TRUE; - } -+#endif - -+#ifdef WITH_CONSOLE_KIT - static gboolean --session_unlock (GdmManager *manager, -- const char *ssid) -+activate_session_id_for_ck (GdmManager *manager, -+ const char *seat_id, -+ const char *session_id) - { - GError *error = NULL; - GVariant *reply; - -- g_debug ("Unlocking session %s", ssid); -+ reply = g_dbus_connection_call_sync (manager->priv->connection, -+ CK_NAME, -+ seat_id, -+ "org.freedesktop.ConsoleKit.Seat", -+ "ActivateSession", -+ g_variant_new ("(o)", session_id), -+ NULL, /* expected reply */ -+ G_DBUS_CALL_FLAGS_NONE, -+ -1, -+ NULL, -+ &error); -+ if (reply == NULL) { -+ g_debug ("GdmManager: ConsoleKit %s raised:\n %s\n\n", -+ g_dbus_error_get_remote_error (error), error->message); -+ g_error_free (error); - -+ /* It is very likely that the "error" just reported is -+ * that the session is already active. Unfortunately, -+ * ConsoleKit doesn't use proper error codes and it -+ * translates the error message, so we have no real way -+ * to detect this case... -+ */ -+ return TRUE; -+ } -+ -+ g_variant_unref (reply); -+ -+ return TRUE; -+} -+#endif -+ -+static gboolean -+activate_session_id (GdmManager *manager, -+ const char *seat_id, -+ const char *session_id) -+{ -+ -+#ifdef WITH_SYSTEMD -+ if (LOGIND_RUNNING()) { -+ return activate_session_id_for_systemd (manager, seat_id, session_id); -+ } -+#endif -+ -+#ifdef WITH_CONSOLE_KIT -+ return activate_session_id_for_ck (manager, seat_id, session_id); -+#else -+ return FALSE; -+#endif -+} -+ -+#ifdef WITH_SYSTEMD -+static gboolean -+session_unlock_for_systemd (GdmManager *manager, -+ const char *ssid) -+{ -+ GError *error = NULL; -+ GVariant *reply; -+ ++#if defined(WITH_SYSTEMD) reply = g_dbus_connection_call_sync (manager->priv->connection, "org.freedesktop.login1", "/org/freedesktop/login1", -@@ -358,7 +594,60 @@ session_unlock (GdmManager *manager, - - return TRUE; - } -+#endif - -+#ifdef WITH_CONSOLE_KIT -+static gboolean -+session_unlock_for_ck (GdmManager *manager, -+ const char *ssid) -+{ -+ GError *error = NULL; -+ GVariant *reply; -+ +@@ -321,6 +324,25 @@ session_unlock (GdmManager *manager, + g_error_free (error); + return FALSE; + } ++#elif defined(WITH_CONSOLE_KIT) + reply = g_dbus_connection_call_sync (manager->priv->connection, + CK_NAME, + ssid, @@ -391,476 +44,63 @@ Subject: require logind support + NULL, + &error); + if (reply == NULL) { -+ g_debug ("GdmManager: ConsoleKit %s raised:\n %s\n\n", ++ g_debug ("GdmManager: ConsoleKit 'Unlock' %s raised:\n %s\n\n", + g_dbus_error_get_remote_error (error), error->message); + g_error_free (error); + return FALSE; + } -+ -+ g_variant_unref (reply); -+ -+ return TRUE; -+} -+#endif -+ -+static gboolean -+session_unlock (GdmManager *manager, -+ const char *ssid) -+{ -+ -+ g_debug ("Unlocking session %s", ssid); -+ -+#ifdef WITH_SYSTEMD -+ if (LOGIND_RUNNING()) { -+ return session_unlock_for_systemd (manager, ssid); -+ } +#endif -+ -+#ifdef WITH_CONSOLE_KIT -+ return session_unlock_for_ck (manager, ssid); -+#else -+ return TRUE; -+#endif -+} -+ - static GdmSession * - find_session_for_user_on_seat (GdmManager *manager, - const char *username, -@@ -389,11 +678,44 @@ find_session_for_user_on_seat (GdmManager *manager, - return NULL; - } -+#ifdef WITH_CONSOLE_KIT - static gboolean --is_remote_session (GdmManager *self, -- const char *session_id, -- GError **error) -+is_consolekit_remote_session (GdmManager *self, -+ GDBusConnection *connection, -+ const char *session_id, -+ GError **error) - { -+ GVariant *reply; -+ gboolean is_remote; -+ -+ reply = g_dbus_connection_call_sync (connection, -+ "org.freedesktop.ConsoleKit", -+ session_id, -+ "org.freedesktop.ConsoleKit.Session", -+ "IsLocal", -+ NULL, -+ G_VARIANT_TYPE ("(b)"), -+ G_DBUS_CALL_FLAGS_NONE, -+ -1, -+ NULL, -+ error); -+ if (reply == NULL) { -+ return FALSE; -+ } -+ -+ g_variant_get (reply, "(b)", &is_remote); -+ g_variant_unref (reply); -+ -+ return is_remote; -+} -+#endif -+ -+#ifdef WITH_SYSTEMD -+static gboolean -+is_systemd_remote_session (GdmManager *self, -+ const char *session_id, -+ GError **error) -+{ - char *seat; - int ret; - gboolean is_remote; -@@ -418,10 +740,31 @@ is_remote_session (GdmManager *self, - - return is_remote; - } -+#endif - -+static gboolean -+is_remote_session (GdmManager *self, -+ GDBusConnection *connection, -+ const char *session_id, -+ GError **error) -+{ -+#ifdef WITH_SYSTEMD -+ if (LOGIND_RUNNING()) { -+ return is_systemd_remote_session (self, session_id, error); -+ } -+#endif -+ -+#ifdef WITH_CONSOLE_KIT -+ return is_consolekit_remote_session (self, connection, session_id, error); -+#endif -+ -+ return FALSE; -+} -+ -+#ifdef WITH_SYSTEMD - static char * --get_seat_id_for_session_id (const char *session_id, -- GError **error) -+get_seat_id_for_systemd_session_id (const char *session_id, -+ GError **error) - { - int ret; - char *seat, *out_seat; -@@ -446,11 +789,62 @@ get_seat_id_for_session_id (const char *session_id, - - return out_seat; - } -+#endif + g_variant_unref (reply); -+#ifdef WITH_CONSOLE_KIT - static char * --get_tty_for_session_id (const char *session_id, -- GError **error) -+get_seat_id_for_consolekit_session_id (GDBusConnection *connection, -+ const char *session_id, -+ GError **error) +@@ -436,6 +458,7 @@ static char * + get_tty_for_session_id (const char *session_id, + GError **error) { -+ GVariant *reply; -+ char *retval; -+ -+ reply = g_dbus_connection_call_sync (connection, -+ "org.freedesktop.ConsoleKit", -+ session_id, -+ "org.freedesktop.ConsoleKit.Session", -+ "GetSeatId", -+ NULL, -+ G_VARIANT_TYPE ("(o)"), -+ G_DBUS_CALL_FLAGS_NONE, -+ -1, -+ NULL, -+ error); -+ if (reply == NULL) { -+ return NULL; -+ } -+ -+ g_variant_get (reply, "(o)", &retval); -+ g_variant_unref (reply); -+ -+ return retval; -+} -+#endif -+ -+static char * -+get_seat_id_for_session_id (GDBusConnection *connection, -+ const char *session_id, -+ GError **error) -+{ +#ifdef WITH_SYSTEMD -+ if (LOGIND_RUNNING()) { -+ return get_seat_id_for_systemd_session_id (session_id, error); -+ } -+#endif -+ -+#ifdef WITH_CONSOLE_KIT -+ return get_seat_id_for_consolekit_session_id (connection, session_id, error); -+#endif -+ -+ return NULL; -+} -+ -+#ifdef WITH_SYSTEMD -+static char * -+get_tty_for_systemd_session_id (const char *session_id, -+ GError **error) -+{ int ret; char *tty, *out_tty; -@@ -473,7 +867,21 @@ get_tty_for_session_id (const char *session_id, +@@ -457,6 +480,9 @@ get_tty_for_session_id (const char *session_id, + } return out_tty; - } ++#elif defined(WITH_CONSOLE_KIT) ++ return NULL; +#endif - -+static char * -+get_tty_for_session_id (const char *session_id, -+ GError **error) -+{ -+#ifdef WITH_SYSTEMD -+ if (LOGIND_RUNNING()) { -+ return get_tty_for_systemd_session_id (session_id, error); -+ } -+#endif -+ -+ return NULL; -+} -+ - static void - get_display_and_details_for_bus_sender (GdmManager *self, - GDBusConnection *connection, -@@ -516,7 +924,7 @@ get_display_and_details_for_bus_sender (GdmManager - goto out; - } - -- session_id = get_session_id_for_pid (pid, &error); -+ session_id = get_session_id_for_pid (connection, pid, &error); - - if (session_id == NULL) { - g_debug ("GdmManager: Error while retrieving session id for sender: %s", -@@ -530,7 +938,7 @@ get_display_and_details_for_bus_sender (GdmManager - } - - if (out_is_login_screen != NULL) { -- *out_is_login_screen = is_login_session (self, session_id, &error); -+ *out_is_login_screen = is_login_session (self, connection, session_id, &error); - - if (error != NULL) { - g_debug ("GdmManager: Error while checking if sender is login screen: %s", -@@ -540,7 +948,7 @@ get_display_and_details_for_bus_sender (GdmManager - } - } - -- if (!get_uid_for_session_id (session_id, &session_uid, &error)) { -+ if (!get_uid_for_session_id (connection, session_id, &session_uid, &error)) { - g_debug ("GdmManager: Error while retrieving uid for session: %s", - error->message); - g_error_free (error); -@@ -557,7 +965,7 @@ get_display_and_details_for_bus_sender (GdmManager - } - - if (out_seat_id != NULL) { -- *out_seat_id = get_seat_id_for_session_id (session_id, &error); -+ *out_seat_id = get_seat_id_for_session_id (connection, session_id, &error); - - if (error != NULL) { - g_debug ("GdmManager: Error while retrieving seat id for session: %s", -@@ -567,7 +975,7 @@ get_display_and_details_for_bus_sender (GdmManager - } - - if (out_is_remote != NULL) { -- *out_is_remote = is_remote_session (self, session_id, &error); -+ *out_is_remote = is_remote_session (self, connection, session_id, &error); - - if (error != NULL) { - g_debug ("GdmManager: Error while retrieving remoteness for session: %s", -@@ -725,29 +1133,6 @@ out: - return recorded; } --static GdmSession * --find_user_session_for_display (GdmManager *self, -- GdmDisplay *display) --{ -- -- GList *node = self->priv->user_sessions; -- -- while (node != NULL) { -- GdmSession *session = node->data; -- GdmDisplay *candidate_display; -- GList *next_node = node->next; -- -- candidate_display = get_display_for_user_session (session); -- -- if (candidate_display == display) -- return session; -- -- node = next_node; -- } -- -- return NULL; --} -- - static gboolean - gdm_manager_handle_register_display (GdmDBusManager *manager, - GDBusMethodInvocation *invocation, -@@ -787,7 +1172,7 @@ gdm_manager_handle_register_display (GdmDBusManager + static void +@@ -609,6 +635,7 @@ switch_to_compatible_user_session (GdmManager *manager + + if (existing_session != NULL) { + ssid_to_activate = gdm_session_get_session_id (existing_session); ++#ifndef __FreeBSD__ + if (seat_id != NULL) { + res = gdm_activate_session_by_id (manager->priv->connection, seat_id, ssid_to_activate); + if (! res) { +@@ -616,6 +643,7 @@ switch_to_compatible_user_session (GdmManager *manager + goto out; + } } - } - -- session = find_user_session_for_display (self, display); -+ session = get_user_session_for_display (display); - - if (session != NULL) { - GPid pid; -@@ -961,7 +1346,8 @@ on_reauthentication_client_rejected (GdmSession - * same audit session, ignore it since it doesn't "own" the - * reauthentication session - */ -- client_session_id = get_session_id_for_pid (pid_of_client, -+ client_session_id = get_session_id_for_pid (self->priv->connection, -+ pid_of_client, - NULL); - session_id = g_object_get_data (G_OBJECT (session), "caller-session-id"); ++#endif -@@ -1173,16 +1559,20 @@ static gboolean - display_is_on_seat0 (GdmDisplay *display) - { - gboolean is_on_seat0 = TRUE; -- char *seat_id = NULL; + res = session_unlock (manager, ssid_to_activate); + if (!res) { +@@ -1204,7 +1232,7 @@ display_is_on_seat0 (GdmDisplay *display) -- g_object_get (G_OBJECT (display), "seat-id", &seat_id, NULL); -+#ifdef WITH_SYSTEMD -+ if (LOGIND_RUNNING()) { -+ char *seat_id = NULL; + g_object_get (G_OBJECT (display), "seat-id", &seat_id, NULL); - if (g_strcmp0 (seat_id, "seat0") != 0) { -- is_on_seat0 = FALSE; -- } -+ g_object_get (G_OBJECT (display), "seat-id", &seat_id, NULL); - -- g_free (seat_id); -+ if (g_strcmp0 (seat_id, "seat0") != 0) { -+ is_on_seat0 = FALSE; -+ } - -+ g_free (seat_id); -+ } -+#endif - return is_on_seat0; - } - -@@ -1320,133 +1710,6 @@ maybe_start_pending_initial_login (GdmManager *manager - g_free (user_session_seat_id); - } ++ if (g_strcmp0 (seat_id, SEAT_ID) != 0) { + is_on_seat0 = FALSE; + } --static gboolean --get_login_window_session_id (const char *seat_id, -- char **session_id) --{ -- gboolean ret; -- int res, i; -- char **sessions; -- char *service_id; -- char *service_class; -- char *state; -- -- res = sd_seat_get_sessions (seat_id, &sessions, NULL, NULL); -- if (res < 0) { -- g_debug ("Failed to determine sessions: %s", strerror (-res)); -- return FALSE; -- } -- -- if (sessions == NULL || sessions[0] == NULL) { -- *session_id = NULL; -- ret = TRUE; -- goto out; -- } -- -- for (i = 0; sessions[i]; i ++) { -- -- res = sd_session_get_class (sessions[i], &service_class); -- if (res < 0) { -- g_debug ("failed to determine class of session %s: %s", sessions[i], strerror (-res)); -- ret = FALSE; -- goto out; -- } -- -- if (strcmp (service_class, "greeter") != 0) { -- free (service_class); -- continue; -- } -- -- free (service_class); -- -- ret = sd_session_get_state (sessions[i], &state); -- if (ret < 0) { -- g_debug ("failed to determine state of session %s: %s", sessions[i], strerror (-res)); -- ret = FALSE; -- goto out; -- } -- -- if (g_strcmp0 (state, "closing") == 0) { -- free (state); -- continue; -- } -- free (state); -- -- res = sd_session_get_service (sessions[i], &service_id); -- if (res < 0) { -- g_debug ("failed to determine service of session %s: %s", sessions[i], strerror (-res)); -- ret = FALSE; -- goto out; -- } -- -- if (strcmp (service_id, "gdm-launch-environment") == 0) { -- *session_id = g_strdup (sessions[i]); -- ret = TRUE; -- -- free (service_id); -- goto out; -- } -- -- free (service_id); -- } -- -- *session_id = NULL; -- ret = TRUE; -- --out: -- if (sessions) { -- for (i = 0; sessions[i]; i ++) { -- free (sessions[i]); -- } -- -- free (sessions); -- } -- -- return ret; --} -- --static void --activate_login_window_session_on_seat (GdmManager *self, -- const char *seat_id) --{ -- char *session_id; -- -- if (!get_login_window_session_id (seat_id, &session_id)) { -- return; -- } -- -- activate_session_id (self, seat_id, session_id); --} -- --static void --maybe_activate_other_session (GdmManager *self, -- GdmDisplay *old_display) --{ -- char *seat_id = NULL; -- char *session_id; -- int ret; -- -- g_object_get (G_OBJECT (old_display), -- "seat-id", &seat_id, -- NULL); -- -- ret = sd_seat_get_active (seat_id, &session_id, NULL); -- -- if (ret == 0) { -- GdmDisplay *display; -- -- display = gdm_display_store_find (self->priv->display_store, -- lookup_by_session_id, -- (gpointer) session_id); -- -- if (display == NULL) { -- activate_login_window_session_on_seat (self, seat_id); -- } -- } -- -- g_free (seat_id); --} -- - static const char * - get_username_for_greeter_display (GdmManager *manager, - GdmDisplay *display) -@@ -1692,7 +1955,6 @@ on_display_status_changed (GdmDisplay *display, - manager->priv->ran_once = TRUE; - } - maybe_start_pending_initial_login (manager, display); -- maybe_activate_other_session (manager, display); - break; - default: - break; -@@ -2027,11 +2289,57 @@ on_user_session_died (GdmSession *session, +@@ -2019,12 +2047,58 @@ on_user_session_died (GdmSession *session, + remove_user_session (manager, session); } ++#ifdef WITH_CONSOLE_KIT static char * +query_ck_for_display_device (GdmManager *manager, + GdmDisplay *display) @@ -877,7 +117,7 @@ Subject: require logind support + NULL); + + error = NULL; -+ command = g_strdup_printf (CONSOLEKIT_DIR "/ck-get-x11-display-device --display %s", ++ command = g_strdup_printf ("/usr/local/libexec/ck-get-x11-display-device --display %s", + display_name); + g_free (display_name); + @@ -900,47 +140,18 @@ Subject: require logind support + + return out; +} ++#endif + +static char * get_display_device (GdmManager *manager, GdmDisplay *display) { -- /* systemd finds the display device out on its own based on the display */ -- return NULL; +#ifdef WITH_SYSTEMD -+ if (LOGIND_RUNNING()) { -+ /* systemd finds the display device out on its own based on the display */ -+ return NULL; -+ } -+#endif -+ + /* systemd finds the display device out on its own based on the display */ + return NULL; ++#elif defined(WITH_CONSOLE_KIT) + return query_ck_for_display_device (manager, display); ++#endif } static void -@@ -2040,25 +2348,6 @@ on_session_reauthenticated (GdmSession *session, - GdmManager *manager) - { - gboolean fail_if_already_switched = FALSE; -- -- if (gdm_session_get_display_mode (session) == GDM_SESSION_DISPLAY_MODE_REUSE_VT) { -- const char *seat_id; -- char *session_id; -- -- seat_id = gdm_session_get_display_seat_id (session); -- if (get_login_window_session_id (seat_id, &session_id)) { -- GdmDisplay *display = gdm_display_store_find (manager->priv->display_store, -- lookup_by_session_id, -- (gpointer) session_id); -- -- if (display != NULL) { -- gdm_display_stop_greeter_session (display); -- gdm_display_unmanage (display); -- gdm_display_finish (display); -- } -- g_free (session_id); -- } -- } - - /* There should already be a session running, so jump to its - * VT. In the event we're already on the right VT, (i.e. user diff --git a/x11/gdm/files/patch-daemon_gdm-server.c b/x11/gdm/files/patch-daemon_gdm-server.c index 22325e63a15f..136fc2bc9115 100644 --- a/x11/gdm/files/patch-daemon_gdm-server.c +++ b/x11/gdm/files/patch-daemon_gdm-server.c @@ -1,5 +1,5 @@ ---- daemon/gdm-server.c.orig 2017-05-05 16:40:44.000000000 +0200 -+++ daemon/gdm-server.c 2017-06-08 10:39:30.725180000 +0200 +--- daemon/gdm-server.c.orig 2022-01-28 21:55:35 UTC ++++ daemon/gdm-server.c @@ -43,7 +43,9 @@ #include <linux/vt.h> #endif @@ -10,12 +10,23 @@ #ifdef ENABLE_SYSTEMD_JOURNAL #include <systemd/sd-journal.h> -@@ -122,23 +124,65 @@ +@@ -84,6 +86,9 @@ struct _GdmServer + char *auth_file; + + guint child_watch_id; ++#ifndef HAVE_SIGWAITINFO ++ guint sigusr1_id; ++#endif + + gboolean is_initial; + }; +@@ -114,13 +119,60 @@ static void gdm_server_finalize (GObject G_DEFINE_TYPE (GdmServer, gdm_server, G_TYPE_OBJECT) ++#ifdef WITH_CONSOLE_KIT +static char * -+_gdm_server_query_ck_for_display_device (GdmServer *server) ++gdm_server_query_ck_for_display_device (GdmServer *server) +{ + char *out; + char *command; @@ -26,8 +37,8 @@ + g_return_val_if_fail (GDM_IS_SERVER (server), NULL); + + error = NULL; -+ command = g_strdup_printf (CONSOLEKIT_DIR "/ck-get-x11-display-device --display %s", -+ server->priv->display_name); ++ command = g_strdup_printf ("/usr/local/libexec/ck-get-x11-display-device --display %s", ++ server->display_name); + + g_debug ("GdmServer: Running helper %s", command); + out = NULL; @@ -48,120 +59,125 @@ + + return out; +} ++#endif + char * gdm_server_get_display_device (GdmServer *server) { -- /* systemd finds the display device out on its own based on the display */ -- return NULL; -+#ifdef WITH_SYSTEMD -+ if (LOGIND_RUNNING()) { -+ /* systemd finds the display device out on its own based on the display */ -+ return NULL; -+ } -+#endif -+ -+ if (server->priv->display_device == NULL) { -+ server->priv->display_device = -+ _gdm_server_query_ck_for_display_device (server); -+ ++#if defined(WITH_SYSTEMD) + /* systemd finds the display device out on its own based on the display */ + return NULL; ++#elif defined(WITH_CONSOLE_KIT) ++ if (server->display_device == NULL) { ++ server->display_device = ++ gdm_server_query_ck_for_display_device (server); + g_object_notify (G_OBJECT (server), "display-device"); + } -+ -+ return g_strdup (server->priv->display_device); ++ return g_strdup (server->display_device); ++#endif } ++#ifdef HAVE_SIGWAITINFO static void gdm_server_ready (GdmServer *server) { - g_debug ("GdmServer: Got USR1 from X server - emitting READY"); -- -- gdm_run_script (GDMCONFDIR "/Init", GDM_USERNAME, -- server->priv->display_name, -- NULL, /* hostname */ -- server->priv->auth_file); -- +@@ -133,7 +185,26 @@ gdm_server_ready (GdmServer *server) + g_signal_emit (server, signals[READY], 0); } ++#else ++static gboolean ++gdm_server_ready (gpointer user_data) ++{ ++ GdmServer *server = user_data; -@@ -226,8 +270,10 @@ - debug_options = ""; - } - --#define X_SERVER_ARG_FORMAT " -background none -noreset -verbose %s%s" -+ #define X_SERVER_ARG_FORMAT " -background none -noreset -verbose %s%s" - -+#ifdef WITH_SYSTEMD ++ g_debug ("GdmServer: Got USR1 from X server - emitting READY"); + - /* This is a temporary hack to work around the fact that XOrg - * currently lacks support for multi-seat hotplugging for - * display devices. This bit should be removed as soon as XOrg -@@ -242,6 +288,10 @@ - * wasn't booted using systemd, or b) the wrapper tool is - * missing, or c) we are running for the main seat 'seat0'. */ - -+ if (!LOGIND_RUNNING()) { -+ goto fallback; -+ } ++ gdm_run_script (GDMCONFDIR "/Init", GDM_USERNAME, ++ server->display_name, ++ NULL, /* hostname */ ++ server->auth_file); + - #ifdef ENABLE_SYSTEMD_JOURNAL - /* For systemd, we don't have a log file but instead log to stdout, - so set it to the xserver's built-in default verbosity */ -@@ -264,8 +314,9 @@ - return; - - fallback: -- server->priv->command = g_strdup_printf (X_SERVER X_SERVER_ARG_FORMAT, verbosity, debug_options); ++ g_signal_emit (server, signals[READY], 0); ++ ++ return FALSE; ++} +#endif - -+ server->priv->command = g_strdup_printf (X_SERVER X_SERVER_ARG_FORMAT, verbosity, debug_options); ++ ++#ifdef HAVE_SIGWAITINFO + static GSList *active_servers; + static gboolean sigusr1_thread_running; + static GCond sigusr1_thread_cond; +@@ -199,6 +270,7 @@ gdm_server_launch_sigusr1_thread_if_needed (void) + g_mutex_unlock (&sigusr1_thread_mutex); + } } ++#endif - static gboolean -@@ -315,10 +366,12 @@ - argv[len++] = g_strdup (server->priv->auth_file); + static void + gdm_server_init_command (GdmServer *server) +@@ -307,10 +379,12 @@ gdm_server_resolve_command_line (GdmServer *server, + argv[len++] = g_strdup (server->auth_file); } -- if (server->priv->display_seat_id != NULL) { +#ifdef WITH_SYSTEMD -+ if (LOGIND_RUNNING() && server->priv->display_seat_id != NULL) { + if (server->display_seat_id != NULL) { argv[len++] = g_strdup ("-seat"); - argv[len++] = g_strdup (server->priv->display_seat_id); + argv[len++] = g_strdup (server->display_seat_id); } +#endif /* If we were compiled with Xserver >= 1.17 we need to specify * '-listen tcp' as the X server dosen't listen on tcp sockets -@@ -657,18 +710,14 @@ - g_signal_emit (server, signals [DIED], 0, num); - } - -+ active_servers = g_slist_remove (active_servers, server); -+ - g_spawn_close_pid (server->priv->pid); - server->priv->pid = -1; - +@@ -656,11 +730,13 @@ server_child_watch (GPid pid, g_object_unref (server); } --static void --prune_active_servers_list (GdmServer *server) --{ -- active_servers = g_slist_remove (active_servers, server); --} -- ++#ifdef HAVE_SIGWAITINFO + static void + prune_active_servers_list (GdmServer *server) + { + active_servers = g_slist_remove (active_servers, server); + } ++#endif + static gboolean gdm_server_spawn (GdmServer *server, - const char *vtarg, -@@ -707,11 +756,6 @@ +@@ -699,6 +775,7 @@ gdm_server_spawn (GdmServer *server, + g_debug ("GdmServer: Starting X server process: %s", freeme); g_free (freeme); ++#ifdef HAVE_SIGWAITINFO active_servers = g_slist_append (active_servers, server); -- -- g_object_weak_ref (G_OBJECT (server), -- (GWeakNotify) -- prune_active_servers_list, -- server); + + g_object_weak_ref (G_OBJECT (server), +@@ -707,6 +784,7 @@ gdm_server_spawn (GdmServer *server, + server); gdm_server_launch_sigusr1_thread_if_needed (); ++#endif + + if (!g_spawn_async_with_pipes (NULL, + argv, +@@ -1044,6 +1122,9 @@ gdm_server_init (GdmServer *server) + server->pid = -1; + + server->log_dir = g_strdup (LOGDIR); ++#ifndef HAVE_SIGWAITINFO ++ server->sigusr1_id = g_unix_signal_add (SIGUSR1, gdm_server_ready, server); ++#endif + } + + static void +@@ -1055,6 +1136,11 @@ gdm_server_finalize (GObject *object) + g_return_if_fail (GDM_IS_SERVER (object)); + + server = GDM_SERVER (object); ++ ++#ifndef HAVE_SIGWAITINFO ++ if (server->sigusr1_id > 0) ++ g_source_remove (server->sigusr1_id); ++#endif + + gdm_server_stop (server); diff --git a/x11/gdm/files/patch-daemon_gdm-session-record.c b/x11/gdm/files/patch-daemon_gdm-session-record.c new file mode 100644 index 000000000000..bb55ed46b513 --- /dev/null +++ b/x11/gdm/files/patch-daemon_gdm-session-record.c @@ -0,0 +1,141 @@ +--- daemon/gdm-session-record.c.orig 2022-01-12 14:15:56 UTC ++++ daemon/gdm-session-record.c +@@ -27,12 +27,20 @@ + + #if defined(HAVE_UTMPX_H) + #include <utmpx.h> ++#define utmp utmpx + #endif + + #if defined(HAVE_UTMP_H) + #include <utmp.h> ++#include <util.h> + #endif + ++#if defined(HAVE_GETTTYENT) ++#include <fcntl.h> /* open(2) */ ++#include <ttyent.h> ++static int fd = -1; ++#endif ++ + #include <glib.h> + #include <glib/gi18n.h> + #include <glib/gstdio.h> +@@ -43,6 +51,9 @@ + #define GDM_BAD_SESSION_RECORDS_FILE "/var/log/btmp" + #endif + ++static void write_utmp_login_manually (struct utmp *ut); ++static void write_utmp_logout_manually (char *); ++ + #if !defined(GDM_NEW_SESSION_RECORDS_FILE) + # if defined(WTMPX_FILE) + # define GDM_NEW_SESSION_RECORDS_FILE WTMPX_FILE +@@ -168,6 +179,84 @@ record_set_line (UTMP *u, + g_debug ("using ut_line %.*s", (int) sizeof (u->ut_line), u->ut_line); + } + ++static void ++write_utmp_login_manually (struct utmp *ut) ++{ ++#if defined(HAVE_GETTTYENT) && defined(HAVE_UTMP_H) ++ UTMP ubuf; ++ int topslot = -1; ++ ++ g_debug ("Adding new utmp record"); ++ ++ /* ++ * First, loop through /etc/ttys, if needed, to initialize the ++ * top of the tty slots, since gdm has no tty. ++ */ ++ if (topslot < 0) { ++ topslot = 0; ++ while (getttyent () != (struct ttyent *) NULL) ++ topslot++; ++ } ++ if ((topslot < 0) || ((fd < 0) && ++ (fd = open (_PATH_UTMP, O_RDWR|O_CREAT, 0644)) < 0)) ++ return; ++ ++ /* ++ * Now find a slot that's not in use... ++ */ ++ (void) lseek (fd, (off_t) (topslot * sizeof (struct utmp)), SEEK_SET); ++ ++ while (1) { ++ if (read (fd, &ubuf, sizeof (struct utmp)) == ++ sizeof (struct utmp)) { ++ if (!ubuf.ut_name[0]) { ++ (void) lseek (fd, -(off_t) sizeof (struct utmp), ++ SEEK_CUR); ++ break; ++ } ++ topslot++; ++ } else { ++ (void) lseek (fd, (off_t) (topslot * ++ sizeof (struct utmp)), SEEK_SET); ++ break; ++ } ++ } ++ ++ (void) write (fd, ut, sizeof (struct utmp)); ++#endif ++} ++ ++static void ++write_utmp_logout_manually (char *line) ++{ ++#if defined(HAVE_GETTTYENT) && defined(HAVE_UTMP_H) ++ int rval = 1; ++ struct timeval tv; ++ UTMP ut; ++ ++ g_debug ("Removing utmp record"); ++ ++ if (fd >= 0) { ++ (void) lseek (fd, 0, SEEK_SET); ++ while (read (fd, &ut, sizeof (struct utmp)) == sizeof (struct utmp)) { ++ if (!ut.ut_name[0] || ++ strncmp (ut.ut_line, line, UT_LINESIZE)) ++ continue; ++ bzero (ut.ut_name, UT_NAMESIZE); ++ bzero (ut.ut_host, UT_HOSTSIZE); ++ gettimeofday (&tv, NULL); ++ ut.ut_time = tv.tv_sec; ++ (void) lseek (fd, -(off_t) sizeof (struct utmp), SEEK_CUR); ++ (void) write (fd, &ut, sizeof (struct utmp)); ++ rval = 0; ++ } ++ } ++ ++ if (rval != 0) ++ g_debug ("Failed to remove utmp record"); ++#endif ++} ++ + void + gdm_session_record_login (GPid session_pid, + const char *user_name, +@@ -214,8 +303,9 @@ gdm_session_record_login (GPid sessio + setutxent(); + pututxline (&session_record); + endutxent(); +-#elif defined(HAVE_LOGIN) +- login (&session_record); ++#else ++ if (strcmp (session_record.ut_name, "(unknown)") != 0) ++ write_utmp_login_manually (&session_record); + #endif + } + +@@ -259,8 +349,8 @@ gdm_session_record_logout (GPid sessi + setutxent(); + pututxline (&session_record); + endutxent(); +-#elif defined(HAVE_LOGOUT) +- logout (session_record.ut_line); ++#else ++ write_utmp_logout_manually (session_record.ut_line); + #endif + } + diff --git a/x11/gdm/files/patch-daemon_gdm-session-worker-job.c b/x11/gdm/files/patch-daemon_gdm-session-worker-job.c index cd7f6b0c27f1..484767fdc9d6 100644 --- a/x11/gdm/files/patch-daemon_gdm-session-worker-job.c +++ b/x11/gdm/files/patch-daemon_gdm-session-worker-job.c @@ -1,13 +1,5 @@ -$OpenBSD: patch-daemon_gdm-session-worker-job_c,v 1.1 2015/10/18 13:25:54 ajacoutot Exp $ - -REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) -From 9be58c9ec9a3a411492a5182ac4b0d51fdc3a323 Mon Sep 17 00:00:00 2001 -From: Ray Strode <rstrode@redhat.com> -Date: Fri, 12 Jun 2015 13:48:52 -0400 -Subject: require logind support - ---- daemon/gdm-session-worker-job.c.orig Mon Sep 21 16:12:33 2015 -+++ daemon/gdm-session-worker-job.c Sun Oct 18 14:23:39 2015 +--- daemon/gdm-session-worker-job.c.orig 2022-01-12 14:15:56 UTC ++++ daemon/gdm-session-worker-job.c @@ -36,7 +36,9 @@ #include <sys/prctl.h> #endif diff --git a/x11/gdm/files/patch-daemon_gdm-session-worker.c b/x11/gdm/files/patch-daemon_gdm-session-worker.c index 121ca11a0232..a05cb45b5d4c 100644 --- a/x11/gdm/files/patch-daemon_gdm-session-worker.c +++ b/x11/gdm/files/patch-daemon_gdm-session-worker.c @@ -1,31 +1,5 @@ -$OpenBSD: patch-daemon_gdm-session-worker_c,v 1.15 2017/03/12 12:58:03 nigel Exp $ - -REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) -From 1ac67f522f5690c27023d98096ca817f12f7eb88 Mon Sep 17 00:00:00 2001 -From: Ray Strode <rstrode@redhat.com> -Date: Fri, 12 Jun 2015 13:28:01 -0400 -Subject: drop consolekit support - -REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) -From 9be58c9ec9a3a411492a5182ac4b0d51fdc3a323 Mon Sep 17 00:00:00 2001 -From: Ray Strode <rstrode@redhat.com> -Date: Fri, 12 Jun 2015 13:48:52 -0400 -Subject: require logind support - -REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) -From a9cacb929470eb82582396984c61d5b611bfeb1a Mon Sep 17 00:00:00 2001 -From: Ray Strode <rstrode@redhat.com> -Date: Fri, 12 Jun 2015 14:33:40 -0400 -Subject: session: drop session-type property - -REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) -From 6942fb9b16bab7173bbd295fb19a9770289dbe0e Mon Sep 17 00:00:00 2001 -From: Tim Lunn <tim@feathertop.org> -Date: Mon, 11 Apr 2016 23:18:10 +1000 -Subject: gdm-session: set PAM_TTY when initialising pam - ---- daemon/gdm-session-worker.c.orig 2017-10-31 18:16:51.000000000 +0100 -+++ daemon/gdm-session-worker.c 2018-01-17 17:38:41.826277000 +0100 +--- daemon/gdm-session-worker.c.orig 2022-01-12 14:15:56 UTC ++++ daemon/gdm-session-worker.c @@ -28,9 +28,11 @@ #include <string.h> #include <sys/types.h> @@ -48,7 +22,7 @@ Subject: gdm-session: set PAM_TTY when initialising pam #ifdef ENABLE_SYSTEMD_JOURNAL #include <systemd/sd-journal.h> -@@ -93,7 +97,7 @@ +@@ -94,7 +98,7 @@ #endif #ifndef GDM_SESSION_DEFAULT_PATH @@ -57,7 +31,7 @@ Subject: gdm-session: set PAM_TTY when initialising pam #endif #ifndef GDM_SESSION_ROOT_UID -@@ -136,6 +140,10 @@ struct GdmSessionWorkerPrivate +@@ -126,6 +130,10 @@ struct GdmSessionWorkerPrivate int exit_code; @@ -68,17 +42,34 @@ Subject: gdm-session: set PAM_TTY when initialising pam pam_handle_t *pam_handle; GPid child_pid; -@@ -150,6 +158,7 @@ struct GdmSessionWorkerPrivate +@@ -140,6 +148,11 @@ struct GdmSessionWorkerPrivate char *hostname; char *username; char *log_file; ++#ifdef WITH_CONSOLE_KIT + char *session_type; ++ char *session_class; ++ char *session_service; ++#endif char *session_id; uid_t uid; gid_t gid; -@@ -223,6 +232,204 @@ G_DEFINE_TYPE_WITH_CODE (GdmSessionWorker, - G_IMPLEMENT_INTERFACE (GDM_DBUS_TYPE_WORKER, - worker_interface_init)) +@@ -207,6 +220,12 @@ typedef int (* GdmSessionWorkerPamNewMessagesFunc) (in + struct pam_response **, + gpointer); + ++#ifdef WITH_CONSOLE_KIT ++static char * ++gdm_session_worker_get_environment_variable (GdmSessionWorker *worker, ++ const char *key); ++#endif ++ + G_DEFINE_TYPE_WITH_CODE (GdmSessionWorker, + gdm_session_worker, + GDM_DBUS_TYPE_WORKER_SKELETON, +@@ -214,6 +233,211 @@ G_DEFINE_TYPE_WITH_CODE (GdmSessionWorker, + worker_interface_init) + G_ADD_PRIVATE (GdmSessionWorker)) +#ifdef WITH_CONSOLE_KIT +static gboolean @@ -94,7 +85,6 @@ Subject: gdm-session: set PAM_TTY when initialising pam + const char *display_name; + const char *display_device; + const char *display_hostname; -+ const char *session_type; + gint32 uid; + + g_assert (worker->priv->session_cookie == NULL); @@ -115,12 +105,6 @@ Subject: gdm-session: set PAM_TTY when initialising pam + display_device = ""; + } + -+ if (worker->priv->session_type != NULL) { -+ session_type = worker->priv->session_type; -+ } else { -+ session_type = ""; -+ } -+ + g_assert (worker->priv->username != NULL); + + gdm_get_pwent_for_name (worker->priv->username, &pwent); @@ -147,15 +131,29 @@ Subject: gdm-session: set PAM_TTY when initialising pam + g_variant_builder_add_parsed (&builder, "('x11-display', <%s>)", display_name); + g_variant_builder_add_parsed (&builder, "('remote-host-name', <%s>)", display_hostname); + g_variant_builder_add_parsed (&builder, "('is-local', <%b>)", worker->priv->display_is_local); -+ g_variant_builder_add_parsed (&builder, "('session-type', <%s>)", session_type); ++ ++ worker->priv->session_type = gdm_session_worker_get_environment_variable (worker, "XDG_SESSION_TYPE"); ++ if (worker->priv->session_type != NULL) { ++ g_variant_builder_add_parsed (&builder, "('session-type', <%s>)", worker->priv->session_type); ++ } ++ ++ worker->priv->session_class = gdm_session_worker_get_environment_variable (worker, "XDG_SESSION_CLASS"); ++ if (worker->priv->session_class != NULL) { ++ g_variant_builder_add_parsed (&builder, "('session-class', <%s>)", worker->priv->session_class); ++ } ++ ++ worker->priv->session_service = gdm_session_worker_get_environment_variable (worker, "XDG_SESSION_SERVICE"); ++ if (worker->priv->session_service != NULL) { ++ g_variant_builder_add_parsed (&builder, "('session-service', <%s>)", worker->priv->session_service); ++ } + + parameters = g_variant_builder_end (&builder); + in_args = g_variant_new_tuple (¶meters, 1); + + reply = g_dbus_connection_call_sync (system_bus, -+ "org.freedesktop.ConsoleKit", -+ "/org/freedesktop/ConsoleKit/Manager", -+ "org.freedesktop.ConsoleKit.Manager", ++ CK_NAME, ++ CK_MANAGER_PATH, ++ CK_MANAGER_INTERFACE, + "OpenSessionWithParameters", + in_args, + G_VARIANT_TYPE ("(s)"), @@ -202,9 +200,9 @@ Subject: gdm-session: set PAM_TTY when initialising pam + } + + reply = g_dbus_connection_call_sync (system_bus, -+ "org.freedesktop.ConsoleKit", -+ "/org/freedesktop/ConsoleKit/Manager", -+ "org.freedesktop.ConsoleKit.Manager", ++ CK_NAME, ++ CK_MANAGER_PATH, ++ CK_MANAGER_INTERFACE, + "CloseSession", + g_variant_new ("(s)", worker->priv->session_cookie), + G_VARIANT_TYPE ("(b)"), @@ -252,9 +250,9 @@ Subject: gdm-session: set PAM_TTY when initialising pam + } + + reply = g_dbus_connection_call_sync (system_bus, -+ "org.freedesktop.ConsoleKit", -+ "/org/freedesktop/ConsoleKit/Manager", -+ "org.freedesktop.ConsoleKit.Manager", ++ CK_NAME, ++ CK_MANAGER_PATH, ++ CK_MANAGER_INTERFACE, + "GetSessionForCookie", + g_variant_new ("(s)", worker->priv->session_cookie), + G_VARIANT_TYPE ("(o)"), @@ -281,7 +279,7 @@ Subject: gdm-session: set PAM_TTY when initialising pam /* adapted from glib script_execute */ static void script_execute (const gchar *file, -@@ -674,7 +881,9 @@ gdm_session_worker_process_pam_message (GdmSessionWork +@@ -670,7 +894,9 @@ gdm_session_worker_process_pam_message (GdmSessionWork char *user_answer; gboolean res; char *utf8_msg; @@ -291,7 +289,7 @@ Subject: gdm-session: set PAM_TTY when initialising pam if (response != NULL) { *response = NULL; -@@ -878,6 +1087,7 @@ gdm_session_worker_stop_auditor (GdmSessionWorker *wor +@@ -914,6 +1140,7 @@ gdm_session_worker_stop_auditor (GdmSessionWorker *wor worker->priv->auditor = NULL; } @@ -299,84 +297,43 @@ Subject: gdm-session: set PAM_TTY when initialising pam static void on_release_display (int signal) { -@@ -1003,6 +1213,7 @@ jump_to_vt (GdmSessionWorker *worker, +@@ -1056,6 +1283,7 @@ jump_to_vt (GdmSessionWorker *worker, close (active_vt_tty_fd); } +#endif static void - gdm_session_worker_uninitialize_pam (GdmSessionWorker *worker, -@@ -1033,11 +1244,13 @@ gdm_session_worker_uninitialize_pam (GdmSessionWorker - - gdm_session_worker_stop_auditor (worker); - -+#ifdef WITH_SYSTEMD - if (g_strcmp0 (worker->priv->display_seat_id, "seat0") == 0) { - if (worker->priv->login_vt != worker->priv->session_vt) { - jump_to_vt (worker, worker->priv->login_vt); - } - } -+#endif - - worker->priv->login_vt = 0; - worker->priv->session_vt = 0; -@@ -1088,6 +1301,7 @@ _get_xauth_for_pam (const char *x11_authority_file) - } - #endif - -+#ifdef WITH_SYSTEMD - static gboolean - ensure_login_vt (GdmSessionWorker *worker) - { -@@ -1099,7 +1313,7 @@ ensure_login_vt (GdmSessionWorker *worker) - - if (fd < 0) { - g_debug ("GdmSessionWorker: couldn't open VT master: %m"); -- return FALSE; -+ return FALSE; - } - - if (ioctl (fd, VT_GETSTATE, &vt_state) < 0) { -@@ -1113,6 +1327,7 @@ out: - close (fd); - return got_login_vt; - } -+#endif - - static gboolean - gdm_session_worker_initialize_pam (GdmSessionWorker *worker, -@@ -1129,7 +1344,6 @@ gdm_session_worker_initialize_pam (GdmSessionWorker + gdm_session_worker_set_state (GdmSessionWorker *worker, +@@ -1158,7 +1386,9 @@ gdm_session_worker_initialize_pam (GdmSessionWorker { struct pam_conv pam_conversation; int error_code; -- char tty_string[256]; ++#ifdef WITH_SYSTEMD + char tty_string[256]; ++#endif g_assert (worker->priv->pam_handle == NULL); -@@ -1196,10 +1410,12 @@ gdm_session_worker_initialize_pam (GdmSessionWorker - } - } - -+#ifdef WITH_SYSTEMD - /* set seat ID */ -- if (seat_id != NULL && seat_id[0] != '\0') { -+ if (seat_id != NULL && seat_id[0] != '\0' && LOGIND_RUNNING()) { +@@ -1230,6 +1460,10 @@ gdm_session_worker_initialize_pam (GdmSessionWorker gdm_session_worker_set_environment_variable (worker, "XDG_SEAT", seat_id); } -+#endif ++#ifdef WITH_CONSOLE_KIT ++ gdm_session_worker_set_environment_variable (worker, "XDG_SESSION_SERVICE", service); ++#endif ++ if (strcmp (service, "gdm-launch-environment") == 0) { gdm_session_worker_set_environment_variable (worker, "XDG_SESSION_CLASS", "greeter"); -@@ -1208,6 +1424,7 @@ gdm_session_worker_initialize_pam (GdmSessionWorker + } +@@ -1237,12 +1471,14 @@ gdm_session_worker_initialize_pam (GdmSessionWorker g_debug ("GdmSessionWorker: state SETUP_COMPLETE"); - worker->priv->state = GDM_SESSION_WORKER_STATE_SETUP_COMPLETE; + gdm_session_worker_set_state (worker, GDM_SESSION_WORKER_STATE_SETUP_COMPLETE); +#ifdef WITH_SYSTEMD - /* Temporarily set PAM_TTY with the currently active VT (login screen) + /* Temporarily set PAM_TTY with the login VT, PAM_TTY will be reset with the users VT right before the user session is opened */ - ensure_login_vt (worker); -@@ -1215,6 +1432,7 @@ gdm_session_worker_initialize_pam (GdmSessionWorker + g_snprintf (tty_string, 256, "/dev/tty%d", GDM_INITIAL_VT); pam_set_item (worker->priv->pam_handle, PAM_TTY, tty_string); if (!display_is_local) worker->priv->password_is_required = TRUE; @@ -384,16 +341,20 @@ Subject: gdm-session: set PAM_TTY when initialising pam out: if (error_code != PAM_SUCCESS) { -@@ -1509,7 +1727,7 @@ _lookup_passwd_info (const char *username, +@@ -1545,7 +1781,11 @@ _lookup_passwd_info (const char *username, if (passwd_entry->pw_shell != NULL && passwd_entry->pw_shell[0] != '\0') { *shellp = g_strdup (passwd_entry->pw_shell); } else { - *shellp = g_strdup ("/bin/bash"); ++#if defined(__OpenBSD__) ++ *shellp = g_strdup ("/bin/ksh"); ++#else + *shellp = g_strdup ("/bin/sh"); ++#endif } } ret = TRUE; -@@ -1762,6 +1980,26 @@ gdm_session_worker_get_environment (GdmSessionWorker * +@@ -1689,6 +1929,20 @@ gdm_session_worker_get_environment (GdmSessionWorker * return (const char * const *) pam_getenvlist (worker->priv->pam_handle); } @@ -401,12 +362,6 @@ Subject: gdm-session: set PAM_TTY when initialising pam +static void +register_ck_session (GdmSessionWorker *worker) +{ -+#ifdef WITH_SYSTEMD -+ if (LOGIND_RUNNING()) { -+ return; -+ } -+#endif -+ + open_ck_session (worker); + + if (worker->priv->session_cookie != NULL) { @@ -420,17 +375,18 @@ Subject: gdm-session: set PAM_TTY when initialising pam static gboolean run_script (GdmSessionWorker *worker, const char *dir) -@@ -1792,6 +2030,9 @@ session_worker_child_watch (GPid pid, +@@ -1766,6 +2020,10 @@ session_worker_child_watch (GPid pid, : WIFSIGNALED (status) ? WTERMSIG (status) : -1); +#ifdef WITH_CONSOLE_KIT + close_ck_session (worker); +#endif - ++ gdm_session_worker_uninitialize_pam (worker, PAM_SUCCESS); -@@ -1982,6 +2223,7 @@ gdm_session_worker_start_session (GdmSessionWorker *w + worker->priv->child_pid = -1; +@@ -1978,6 +2236,7 @@ gdm_session_worker_start_session (GdmSessionWorker *w error_code = PAM_SUCCESS; @@ -438,7 +394,7 @@ Subject: gdm-session: set PAM_TTY when initialising pam /* If we're in new vt mode, jump to the new vt now. There's no need to jump for * the other two modes: in the logind case, the session will activate itself when * ready, and in the reuse server case, we're already on the correct VT. */ -@@ -1990,6 +2232,7 @@ gdm_session_worker_start_session (GdmSessionWorker *w +@@ -1986,6 +2245,7 @@ gdm_session_worker_start_session (GdmSessionWorker *w jump_to_vt (worker, worker->priv->session_vt); } } @@ -446,7 +402,7 @@ Subject: gdm-session: set PAM_TTY when initialising pam if (!worker->priv->is_program_session && !run_script (worker, GDMCONFDIR "/PostLogin")) { g_set_error (error, -@@ -2054,6 +2297,7 @@ gdm_session_worker_start_session (GdmSessionWorker *w +@@ -2048,6 +2308,7 @@ gdm_session_worker_start_session (GdmSessionWorker *w _exit (EXIT_FAILURE); } @@ -454,7 +410,7 @@ Subject: gdm-session: set PAM_TTY when initialising pam /* Take control of the tty */ if (needs_controlling_terminal) { -@@ -2061,6 +2305,7 @@ gdm_session_worker_start_session (GdmSessionWorker *w +@@ -2055,6 +2316,7 @@ gdm_session_worker_start_session (GdmSessionWorker *w g_debug ("GdmSessionWorker: could not take control of tty: %m"); } } @@ -462,7 +418,7 @@ Subject: gdm-session: set PAM_TTY when initialising pam #ifdef HAVE_LOGINCAP if (setusercontext (NULL, passwd_entry, passwd_entry->pw_uid, LOGIN_SETALL) < 0) { -@@ -2205,11 +2450,13 @@ gdm_session_worker_start_session (GdmSessionWorker *w +@@ -2186,6 +2448,7 @@ gdm_session_worker_start_session (GdmSessionWorker *w return TRUE; } @@ -470,33 +426,7 @@ Subject: gdm-session: set PAM_TTY when initialising pam static gboolean set_up_for_new_vt (GdmSessionWorker *worker) { - int fd; - char vt_string[256], tty_string[256]; -+ struct vt_stat vt_state = { 0 }; - int session_vt = 0; - - fd = open ("/dev/tty0", O_RDWR | O_NOCTTY); -@@ -2219,6 +2466,11 @@ set_up_for_new_vt (GdmSessionWorker *worker) - return FALSE; - } - -+ if (ioctl (fd, VT_GETSTATE, &vt_state) < 0) { -+ g_debug ("GdmSessionWorker: couldn't get current VT: %m"); -+ goto fail; -+ } -+ - if (worker->priv->display_is_initial) { - session_vt = atoi (GDM_INITIAL_VT); - } else { -@@ -2228,6 +2480,7 @@ set_up_for_new_vt (GdmSessionWorker *worker) - } - } - -+ worker->priv->login_vt = vt_state.v_active; - worker->priv->session_vt = session_vt; - - close (fd); -@@ -2290,6 +2543,7 @@ fail: +@@ -2286,6 +2549,7 @@ fail: close (fd); return FALSE; } @@ -504,7 +434,7 @@ Subject: gdm-session: set PAM_TTY when initialising pam static gboolean set_up_for_current_vt (GdmSessionWorker *worker, -@@ -2357,12 +2611,14 @@ set_up_for_current_vt (GdmSessionWorker *worker, +@@ -2353,12 +2617,14 @@ set_up_for_current_vt (GdmSessionWorker *worker, } #endif @@ -519,33 +449,31 @@ Subject: gdm-session: set PAM_TTY when initialising pam return TRUE; out: -@@ -2386,6 +2642,7 @@ gdm_session_worker_open_session (GdmSessionWorker *wo - return FALSE; - } +@@ -2384,6 +2650,7 @@ gdm_session_worker_open_session (GdmSessionWorker *wo break; -+#ifdef WITH_SYSTEMD case GDM_SESSION_DISPLAY_MODE_NEW_VT: case GDM_SESSION_DISPLAY_MODE_LOGIND_MANAGED: ++#ifdef WITH_SYSTEMD if (!set_up_for_new_vt (worker)) { -@@ -2396,6 +2653,7 @@ gdm_session_worker_open_session (GdmSessionWorker *wo + g_set_error (error, + GDM_SESSION_WORKER_ERROR, +@@ -2391,6 +2658,7 @@ gdm_session_worker_open_session (GdmSessionWorker *wo + "Unable to open VT"); return FALSE; } - break; +#endif + break; } - flags = 0; -@@ -2417,8 +2675,18 @@ gdm_session_worker_open_session (GdmSessionWorker *wo +@@ -2413,8 +2681,16 @@ gdm_session_worker_open_session (GdmSessionWorker *wo g_debug ("GdmSessionWorker: state SESSION_OPENED"); - worker->priv->state = GDM_SESSION_WORKER_STATE_SESSION_OPENED; + gdm_session_worker_set_state (worker, GDM_SESSION_WORKER_STATE_SESSION_OPENED); -+#ifdef WITH_SYSTEMD ++#if defined(WITH_SYSTEMD) session_id = gdm_session_worker_get_environment_variable (worker, "XDG_SESSION_ID"); -+#endif - -+#ifdef WITH_CONSOLE_KIT ++#elif defined(WITH_CONSOLE_KIT) + register_ck_session (worker); -+ + + if (session_id == NULL) { + session_id = get_ck_session_id (worker); + } @@ -554,27 +482,7 @@ Subject: gdm-session: set PAM_TTY when initialising pam if (session_id != NULL) { g_free (worker->priv->session_id); worker->priv->session_id = session_id; -@@ -2523,6 +2791,19 @@ gdm_session_worker_handle_set_session_name (GdmDBusWor - } - - static gboolean -+gdm_session_worker_handle_set_session_type (GdmDBusWorker *object, -+ GDBusMethodInvocation *invocation, -+ const char *session_type) -+{ -+ GdmSessionWorker *worker = GDM_SESSION_WORKER (object); -+ g_debug ("GdmSessionWorker: session type set to %s", session_type); -+ g_free (worker->priv->session_type); -+ worker->priv->session_type = g_strdup (session_type); -+ gdm_dbus_worker_complete_set_session_type (object, invocation); -+ return TRUE; -+} -+ -+static gboolean - gdm_session_worker_handle_set_session_display_mode (GdmDBusWorker *object, - GDBusMethodInvocation *invocation, - const char *str) -@@ -2949,6 +3230,7 @@ gdm_session_worker_handle_open (GdmDBusWorker +@@ -2968,6 +3244,7 @@ gdm_session_worker_handle_open (GdmDBusWorker return TRUE; } @@ -582,7 +490,7 @@ Subject: gdm-session: set PAM_TTY when initialising pam static char ** filter_extensions (const char * const *extensions) { -@@ -2974,6 +3256,7 @@ filter_extensions (const char * const *extensions) +@@ -2993,6 +3270,7 @@ filter_extensions (const char * const *extensions) return filtered_extensions; } @@ -590,7 +498,7 @@ Subject: gdm-session: set PAM_TTY when initialising pam static gboolean gdm_session_worker_handle_initialize (GdmDBusWorker *object, -@@ -2993,8 +3276,10 @@ gdm_session_worker_handle_initialize (GdmDBusWorker +@@ -3012,8 +3290,10 @@ gdm_session_worker_handle_initialize (GdmDBusWorker while (g_variant_iter_loop (&iter, "{sv}", &key, &value)) { if (g_strcmp0 (key, "service") == 0) { worker->priv->service = g_variant_dup_string (value, NULL); @@ -601,11 +509,3 @@ Subject: gdm-session: set PAM_TTY when initialising pam } 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) { -@@ -3434,6 +3719,7 @@ worker_interface_init (GdmDBusWorkerIface *interface) - interface->handle_open = gdm_session_worker_handle_open; - interface->handle_set_language_name = gdm_session_worker_handle_set_language_name; - interface->handle_set_session_name = gdm_session_worker_handle_set_session_name; -+ interface->handle_set_session_type = gdm_session_worker_handle_set_session_type; - interface->handle_set_session_display_mode = gdm_session_worker_handle_set_session_display_mode; - interface->handle_set_environment_variable = gdm_session_worker_handle_set_environment_variable; - interface->handle_start_program = gdm_session_worker_handle_start_program; diff --git a/x11/gdm/files/patch-daemon_gdm-session-worker.xml b/x11/gdm/files/patch-daemon_gdm-session-worker.xml deleted file mode 100644 index 185ce246bc24..000000000000 --- a/x11/gdm/files/patch-daemon_gdm-session-worker.xml +++ /dev/null @@ -1,12 +0,0 @@ ---- daemon/gdm-session-worker.xml.orig 2015-07-20 13:13:42 UTC -+++ daemon/gdm-session-worker.xml -@@ -13,6 +13,9 @@ - <method name="SetSessionName"> - <arg name="session_name" direction="in" type="s" /> - </method> -+ <method name="SetSessionType"> -+ <arg name="session_type" direction="in" type="s"/> -+ </method> - <method name="SetSessionDisplayMode"> - <arg name="mode" direction="in" type="s"/> - </method> diff --git a/x11/gdm/files/patch-daemon_gdm-session.c b/x11/gdm/files/patch-daemon_gdm-session.c index a7c1f80f44be..86eeacc33840 100644 --- a/x11/gdm/files/patch-daemon_gdm-session.c +++ b/x11/gdm/files/patch-daemon_gdm-session.c @@ -1,56 +1,22 @@ -$OpenBSD: patch-daemon_gdm-session_c,v 1.12 2017/05/10 10:18:15 ajacoutot Exp $ - -REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) -From 9be58c9ec9a3a411492a5182ac4b0d51fdc3a323 Mon Sep 17 00:00:00 2001 -From: Ray Strode <rstrode@redhat.com> -Date: Fri, 12 Jun 2015 13:48:52 -0400 -Subject: require logind support - -REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) -From a9cacb929470eb82582396984c61d5b611bfeb1a Mon Sep 17 00:00:00 2001 -From: Ray Strode <rstrode@redhat.com> -Date: Fri, 12 Jun 2015 14:33:40 -0400 -Subject: session: drop session-type property - -Index: daemon/gdm-session.c ---- daemon/gdm-session.c.orig +--- daemon/gdm-session.c.orig 2022-01-12 14:15:56 UTC +++ daemon/gdm-session.c -@@ -3076,6 +3076,10 @@ gdm_session_bypasses_xsession (GdmSession *self) - g_return_val_if_fail (self != NULL, FALSE); - g_return_val_if_fail (GDM_IS_SESSION (self), FALSE); +@@ -116,6 +116,9 @@ struct _GdmSession -+ if (!LOGIND_RUNNING()) { -+ return GDM_SESSION_DISPLAY_MODE_REUSE_VT; -+ } -+ - #ifdef ENABLE_WAYLAND_SUPPORT - if (gdm_session_is_wayland_session (self)) { - bypasses_xsession = TRUE; -@@ -3168,6 +3172,27 @@ gdm_session_select_program (GdmSession *self, - g_free (self->priv->selected_program); + /* object lifetime scope */ + char *session_type; ++#ifdef WITH_CONSOLE_KIT ++ char *session_class; ++#endif + char *display_name; + char *display_hostname; + char *display_device; +@@ -371,7 +374,9 @@ get_system_session_dirs (GdmSession *self, + DATADIR "/xsessions/", + }; - self->priv->selected_program = g_strdup (text); -+} -+ -+void -+gdm_session_select_session_type (GdmSession *self, -+ const char *text) -+{ -+ GHashTableIter iter; -+ gpointer key, value; -+ -+ g_debug ("GdmSession: selecting session type '%s'", text); -+ -+ g_hash_table_iter_init (&iter, self->priv->conversations); -+ while (g_hash_table_iter_next (&iter, &key, &value)) { -+ GdmSessionConversation *conversation; -+ -+ conversation = (GdmSessionConversation *) value; -+ -+ gdm_dbus_worker_call_set_session_type (conversation->worker_proxy, -+ text, -+ NULL, NULL, NULL); -+ } - } ++#ifdef ENABLE_WAYLAND_SUPPORT + static const char *wayland_search_dir = DATADIR "/wayland-sessions/"; ++#endif + + search_array = g_array_new (TRUE, TRUE, sizeof (char *)); - void diff --git a/x11/gdm/files/patch-daemon_gdm-session.h b/x11/gdm/files/patch-daemon_gdm-session.h deleted file mode 100644 index dc8dd0dbf735..000000000000 --- a/x11/gdm/files/patch-daemon_gdm-session.h +++ /dev/null @@ -1,19 +0,0 @@ -$OpenBSD: patch-daemon_gdm-session_h,v 1.4 2016/04/26 08:25:04 ajacoutot Exp $ - -REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) -From a9cacb929470eb82582396984c61d5b611bfeb1a Mon Sep 17 00:00:00 2001 -From: Ray Strode <rstrode@redhat.com> -Date: Fri, 12 Jun 2015 14:33:40 -0400 -Subject: session: drop session-type property - ---- daemon/gdm-session.h.orig Tue Apr 19 07:00:04 2016 -+++ daemon/gdm-session.h Tue Apr 26 10:02:48 2016 -@@ -180,6 +180,8 @@ void gdm_session_answer_query - const char *text); - void gdm_session_select_program (GdmSession *session, - const char *command_line); -+void gdm_session_select_session_type (GdmSession *session, -+ const char *session_type); - void gdm_session_select_session (GdmSession *session, - const char *session_name); - void gdm_session_select_user (GdmSession *session, diff --git a/x11/gdm/files/patch-daemon_gdm-x-session.c b/x11/gdm/files/patch-daemon_gdm-x-session.c new file mode 100644 index 000000000000..5846e278e63e --- /dev/null +++ b/x11/gdm/files/patch-daemon_gdm-x-session.c @@ -0,0 +1,20 @@ +--- daemon/gdm-x-session.c.orig 2022-01-12 14:15:56 UTC ++++ daemon/gdm-x-session.c +@@ -114,7 +114,7 @@ prepare_auth_file (void) + GError *error = NULL; + gboolean prepared = FALSE; + Xauth auth_entry = { 0 }; +- char localhost[HOST_NAME_MAX + 1] = ""; ++ char localhost[256] = ""; + + g_debug ("Preparing auth file for X server"); + +@@ -124,7 +124,7 @@ prepare_auth_file (void) + return NULL; + } + +- if (gethostname (localhost, HOST_NAME_MAX) < 0) { ++ if (gethostname (localhost, 255) < 0) { + strncpy (localhost, "localhost", sizeof (localhost) - 1); + } + diff --git a/x11/gdm/files/patch-daemon_gdm-xdmcp-display-factory.c b/x11/gdm/files/patch-daemon_gdm-xdmcp-display-factory.c deleted file mode 100644 index 2d5aa39d1285..000000000000 --- a/x11/gdm/files/patch-daemon_gdm-xdmcp-display-factory.c +++ /dev/null @@ -1,11 +0,0 @@ ---- daemon/gdm-xdmcp-display-factory.c.orig 2014-03-21 08:21:57.405582553 +0000 -+++ daemon/gdm-xdmcp-display-factory.c 2014-03-21 08:22:13.029582593 +0000 -@@ -77,7 +77,7 @@ - #define DEFAULT_USE_MULTICAST FALSE - #define DEFAULT_MULTICAST_ADDRESS "ff02::1" - #define DEFAULT_HONOR_INDIRECT TRUE --#define DEFAULT_MAX_DISPLAYS_PER_HOST 1 -+#define DEFAULT_MAX_DISPLAYS_PER_HOST 2 - #define DEFAULT_MAX_DISPLAYS 16 - #define DEFAULT_MAX_PENDING_DISPLAYS 4 - #define DEFAULT_MAX_WAIT 30 diff --git a/x11/gdm/files/patch-daemon_main.c b/x11/gdm/files/patch-daemon_main.c new file mode 100644 index 000000000000..abdcc0604e97 --- /dev/null +++ b/x11/gdm/files/patch-daemon_main.c @@ -0,0 +1,28 @@ +--- daemon/main.c.orig 2022-01-12 14:15:56 UTC ++++ daemon/main.c +@@ -289,6 +289,7 @@ is_debug_set (void) + return debug; + } + ++#ifdef HAVE_SIGWAITINFO + /* SIGUSR1 is used by the X server to tell us that we're ready, so + * block it. We'll unblock it in the worker thread in gdm-server.c + */ +@@ -301,6 +302,7 @@ block_sigusr1 (void) + sigaddset (&mask, SIGUSR1); + sigprocmask (SIG_BLOCK, &mask, NULL); + } ++#endif + + int + main (int argc, +@@ -321,7 +323,9 @@ main (int argc, + { NULL } + }; + ++#ifdef HAVE_SIGWAITINFO + block_sigusr1 (); ++#endif + + bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); + textdomain (GETTEXT_PACKAGE); diff --git a/x11/gdm/files/patch-daemon_meson.build b/x11/gdm/files/patch-daemon_meson.build new file mode 100644 index 000000000000..b9d96a12b5dc --- /dev/null +++ b/x11/gdm/files/patch-daemon_meson.build @@ -0,0 +1,18 @@ +--- daemon/meson.build.orig 2022-01-12 14:15:56 UTC ++++ daemon/meson.build +@@ -128,6 +128,7 @@ endif + gdm_session_worker = executable('gdm-session-worker', + gdm_session_worker_src, + dependencies: gdm_session_worker_deps, ++ link_args : ['-lutil'], + include_directories: gdm_session_worker_includes, + install: true, + install_dir: get_option('libexecdir'), +@@ -207,6 +208,7 @@ endif + gdm_daemon = executable('gdm', + [ gdm_daemon_sources, gdm_daemon_gen_sources ], + dependencies: gdm_daemon_deps, ++ link_args : ['-lutil'], + include_directories: config_h_dir, + install: true, + install_dir: get_option('sbindir') diff --git a/x11/gdm/files/patch-data_61-gdm.rules.in b/x11/gdm/files/patch-data_61-gdm.rules.in new file mode 100644 index 000000000000..7818313a987a --- /dev/null +++ b/x11/gdm/files/patch-data_61-gdm.rules.in @@ -0,0 +1,23 @@ +--- data/61-gdm.rules.in.orig 2022-01-12 14:15:56 UTC ++++ data/61-gdm.rules.in +@@ -10,7 +10,9 @@ IMPORT{cmdline}="nomodeset", GOTO="gdm_disable_wayland + LABEL="gdm_nomodeset_end" + + # Disable wayland when nvidia modeset is disabled or when drivers are a lower +-# version than 470, in any case always prefer Xorg ++# version than 470, ++# For versions above 470 but lower than 510 prefer Xorg, ++# Above 510, prefer Wayland. + KERNEL!="nvidia_drm", GOTO="gdm_nvidia_drm_end" + SUBSYSTEM!="module", GOTO="gdm_nvidia_drm_end" + ACTION!="add", GOTO="gdm_nvidia_drm_end" +@@ -18,6 +20,9 @@ ACTION!="add", GOTO="gdm_nvidia_drm_end" + ATTR{parameters/modeset}!="Y", GOTO="gdm_disable_wayland" + # disable wayland for nvidia drivers versions lower than 470 + ATTR{version}=="4[0-6][0-9].*|[0-3][0-9][0-9].*|[0-9][0-9].*|[0-9].*", GOTO="gdm_disable_wayland" ++# For nvidia drivers versions Above 510, keep Wayland by default ++ATTR{version}=="[5-9][1-9][0-9].*", GOTO="gdm_end" ++# For nvidia drivers versions 470-495, prefer Xorg by default + GOTO="gdm_prefer_xorg" + LABEL="gdm_nvidia_drm_end" + diff --git a/x11/gdm/files/patch-data_Init.in b/x11/gdm/files/patch-data_Init.in index b89e85ebedf8..3b330208b754 100644 --- a/x11/gdm/files/patch-data_Init.in +++ b/x11/gdm/files/patch-data_Init.in @@ -1,13 +1,66 @@ -$OpenBSD: patch-data_Init_in,v 1.7 2015/04/15 14:47:00 ajacoutot Exp $ ---- data/Init.in.orig Thu Apr 2 15:52:42 2015 -+++ data/Init.in Wed Apr 15 16:43:30 2015 -@@ -6,6 +6,9 @@ +--- data/Init.in.orig 2022-01-12 14:15:56 UTC ++++ data/Init.in +@@ -6,6 +6,19 @@ PATH="@X_PATH@:$PATH" OLD_IFS=$IFS -+# enhance fade in look -+xsetroot -solid black ++# enhance fade in look; ++# gnome-shell-3.38.1/data/theme/gnome-shell-sass/widgets/_screen-shield.scss: ++# #lockDialogGroup { ++# background-color: lighten(#2e3436, 8%); ++# } ++xsetroot -solid "#2e3436" ++ ++# wait for ttys to be initialized ++while ! pgrep -qf "^/usr/libexec/getty "; do ++ sleep 1 ++ [ $((i++)) -ge 10 ] && break ++done + gdmwhich () { COMMAND="$1" OUTPUT= +@@ -22,10 +35,10 @@ gdmwhich () { + echo "$OUTPUT" + } + +-if [ -f /etc/X11/Xresources ]; then +- sysresources=/etc/X11/Xresources ++if [ -f /usr/local/usr/local/usr/local/usr/local/usr/local/usr/local/usr/local/etc/X11/Xresources ]; then ++ sysresources=/usr/local/usr/local/usr/local/usr/local/usr/local/usr/local/usr/local/etc/X11/Xresources + else +- sysresources=/usr/etc/X11/Xresources ++ sysresources=/usr/usr/local/usr/local/usr/local/usr/local/usr/local/usr/local/usr/local/etc/X11/Xresources + fi + + # merge in defaults +@@ -33,10 +46,10 @@ if [ -f "$sysresources" ]; then + xrdb -nocpp -merge "$sysresources" + fi + +-if [ -f /etc/X11/Xmodmap ]; then +- sysmodmap=/etc/X11/Xmodmap ++if [ -f /usr/local/usr/local/usr/local/usr/local/usr/local/usr/local/usr/local/etc/X11/Xmodmap ]; then ++ sysmodmap=/usr/local/usr/local/usr/local/usr/local/usr/local/usr/local/usr/local/etc/X11/Xmodmap + else +- sysmodmap=/usr/etc/X11/Xmodmap ++ sysmodmap=/usr/usr/local/usr/local/usr/local/usr/local/usr/local/usr/local/usr/local/etc/X11/Xmodmap + fi + + XMODMAP=`gdmwhich xmodmap` +@@ -93,5 +106,15 @@ if [ "x$SETXKBMAP" != "x" ] ; then + fi + fi + fi ++ ++# /usr/local/usr/local/usr/local/usr/local/usr/local/usr/local/usr/local/etc/X11/xenodm/GiveConsole, fbtab(5) ++if [ -c /dev/dri/card0 ]; then ++ /sbin/chown _gdm /dev/dri/card0 ++fi ++if [ -c /dev/dri/renderD128 ]; then ++ /sbin/chown _gdm /dev/dri/renderD128 ++fi ++# XXX OpenBSD needs an implementation of XDG_RUNTIME_DIR ++rm -rf /var/db/gdm/.cache/gnome-shell/runtime-state-* + + exit 0 diff --git a/x11/gdm/files/patch-data_PostSession.in b/x11/gdm/files/patch-data_PostSession.in new file mode 100644 index 000000000000..a7d5626f8e1c --- /dev/null +++ b/x11/gdm/files/patch-data_PostSession.in @@ -0,0 +1,14 @@ +--- data/PostSession.in.orig 2022-01-12 14:15:56 UTC ++++ data/PostSession.in +@@ -1,3 +1,11 @@ + #!/bin/sh + ++# /usr/local/usr/local/usr/local/usr/local/usr/local/usr/local/usr/local/etc/X11/xenodm/TakeConsole, fbtab(5) ++if [ -c /dev/dri/card0 ]; then ++ /sbin/chown root /dev/dri/card0 ++fi ++if [ -c /dev/dri/renderD128 ]; then ++ /sbin/chown root /dev/dri/renderD128 ++fi ++ + exit 0 diff --git a/x11/gdm/files/patch-data_PreSession.in b/x11/gdm/files/patch-data_PreSession.in new file mode 100644 index 000000000000..4c38db5f77ca --- /dev/null +++ b/x11/gdm/files/patch-data_PreSession.in @@ -0,0 +1,14 @@ +--- data/PreSession.in.orig 2022-01-12 14:15:56 UTC ++++ data/PreSession.in +@@ -7,3 +7,11 @@ + # Note that output goes into the .xsession-errors file for easy debugging + # + PATH="@X_PATH@:$PATH" ++ ++# /usr/local/usr/local/usr/local/usr/local/usr/local/usr/local/usr/local/etc/X11/xenodm/GiveConsole, fbtab(5) ++if [ -c /dev/dri/card0 ]; then ++ /sbin/chown $USER /dev/dri/card0 ++fi ++if [ -c /dev/dri/renderD128 ]; then ++ /sbin/chown $USER /dev/dri/renderD128 ++fi diff --git a/x11/gdm/files/patch-data_Xsession.in b/x11/gdm/files/patch-data_Xsession.in deleted file mode 100644 index 9675cb2af95a..000000000000 --- a/x11/gdm/files/patch-data_Xsession.in +++ /dev/null @@ -1,21 +0,0 @@ ---- data/Xsession.in.orig 2014-05-08 18:53:58.000000000 +0200 -+++ data/Xsession.in 2014-05-08 18:54:21.000000000 +0200 -@@ -184,6 +184,10 @@ - fi - fi - -+# Do not start ssh-agent(1) in case we run gnome-session (gnome-keyring -+# already provides the functionality of an SSH agent), see: -+# https://bugzilla.redhat.com/show_bug.cgi?id=441123 -+if [ "x$command" != "xgnome-session" ]; then - # add ssh-agent if found - sshagent="`gdmwhich ssh-agent`" - if [ -n "$sshagent" ] && [ -x "$sshagent" ] && [ -z "$SSH_AUTH_SOCK" ]; then -@@ -191,6 +195,7 @@ - elif [ -z "$sshagent" ] ; then - echo "$0: ssh-agent not found!" - fi -+fi - - echo "$0: Setup done, will execute: $command" - diff --git a/x11/gdm/files/patch-data_applications_mime-dummy-handler.desktop b/x11/gdm/files/patch-data_applications_mime-dummy-handler.desktop deleted file mode 100644 index 8ed03d6e8f6c..000000000000 --- a/x11/gdm/files/patch-data_applications_mime-dummy-handler.desktop +++ /dev/null @@ -1,10 +0,0 @@ ---- data/applications/mime-dummy-handler.desktop.orig 2015-05-29 13:27:05.000000000 +0200 -+++ data/applications/mime-dummy-handler.desktop 2015-06-04 07:47:55.014724000 +0200 -@@ -1,6 +1,6 @@ - [Desktop Entry] - Type=Application - Name=Dummy URI Handler --Exec=true %U -+Exec=/usr/bin/true %U - Terminal=false - StartupNotify=false diff --git a/x11/gdm/files/patch-data_dconf_defaults_00-upstream-settings b/x11/gdm/files/patch-data_dconf_defaults_00-upstream-settings deleted file mode 100644 index 7e421494d96d..000000000000 --- a/x11/gdm/files/patch-data_dconf_defaults_00-upstream-settings +++ /dev/null @@ -1,11 +0,0 @@ ---- data/dconf/defaults/00-upstream-settings.orig 2015-05-29 13:27:05.000000000 +0200 -+++ data/dconf/defaults/00-upstream-settings 2015-06-04 07:49:07.773567000 +0200 -@@ -13,7 +13,7 @@ - show-desktop-icons=false - - [org/gnome/desktop/default-applications/terminal] --exec='true' -+exec='/usr/bin/true' - - [org/gnome/desktop/interface] - toolkit-accessibility=true diff --git a/x11/gdm/files/patch-data_gdm.conf-custom.in b/x11/gdm/files/patch-data_gdm.conf-custom.in deleted file mode 100644 index 7bf827126730..000000000000 --- a/x11/gdm/files/patch-data_gdm.conf-custom.in +++ /dev/null @@ -1,12 +0,0 @@ ---- data/gdm.conf-custom.in.orig 2013-11-20 10:35:05.845253412 +0000 -+++ data/gdm.conf-custom.in 2013-11-20 10:35:11.644252821 +0000 -@@ -2,6 +2,9 @@ - - [daemon] - -+HaltCommand=/sbin/shutdown -p now -+RebootCommand=/sbin/shutdown -r now -+ - [security] - - [xdmcp] diff --git a/x11/gdm/files/patch-data_gdm.schemas.in.in b/x11/gdm/files/patch-data_gdm.schemas.in.in deleted file mode 100644 index f52dd8bd5698..000000000000 --- a/x11/gdm/files/patch-data_gdm.schemas.in.in +++ /dev/null @@ -1,11 +0,0 @@ ---- data/gdm.schemas.in.in.orig 2009-05-16 18:17:53.000000000 -0400 -+++ data/gdm.schemas.in.in 2009-05-16 18:18:01.000000000 -0400 -@@ -77,7 +77,7 @@ - <schema> - <key>xdmcp/DisplaysPerHost</key> - <signature>i</signature> -- <default>1</default> -+ <default>2</default> - </schema> - <schema> - <key>xdmcp/Port</key> diff --git a/x11/gdm/files/patch-data_gnome-login.session.in b/x11/gdm/files/patch-data_gnome-login.session.in deleted file mode 100644 index ed6dcfd0efcf..000000000000 --- a/x11/gdm/files/patch-data_gnome-login.session.in +++ /dev/null @@ -1,7 +0,0 @@ ---- data/gnome-login.session.in.orig 2018-08-01 19:00:01 UTC -+++ data/gnome-login.session.in -@@ -1,3 +1,3 @@ - [GNOME Session] - Name=Display Manager --RequiredComponents=org.gnome.Shell;org.gnome.SettingsDaemon.A11ySettings;org.gnome.SettingsDaemon.Clipboard;org.gnome.SettingsDaemon.Color;org.gnome.SettingsDaemon.Datetime;org.gnome.SettingsDaemon.Housekeeping;org.gnome.SettingsDaemon.Keyboard;org.gnome.SettingsDaemon.MediaKeys;org.gnome.SettingsDaemon.Mouse;org.gnome.SettingsDaemon.Power;org.gnome.SettingsDaemon.PrintNotifications;org.gnome.SettingsDaemon.Rfkill;org.gnome.SettingsDaemon.ScreensaverProxy;org.gnome.SettingsDaemon.Sharing;org.gnome.SettingsDaemon.Smartcard;org.gnome.SettingsDaemon.Sound;org.gnome.SettingsDaemon.Wacom;org.gnome.SettingsDaemon.XSettings; -+RequiredComponents=org.gnome.Shell;org.gnome.SettingsDaemon.A11ySettings;org.gnome.SettingsDaemon.Color;org.gnome.SettingsDaemon.Datetime;org.gnome.SettingsDaemon.Housekeeping;org.gnome.SettingsDaemon.Keyboard;org.gnome.SettingsDaemon.MediaKeys;org.gnome.SettingsDaemon.Power;org.gnome.SettingsDaemon.PrintNotifications;org.gnome.SettingsDaemon.Rfkill;org.gnome.SettingsDaemon.ScreensaverProxy;org.gnome.SettingsDaemon.Sharing;org.gnome.SettingsDaemon.Smartcard;org.gnome.SettingsDaemon.Sound;org.gnome.SettingsDaemon.Wacom;org.gnome.SettingsDaemon.XSettings; diff --git a/x11/gdm/files/patch-data_meson.build b/x11/gdm/files/patch-data_meson.build new file mode 100644 index 000000000000..7ce3022632a4 --- /dev/null +++ b/x11/gdm/files/patch-data_meson.build @@ -0,0 +1,77 @@ +--- data/meson.build.orig 2022-01-12 14:15:56 UTC ++++ data/meson.build +@@ -164,41 +164,43 @@ else + service_config.set('PLYMOUTH_QUIT_SERVICE', '') + endif + +-if get_option('systemdsystemunitdir') != '' +- systemd_systemunitdir = get_option('systemdsystemunitdir') +-else +- systemd_systemunitdir = systemd_dep.get_pkgconfig_variable('systemdsystemunitdir') +-endif ++if host_machine.system() == 'linux' ++ if get_option('systemdsystemunitdir') != '' ++ systemd_systemunitdir = get_option('systemdsystemunitdir') ++ else ++ systemd_systemunitdir = systemd_dep.get_pkgconfig_variable('systemdsystemunitdir') ++ endif + +-if get_option('systemduserunitdir') != '' +- systemd_userunitdir = get_option('systemduserunitdir') +-else +- systemd_userunitdir = systemd_dep.get_pkgconfig_variable('systemduserunitdir', +- define_variable: ['prefix', get_option('prefix')]) +-endif ++ if get_option('systemduserunitdir') != '' ++ systemd_userunitdir = get_option('systemduserunitdir') ++ else ++ systemd_userunitdir = systemd_dep.get_pkgconfig_variable('systemduserunitdir', ++ define_variable: ['prefix', get_option('prefix')]) ++ endif + +-configure_file( +- input: 'gdm.service.in', +- output: '@BASENAME@', +- configuration: service_config, +- install_dir: systemd_systemunitdir, +- format: 'cmake' +-) ++ configure_file( ++ input: 'gdm.service.in', ++ output: '@BASENAME@', ++ configuration: service_config, ++ install_dir: systemd_systemunitdir, ++ format: 'cmake' ++ ) + +-gdm_gnome_session_wanted_targets = [] +-foreach component: gdm_gnome_user_session_wanted_components +- gdm_gnome_session_wanted_targets += 'Wants=@0@.target'.format(component) +-endforeach ++ gdm_gnome_session_wanted_targets = [] ++ foreach component: gdm_gnome_user_session_wanted_components ++ gdm_gnome_session_wanted_targets += 'Wants=@0@.target'.format(component) ++ endforeach + +-configure_file( +- input: 'session.conf.in', +- output: 'session.conf', +- configuration: { +- 'requires_component': gdm_gnome_shell_component, +- 'wants_required_components': '\n'.join(gdm_gnome_session_wanted_targets), +- }, +- install_dir: systemd_userunitdir / 'gnome-session@gnome-login.target.d', +-) ++ configure_file( ++ input: 'session.conf.in', ++ output: 'session.conf', ++ configuration: { ++ 'requires_component': gdm_gnome_shell_component, ++ 'wants_required_components': '\n'.join(gdm_gnome_session_wanted_targets), ++ }, ++ install_dir: systemd_userunitdir / 'gnome-session@gnome-login.target.d', ++ ) ++endif + + # XSession + if get_option('gdm-xsession') diff --git a/x11/gdm/files/patch-data_pam-exherbo_gdm-autologin.pam b/x11/gdm/files/patch-data_pam-exherbo_gdm-autologin.pam new file mode 100644 index 000000000000..79bd730409f8 --- /dev/null +++ b/x11/gdm/files/patch-data_pam-exherbo_gdm-autologin.pam @@ -0,0 +1,20 @@ +--- data/pam-exherbo/gdm-autologin.pam.orig 2022-01-12 14:15:56 UTC ++++ data/pam-exherbo/gdm-autologin.pam +@@ -1,9 +1,7 @@ +-# mirrors system-auth / system(-local)-login +-# except for the authentication method, which is: +-# always permit login ++#%PAM-1.0 + + auth [success=ok default=1] pam_gdm.so +--auth optional pam_gnome_keyring.so ++auth optional pam_gnome_keyring.so + auth sufficient pam_permit.so + + account include system-local-login +@@ -11,4 +9,4 @@ account include system-local-login + password include system-local-login + + session include system-local-login +--session optional pam_gnome_keyring.so auto_start ++session optional pam_gnome_keyring.so auto_start diff --git a/x11/gdm/files/patch-data_pam-exherbo_gdm-fingerprint.pam b/x11/gdm/files/patch-data_pam-exherbo_gdm-fingerprint.pam new file mode 100644 index 000000000000..3e7098a3d6fb --- /dev/null +++ b/x11/gdm/files/patch-data_pam-exherbo_gdm-fingerprint.pam @@ -0,0 +1,25 @@ +--- data/pam-exherbo/gdm-fingerprint.pam.orig 2022-01-12 14:15:56 UTC ++++ data/pam-exherbo/gdm-fingerprint.pam +@@ -1,10 +1,16 @@ +-account include system-login ++#%PAM-1.0 + +-auth substack fingerprint-auth +-auth optional pam_gnome_keyring.so ++auth required pam_shells.so ++auth required pam_nologin.so ++auth required pam_faillock.so preauth ++auth required pam_fprintd.so ++auth required pam_env.so ++auth [success=ok default=1] pam_gdm.so ++auth optional pam_gnome_keyring.so + +-password required pam_deny.so ++account include system-local-login + +-session substack system-login +-session optional pam_gnome_keyring.so auto_start ++password include system-local-login + ++session include system-local-login ++session optional pam_gnome_keyring.so auto_start diff --git a/x11/gdm/files/patch-data_pam-exherbo_gdm-launch-environment.pam b/x11/gdm/files/patch-data_pam-exherbo_gdm-launch-environment.pam new file mode 100644 index 000000000000..249c803fd05d --- /dev/null +++ b/x11/gdm/files/patch-data_pam-exherbo_gdm-launch-environment.pam @@ -0,0 +1,25 @@ +--- data/pam-exherbo/gdm-launch-environment.pam.orig 2022-01-12 14:15:56 UTC ++++ data/pam-exherbo/gdm-launch-environment.pam +@@ -1,15 +1,16 @@ +-account required pam_nologin.so +-account required pam_succeed_if.so audit quiet_success user = gdm +-account required pam_permit.so ++#%PAM-1.0 + +-auth required pam_env.so + auth required pam_succeed_if.so audit quiet_success user = gdm + auth required pam_permit.so ++auth required pam_env.so + ++account required pam_succeed_if.so audit quiet_success user = gdm ++account required pam_permit.so ++ + password required pam_deny.so + +--session optional pam_systemd.so ++session optional pam_loginuid.so + session optional pam_keyinit.so force revoke + session required pam_succeed_if.so audit quiet_success user = gdm + session required pam_permit.so +- ++-session optional pam_systemd.so diff --git a/x11/gdm/files/patch-data_pam-exherbo_gdm-password.pam b/x11/gdm/files/patch-data_pam-exherbo_gdm-password.pam new file mode 100644 index 000000000000..dca6f4c51c84 --- /dev/null +++ b/x11/gdm/files/patch-data_pam-exherbo_gdm-password.pam @@ -0,0 +1,20 @@ +--- data/pam-exherbo/gdm-password.pam.orig 2022-01-12 14:15:56 UTC ++++ data/pam-exherbo/gdm-password.pam +@@ -1,10 +1,12 @@ +-account include system-login ++#%PAM-1.0 + +-auth substack system-login ++auth include system-local-login + auth optional pam_gnome_keyring.so + +-password required pam_deny.so ++account include system-local-login + +-session substack system-login +-session optional pam_gnome_keyring.so auto_start ++password include system-local-login ++password optional pam_gnome_keyring.so use_authtok + ++session include system-local-login ++session optional pam_gnome_keyring.so auto_start diff --git a/x11/gdm/files/patch-data_pam-exherbo_gdm-smartcard.pam b/x11/gdm/files/patch-data_pam-exherbo_gdm-smartcard.pam new file mode 100644 index 000000000000..3331fca00fe6 --- /dev/null +++ b/x11/gdm/files/patch-data_pam-exherbo_gdm-smartcard.pam @@ -0,0 +1,28 @@ +--- data/pam-exherbo/gdm-smartcard.pam.orig 2022-01-12 14:15:56 UTC ++++ data/pam-exherbo/gdm-smartcard.pam +@@ -1,18 +1,16 @@ +-# mirrors system-auth / system(-local)-login +-# except for the authentication method, which is: +-# smartcard login ++#%PAM-1.0 + +-auth required pam_env.so +-auth required pam_tally.so file=/var/log/faillog onerr=succeed + auth required pam_shells.so + auth required pam_nologin.so +-auth [success=done ignore=ignore default=die] pam_pkcs11.so wait_for_card card_only +--auth optional pam_gnome_keyring.so ++auth required pam_faillock.so preauth ++auth required pam_pkcs11.so wait_for_card card_only ++auth required pam_env.so ++auth [success=ok default=1] pam_gdm.so ++auth optional pam_gnome_keyring.so + + account include system-local-login + + password include system-local-login + + session include system-local-login +--session optional pam_gnome_keyring.so auto_start +- ++session optional pam_gnome_keyring.so auto_start diff --git a/x11/gdm/files/patch-data_pam-redhat_gdm-autologin.pam b/x11/gdm/files/patch-data_pam-redhat_gdm-autologin.pam deleted file mode 100644 index e7653c42b323..000000000000 --- a/x11/gdm/files/patch-data_pam-redhat_gdm-autologin.pam +++ /dev/null @@ -1,10 +0,0 @@ ---- data/pam-redhat/gdm-autologin.pam.orig 2015-07-20 13:13:44 UTC -+++ data/pam-redhat/gdm-autologin.pam -@@ -8,6 +8,7 @@ password include system-auth - session required pam_selinux.so close - session required pam_loginuid.so - session optional pam_console.so -+-session optional pam_ck_connector.so - session required pam_selinux.so open - session optional pam_keyinit.so force revoke - session required pam_namespace.so diff --git a/x11/gdm/files/patch-data_pam-redhat_gdm-fingerprint.pam b/x11/gdm/files/patch-data_pam-redhat_gdm-fingerprint.pam deleted file mode 100644 index 9ce2f7729d58..000000000000 --- a/x11/gdm/files/patch-data_pam-redhat_gdm-fingerprint.pam +++ /dev/null @@ -1,10 +0,0 @@ ---- data/pam-redhat/gdm-fingerprint.pam.orig 2015-07-20 13:13:44 UTC -+++ data/pam-redhat/gdm-fingerprint.pam -@@ -9,6 +9,7 @@ password include fingerprint-au - session required pam_selinux.so close - session required pam_loginuid.so - session optional pam_console.so -+-session optional pam_ck_connector.so - session required pam_selinux.so open - session optional pam_keyinit.so force revoke - session required pam_namespace.so diff --git a/x11/gdm/files/patch-data_pam-redhat_gdm-password.pam b/x11/gdm/files/patch-data_pam-redhat_gdm-password.pam deleted file mode 100644 index de3e5c3c78b3..000000000000 --- a/x11/gdm/files/patch-data_pam-redhat_gdm-password.pam +++ /dev/null @@ -1,10 +0,0 @@ ---- data/pam-redhat/gdm-password.pam.orig 2015-07-20 13:13:44 UTC -+++ data/pam-redhat/gdm-password.pam -@@ -12,6 +12,7 @@ password substack password-auth - session required pam_selinux.so close - session required pam_loginuid.so - session optional pam_console.so -+-session optional pam_ck_connector.so - session required pam_selinux.so open - session optional pam_keyinit.so force revoke - session required pam_namespace.so diff --git a/x11/gdm/files/patch-data_pam-redhat_gdm-pin.pam b/x11/gdm/files/patch-data_pam-redhat_gdm-pin.pam deleted file mode 100644 index 14dff49185ee..000000000000 --- a/x11/gdm/files/patch-data_pam-redhat_gdm-pin.pam +++ /dev/null @@ -1,10 +0,0 @@ ---- data/pam-redhat/gdm-pin.pam.orig 2015-07-20 13:13:44 UTC -+++ data/pam-redhat/gdm-pin.pam -@@ -13,6 +13,7 @@ password optional pam_pin.so - session required pam_selinux.so close - session required pam_loginuid.so - session optional pam_console.so -+-session optional pam_ck_connector.so - session required pam_selinux.so open - session optional pam_keyinit.so force revoke - session required pam_namespace.so diff --git a/x11/gdm/files/patch-data_pam-redhat_gdm-smartcard.pam b/x11/gdm/files/patch-data_pam-redhat_gdm-smartcard.pam deleted file mode 100644 index e7acf1de5372..000000000000 --- a/x11/gdm/files/patch-data_pam-redhat_gdm-smartcard.pam +++ /dev/null @@ -1,10 +0,0 @@ ---- data/pam-redhat/gdm-smartcard.pam.orig 2015-07-20 13:13:44 UTC -+++ data/pam-redhat/gdm-smartcard.pam -@@ -9,6 +9,7 @@ password include smartcard-auth - session required pam_selinux.so close - session required pam_loginuid.so - session optional pam_console.so -+-session optional pam_ck_connector.so - session required pam_selinux.so open - session optional pam_keyinit.so force revoke - session required pam_namespace.so diff --git a/x11/gdm/files/patch-libgdm_gdm-user-switching.c b/x11/gdm/files/patch-libgdm_gdm-user-switching.c index cedffff73382..f3b45165cea4 100644 --- a/x11/gdm/files/patch-libgdm_gdm-user-switching.c +++ b/x11/gdm/files/patch-libgdm_gdm-user-switching.c @@ -1,6 +1,6 @@ ---- libgdm/gdm-user-switching.c.orig 2015-07-20 13:13:45 UTC +--- libgdm/gdm-user-switching.c.orig 2022-01-12 14:15:56 UTC +++ libgdm/gdm-user-switching.c -@@ -31,12 +31,25 @@ +@@ -31,7 +31,9 @@ #include <glib-object.h> #include <gio/gio.h> @@ -10,120 +10,19 @@ #include "common/gdm-common.h" #include "gdm-user-switching.h" - #include "gdm-client.h" - -+#ifdef WITH_CONSOLE_KIT -+#define CK_NAME "org.freedesktop.ConsoleKit" -+#define CK_PATH "/org/freedesktop/ConsoleKit" -+#define CK_INTERFACE "org.freedesktop.ConsoleKit" -+ -+#define CK_MANAGER_PATH "/org/freedesktop/ConsoleKit/Manager" -+#define CK_MANAGER_INTERFACE "org.freedesktop.ConsoleKit.Manager" -+#define CK_SEAT_INTERFACE "org.freedesktop.ConsoleKit.Seat" -+#define CK_SESSION_INTERFACE "org.freedesktop.ConsoleKit.Session" -+#endif -+ - static gboolean - create_transient_display (GDBusConnection *connection, - GCancellable *cancellable, -@@ -67,12 +80,304 @@ create_transient_display (GDBusConnectio - return TRUE; - } +@@ -76,6 +78,7 @@ activate_session_id (GDBusConnection *connection, + { + GVariant *reply; -+#ifdef WITH_CONSOLE_KIT -+ - static gboolean --activate_session_id (GDBusConnection *connection, -- GCancellable *cancellable, -- const char *seat_id, -- const char *session_id, -- GError **error) -+get_current_session_id (GDBusConnection *connection, -+ char **session_id) -+{ -+ GError *local_error = NULL; -+ GVariant *reply; -+ -+ reply = g_dbus_connection_call_sync (connection, -+ CK_NAME, -+ CK_MANAGER_PATH, -+ CK_MANAGER_INTERFACE, -+ "GetCurrentSession", -+ NULL, /* parameters */ -+ G_VARIANT_TYPE ("(o)"), -+ G_DBUS_CALL_FLAGS_NONE, -+ -1, -+ NULL, &local_error); -+ if (reply == NULL) { -+ g_warning ("Unable to determine session: %s", local_error->message); -+ g_error_free (local_error); -+ return FALSE; -+ } -+ -+ g_variant_get (reply, "(o)", session_id); -+ g_variant_unref (reply); -+ -+ return TRUE; -+} -+ -+static gboolean -+get_seat_id_for_session (GDBusConnection *connection, -+ const char *session_id, -+ char **seat_id) -+{ -+ GError *local_error = NULL; -+ GVariant *reply; -+ -+ reply = g_dbus_connection_call_sync (connection, -+ CK_NAME, -+ session_id, -+ CK_SESSION_INTERFACE, -+ "GetSeatId", -+ NULL, /* parameters */ -+ G_VARIANT_TYPE ("(o)"), -+ G_DBUS_CALL_FLAGS_NONE, -+ -1, -+ NULL, &local_error); -+ if (reply == NULL) { -+ g_warning ("Unable to determine seat: %s", local_error->message); -+ g_error_free (local_error); -+ return FALSE; -+ } -+ -+ g_variant_get (reply, "(o)", seat_id); -+ g_variant_unref (reply); -+ -+ return TRUE; -+} -+ -+static char * -+get_current_seat_id (GDBusConnection *connection) -+{ -+ gboolean res; -+ char *session_id; -+ char *seat_id; -+ -+ session_id = NULL; -+ seat_id = NULL; -+ -+ res = get_current_session_id (connection, &session_id); -+ if (res) { -+ res = get_seat_id_for_session (connection, session_id, &seat_id); -+ } -+ g_free (session_id); -+ -+ return seat_id; -+} -+ -+static gboolean -+activate_session_id_for_ck (GDBusConnection *connection, -+ GCancellable *cancellable, -+ const char *seat_id, -+ const char *session_id, -+ GError **error) -+{ -+ GVariant *reply; -+ ++#if defined(WITH_SYSTEMD) + reply = g_dbus_connection_call_sync (connection, + "org.freedesktop.login1", + "/org/freedesktop/login1", +@@ -86,6 +89,18 @@ activate_session_id (GDBusConnection *connection, + G_DBUS_CALL_FLAGS_NONE, + -1, + cancellable, error); ++#elif defined(WITH_CONSOLE_KIT) + reply = g_dbus_connection_call_sync (connection, + CK_NAME, + seat_id, @@ -134,279 +33,16 @@ + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, error); -+ if (reply == NULL) { -+ g_prefix_error (error, _("Unable to activate session: ")); -+ return FALSE; -+ } -+ -+ g_variant_unref (reply); -+ -+ return TRUE; -+} -+ -+static gboolean -+session_is_login_window (GDBusConnection *connection, -+ const char *session_id) -+{ -+ GError *local_error = NULL; -+ GVariant *reply; -+ const char *value; -+ gboolean ret; -+ -+ reply = g_dbus_connection_call_sync (connection, -+ CK_NAME, -+ session_id, -+ CK_SESSION_INTERFACE, -+ "GetSessionType", -+ NULL, -+ G_VARIANT_TYPE ("(s)"), -+ G_DBUS_CALL_FLAGS_NONE, -+ -1, -+ NULL, &local_error); -+ if (reply == NULL) { -+ g_warning ("Unable to determine session type: %s", local_error->message); -+ g_error_free (local_error); -+ return FALSE; -+ } -+ -+ g_variant_get (reply, "(&s)", &value); -+ -+ if (value == NULL || value[0] == '\0' || strcmp (value, "LoginWindow") != 0) { -+ ret = FALSE; -+ } else { -+ ret = TRUE; -+ } -+ -+ g_variant_unref (reply); -+ -+ return ret; -+} -+ -+static gboolean -+seat_can_activate_sessions (GDBusConnection *connection, -+ const char *seat_id) -+{ -+ GError *local_error = NULL; -+ GVariant *reply; -+ gboolean ret; -+ -+ reply = g_dbus_connection_call_sync (connection, -+ CK_NAME, -+ seat_id, -+ CK_SEAT_INTERFACE, -+ "CanActivateSessions", -+ NULL, -+ G_VARIANT_TYPE ("(b)"), -+ G_DBUS_CALL_FLAGS_NONE, -+ -1, -+ NULL, &local_error); -+ if (reply == NULL) { -+ g_warning ("Unable to determine if can activate sessions: %s", local_error->message); -+ g_error_free (local_error); -+ return FALSE; -+ } -+ -+ g_variant_get (reply, "(b)", &ret); -+ g_variant_unref (reply); -+ -+ return ret; -+} -+ -+static const char ** -+seat_get_sessions (GDBusConnection *connection, -+ const char *seat_id) -+{ -+ GError *local_error = NULL; -+ GVariant *reply; -+ const char **value; -+ -+ reply = g_dbus_connection_call_sync (connection, -+ CK_NAME, -+ seat_id, -+ CK_SEAT_INTERFACE, -+ "GetSessions", -+ NULL, -+ G_VARIANT_TYPE ("(ao)"), -+ G_DBUS_CALL_FLAGS_NONE, -+ -1, -+ NULL, &local_error); -+ if (reply == NULL) { -+ g_warning ("Unable to list sessions: %s", local_error->message); -+ g_error_free (local_error); -+ return FALSE; -+ } -+ -+ g_variant_get (reply, "(^ao)", &value); -+ g_variant_unref (reply); -+ -+ return value; -+} -+ -+static gboolean -+get_login_window_session_id_for_ck (GDBusConnection *connection, -+ const char *seat_id, -+ char **session_id) -+{ -+ gboolean can_activate_sessions; -+ const char **sessions; -+ int i; -+ -+ *session_id = NULL; -+ sessions = NULL; -+ -+ g_debug ("checking if seat can activate sessions"); -+ -+ can_activate_sessions = seat_can_activate_sessions (connection, seat_id); -+ if (! can_activate_sessions) { -+ g_debug ("seat is unable to activate sessions"); -+ return FALSE; -+ } -+ -+ sessions = seat_get_sessions (connection, seat_id); -+ for (i = 0; sessions [i] != NULL; i++) { -+ const char *ssid; -+ -+ ssid = sessions [i]; -+ -+ if (session_is_login_window (connection, ssid)) { -+ *session_id = g_strdup (ssid); -+ break; -+ } -+ } -+ g_free (sessions); -+ -+ return TRUE; -+} -+ -+static gboolean -+goto_login_session_for_ck (GDBusConnection *connection, -+ GCancellable *cancellable, -+ GError **error) -+{ -+ gboolean ret; -+ gboolean res; -+ char *session_id; -+ char *seat_id; -+ -+ ret = FALSE; -+ -+ /* First look for any existing LoginWindow sessions on the seat. -+ If none are found, create a new one. */ -+ -+ seat_id = get_current_seat_id (connection); -+ if (seat_id == NULL || seat_id[0] == '\0') { -+ g_debug ("seat id is not set; can't switch sessions"); -+ g_set_error (error, GDM_CLIENT_ERROR, 0, _("Could not identify the current session.")); -+ -+ return FALSE; -+ } -+ -+ res = get_login_window_session_id_for_ck (connection, seat_id, &session_id); -+ if (! res) { -+ g_set_error (error, GDM_CLIENT_ERROR, 0, _("User unable to switch sessions.")); -+ return FALSE; -+ } -+ -+ if (session_id != NULL) { -+ res = activate_session_id_for_ck (connection, cancellable, seat_id, session_id, error); -+ if (res) { -+ ret = TRUE; -+ } -+ } -+ -+ if (! ret && g_strcmp0 (seat_id, "/org/freedesktop/ConsoleKit/Seat1") == 0) { -+ res = create_transient_display (connection, cancellable, error); -+ if (res) { -+ ret = TRUE; -+ } -+ } -+ -+ return ret; -+} +#endif -+ -+#ifdef WITH_SYSTEMD -+ -+static gboolean -+activate_session_id_for_systemd (GDBusConnection *connection, -+ GCancellable *cancellable, -+ const char *seat_id, -+ const char *session_id, -+ GError **error) - { - GVariant *reply; - -@@ -97,8 +402,8 @@ activate_session_id (GDBusConnection *c - } - - static gboolean --get_login_window_session_id (const char *seat_id, -- char **session_id) -+get_login_window_session_id_for_systemd (const char *seat_id, -+ char **session_id) - { - gboolean ret; - int res, i; -@@ -182,9 +487,9 @@ out: - } - - static gboolean --goto_login_session (GDBusConnection *connection, -- GCancellable *cancellable, -- GError **error) -+goto_login_session_for_systemd (GDBusConnection *connection, -+ GCancellable *cancellable, -+ GError **error) - { - gboolean ret; - int res; -@@ -238,9 +543,9 @@ goto_login_session (GDBusConnection *co + if (reply == NULL) { + g_prefix_error (error, _("Unable to activate session: ")); return FALSE; +@@ -227,7 +242,7 @@ goto_login_session (GDBusConnection *connection, + } } -- res = get_login_window_session_id (seat_id, &session_id); -+ res = get_login_window_session_id_for_systemd (seat_id, &session_id); - if (res && session_id != NULL) { -- res = activate_session_id (connection, cancellable, seat_id, session_id, error); -+ res = activate_session_id_for_systemd (connection, cancellable, seat_id, session_id, error); - +- if (! ret && g_strcmp0 (seat_id, "seat0") == 0) { ++ if (! ret && g_strcmp0 (seat_id, SEAT_ID) == 0) { + res = create_transient_display (connection, cancellable, error); if (res) { ret = TRUE; -@@ -259,10 +564,11 @@ goto_login_session (GDBusConnection *co - - return ret; - } -+#endif - - gboolean - gdm_goto_login_session_sync (GCancellable *cancellable, -- GError **error) -+ GError **error) - { - GDBusConnection *connection; - gboolean retval; -@@ -271,8 +577,23 @@ gdm_goto_login_session_sync (GCancellabl - if (!connection) - return FALSE; - -- retval = goto_login_session (connection, cancellable, error); -+#ifdef WITH_SYSTEMD -+ if (LOGIND_RUNNING()) { -+ retval = goto_login_session_for_systemd (connection, -+ cancellable, -+ error); -+ -+ g_object_unref (connection); -+ return retval; -+ } -+#endif -+ -+#ifdef WITH_CONSOLE_KIT -+ retval = goto_login_session_for_ck (connection, cancellable, error); - - g_object_unref (connection); - return retval; -+#else -+ return FALSE; -+#endif - } diff --git a/x11/gdm/files/patch-meson.build b/x11/gdm/files/patch-meson.build new file mode 100644 index 000000000000..18d3af61c242 --- /dev/null +++ b/x11/gdm/files/patch-meson.build @@ -0,0 +1,52 @@ +--- meson.build.orig 2022-01-12 14:15:56 UTC ++++ meson.build +@@ -37,7 +37,12 @@ gdm_screenshot_dir = (get_option('screenshot-dir') != + config_h_dir = include_directories('.') + + # Dependencies +-udev_dep = dependency('udev') ++if host_machine.system() == 'linux' ++ udev_dep = dependency('udev') ++else ++ udev_dep = declare_dependency() ++ udev_dir = '/usr/local/lib/udev/rules.d' ++endif + + glib_min_version = '2.56.0' + +@@ -88,17 +93,22 @@ if find_x_server_out != '' + else + # what to do, what to do, this is wrong, but this just sets the + # defaults, perhaps this user is cross compiling or some such +- x_path = '/usr/bin/X11:/usr/X11R6/bin:/opt/X11R6/bin' +- x_bin = '/usr/bin/X' ++ x_path = '/usr/local/bin/X11:/usr/local/bin:/opt/X11R6/bin' ++ x_bin = '/usr/local/bin/X' + endif + xdmcp_dep = cc.find_library('Xdmcp', required: get_option('xdmcp')) + if xdmcp_dep.found() and get_option('tcp-wrappers') + libwrap_dep = cc.find_library('wrap') + endif + # systemd +-systemd_dep = dependency('systemd') +-libsystemd_dep = dependency('libsystemd') +-if meson.version().version_compare('>= 0.53') ++if host_machine.system() == 'linux' ++ systemd_dep = dependency('systemd') ++ libsystemd_dep = dependency('libsystemd') ++else ++ systemd_dep = declare_dependency() ++ libsystemd_dep = declare_dependency() ++endif ++if host_machine.system() == 'linux' + systemd_multiseat_x = find_program('systemd-multi-seat-x', + required: false, + dirs: [ +@@ -255,6 +265,7 @@ conf.set('HAVE_UT_UT_TIME', utmp_has_time_field) + conf.set('HAVE_UT_UT_TV', utmp_has_tv_field) + conf.set('HAVE_UT_UT_SYSLEN', utmp_has_syslen_field) + conf.set('ENABLE_IPV6', get_option('ipv6')) ++conf.set('HAVE_SIGWAITINFO', cc.has_function('sigwaitinfo')) + configure_file(output: 'config.h', configuration: conf) + + # Subdirs diff --git a/x11/gdm/files/patch-pam__gdm_pam__gdm.c b/x11/gdm/files/patch-pam__gdm_pam__gdm.c new file mode 100644 index 000000000000..e39aa644f9c7 --- /dev/null +++ b/x11/gdm/files/patch-pam__gdm_pam__gdm.c @@ -0,0 +1,18 @@ +--- pam_gdm/pam_gdm.c.orig 2022-01-12 14:15:56 UTC ++++ pam_gdm/pam_gdm.c +@@ -21,11 +21,15 @@ + + #include <unistd.h> + ++#ifdef __linux__ + #include <security/_pam_macros.h> + #include <security/pam_ext.h> + #include <security/pam_misc.h> + #include <security/pam_modules.h> + #include <security/pam_modutil.h> ++#else ++#include <security/pam_modules.h> ++#endif + + #ifdef HAVE_KEYUTILS + #include <keyutils.h> diff --git a/x11/gdm/pkg-plist b/x11/gdm/pkg-plist index eaab06ef9556..b08b7f532e11 100644 --- a/x11/gdm/pkg-plist +++ b/x11/gdm/pkg-plist @@ -20,9 +20,10 @@ lib/girepository-1.0/Gdm-1.0.typelib lib/libgdm.so lib/libgdm.so.1 lib/libgdm.so.1.0.0 +lib/security/pam_gdm.so libdata/pkgconfig/gdm.pc -libexec/gdm-disable-wayland libexec/gdm-host-chooser +libexec/gdm-runtime-config libexec/gdm-session-worker libexec/gdm-simple-chooser libexec/gdm-wayland-session @@ -52,6 +53,8 @@ share/help/en_GB/gdm/index.docbook share/help/en_GB/gdm/legal.xml share/help/es/gdm/index.docbook share/help/es/gdm/legal.xml +share/help/eu/gdm/index.docbook +share/help/eu/gdm/legal.xml share/help/fr/gdm/index.docbook share/help/fr/gdm/legal.xml share/help/gl/gdm/index.docbook @@ -84,9 +87,6 @@ share/help/uk/gdm/index.docbook share/help/uk/gdm/legal.xml share/help/zh_CN/gdm/index.docbook share/help/zh_CN/gdm/legal.xml -share/icons/hicolor/16x16/apps/gdm-xnest.png -share/icons/hicolor/32x32/apps/gdm-setup.png -share/icons/hicolor/32x32/apps/gdm-xnest.png share/locale/af/LC_MESSAGES/gdm.mo share/locale/am/LC_MESSAGES/gdm.mo share/locale/an/LC_MESSAGES/gdm.mo @@ -103,6 +103,7 @@ share/locale/br/LC_MESSAGES/gdm.mo share/locale/bs/LC_MESSAGES/gdm.mo share/locale/ca/LC_MESSAGES/gdm.mo share/locale/ca@valencia/LC_MESSAGES/gdm.mo +share/locale/ckb/LC_MESSAGES/gdm.mo share/locale/crh/LC_MESSAGES/gdm.mo share/locale/cs/LC_MESSAGES/gdm.mo share/locale/csb/LC_MESSAGES/gdm.mo @@ -150,6 +151,7 @@ share/locale/lv/LC_MESSAGES/gdm.mo share/locale/mai/LC_MESSAGES/gdm.mo share/locale/mg/LC_MESSAGES/gdm.mo share/locale/mi/LC_MESSAGES/gdm.mo +share/locale/mjw/LC_MESSAGES/gdm.mo share/locale/mk/LC_MESSAGES/gdm.mo share/locale/ml/LC_MESSAGES/gdm.mo share/locale/mn/LC_MESSAGES/gdm.mo @@ -178,6 +180,7 @@ share/locale/sq/LC_MESSAGES/gdm.mo share/locale/sr/LC_MESSAGES/gdm.mo share/locale/sr@latin/LC_MESSAGES/gdm.mo share/locale/sv/LC_MESSAGES/gdm.mo +share/locale/sw/LC_MESSAGES/gdm.mo share/locale/ta/LC_MESSAGES/gdm.mo share/locale/te/LC_MESSAGES/gdm.mo share/locale/tg/LC_MESSAGES/gdm.mo @@ -194,12 +197,6 @@ share/locale/zh_CN/LC_MESSAGES/gdm.mo share/locale/zh_HK/LC_MESSAGES/gdm.mo share/locale/zh_TW/LC_MESSAGES/gdm.mo share/locale/zu/LC_MESSAGES/gdm.mo -share/pixmaps/gdm-foot-logo.png -share/pixmaps/gdm-setup.png -share/pixmaps/gdm-xnest.png -share/pixmaps/gdm.png -share/pixmaps/nobody.png -share/pixmaps/nohost.png @postexec mkdir -p %D/share/xsessions @postexec dconf update @postunexec dconf update @@ -208,7 +205,6 @@ share/pixmaps/nohost.png @mode @postunexec rm -rf %D/etc/gdm/home/.gconf* @dir %%ETCDIR%%/Sessions -@dir %%ETCDIR%%/home/.local/share/applications @dir etc/dm @dir etc/dm/Sessions @dir share/xsessions |