pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

gdm: Update wip/gdm to 3.36.2



Module Name:	pkgsrc-wip
Committed By:	Dan Cîrnaț <cirnatdan%gmail.com@localhost>
Pushed By:	cirnatdan
Date:		Wed Jun 10 15:28:06 2020 +0200
Changeset:	09ebc0e0ab744cdb1faab75f7d0df7b093a3bebc

Modified Files:
	gdm/Makefile
	gdm/PLIST
	gdm/distinfo
	gdm/patches/patch-common_gdm-common_c
	gdm/patches/patch-common_gdm-common_h
	gdm/patches/patch-common_gdm-log_c
	gdm/patches/patch-configure_ac
	gdm/patches/patch-daemon_gdm-display_c
	gdm/patches/patch-daemon_gdm-launch-environment_c
	gdm/patches/patch-daemon_gdm-local-display-factory_c
	gdm/patches/patch-daemon_gdm-manager_c
	gdm/patches/patch-daemon_gdm-server_c
	gdm/patches/patch-daemon_gdm-session-record_c
	gdm/patches/patch-daemon_gdm-session-worker_c
	gdm/patches/patch-daemon_gdm-session_c
	gdm/patches/patch-data_Makefile_am
	gdm/patches/patch-libgdm_gdm-user-switching_c
Added Files:
	gdm/files/10_org.gnome.login-screen.gschema.override
	gdm/patches/patch-Makefile.am

Log Message:
gdm: Update wip/gdm to 3.36.2

Work in progress, package is still broken.
Builds on NetBSD, but can't run successfully.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=09ebc0e0ab744cdb1faab75f7d0df7b093a3bebc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 gdm/Makefile                                       |  64 +----
 gdm/PLIST                                          |  20 +-
 gdm/distinfo                                       |  37 +--
 .../10_org.gnome.login-screen.gschema.override     |   8 +
 gdm/patches/patch-Makefile.am                      |  12 +
 gdm/patches/patch-common_gdm-common_c              | 237 +++++++++++++++---
 gdm/patches/patch-common_gdm-common_h              |  42 +++-
 gdm/patches/patch-common_gdm-log_c                 |  17 +-
 gdm/patches/patch-configure_ac                     |  54 ++++-
 gdm/patches/patch-daemon_gdm-display_c             |  34 ++-
 gdm/patches/patch-daemon_gdm-launch-environment_c  |  15 +-
 .../patch-daemon_gdm-local-display-factory_c       | 154 ++++++------
 gdm/patches/patch-daemon_gdm-manager_c             | 266 ++++++++++++++-------
 gdm/patches/patch-daemon_gdm-server_c              |  83 +++----
 gdm/patches/patch-daemon_gdm-session-record_c      |  25 +-
 gdm/patches/patch-daemon_gdm-session-worker_c      | 202 +++++++++++-----
 gdm/patches/patch-daemon_gdm-session_c             |  19 +-
 gdm/patches/patch-data_Makefile_am                 |  20 +-
 gdm/patches/patch-libgdm_gdm-user-switching_c      |  22 +-
 19 files changed, 872 insertions(+), 459 deletions(-)

diffs:
diff --git a/gdm/Makefile b/gdm/Makefile
index 2e1259ef99..ce43723f86 100644
--- a/gdm/Makefile
+++ b/gdm/Makefile
@@ -1,7 +1,6 @@
 # $NetBSD: Makefile,v 1.6 2015/06/06 20:44:44 krytarowski Exp $
-#
 
-DISTNAME=	gdm-3.18.2
+DISTNAME=	gdm-3.36.2
 CATEGORIES=	x11 gnome
 MASTER_SITES=	${MASTER_SITE_GITHUB:=GNOME/}
 LICENSE=	gnu-gpl-v2
@@ -15,7 +14,7 @@ DEPENDS+=	zenity>=2.16.0:../../wip/zenity
 USE_PKGLOCALEDIR=	YES
 GNU_CONFIGURE=		YES
 USE_LIBTOOL=		YES
-USE_TOOLS+=		gmake intltool msgfmt pkg-config
+USE_TOOLS+=		gmake msgfmt pkg-config
 USE_TOOLS+=		automake autoconf autoreconf
 BUILD_DEFS+=		VARBASE
 
@@ -31,8 +30,12 @@ CONFIGURE_ARGS+=	--with-prefetch=yes
 CONFIGURE_ARGS+=	--without-plymouth
 CONFIGURE_ARGS+=	--without-systemd
 CONFIGURE_ARGS+=	--disable-systemd-journal
+CONFIGURE_ARGS+=	--disable-user-display-server
+CONFIGURE_ARGS+=	--with-user=${GDMOWN}
+CONFIGURE_ARGS+=	--with-group=${GDMGRP}
 CONFIGURE_ENV+=		PREFIX=${PREFIX}
 CONFIGURE_ENV+=		X11BASE=${X11BASE}
+CONFIGURE_SCRIPT=	./autogen.sh
 INSTALL_MAKE_FLAGS+=	${MAKE_FLAGS}
 INSTALL_MAKE_FLAGS+=	GDM_CUSTOM_CONF=${EGDIR}/custom.conf
 INSTALL_MAKE_FLAGS+=	sysconfdir=${EGDIR}
@@ -49,39 +52,12 @@ OWN_DIRS+=		${VARBASE}/log/gdm
 
 PKG_SYSCONFSUBDIR=	gdm
 EGDIR=			${PREFIX}/share/examples/gdm
-CONF_FILES=		${EGDIR}/custom.conf ${PKG_SYSCONFDIR}/data/custom.conf
+CONF_FILES=		${EGDIR}/custom.conf ${PKG_SYSCONFDIR}/custom.conf
 
 RCD_SCRIPTS=		gdm
 
 .include "../../mk/bsd.prefs.mk"
 
-SUBST_CLASSES+=		desktop
-SUBST_MESSAGE.desktop=	Configuring GDM settings.
-SUBST_STAGE.desktop=	pre-configure
-SUBST_FILES.desktop=	config/default.desktop.in
-#SUBST_FILES.desktop+=	config/gnome.desktop.in
-SUBST_FILES.desktop+=	config/gdm.conf.in
-SUBST_SED.desktop=	-e 's/^_//g'
-SUBST_SED.desktop+=	-e 's|^User=gdm$$|User=${GDMOWN}|g'
-SUBST_SED.desktop+=	-e 's|^Group=gdm$$|Group=${GDMGRP}|g'
-SUBST_SED.desktop+=	-e 's|^\#GtkTheme=.*$$|GtkTheme=Clearlooks|g'
-SUBST_SED.desktop+=	-e 's|^\#FirstVT=.*$$|FirstVT=5|g'
-SUBST_SED.desktop+=	-e 's|^\#VTAllocation=.*$$|VTAllocation=true|g'
-.if ${OPSYS} == "NetBSD"
-SUBST_SED.desktop+=	-e 's|^\#Logo=.*$$|Logo=${PREFIX}/share/pixmaps/NetBSD.xpm|g'
-.endif
-.if ${OPSYS} == "NetBSD" || ${OPSYS} == "OpenBSD"
-SUBST_SED.desktop+=	-e 's|^\#RebootCommand=.*$$|RebootCommand=/sbin/shutdown -r now|g'
-SUBST_SED.desktop+=	-e 's|^\#HaltCommand=.*$$|HaltCommand=/sbin/shutdown -p now|g'
-.endif
-SUBST_SED.desktop+=	-e 's|^PreFetchProgram=.*$$|PreFetchProgram=${PREFIX}/libexec/gdmprefetch @${PKG_SYSCONFDIR}/gdmprefetchlist|g'
-
-SUBST_CLASSES+=		gdmsetup
-SUBST_MESSAGE.gdmsetup=	Patching gdmsetup theme installer to use ${REAL_ROOT_USER}:${REAL_ROOT_GROUP}
-SUBST_STAGE.gdmsetup=	post-patch
-SUBST_FILES.gdmsetup=	gui/gdmsetup.c
-SUBST_SED.gdmsetup=	-e 's/root:root/${REAL_ROOT_USER}:${REAL_ROOT_GROUP}/g'
-
 .if ${OPSYS} == "SunOS"
 CFLAGS+=	-DSunOS
 GDMOWN=		daemon
@@ -121,36 +97,22 @@ PLIST.gdmopen=		yes
 .endif
 PRINT_PLIST_AWK+=	/gdmopen/ { print "$${GDMOPEN}" $$0; next }
 
-pre-configure:
-	sed -i -e 's,/usr/local,${PREFIX},g' \
-		-e 's,/bin/bash,/bin/sh,g' \
-		${WRKSRC}/daemon/gdm-session-worker.c &&
-	cd ${WRKSRC}; \
-		./autogen.sh; \
-		autoreconf -fiv; \
-		intltoolize
 post-install:
+	${INSTALL_DATA_DIR} ${DESTDIR}${PREFIX}/share/pixmaps
 	${INSTALL_DATA} ${FILESDIR}/NetBSD.xpm ${DESTDIR}${PREFIX}/share/pixmaps
+	${INSTALL_DATA_DIR} ${DESTDIR}${PREFIX}/share/gdm/BuiltInSessions
 	${INSTALL_DATA} ${FILESDIR}/custom.desktop \
 		${DESTDIR}${PREFIX}/share/gdm/BuiltInSessions
 
+.include "../../sysutils/gsettings-desktop-schemas/buildlink3.mk"
+.include "../../security/openpam/buildlink3.mk"
+.include "../../devel/dconf/buildlink3.mk"
 .include "../../audio/libcanberra/buildlink3.mk"
 .include "../../textproc/iso-codes/buildlink3.mk"
 .include "../../x11/gtk3/buildlink3.mk"
-.include "../../wip/accountsservice/buildlink3.mk"
+.include "../../sysutils/accountsservice/buildlink3.mk"
 .include "../../devel/gettext-lib/buildlink3.mk"
 .include "../../devel/glib2/buildlink3.mk"
-.include "../../devel/libglade/buildlink3.mk"
-.include "../../devel/pango/buildlink3.mk"
-.include "../../devel/popt/buildlink3.mk"
-.include "../../graphics/hicolor-icon-theme/buildlink3.mk"
-BUILDLINK_API_DEPENDS.libart+=	libart>=2.3.11
-.include "../../graphics/libart/buildlink3.mk"
-.include "../../graphics/libgnomecanvas/buildlink3.mk"
-.include "../../graphics/librsvg/buildlink3.mk"
 .include "../../security/tcp_wrappers/buildlink3.mk"
-.include "../../textproc/gnome-doc-utils/buildlink3.mk"
-.include "../../textproc/libxml2/buildlink3.mk"
 .include "../../mk/omf-scrollkeeper.mk"
-.include "../../x11/gtk2/buildlink3.mk"
 .include "../../mk/bsd.pkg.mk"
diff --git a/gdm/PLIST b/gdm/PLIST
index c0fe568ead..b305d91312 100644
--- a/gdm/PLIST
+++ b/gdm/PLIST
@@ -9,6 +9,7 @@ include/gdm/gdm-user-switching.h
 lib/girepository-1.0/Gdm-1.0.typelib
 lib/libgdm.la
 lib/pkgconfig/gdm.pc
+libexec/gdm-disable-wayland
 libexec/gdm-host-chooser
 libexec/gdm-session-worker
 libexec/gdm-simple-chooser
@@ -21,18 +22,17 @@ share/examples/gdm/PostLogin/Default.sample
 share/examples/gdm/PostSession/Default
 share/examples/gdm/PreSession/Default
 share/examples/gdm/custom.conf
-share/gdm/BuiltInSessions
+share/gdm/BuiltInSessions/custom.desktop
 share/gdm/gdb-cmd
 share/gdm/gdm.schemas
 share/gdm/greeter-dconf-defaults
-share/gdm/greeter/applications/gnome-shell-wayland.desktop
-share/gdm/greeter/applications/gnome-shell.desktop
 share/gdm/greeter/applications/mime-dummy-handler.desktop
 share/gdm/greeter/applications/mimeapps.list
 share/gdm/greeter/autostart/orca-autostart.desktop
 share/gdm/locale.alias
 share/gir-1.0/Gdm-1.0.gir
 share/glib-2.0/schemas/org.gnome.login-screen.gschema.xml
+share/gnome-session/sessions/gnome-login.session
 share/help/C/gdm/index.docbook
 share/help/C/gdm/legal.xml
 share/help/ca/gdm/index.docbook
@@ -73,13 +73,12 @@ share/help/sv/gdm/index.docbook
 share/help/sv/gdm/legal.xml
 share/help/te/gdm/index.docbook
 share/help/te/gdm/legal.xml
+share/help/tr/gdm/index.docbook
+share/help/tr/gdm/legal.xml
 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
@@ -96,6 +95,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
@@ -143,6 +143,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
@@ -171,6 +172,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
@@ -188,9 +190,3 @@ 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/NetBSD.xpm
-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
diff --git a/gdm/distinfo b/gdm/distinfo
index c4951a4751..d4aa5bdc2b 100644
--- a/gdm/distinfo
+++ b/gdm/distinfo
@@ -1,29 +1,30 @@
 $NetBSD: distinfo,v 1.5 2015/06/06 20:00:43 krytarowski Exp $
 
-SHA1 (gdm-3.18.2.tar.gz) = f62a3fd116198d1ac500d64d00380a4bb6da3de9
-RMD160 (gdm-3.18.2.tar.gz) = 06eb2e9a1d90b06def795d3c1dd02ea3fe0a027e
-SHA512 (gdm-3.18.2.tar.gz) = d0806010a1575880a9f108fdefe0bb68d40c64c9ff9307fa3718a93125d95293e16f9c44e6041723132a0630db09df37e54f8b2996c940458b73c71848725215
-Size (gdm-3.18.2.tar.gz) = 2603925 bytes
+SHA1 (gdm-3.36.2.tar.gz) = 3d6912431458e6972ef35093c10dc57b5f734aa5
+RMD160 (gdm-3.36.2.tar.gz) = 5920f54069a351f61e37ac013f0fed22ba899ced
+SHA512 (gdm-3.36.2.tar.gz) = f4ed10b13d0da938ec90f50e37d32dd16828ac514d6d034e4512a75649386b16698436cc6aef04298ccb4fc33491433971b18e5da76634d85fd58624efff65cc
+Size (gdm-3.36.2.tar.gz) = 1535203 bytes
+SHA1 (patch-Makefile.am) = 06b2d36d6fad1abb9405414c9f4e12ca11b409c4
 SHA1 (patch-common_gdm-address_c) = 194c2ccb1404709d2cb78cdaded93258bfec74f3
-SHA1 (patch-common_gdm-common_c) = 4ce512da501f37c98c397dc29b375e90c41e845e
-SHA1 (patch-common_gdm-common_h) = 4d2b59d14aac48af055bb805ee4d4533a1e2b674
-SHA1 (patch-common_gdm-log_c) = 7f3b809a082a17b9d6d05b4bcc6f3d623860bd47
-SHA1 (patch-configure_ac) = c2696cedeee73ef3e8f8fb8b7a20c0211bf06e74
+SHA1 (patch-common_gdm-common_c) = a144a8d39380b921f1cd8b9568886cb853189afa
+SHA1 (patch-common_gdm-common_h) = 9a3ae5a59f66539f861ced8f31f4daa2388aafdc
+SHA1 (patch-common_gdm-log_c) = 8855a1ddc30f927248c86eeede943e7f447a71cd
+SHA1 (patch-configure_ac) = 40e3d7d9b5dc828cf1f7360e949fdcf7c17d0a84
 SHA1 (patch-daemon_Makefile_am) = 45e1bdaada5241a488c4d3bb1a4f538f22483a30
-SHA1 (patch-daemon_gdm-display_c) = d24d91aeb8e7e85980b45cc084fc4dc6f81aa938
-SHA1 (patch-daemon_gdm-launch-environment_c) = 712c3dc71101970bbaca2ff36d5a0226d82f58c2
-SHA1 (patch-daemon_gdm-local-display-factory_c) = 7e9e3aab79d5067be8c219408e7a591cfe9af38a
-SHA1 (patch-daemon_gdm-manager_c) = b8429ff15331586e8dfa72c6d6691203029b9d46
-SHA1 (patch-daemon_gdm-server_c) = 283d327c96269b7d2722a15ca9dd33c7ca9210aa
-SHA1 (patch-daemon_gdm-session-record_c) = 20d41463cd76181cb06af812834efcc204e89c09
+SHA1 (patch-daemon_gdm-display_c) = 8c0dd3f90126b5a037411c56b2e9b7775a761d1d
+SHA1 (patch-daemon_gdm-launch-environment_c) = 0df990e1259b206eb1de05f2c4c88941b4d43197
+SHA1 (patch-daemon_gdm-local-display-factory_c) = 255c98e7b31475f171ed47f8e327784d0d37cd35
+SHA1 (patch-daemon_gdm-manager_c) = bc34826f3f4063c0eee4065641866ed8c565bfc0
+SHA1 (patch-daemon_gdm-server_c) = f06c049ce141703ead9d9ad672f767414008e170
+SHA1 (patch-daemon_gdm-session-record_c) = 70111b27c5c9276bd0adae1d29dd32d37eb00b29
 SHA1 (patch-daemon_gdm-session-worker-job_c) = 1c067b09637f96e7e997bdfbada6eb61ec760cda
-SHA1 (patch-daemon_gdm-session-worker_c) = ab54b035f669ffc536aa91a5a2786b1e3aed7d36
+SHA1 (patch-daemon_gdm-session-worker_c) = 56ad070bbdfa21db18f6438ba6d4461c80e991c2
 SHA1 (patch-daemon_gdm-session-worker_xml) = d6b97526777bc6bf374069cfd11c1370c6bb1ac6
-SHA1 (patch-daemon_gdm-session_c) = 6b7b7173e2b5f678616f5b22e5f7288b2f0a6c70
+SHA1 (patch-daemon_gdm-session_c) = df2b49b701468256f345000a2fb311e868133e2f
 SHA1 (patch-daemon_gdm-session_h) = 026c361633566413f7a07135683596feb9f9ad09
 SHA1 (patch-daemon_main_c) = 10342344290dfe27b93d0b5b620861e7af8026d1
 SHA1 (patch-data_Init_in) = 9df2fcf45c138fd3bd392964b6f7dd514e31bcad
-SHA1 (patch-data_Makefile_am) = 699bf0cbb3a8e9f4886985b6880c47230e613bc5
+SHA1 (patch-data_Makefile_am) = ccfad37aa9ec3e37191454b10f8243a5bf97f1a5
 SHA1 (patch-data_PostSession_in) = 3a8e66f8ae2839a54955aa8a25f51f3a26cbe791
 SHA1 (patch-data_PreSession_in) = 598d10822c2d9e0600a684c29a7b2a2f5e14d10d
-SHA1 (patch-libgdm_gdm-user-switching_c) = 861d676eb6f4a2c94c85993d49f7ee71643b7af1
+SHA1 (patch-libgdm_gdm-user-switching_c) = d655f79e498eaa7efd88ada4409d48270adf1d0c
diff --git a/gdm/files/10_org.gnome.login-screen.gschema.override b/gdm/files/10_org.gnome.login-screen.gschema.override
new file mode 100644
index 0000000000..88290b104b
--- /dev/null
+++ b/gdm/files/10_org.gnome.login-screen.gschema.override
@@ -0,0 +1,8 @@
+# $NetBSD$
+
+# corresponding PAM support is not available on OpenBSD/NetBSD
+[org.gnome.login-screen]
+enable-fingerprint-authentication=false
+enable-smartcard-authentication=false
+logo='${PREFIX}/share/pixmaps/NetBSD.xpm'
+
diff --git a/gdm/patches/patch-Makefile.am b/gdm/patches/patch-Makefile.am
new file mode 100644
index 0000000000..ab11df4273
--- /dev/null
+++ b/gdm/patches/patch-Makefile.am
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- Makefile.am.orig	2020-05-04 20:11:25.000000000 +0000
++++ Makefile.am
+@@ -7,7 +7,6 @@ SUBDIRS = 			\
+ 	daemon 			\
+ 	libgdm 			\
+ 	utils 			\
+-	pam_gdm			\
+ 	po 			\
+ 	tests 			\
+ 	$(NULL)
diff --git a/gdm/patches/patch-common_gdm-common_c b/gdm/patches/patch-common_gdm-common_c
index 04404145a9..231fea1f17 100644
--- a/gdm/patches/patch-common_gdm-common_c
+++ b/gdm/patches/patch-common_gdm-common_c
@@ -1,4 +1,10 @@
-$OpenBSD: patch-common_gdm-common_c,v 1.4 2015/10/18 13:25:54 ajacoutot Exp $
+$OpenBSD: patch-common_gdm-common_c,v 1.8 2020/05/14 15:25:54 ajacoutot Exp $
+
+REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit)
+From fcba1e1a5d556ce7b52101dbd2d1ba4a19469161 Mon Sep 17 00:00:00 2001
+From: Iain Lane <iain%orangesquash.org.uk@localhost>
+Date: Fri, 5 Jan 2018 11:53:34 +0000
+Subject: [PATCH] manager: Find user's current graphical session, not session of caller
 
 REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit)
 From 9be58c9ec9a3a411492a5182ac4b0d51fdc3a323 Mon Sep 17 00:00:00 2001
@@ -12,11 +18,12 @@ From: Ray Strode <rstrode%redhat.com@localhost>
 Date: Fri, 12 Jun 2015 13:28:01 -0400
 Subject: drop consolekit support
 
---- common/gdm-common.c.orig	2015-11-17 17:16:04.000000000 +0000
+Index: common/gdm-common.c
+--- common/gdm-common.c.orig	2020-05-04 20:11:25.000000000 +0000
 +++ common/gdm-common.c
-@@ -39,12 +39,25 @@
- #include "mkdtemp.h"
- #endif
+@@ -36,12 +36,25 @@
+ 
+ #include "gdm-common.h"
  
 +#ifdef WITH_SYSTEMD
  #include <systemd/sd-login.h>
@@ -39,14 +46,14 @@ Subject: drop consolekit support
 +
  G_DEFINE_QUARK (gdm-common-error, gdm_common_error);
  
- const char *
-@@ -343,10 +356,301 @@ create_transient_display (GDBusConnectio
+ gboolean
+@@ -352,8 +365,87 @@ create_transient_display (GDBusConnectio
          return TRUE;
  }
  
 +#ifdef WITH_CONSOLE_KIT
-+
-+static gboolean
+ gboolean
+-gdm_activate_session_by_id (GDBusConnection *connection,
 +get_current_session_id (GDBusConnection  *connection,
 +                        char            **session_id)
 +{
@@ -124,15 +131,15 @@ Subject: drop consolekit support
 +        return seat_id;
 +}
 +
-+static gboolean
++gboolean
 +activate_session_id_for_ck (GDBusConnection *connection,
-+                            const char      *seat_id,
-+                            const char      *session_id)
-+{
-+        GError *local_error = NULL;
-+        GVariant *reply;
-+
-+        reply = g_dbus_connection_call_sync (connection,
+                             const char      *seat_id,
+                             const char      *session_id)
+ {
+@@ -361,6 +453,217 @@ gdm_activate_session_by_id (GDBusConnect
+         GVariant *reply;
+ 
+         reply = g_dbus_connection_call_sync (connection,
 +                                             CK_NAME,
 +                                             seat_id,
 +                                             CK_SEAT_INTERFACE,
@@ -153,10 +160,7 @@ Subject: drop consolekit support
 +        return TRUE;
 +}
 +
- static gboolean
--activate_session_id (GDBusConnection *connection,
--                     const char      *seat_id,
--                     const char      *session_id)
++static gboolean
 +session_is_login_window (GDBusConnection *connection,
 +                         const char      *session_id)
 +{
@@ -259,7 +263,7 @@ Subject: drop consolekit support
 +                                    const char       *seat_id,
 +                                    char            **session_id)
 +{
-+        gboolean     can_activate_sessions;
++       gboolean     can_activate_sessions;
 +        const char **sessions;
 +        int          i;
 +
@@ -338,25 +342,30 @@ Subject: drop consolekit support
 +
 +#ifdef WITH_SYSTEMD
 +
-+static gboolean
++gboolean
 +activate_session_id_for_systemd (GDBusConnection *connection,
 +                                 const char      *seat_id,
 +                                 const char      *session_id)
- {
-         GError *local_error = NULL;
-         GVariant *reply;
-@@ -373,8 +677,8 @@ activate_session_id (GDBusConnection *co
++{
++        GError *local_error = NULL;
++        GVariant *reply;
++
++        reply = g_dbus_connection_call_sync (connection,
+                                              "org.freedesktop.login1",
+                                              "/org/freedesktop/login1",
+                                              "org.freedesktop.login1.Manager",
+@@ -382,8 +685,8 @@ gdm_activate_session_by_id (GDBusConnect
  }
  
- static gboolean
--get_login_window_session_id (const char  *seat_id,
--                             char       **session_id)
+ gboolean
+-gdm_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:
+@@ -476,15 +779,14 @@ out:
  }
  
  static gboolean
@@ -367,19 +376,39 @@ Subject: drop consolekit support
  {
          gboolean        ret;
          int             res;
-@@ -497,9 +801,9 @@ goto_login_session (GDBusConnection  *co
+         char           *our_session;
+         char           *session_id;
+         char           *seat_id;
+-        GError         *local_error = NULL;
+ 
+         ret = FALSE;
+         session_id = NULL;
+@@ -497,8 +799,10 @@ goto_login_session (GDBusConnection  *co
+          * since the data allocated is from libsystemd-logind, which
+          * does not use GLib's g_malloc (). */
+ 
+-        if (!gdm_find_display_session (0, getuid (), &our_session, &local_error)) {
+-                g_propagate_prefixed_error (error, local_error, _("Could not identify the current session: "));
++        res = sd_pid_get_session (0, &our_session);
++        if (res < 0) {
++                g_debug ("failed to determine own session: %s", strerror (-res));
++                g_set_error (error, GDM_COMMON_ERROR, 0, _("Could not identify the current session."));
+ 
+                 return FALSE;
+         }
+@@ -530,9 +834,9 @@ goto_login_session (GDBusConnection  *co
                  return FALSE;
          }
  
--        res = get_login_window_session_id (seat_id, &session_id);
+-        res = gdm_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 = gdm_activate_session_by_id (connection, seat_id, session_id);
 +                res = activate_session_id_for_systemd (connection, seat_id, session_id);
  
                  if (res) {
                          ret = TRUE;
-@@ -518,6 +822,7 @@ goto_login_session (GDBusConnection  *co
+@@ -551,6 +855,7 @@ goto_login_session (GDBusConnection  *co
  
          return ret;
  }
@@ -387,7 +416,7 @@ Subject: drop consolekit support
  
  gboolean
  gdm_goto_login_session (GError **error)
-@@ -533,7 +838,17 @@ gdm_goto_login_session (GError **error)
+@@ -566,7 +871,17 @@ gdm_goto_login_session (GError **error)
                  return FALSE;
          }
  
@@ -406,3 +435,139 @@ Subject: drop consolekit support
  }
  
  static void
+@@ -842,135 +1157,3 @@ gdm_shell_expand (const char *str,
+         }
+         return g_string_free (s, FALSE);
+ }
+-
+-static gboolean
+-_systemd_session_is_graphical (const char *session_id)
+-{
+-        const gchar * const graphical_session_types[] = { "wayland", "x11", "mir", NULL };
+-        int saved_errno;
+-        g_autofree gchar *type = NULL;
+-
+-        saved_errno = sd_session_get_type (session_id, &type);
+-        if (saved_errno < 0) {
+-                g_warning ("Couldn't get type for session '%s': %s",
+-                           session_id,
+-                           g_strerror (-saved_errno));
+-                return FALSE;
+-        }
+-
+-        if (!g_strv_contains (graphical_session_types, type)) {
+-                g_debug ("Session '%s' is not a graphical session (type: '%s')",
+-                         session_id,
+-                         type);
+-                return FALSE;
+-        }
+-
+-        return TRUE;
+-}
+-
+-static gboolean
+-_systemd_session_is_active (const char *session_id)
+-{
+-        const gchar * const active_states[] = { "active", "online", NULL };
+-        int saved_errno;
+-        g_autofree gchar *state = NULL;
+-
+-        /*
+-         * display sessions can be 'closing' if they are logged out but some
+-         * processes are lingering; we shouldn't consider these (this is
+-         * checking for a race condition since we specified
+-         * GDM_SYSTEMD_SESSION_REQUIRE_ONLINE)
+-         */
+-        saved_errno = sd_session_get_state (session_id, &state);
+-        if (saved_errno < 0) {
+-                g_warning ("Couldn't get state for session '%s': %s",
+-                           session_id,
+-                           g_strerror (-saved_errno));
+-                return FALSE;
+-        }
+-
+-        if (!g_strv_contains (active_states, state)) {
+-                g_debug ("Session '%s' is not active or online", session_id);
+-                return FALSE;
+-        }
+-
+-        return TRUE;
+-}
+-
+-gboolean
+-gdm_find_display_session (GPid        pid,
+-                          const uid_t uid,
+-                          char      **out_session_id,
+-                          GError    **error)
+-{
+-        char *local_session_id = NULL;
+-        g_auto(GStrv) sessions = NULL;
+-        int n_sessions;
+-        int res;
+-
+-        g_return_val_if_fail (out_session_id != NULL, FALSE);
+-
+-        /* First try to look up the session using the pid. We need this
+-         * at least for the greeter, because it currently runs multiple
+-         * sessions under the same user.
+-         * See also commit 2b52d8933c8ab38e7ee83318da2363d00d8c5581
+-         * which added an explicit dbus-run-session for all but seat0.
+-         */
+-        res = sd_pid_get_session (pid, &local_session_id);
+-        if (res >= 0) {
+-                g_debug ("GdmCommon: Found session %s for PID %d, using", local_session_id, pid);
+-
+-                *out_session_id = g_strdup (local_session_id);
+-                free (local_session_id);
+-
+-                return TRUE;
+-        } else {
+-                if (res != -ENODATA)
+-                        g_warning ("GdmCommon: Failed to retrieve session information for pid %d: %s",
+-                                   pid, strerror (-res));
+-        }
+-
+-        g_debug ("Finding a graphical session for user %d", uid);
+-
+-        n_sessions = sd_uid_get_sessions (uid,
+-                                          GDM_SYSTEMD_SESSION_REQUIRE_ONLINE,
+-                                          &sessions);
+-
+-        if (n_sessions < 0) {
+-                g_set_error (error,
+-                             GDM_COMMON_ERROR,
+-                             0,
+-                             "Failed to get sessions for user %d",
+-                             uid);
+-                return FALSE;
+-        }
+-
+-        for (int i = 0; i < n_sessions; ++i) {
+-                g_debug ("Considering session '%s'", sessions[i]);
+-
+-                if (!_systemd_session_is_graphical (sessions[i]))
+-                        continue;
+-
+-                if (!_systemd_session_is_active (sessions[i]))
+-                        continue;
+-
+-                /*
+-                 * We get the sessions from newest to oldest, so take the last
+-                 * one we find that's good
+-                 */
+-                local_session_id = sessions[i];
+-        }
+-
+-        if (local_session_id == NULL) {
+-                g_set_error (error,
+-                             GDM_COMMON_ERROR,
+-                             0,
+-                             "Could not find a graphical session for user %d",
+-                             uid);
+-                return FALSE;
+-        }
+-
+-        *out_session_id = g_strdup (local_session_id);
+-
+-        return TRUE;
+-}
diff --git a/gdm/patches/patch-common_gdm-common_h b/gdm/patches/patch-common_gdm-common_h
index 474ac279d2..532f1c53c2 100644
--- a/gdm/patches/patch-common_gdm-common_h
+++ b/gdm/patches/patch-common_gdm-common_h
@@ -1,4 +1,10 @@
-$OpenBSD: patch-common_gdm-common_h,v 1.1 2015/10/18 13:25:54 ajacoutot Exp $
+$OpenBSD: patch-common_gdm-common_h,v 1.5 2020/05/14 15:25:54 ajacoutot Exp $
+
+REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit)
+From fcba1e1a5d556ce7b52101dbd2d1ba4a19469161 Mon Sep 17 00:00:00 2001
+From: Iain Lane <iain%orangesquash.org.uk@localhost>
+Date: Fri, 5 Jan 2018 11:53:34 +0000
+Subject: [PATCH] manager: Find user's current graphical session, not session of caller
 
 REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit)
 From 9be58c9ec9a3a411492a5182ac4b0d51fdc3a323 Mon Sep 17 00:00:00 2001
@@ -6,15 +12,41 @@ From: Ray Strode <rstrode%redhat.com@localhost>
 Date: Fri, 12 Jun 2015 13:48:52 -0400
 Subject: require logind support
 
---- common/gdm-common.h.orig	Mon Sep 21 16:12:33 2015
-+++ common/gdm-common.h	Sun Oct 18 14:23:39 2015
-@@ -33,6 +33,9 @@
+Index: common/gdm-common.h
+--- common/gdm-common.h.orig	2020-05-04 20:11:25.000000000 +0000
++++ common/gdm-common.h
+@@ -37,6 +37,11 @@
  
- #define GDM_CUSTOM_SESSION  "custom"
+ #define GDM_SYSTEMD_SESSION_REQUIRE_ONLINE 0
  
 +/* check if logind is running */
 +#define LOGIND_RUNNING() (access("/run/systemd/seats/", F_OK) >= 0)
++
++#define GDM_SYSTEMD_SESSION_REQUIRE_ONLINE 0
 +
  GQuark gdm_common_error_quark (void);
  #define GDM_COMMON_ERROR gdm_common_error_quark()
  
+@@ -51,11 +56,6 @@ int            gdm_wait_on_and_disown_pi
+ int            gdm_signal_pid            (int pid,
+                                           int signal);
+ 
+-gboolean       gdm_find_display_session (GPid        pid,
+-                                         const uid_t uid,
+-                                         char      **out_session_id,
+-                                         GError    **error);
+-
+ gboolean       gdm_get_pwent_for_name    (const char     *name,
+                                           struct passwd **pwentp);
+ 
+@@ -83,10 +83,6 @@ char *        gdm_shell_expand          
+                                            GdmExpandVarFunc expand_func,
+                                            gpointer user_data);
+ 
+-gboolean      gdm_activate_session_by_id (GDBusConnection *connection,
+-                                          const char      *seat_id,
+-                                          const char      *session_id);
+-
+ G_END_DECLS
+ 
+ #endif /* _GDM_COMMON_H */
diff --git a/gdm/patches/patch-common_gdm-log_c b/gdm/patches/patch-common_gdm-log_c
index d1982306b9..b1faf9ca32 100644
--- a/gdm/patches/patch-common_gdm-log_c
+++ b/gdm/patches/patch-common_gdm-log_c
@@ -1,4 +1,4 @@
-$OpenBSD: patch-common_gdm-log_c,v 1.1 2015/10/18 13:25:54 ajacoutot Exp $
+$OpenBSD: patch-common_gdm-log_c,v 1.2 2018/04/24 08:37:00 ajacoutot Exp $
 
 REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit)
 From 9be58c9ec9a3a411492a5182ac4b0d51fdc3a323 Mon Sep 17 00:00:00 2001
@@ -6,8 +6,9 @@ From: Ray Strode <rstrode%redhat.com@localhost>
 Date: Fri, 12 Jun 2015 13:48:52 -0400
 Subject: require logind support
 
---- common/gdm-log.c.orig	Mon Sep 21 16:12:33 2015
-+++ common/gdm-log.c	Sun Oct 18 14:23:39 2015
+Index: common/gdm-log.c
+--- common/gdm-log.c.orig
++++ common/gdm-log.c
 @@ -30,7 +30,9 @@
  #include <unistd.h>
  
@@ -18,7 +19,15 @@ Subject: require logind support
  
  #include <glib.h>
  #include <glib/gstdio.h>
-@@ -133,7 +135,27 @@ gdm_log_init (void)
+@@ -125,12 +127,35 @@ gdm_log_set_debug (gboolean debug)
+ void
+ gdm_log_init (void)
+ {
++	const char *prg_name;
++	int         options;
++
+         if (initialized)
+                 return;
  
          initialized = TRUE;
  
diff --git a/gdm/patches/patch-configure_ac b/gdm/patches/patch-configure_ac
index 8d9277e766..b7c88c670e 100644
--- a/gdm/patches/patch-configure_ac
+++ b/gdm/patches/patch-configure_ac
@@ -1,4 +1,10 @@
-$OpenBSD: patch-configure_ac,v 1.7 2015/10/18 13:25:54 ajacoutot Exp $
+$OpenBSD: patch-configure_ac,v 1.18 2020/05/14 15:25:54 ajacoutot Exp $
+
+REVERT - Linux-PAM
+From 714b6af29b916ac7da0cdab6f83460574ed49cf2 Mon Sep 17 00:00:00 2001
+From: Ray Strode <rstrode%redhat.com@localhost>
+Date: Mon, 15 Aug 2016 13:48:00 -0400
+Subject: pam_gdm: add stub pam module
 
 REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit)
 From 1ac67f522f5690c27023d98096ca817f12f7eb88 Mon Sep 17 00:00:00 2001
@@ -8,13 +14,27 @@ Subject: drop consolekit support
 
 https://bugzilla.gnome.org/show_bug.cgi?id=722482
 
---- configure.ac.orig	2015-11-17 17:16:04.000000000 +0000
+Index: configure.ac
+--- configure.ac.orig
 +++ configure.ac
-@@ -244,7 +244,15 @@ AC_ARG_WITH(tcp-wrappers,
-                            [Use TCP Wrappers @<:@default=auto@:>@]),,
-             with_tcp_wrappers=auto)
+@@ -224,12 +224,6 @@ AM_CONDITIONAL(ENABLE_EXHERBO_PAM_CONFIG, test x$with_
+ AM_CONDITIONAL(ENABLE_LFS_PAM_CONFIG, test x$with_default_pam_config = xlfs)
+ AM_CONDITIONAL(ENABLE_ARCH_PAM_CONFIG, test x$with_default_pam_config = xarch)
  
+-AC_CHECK_HEADERS([security/pam_modules.h security/pam_modutil.h security/pam_ext.h],
+-                 [have_pam=yes],
+-                 [if test "x$have_pam" = xyes ; then
+-                        AC_MSG_ERROR([PAM development files not found.])
+-                 fi])
 -
+ AC_ARG_ENABLE(console-helper,
+ 	      AS_HELP_STRING([--enable-console-helper],
+                              [Enable PAM console helper @<:@default=auto@:>@]),,
+@@ -259,6 +253,17 @@ AC_ARG_WITH([udevdir],
+             AS_HELP_STRING([--with-udevdir=DIR],
+                            [Directory for udev files]),
+                 [with_udevdir=$withval], [with_udevdir=$($PKG_CONFIG --variable=udevdir udev)])
++
 +AC_ARG_WITH(console-kit,
 +            AS_HELP_STRING([--with-console-kit],
 +                           [Add ConsoleKit support @<:@default=auto@:>@]),,
@@ -24,10 +44,20 @@ https://bugzilla.gnome.org/show_bug.cgi?id=722482
 +            AS_HELP_STRING([--with-systemd],
 +                           [Add systemd support @<:@default=auto@:>@]),
 +            [with_systemd=$withval], [with_systemd=auto])
++
  AC_ARG_WITH([systemdsystemunitdir],
              AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
                             [Directory for systemd service files]),
-@@ -614,14 +622,8 @@ dnl ------------------------------------
+@@ -530,6 +535,8 @@ fi
+ if test "x$supports_pam_extensions" = "xyes" ; then
+ 	AM_CONDITIONAL(SUPPORTS_PAM_EXTENSIONS, true)
+ 	AC_DEFINE(SUPPORTS_PAM_EXTENSIONS, 1, [Define if PAM supports GDMs custom extensions])
++else
++	AM_CONDITIONAL(SUPPORTS_PAM_EXTENSIONS, false)
+ fi
+ 
+ PKG_CHECK_MODULES([KEYUTILS],
+@@ -612,14 +619,8 @@ dnl --------------------------------------------------
  dnl - Check for utmp stuff
  dnl ---------------------------------------------------------------------------
  
@@ -44,7 +74,7 @@ https://bugzilla.gnome.org/show_bug.cgi?id=722482
  AC_CHECK_LIB(util, logwtmp, [
  	  	   AC_DEFINE(HAVE_LOGWTMP, 1, [Define if have logwtmp])
  		       EXTRA_DAEMON_LIBS="$EXTRA_DAEMON_LIBS -lutil" ])
-@@ -870,12 +872,42 @@ AC_SUBST(XINERAMA_LIBS)
+@@ -828,12 +829,42 @@ AC_SUBST(XINERAMA_LIBS)
  CPPFLAGS="$xinerama_save_cppflags"
  
  dnl ---------------------------------------------------------------------------
@@ -88,7 +118,7 @@ https://bugzilla.gnome.org/show_bug.cgi?id=722482
  AC_SUBST(SYSTEMD_CFLAGS)
  AC_SUBST(SYSTEMD_LIBS)
  
-@@ -1068,6 +1100,14 @@ fi
+@@ -1026,6 +1057,14 @@ fi
  AC_SUBST(GDM_CUSTOM_CONF)
  AC_SUBST(GDM_OLD_CONF, '${gdmconfdir}/gdm.conf')
  
@@ -103,7 +133,7 @@ https://bugzilla.gnome.org/show_bug.cgi?id=722482
  AC_ARG_WITH(gnome-settings-daemon-directory,
                [AC_HELP_STRING([--with-gnome-settings-daemon-directory],
                                [Specify the directory of gnome-settings-daemon used by the chooser @<:@default=libexecdir@:>@])],,
-@@ -1549,6 +1589,7 @@ echo "
+@@ -1489,6 +1528,7 @@ echo "
          dmconfdir:                ${dmconfdir}
          localstatedir:            ${localstatedir}
          datadir:                  ${datadir}
@@ -111,16 +141,16 @@ https://bugzilla.gnome.org/show_bug.cgi?id=722482
  	gnome-settings-daemon location: ${with_gnome_settings_daemon_directory}
  	gnome-session-check-accel location: ${with_check_accelerated_directory}
  	source code location:	  ${srcdir}
-@@ -1578,6 +1619,8 @@ echo \
+@@ -1519,6 +1559,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}
+         udev dir:                 ${with_udevdir}
          plymouth support:         ${use_plymouth}
-         wayland support:          ${use_wayland}
-@@ -1586,3 +1629,4 @@ echo \
+@@ -1528,3 +1570,4 @@ echo \
          Enable documentation:     ${enable_documentation}
          Install GDM's Xsession:   ${enable_gdm_xsession}
  "
diff --git a/gdm/patches/patch-daemon_gdm-display_c b/gdm/patches/patch-daemon_gdm-display_c
index 4f4c769b75..c21d91d69f 100644
--- a/gdm/patches/patch-daemon_gdm-display_c
+++ b/gdm/patches/patch-daemon_gdm-display_c
@@ -1,24 +1,18 @@
-$OpenBSD: patch-daemon_gdm-display_c,v 1.1 2015/04/03 18:39:06 ajacoutot Exp $
+$OpenBSD: patch-daemon_gdm-display_c,v 1.8 2019/11/02 15:34:07 ajacoutot Exp $
 
 XXX fix+push upstream
 
---- daemon/gdm-display.c.orig	Fri Apr  3 20:26:42 2015
-+++ daemon/gdm-display.c	Fri Apr  3 20:27:20 2015
-@@ -50,7 +50,7 @@
- #include "gdm-dbus-util.h"
- #include "gdm-xerrors.h"
+Index: daemon/gdm-display.c
+--- daemon/gdm-display.c.orig
++++ daemon/gdm-display.c
+@@ -242,8 +242,8 @@ 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;
+-        host_entries[2].address   = "localuser\0gnome-initial-setup";
+-        host_entries[2].length    = sizeof ("localuser\0gnome-initial-setup");
++        host_entries[2].address   = "localuser\0_gnome-initial-setup";
++        host_entries[2].length    = sizeof ("localuser\0_gnome-initial-setup");
+ }
  
--#define INITIAL_SETUP_USERNAME "gnome-initial-setup"
-+#define INITIAL_SETUP_USERNAME "_gnome-initial-setup"
- #define GNOME_SESSION_SESSIONS_PATH DATADIR "/gnome-session/sessions"
- 
- #define GDM_DISPLAY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_DISPLAY, GdmDisplayPrivate))
-@@ -307,7 +307,7 @@ setup_xhost_auth (XHostAddress              *host_entr
-         si_entries[1].value       = GDM_USERNAME;
-         si_entries[1].valuelength = strlen (GDM_USERNAME);
-         si_entries[2].value       = "gnome-initial-setup";
--        si_entries[2].valuelength = strlen ("gnome-initial-setup");
-+        si_entries[2].valuelength = strlen ("_gnome-initial-setup");
- 
-         host_entries[0].family    = FamilyServerInterpreted;
-         host_entries[0].address   = (char *) &si_entries[0];
+ gboolean
diff --git a/gdm/patches/patch-daemon_gdm-launch-environment_c b/gdm/patches/patch-daemon_gdm-launch-environment_c
index c63cfe3cf1..aaf3cbdb3f 100644
--- a/gdm/patches/patch-daemon_gdm-launch-environment_c
+++ b/gdm/patches/patch-daemon_gdm-launch-environment_c
@@ -1,4 +1,4 @@
-$OpenBSD: patch-daemon_gdm-launch-environment_c,v 1.6 2015/10/18 13:25:54 ajacoutot Exp $
+$OpenBSD: patch-daemon_gdm-launch-environment_c,v 1.10 2019/11/02 15:34:07 ajacoutot Exp $
 
 XXX fix+push upstream
 
@@ -14,18 +14,19 @@ From: Ray Strode <rstrode%redhat.com@localhost>
 Date: Fri, 12 Jun 2015 14:33:40 -0400
 Subject: session: drop session-type property
 
---- daemon/gdm-launch-environment.c.orig	Sun Oct 18 14:26:32 2015
-+++ daemon/gdm-launch-environment.c	Sun Oct 18 14:24:34 2015
+Index: daemon/gdm-launch-environment.c
+--- daemon/gdm-launch-environment.c.orig
++++ daemon/gdm-launch-environment.c
 @@ -50,7 +50,7 @@
  #include "gdm-settings-direct.h"
  #include "gdm-settings-keys.h"
  
 -#define INITIAL_SETUP_USERNAME "gnome-initial-setup"
 +#define INITIAL_SETUP_USERNAME "_gnome-initial-setup"
+ #define GDM_SESSION_MODE "gdm"
+ #define INITIAL_SETUP_SESSION_MODE "initial-setup"
  #define GNOME_SESSION_SESSIONS_PATH DATADIR "/gnome-session/sessions"
- 
- extern char **environ;
-@@ -176,6 +176,9 @@ build_launch_environment (GdmLaunchEnvironment *launch
+@@ -212,6 +212,9 @@ build_launch_environment (GdmLaunchEnvironment *launch
                  char *seat_id;
  
                  seat_id = launch_environment->priv->x11_display_seat_id;
@@ -35,7 +36,7 @@ Subject: session: drop session-type property
  
                  g_hash_table_insert (hash, g_strdup ("GDM_SEAT_ID"), g_strdup (seat_id));
          }
-@@ -204,6 +207,8 @@ on_session_setup_complete (GdmSession        *session,
+@@ -237,6 +240,8 @@ on_session_setup_complete (GdmSession        *session,
                  gdm_session_set_environment_variable (launch_environment->priv->session, key, value);
          }
          g_hash_table_destroy (hash);
diff --git a/gdm/patches/patch-daemon_gdm-local-display-factory_c b/gdm/patches/patch-daemon_gdm-local-display-factory_c
index cf8c218357..3adc298ba0 100644
--- a/gdm/patches/patch-daemon_gdm-local-display-factory_c
+++ b/gdm/patches/patch-daemon_gdm-local-display-factory_c
@@ -1,4 +1,4 @@
-$OpenBSD: patch-daemon_gdm-local-display-factory_c,v 1.3 2015/10/18 13:25:54 ajacoutot Exp $
+$OpenBSD: patch-daemon_gdm-local-display-factory_c,v 1.13 2019/11/02 15:34:07 ajacoutot Exp $
 
 REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit)
 From 1ac67f522f5690c27023d98096ca817f12f7eb88 Mon Sep 17 00:00:00 2001
@@ -12,17 +12,29 @@ From: Ray Strode <rstrode%redhat.com@localhost>
 Date: Fri, 12 Jun 2015 13:48:52 -0400
 Subject: require logind support
 
---- daemon/gdm-local-display-factory.c.orig	2015-11-17 17:16:04.000000000 +0000
+Index: daemon/gdm-local-display-factory.c
+--- daemon/gdm-local-display-factory.c.orig
 +++ daemon/gdm-local-display-factory.c
-@@ -42,6 +42,7 @@
+@@ -28,7 +28,9 @@
+ #include <glib-object.h>
+ #include <gio/gio.h>
  
- #define GDM_LOCAL_DISPLAY_FACTORY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_LOCAL_DISPLAY_FACTORY, GdmLocalDisplayFactoryPrivate))
++#ifdef WITH_SYSTEMD
+ #include <systemd/sd-login.h>
++#endif
  
-+#define CK_SEAT1_PATH                       "/org/freedesktop/ConsoleKit/Seat1"
- #define SYSTEMD_SEAT0_PATH                  "seat0"
+ #include "gdm-common.h"
+ #include "gdm-manager.h"
+@@ -42,6 +44,8 @@
+ #include "gdm-local-display.h"
+ #include "gdm-legacy-display.h"
  
++#define CK_SEAT1_PATH                       "/org/freedesktop/ConsoleKit/Seat1"
++
  #define GDM_DBUS_PATH                       "/org/gnome/DisplayManager"
-@@ -59,8 +60,10 @@ struct GdmLocalDisplayFactoryPrivate
+ #define GDM_LOCAL_DISPLAY_FACTORY_DBUS_PATH GDM_DBUS_PATH "/LocalDisplayFactory"
+ #define GDM_MANAGER_DBUS_NAME               "org.gnome.DisplayManager.LocalDisplayFactory"
+@@ -60,8 +64,10 @@ struct _GdmLocalDisplayFactory
          /* FIXME: this needs to be per seat? */
          guint            num_failures;
  
@@ -30,94 +42,100 @@ Subject: require logind support
          guint            seat_new_id;
          guint            seat_removed_id;
 +#endif
- };
  
- enum {
-@@ -190,8 +193,20 @@ store_display (GdmLocalDisplayFactory *f
- static const char *
- get_seat_of_transient_display (GdmLocalDisplayFactory *factory)
- {
-+        const char *seat_id = NULL;
-+
-         /* FIXME: don't hardcode seat */
--        return SYSTEMD_SEAT0_PATH;
+ #if defined(ENABLE_WAYLAND_SUPPORT) && defined(ENABLE_USER_DISPLAY_SERVER)
+         unsigned int     active_vt;
+@@ -87,7 +93,9 @@ static void     on_display_status_changed             
+                                                          GParamSpec                  *arg1,
+                                                          GdmLocalDisplayFactory      *factory);
+ 
 +#ifdef WITH_SYSTEMD
-+        if (LOGIND_RUNNING() > 0) {
-+                seat_id = SYSTEMD_SEAT0_PATH;
-+        }
+ static gboolean gdm_local_display_factory_sync_seats    (GdmLocalDisplayFactory *factory);
 +#endif
-+
-+        if (seat_id == NULL) {
-+                seat_id = CK_SEAT1_PATH;
-+        }
-+
-+        return seat_id;
- }
- 
- /*
-@@ -216,7 +231,19 @@ gdm_local_display_factory_create_transie
+ static gpointer local_display_factory_object = NULL;
+ static gboolean lookup_by_session_id (const char *id,
+                                       GdmDisplay *display,
+@@ -231,7 +239,7 @@ gdm_local_display_factory_create_transient_display (Gd
  
          g_debug ("GdmLocalDisplayFactory: Creating transient display");
  
--        display = gdm_local_display_new ();
-+#ifdef WITH_SYSTEMD
-+        if (LOGIND_RUNNING() > 0) {
-+                display = gdm_local_display_new ();
-+        }
-+#endif
-+
-+        if (display == NULL) {
-+                guint32 num;
-+
-+                num = take_next_display_number (factory);
-+
-+                display = gdm_legacy_display_new (num);
-+        }
- 
-         seat_id = get_seat_of_transient_display (factory);
-         g_object_set (display,
-@@ -290,7 +317,7 @@ on_display_status_changed (GdmDisplay   
+-#ifdef ENABLE_USER_DISPLAY_SERVER
++#if defined ENABLE_USER_DISPLAY_SERVER && defined WITH_SYSTEMD
+         display = gdm_local_display_new ();
+         if (gdm_local_display_factory_use_wayland ())
+                 g_object_set (G_OBJECT (display), "session-type", "wayland", NULL);
+@@ -370,7 +378,7 @@ on_display_status_changed (GdmDisplay             *dis
                          /* reset num failures */
-                         factory->priv->num_failures = 0;
+                         factory->num_failures = 0;
  
 -                        gdm_local_display_factory_sync_seats (factory);
 +			create_display (factory, seat_id, session_type, is_initial);
                  }
                  break;
          case GDM_DISPLAY_FAILED:
-@@ -372,12 +399,14 @@ create_display (GdmLocalDisplayFactory *
-         g_debug ("GdmLocalDisplayFactory: Adding display on seat %s", seat_id);
+@@ -464,15 +472,19 @@ create_display (GdmLocalDisplayFactory *factory,
+ {
+         GdmDisplayStore *store;
+         GdmDisplay      *display = NULL;
++#ifdef WITH_SYSTEMD
+         g_autofree char *login_session_id = NULL;
++#endif
  
+         g_debug ("GdmLocalDisplayFactory: %s login display for seat %s requested",
+                  session_type? : "X11", seat_id);
+         store = gdm_display_factory_get_display_store (GDM_DISPLAY_FACTORY (factory));
  
 +#ifdef WITH_SYSTEMD
-         if (g_strcmp0 (seat_id, "seat0") == 0) {
-                 display = gdm_local_display_new ();
-                 if (session_type != NULL) {
-                         g_object_set (G_OBJECT (display), "session-type", session_type, NULL);
+         if (sd_seat_can_multi_session (seat_id))
+                 display = gdm_display_store_find (store, lookup_prepared_display_by_seat_id, (gpointer) seat_id);
+         else
++#endif
+                 display = gdm_display_store_find (store, lookup_by_seat_id, (gpointer) seat_id);
+ 
+         /* Ensure we don't create the same display more than once */
+@@ -481,6 +493,7 @@ create_display (GdmLocalDisplayFactory *factory,
+                 return NULL;
+         }
+ 
++#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;
+@@ -494,14 +507,15 @@ create_display (GdmLocalDisplayFactory *factory,
+                         g_object_set (G_OBJECT (display), "status", GDM_DISPLAY_MANAGED, NULL);
+                         g_debug ("GdmLocalDisplayFactory: session %s found, activating.",
+                                  login_session_id);
+-                        gdm_activate_session_by_id (factory->connection, seat_id, login_session_id);
++                        activate_session_id (factory->connection, seat_id, login_session_id);
+                         return NULL;
                  }
          }
 +#endif
  
-         if (display == NULL) {
-                 guint32 num;
-@@ -402,6 +431,8 @@ create_display (GdmLocalDisplayFactory *
+         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) {
+@@ -533,6 +547,7 @@ create_display (GdmLocalDisplayFactory *factory,
          return display;
  }
  
 +#ifdef WITH_SYSTEMD
-+
  static void
  delete_display (GdmLocalDisplayFactory *factory,
                  const char             *seat_id) {
-@@ -538,6 +569,7 @@ gdm_local_display_factory_stop_monitor (
-                 factory->priv->seat_removed_id = 0;
+@@ -911,6 +926,7 @@ gdm_local_display_factory_stop_monitor (GdmLocalDispla
          }
+ #endif
  }
 +#endif
  
  static void
  on_display_added (GdmDisplayStore        *display_store,
-@@ -576,6 +608,7 @@ static gboolean
+@@ -944,6 +960,7 @@ static gboolean
  gdm_local_display_factory_start (GdmDisplayFactory *base_factory)
  {
          GdmLocalDisplayFactory *factory = GDM_LOCAL_DISPLAY_FACTORY (base_factory);
@@ -125,9 +143,9 @@ Subject: require logind support
          GdmDisplayStore *store;
  
          g_return_val_if_fail (GDM_IS_LOCAL_DISPLAY_FACTORY (factory), FALSE);
-@@ -592,8 +625,17 @@ gdm_local_display_factory_start (GdmDisp
-                           G_CALLBACK (on_display_removed),
-                           factory);
+@@ -962,8 +979,17 @@ gdm_local_display_factory_start (GdmDisplayFactory *ba
+                                  factory,
+                                  0);
  
 -        gdm_local_display_factory_start_monitor (factory);
 -        return gdm_local_display_factory_sync_seats (factory);
@@ -145,7 +163,7 @@ Subject: require logind support
  }
  
  static gboolean
-@@ -604,7 +646,9 @@ gdm_local_display_factory_stop (GdmDispl
+@@ -974,7 +1000,9 @@ gdm_local_display_factory_stop (GdmDisplayFactory *bas
  
          g_return_val_if_fail (GDM_IS_LOCAL_DISPLAY_FACTORY (factory), FALSE);
  
@@ -155,9 +173,9 @@ Subject: require logind support
  
          store = gdm_display_factory_get_display_store (GDM_DISPLAY_FACTORY (factory));
  
-@@ -760,7 +804,9 @@ gdm_local_display_factory_finalize (GObj
+@@ -1126,7 +1154,9 @@ gdm_local_display_factory_finalize (GObject *object)
  
-         g_hash_table_destroy (factory->priv->used_display_numbers);
+         g_hash_table_destroy (factory->used_display_numbers);
  
 +#ifdef WITH_SYSTEMD
          gdm_local_display_factory_stop_monitor (factory);
diff --git a/gdm/patches/patch-daemon_gdm-manager_c b/gdm/patches/patch-daemon_gdm-manager_c
index b908848787..238e0b2d6f 100644
--- a/gdm/patches/patch-daemon_gdm-manager_c
+++ b/gdm/patches/patch-daemon_gdm-manager_c
@@ -1,6 +1,22 @@
-$OpenBSD: patch-daemon_gdm-manager_c,v 1.9 2015/10/18 13:25:54 ajacoutot Exp $
+$OpenBSD: patch-daemon_gdm-manager_c,v 1.24 2020/05/14 15:25:54 ajacoutot Exp $
 
-XXX fix+push upstream
+REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit)
+From fcba1e1a5d556ce7b52101dbd2d1ba4a19469161 Mon Sep 17 00:00:00 2001
+From: Iain Lane <iain%orangesquash.org.uk@localhost>
+Date: Fri, 5 Jan 2018 11:53:34 +0000
+Subject: [PATCH] manager: Find user's current graphical session, not session of caller
+
+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@localhost>
+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@localhost>
+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
@@ -14,11 +30,12 @@ From: Ray Strode <rstrode%redhat.com@localhost>
 Date: Fri, 12 Jun 2015 13:48:52 -0400
 Subject: require logind support
 
---- daemon/gdm-manager.c.orig	2015-11-17 17:16:04.000000000 +0000
+Index: daemon/gdm-manager.c
+--- daemon/gdm-manager.c.orig	2020-05-04 20:11:25.000000000 +0000
 +++ daemon/gdm-manager.c
-@@ -34,7 +34,9 @@
- #include <glib/gstdio.h>
- #include <glib-object.h>
+@@ -36,7 +36,9 @@
+ 
+ #include <act/act-user-manager.h>
  
 +#ifdef WITH_SYSTEMD
  #include <systemd/sd-login.h>
@@ -26,13 +43,14 @@ Subject: require logind support
  
  #include "gdm-common.h"
  
-@@ -57,7 +59,16 @@
+@@ -61,9 +63,18 @@
  #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 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"
@@ -41,10 +59,11 @@ Subject: require logind support
 +#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
  {
-@@ -202,9 +213,10 @@ plymouth_quit_without_transition (void)
+         GdmManager *manager;
+@@ -205,9 +216,10 @@ plymouth_quit_without_transition (void)
  }
  #endif
  
@@ -57,7 +76,7 @@ Subject: require logind support
  {
          char *session, *gsession;
          int ret;
-@@ -229,11 +241,61 @@ get_session_id_for_pid (pid_t    pid,
+@@ -232,11 +244,61 @@ get_session_id_for_pid (pid_t    pid,
                  return NULL;
          }
  }
@@ -92,7 +111,7 @@ Subject: require logind support
 +        return retval;
 +}
 +#endif
- 
++
 +static char *
 +get_session_id_for_pid (GDBusConnection  *connection,
 +                        pid_t             pid,
@@ -110,7 +129,7 @@ Subject: require logind support
 +
 +        return NULL;
 +}
-+
+ 
 +#ifdef WITH_SYSTEMD
  static gboolean
 -get_uid_for_session_id (const char  *session_id,
@@ -122,7 +141,7 @@ Subject: require logind support
  {
          int ret;
  
-@@ -250,6 +312,60 @@ get_uid_for_session_id (const char  *ses
+@@ -253,6 +315,60 @@ get_uid_for_session_id (const char  *ses
  
          return TRUE;
  }
@@ -183,7 +202,7 @@ Subject: require logind support
  
  static gboolean
  lookup_by_session_id (const char *id,
-@@ -263,10 +379,50 @@ lookup_by_session_id (const char *id,
+@@ -266,10 +382,50 @@ lookup_by_session_id (const char *id,
          return g_strcmp0 (current, looking_for) == 0;
  }
  
@@ -237,16 +256,15 @@ Subject: require logind support
  {
          char *session_class = NULL;
          int ret;
-@@ -291,11 +447,32 @@ is_login_session (GdmManager  *self,
+@@ -294,29 +450,49 @@ 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)
+-session_unlock (GdmManager *manager,
+-                const char *ssid)
 +is_login_session (GdmManager       *self,
 +                  GDBusConnection  *connection,
 +                  const char       *session_id,
@@ -273,24 +291,43 @@ Subject: require logind support
  {
          GError *error = NULL;
          GVariant *reply;
-@@ -322,15 +499,74 @@ activate_session_id (GdmManager *manager
+ 
+-        g_debug ("Unlocking session %s", ssid);
+-
+         reply = g_dbus_connection_call_sync (manager->priv->connection,
+                                              "org.freedesktop.login1",
+                                              "/org/freedesktop/login1",
+                                              "org.freedesktop.login1.Manager",
+-                                             "UnlockSession",
+-                                             g_variant_new ("(s)", ssid),
++                                             "ActivateSessionOnSeat",
++                                             g_variant_new ("(ss)", session_id, seat_id),
+                                              NULL, /* expected reply */
+                                              G_DBUS_CALL_FLAGS_NONE,
+                                              -1,
+                                              NULL,
+                                              &error);
+         if (reply == NULL) {
+-                g_debug ("GdmManager: logind 'UnlockSession' %s raised:\n %s\n\n",
++                g_debug ("GdmManager: logind 'ActivateSessionOnSeat' %s raised:\n %s\n\n",
+                          g_dbus_error_get_remote_error (error), error->message);
+                 g_error_free (error);
+                 return FALSE;
+@@ -326,6 +502,118 @@ session_unlock (GdmManager *manager,
  
          return TRUE;
  }
 +#endif
- 
++
 +#ifdef WITH_CONSOLE_KIT
- static gboolean
--session_unlock (GdmManager *manager,
--                const char *ssid)
++static gboolean
 +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);
++{
++        GError *error = NULL;
++        GVariant *reply;
++
 +        reply = g_dbus_connection_call_sync (manager->priv->connection,
 +                                             CK_NAME,
 +                                             seat_id,
@@ -337,26 +374,10 @@ Subject: require logind support
 +#ifdef WITH_CONSOLE_KIT
 +        return activate_session_id_for_ck (manager, seat_id, session_id);
 +#else
-+        return FALSE;
++       return FALSE;
 +#endif
 +}
 +
-+#ifdef WITH_SYSTEMD
-+static gboolean
-+session_unlock_for_systemd (GdmManager *manager,
-+                            const char *ssid)
-+{
-+        GError *error = NULL;
-+        GVariant *reply;
- 
-         reply = g_dbus_connection_call_sync (manager->priv->connection,
-                                              "org.freedesktop.login1",
-@@ -354,6 +590,59 @@ session_unlock (GdmManager *manager,
- 
-         return TRUE;
- }
-+#endif
-+
 +#ifdef WITH_CONSOLE_KIT
 +static gboolean
 +session_unlock_for_ck (GdmManager *manager,
@@ -411,7 +432,7 @@ Subject: require logind support
  
  static GdmSession *
  find_session_for_user_on_seat (GdmManager *manager,
-@@ -385,10 +674,43 @@ find_session_for_user_on_seat (GdmManage
+@@ -374,10 +662,43 @@ find_session_for_user_on_seat (GdmManage
          return NULL;
  }
  
@@ -458,12 +479,27 @@ Subject: require logind support
  {
          char *seat;
          int ret;
-@@ -414,10 +736,31 @@ is_remote_session (GdmManager  *self,
+@@ -403,10 +724,12 @@ is_remote_session (GdmManager  *self,
  
          return is_remote;
  }
 +#endif
  
++#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;
+@@ -431,11 +754,85 @@ get_seat_id_for_session_id (const char  
+ 
+         return out_seat;
+ }
++#endif
++
 +static gboolean
 +is_remote_session (GdmManager       *self,
 +                  GDBusConnection  *connection,
@@ -475,7 +511,7 @@ Subject: require logind support
 +                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
@@ -483,21 +519,6 @@ Subject: require logind support
 +        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;
-@@ -442,10 +785,61 @@ get_seat_id_for_session_id (const char  
- 
-         return out_seat;
- }
-+#endif
- 
 +#ifdef WITH_CONSOLE_KIT
  static char *
 -get_tty_for_session_id (const char  *session_id,
@@ -554,9 +575,14 @@ Subject: require logind support
 +get_tty_for_systemd_session_id (const char  *session_id,
 +                                GError     **error)
  {
++
++
++
++
          int ret;
          char *tty, *out_tty;
-@@ -469,6 +863,20 @@ get_tty_for_session_id (const char  *ses
+ 
+@@ -458,6 +855,20 @@ get_tty_for_session_id (const char  *ses
  
          return out_tty;
  }
@@ -577,16 +603,22 @@ Subject: require logind support
  
  static void
  get_display_and_details_for_bus_sender (GdmManager       *self,
-@@ -512,7 +920,7 @@ get_display_and_details_for_bus_sender (
+@@ -501,11 +912,10 @@ get_display_and_details_for_bus_sender (
                  goto out;
          }
  
--        session_id = get_session_id_for_pid (pid, &error);
+-        ret = gdm_find_display_session (pid, caller_uid, &session_id, &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",
-@@ -526,7 +934,7 @@ get_display_and_details_for_bus_sender (
+-        if (!ret) {
+-                g_debug ("GdmManager: Unable to find display session for uid %d: %s",
+-                         (int) caller_uid,
++        if (session_id == NULL) {
++                g_debug ("GdmManager: Error while retrieving session id for sender: %s",
+                          error->message);
+                 g_error_free (error);
+                 goto out;
+@@ -516,7 +926,7 @@ get_display_and_details_for_bus_sender (
          }
  
          if (out_is_login_screen != NULL) {
@@ -595,7 +627,7 @@ Subject: require logind support
  
                  if (error != NULL) {
                          g_debug ("GdmManager: Error while checking if sender is login screen: %s",
-@@ -536,7 +944,7 @@ get_display_and_details_for_bus_sender (
+@@ -526,7 +936,7 @@ get_display_and_details_for_bus_sender (
                  }
          }
  
@@ -604,7 +636,7 @@ Subject: require logind support
                  g_debug ("GdmManager: Error while retrieving uid for session: %s",
                           error->message);
                  g_error_free (error);
-@@ -553,7 +961,7 @@ get_display_and_details_for_bus_sender (
+@@ -543,7 +953,7 @@ get_display_and_details_for_bus_sender (
          }
  
          if (out_seat_id != NULL) {
@@ -613,7 +645,7 @@ Subject: require logind support
  
                  if (error != NULL) {
                          g_debug ("GdmManager: Error while retrieving seat id for session: %s",
-@@ -563,7 +971,7 @@ get_display_and_details_for_bus_sender (
+@@ -553,7 +963,7 @@ get_display_and_details_for_bus_sender (
          }
  
          if (out_is_remote != NULL) {
@@ -622,7 +654,55 @@ Subject: require logind support
  
                  if (error != NULL) {
                          g_debug ("GdmManager: Error while retrieving remoteness for session: %s",
-@@ -927,7 +1335,8 @@ on_reauthentication_client_rejected (Gdm
+@@ -609,7 +1019,7 @@ switch_to_compatible_user_session (GdmMa
+         if (existing_session != NULL) {
+                 ssid_to_activate = gdm_session_get_session_id (existing_session);
+                 if (seat_id != NULL) {
+-                        res = gdm_activate_session_by_id (manager->priv->connection, seat_id, ssid_to_activate);
++                        res = activate_session_id (manager, seat_id, ssid_to_activate);
+                         if (! res) {
+                                 g_debug ("GdmManager: unable to activate session: %s", ssid_to_activate);
+                                 goto out;
+@@ -711,29 +1121,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,
+@@ -773,7 +1160,7 @@ gdm_manager_handle_register_display (Gdm
+                 }
+         }
+ 
+-        session = find_user_session_for_display (self, display);
++        session = get_user_session_for_display (display);
+ 
+         if (session != NULL) {
+                 GPid pid;
+@@ -980,7 +1367,8 @@ on_reauthentication_client_rejected (Gdm
                   * same audit session, ignore it since it doesn't "own" the
                   * reauthentication session
                   */
@@ -632,20 +712,20 @@ Subject: require logind support
                                                              NULL);
                  session_id = g_object_get_data (G_OBJECT (session), "caller-session-id");
  
-@@ -1139,16 +1548,20 @@ static gboolean
+@@ -1199,16 +1587,19 @@ static gboolean
  display_is_on_seat0 (GdmDisplay *display)
  {
          gboolean is_on_seat0 = TRUE;
 -        char *seat_id = NULL;
- 
+-
 -        g_object_get (G_OBJECT (display), "seat-id", &seat_id, NULL);
-+#ifdef WITH_SYSTEMD
-+        if (LOGIND_RUNNING()) {
-+                char *seat_id = NULL;
  
 -        if (g_strcmp0 (seat_id, "seat0") != 0) {
 -            is_on_seat0 = FALSE;
 -        }
++#ifdef WITH_SYSTEMD
++        if (LOGIND_RUNNING()) {
++                char *seat_id = NULL;
 +                g_object_get (G_OBJECT (display), "seat-id", &seat_id, NULL);
  
 -        g_free (seat_id);
@@ -659,7 +739,7 @@ Subject: require logind support
          return is_on_seat0;
  }
  
-@@ -1749,11 +2162,57 @@ on_user_session_died (GdmSession *sessio
+@@ -2031,11 +2422,57 @@ on_user_session_died (GdmSession *sessio
  }
  
  static char *
@@ -719,3 +799,29 @@ Subject: require logind support
  }
  
  static void
+@@ -2045,25 +2482,6 @@ on_session_reauthenticated (GdmSession *
+ {
+         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 (gdm_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
+          * used an unlock screen instead of a user switched login screen),
diff --git a/gdm/patches/patch-daemon_gdm-server_c b/gdm/patches/patch-daemon_gdm-server_c
index 16f98d4c23..61e0ed74f4 100644
--- a/gdm/patches/patch-daemon_gdm-server_c
+++ b/gdm/patches/patch-daemon_gdm-server_c
@@ -1,4 +1,4 @@
-$OpenBSD: patch-daemon_gdm-server_c,v 1.7 2015/10/18 13:25:54 ajacoutot Exp $
+$OpenBSD: patch-daemon_gdm-server_c,v 1.12 2019/05/08 21:58:04 ajacoutot Exp $
 
 REVERT - OpenBSD lacks sigwaitinfo(2)
 From 956d7d1c7a0cfbf2beacdb9e88e645e15ad32047 Mon Sep 17 00:00:00 2001
@@ -18,7 +18,8 @@ From: Ray Strode <rstrode%redhat.com@localhost>
 Date: Fri, 12 Jun 2015 13:48:52 -0400
 Subject: require logind support
 
---- daemon/gdm-server.c.orig	2015-11-17 17:16:04.000000000 +0000
+Index: daemon/gdm-server.c
+--- daemon/gdm-server.c.orig	2020-05-04 20:11:25.000000000 +0000
 +++ daemon/gdm-server.c
 @@ -43,7 +43,9 @@
  #include <linux/vt.h>
@@ -30,7 +31,7 @@ Subject: require logind support
  
  #ifdef ENABLE_SYSTEMD_JOURNAL
  #include <systemd/sd-journal.h>
-@@ -92,6 +94,7 @@ struct GdmServerPrivate
+@@ -84,6 +86,7 @@ struct _GdmServer
          char    *auth_file;
  
          guint    child_watch_id;
@@ -38,7 +39,7 @@ Subject: require logind support
  
          gboolean is_initial;
  };
-@@ -122,90 +125,76 @@ static void     gdm_server_finalize     
+@@ -114,90 +117,74 @@ static void     gdm_server_finalize     
  
  G_DEFINE_TYPE (GdmServer, gdm_server, G_TYPE_OBJECT)
  
@@ -65,7 +66,7 @@ Subject: require logind support
 +
 +        error = NULL;
 +        command = g_strdup_printf (CONSOLEKIT_DIR "/ck-get-x11-display-device --display %s",
-+                                   server->priv->display_name);
++                                   server->display_name);
 +
 +        g_debug ("GdmServer: Running helper %s", command);
 +        out = NULL;
@@ -83,9 +84,9 @@ Subject: require logind support
 +        }
  
 -        gdm_run_script (GDMCONFDIR "/Init", GDM_USERNAME,
--                        server->priv->display_name,
+-                        server->display_name,
 -                        NULL, /* hostname */
--                        server->priv->auth_file);
+-                        server->auth_file);
 +        g_free (command);
  
 -        g_signal_emit (server, signals[READY], 0);
@@ -110,7 +111,7 @@ Subject: require logind support
 -        for (l = active_servers; l; l = l->next) {
 -                GdmServer *server = l->data;
 -
--                if (server->priv->pid == pid)
+-                if (server->pid == pid)
 -                        gdm_server_ready (server);
 +#ifdef WITH_SYSTEMD
 +        if (LOGIND_RUNNING()) {
@@ -143,23 +144,22 @@ Subject: require logind support
 -
 -                if (sigwaitinfo (&sigusr1_mask, &info) == -1)
 -                        continue;
-+        if (server->priv->display_device == NULL) {
-+                server->priv->display_device =
-+                    _gdm_server_query_ck_for_display_device (server);
- 
+-
 -                g_idle_add (got_sigusr1, GUINT_TO_POINTER (info.si_pid));
++        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 NULL;
-+        return g_strdup (server->priv->display_device);
++        return g_strdup (server->display_device);
  }
  
 -static void
 -gdm_server_launch_sigusr1_thread_if_needed (void)
 +static gboolean
 +on_sigusr1 (gpointer user_data)
-+
  {
 -        static GThread *sigusr1_thread;
 +        GdmServer *server = user_data;
@@ -174,16 +174,16 @@ Subject: require logind support
 -                g_mutex_unlock (&sigusr1_thread_mutex);
 -        }
 +        gdm_run_script (GDMCONFDIR "/Init", GDM_USERNAME,
-+                        server->priv->display_name,
++                        server->display_name,
 +                        NULL, /* hostname */
-+                        server->priv->auth_file);
++                        server->auth_file);
 +
 +        g_signal_emit (server, signals[READY], 0);
 +        return FALSE;
  }
  
  static void
-@@ -226,7 +215,9 @@ gdm_server_init_command (GdmServer *serv
+@@ -218,7 +205,9 @@ gdm_server_init_command (GdmServer *serv
                  debug_options = "";
          }
  
@@ -194,7 +194,7 @@ Subject: require logind support
  
          /* This is a temporary hack to work around the fact that XOrg
           * currently lacks support for multi-seat hotplugging for
-@@ -242,6 +233,10 @@ gdm_server_init_command (GdmServer *serv
+@@ -234,6 +223,10 @@ gdm_server_init_command (GdmServer *serv
           * wasn't booted using systemd, or b) the wrapper tool is
           * missing, or c) we are running for the main seat 'seat0'. */
  
@@ -205,32 +205,31 @@ Subject: require logind support
  #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 +259,9 @@ gdm_server_init_command (GdmServer *serv
+@@ -256,8 +249,8 @@ gdm_server_init_command (GdmServer *serv
          return;
  
  fallback:
--        server->priv->command = g_strdup_printf (X_SERVER X_SERVER_ARG_FORMAT, verbosity, debug_options);
 +#endif
- 
-+        server->priv->command = g_strdup_printf (X_SERVER X_SERVER_ARG_FORMAT, verbosity, debug_options);
+         server->command = g_strdup_printf (X_SERVER X_SERVER_ARG_FORMAT, verbosity, debug_options);
+-
  }
  
  static gboolean
-@@ -315,10 +311,12 @@ gdm_server_resolve_command_line (GdmServ
-                 argv[len++] = g_strdup (server->priv->auth_file);
+@@ -307,10 +300,12 @@ gdm_server_resolve_command_line (GdmServ
+                 argv[len++] = g_strdup (server->auth_file);
          }
  
--        if (server->priv->display_seat_id != NULL) {
+-        if (server->display_seat_id != NULL) {
 +#ifdef WITH_SYSTEMD
 +        if (LOGIND_RUNNING() && server->priv->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 (server->priv->disable_tcp && ! query_in_arglist) {
-                 argv[len++] = g_strdup ("-nolisten");
-@@ -650,12 +648,6 @@ server_child_watch (GPid       pid,
+         /* If we were compiled with Xserver >= 1.17 we need to specify
+          * '-listen tcp' as the X server dosen't listen on tcp sockets
+@@ -655,12 +650,6 @@ server_child_watch (GPid       pid,
          g_object_unref (server);
  }
  
@@ -243,7 +242,7 @@ Subject: require logind support
  static gboolean
  gdm_server_spawn (GdmServer    *server,
                    const char   *vtarg,
-@@ -693,15 +685,6 @@ gdm_server_spawn (GdmServer    *server,
+@@ -698,15 +687,6 @@ gdm_server_spawn (GdmServer    *server,
          g_debug ("GdmServer: Starting X server process: %s", freeme);
          g_free (freeme);
  
@@ -259,30 +258,24 @@ Subject: require logind support
          if (!g_spawn_async_with_pipes (NULL,
                                         argv,
                                         (char **)env->pdata,
-@@ -1037,11 +1020,16 @@ gdm_server_class_init (GdmServerClass *k
- static void
- gdm_server_init (GdmServer *server)
- {
-+
-         server->priv = GDM_SERVER_GET_PRIVATE (server);
- 
-         server->priv->pid = -1;
+@@ -1043,6 +1023,10 @@ gdm_server_init (GdmServer *server)
+         server->pid = -1;
  
-         server->priv->log_dir = g_strdup (LOGDIR);
+         server->log_dir = g_strdup (LOGDIR);
 +
-+        server->priv->sigusr1_id = g_unix_signal_add (SIGUSR1,
++        server->sigusr1_id = g_unix_signal_add (SIGUSR1,
 +                                                      on_sigusr1,
 +                                                      server);
  }
  
  static void
-@@ -1056,6 +1044,9 @@ gdm_server_finalize (GObject *object)
+@@ -1055,6 +1039,9 @@ gdm_server_finalize (GObject *object)
  
-         g_return_if_fail (server->priv != NULL);
+         server = GDM_SERVER (object);
  
-+        if (server->priv->sigusr1_id > 0)
-+                g_source_remove (server->priv->sigusr1_id);
++        if (server->sigusr1_id > 0)
++                g_source_remove (server->sigusr1_id);
 +
          gdm_server_stop (server);
  
-         g_free (server->priv->command);
+         g_free (server->command);
diff --git a/gdm/patches/patch-daemon_gdm-session-record_c b/gdm/patches/patch-daemon_gdm-session-record_c
index 4f171a4ca8..4a5293a815 100644
--- a/gdm/patches/patch-daemon_gdm-session-record_c
+++ b/gdm/patches/patch-daemon_gdm-session-record_c
@@ -1,8 +1,9 @@
-$OpenBSD: patch-daemon_gdm-session-record_c,v 1.7 2015/10/18 13:25:54 ajacoutot Exp $
+$OpenBSD: patch-daemon_gdm-session-record_c,v 1.11 2019/11/02 15:34:07 ajacoutot Exp $
 
 https://bugzilla.gnome.org/show_bug.cgi?id=722482
 
---- daemon/gdm-session-record.c.orig	2015-11-17 17:16:04.000000000 +0000
+Index: daemon/gdm-session-record.c
+--- daemon/gdm-session-record.c.orig	2020-05-04 20:11:25.000000000 +0000
 +++ daemon/gdm-session-record.c
 @@ -33,6 +33,16 @@
  #include <utmp.h>
@@ -31,7 +32,7 @@ https://bugzilla.gnome.org/show_bug.cgi?id=722482
  #if !defined(GDM_NEW_SESSION_RECORDS_FILE)
  #    if defined(WTMPX_FILE)
  #        define GDM_NEW_SESSION_RECORDS_FILE WTMPX_FILE
-@@ -183,6 +196,84 @@ record_set_line (UTMP       *u,
+@@ -168,6 +181,84 @@ record_set_line (UTMP       *u,
          g_debug ("using ut_line %.*s", (int) sizeof (u->ut_line), u->ut_line);
  }
  
@@ -85,7 +86,7 @@ https://bugzilla.gnome.org/show_bug.cgi?id=722482
 +static void
 +write_utmp_logout_manually (char *line)
 +{
-+#if defined(HAVE_GETTTYENT) && defined(HAVE_UTMP_H)
++#if defined(HAVE_GETTTYENT) && defined(HAVE_UTMP_H) && !defined(HAVE_GETUTXENT)
 +        int rval = 1;
 +        struct timeval tv;
 +        UTMP ut;
@@ -101,7 +102,7 @@ https://bugzilla.gnome.org/show_bug.cgi?id=722482
 +                    bzero (ut.ut_name, UT_NAMESIZE);
 +                    bzero (ut.ut_host, UT_HOSTSIZE);
 +                    gettimeofday (&tv, NULL);
-+                    ut.ut_tv = tv;
++                    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;
@@ -116,22 +117,22 @@ https://bugzilla.gnome.org/show_bug.cgi?id=722482
  void
  gdm_session_record_login (GPid                  session_pid,
                            const char           *user_name,
-@@ -227,8 +318,9 @@ gdm_session_record_login (GPid          
- #if defined(HAVE_GETUTXENT)
-         g_debug ("Adding or updating utmp record for login");
+@@ -214,8 +305,9 @@ gdm_session_record_login (GPid          
+         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);
++	    write_utmp_login_manually (&session_record);
  #endif
  }
  
-@@ -270,8 +362,8 @@ gdm_session_record_logout (GPid         
- #if defined(HAVE_GETUTXENT)
-         g_debug ("Adding or updating utmp record for logout");
+@@ -259,8 +351,8 @@ gdm_session_record_logout (GPid         
+         setutxent();
          pututxline (&session_record);
+         endutxent();
 -#elif defined(HAVE_LOGOUT)
 -        logout (session_record.ut_line);
 +#else
diff --git a/gdm/patches/patch-daemon_gdm-session-worker_c b/gdm/patches/patch-daemon_gdm-session-worker_c
index 8482eac3b4..f5fd04d433 100644
--- a/gdm/patches/patch-daemon_gdm-session-worker_c
+++ b/gdm/patches/patch-daemon_gdm-session-worker_c
@@ -1,4 +1,4 @@
-$OpenBSD: patch-daemon_gdm-session-worker_c,v 1.10 2015/10/18 13:25:54 ajacoutot Exp $
+$OpenBSD: patch-daemon_gdm-session-worker_c,v 1.21 2020/05/14 15:25:54 ajacoutot Exp $
 
 REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit)
 From 1ac67f522f5690c27023d98096ca817f12f7eb88 Mon Sep 17 00:00:00 2001
@@ -18,7 +18,14 @@ From: Ray Strode <rstrode%redhat.com@localhost>
 Date: Fri, 12 Jun 2015 14:33:40 -0400
 Subject: session: drop session-type property
 
---- daemon/gdm-session-worker.c.orig	2015-11-17 17:16:04.000000000 +0000
+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@localhost>
+Date: Mon, 11 Apr 2016 23:18:10 +1000
+Subject: gdm-session: set PAM_TTY when initialising pam
+
+Index: daemon/gdm-session-worker.c
+--- daemon/gdm-session-worker.c.orig	2020-05-04 20:11:25.000000000 +0000
 +++ daemon/gdm-session-worker.c
 @@ -28,9 +28,11 @@
  #include <string.h>
@@ -42,16 +49,16 @@ Subject: session: drop session-type property
  
  #ifdef ENABLE_SYSTEMD_JOURNAL
  #include <systemd/sd-journal.h>
-@@ -88,7 +92,7 @@
+@@ -93,7 +97,7 @@
  #endif
  
  #ifndef GDM_SESSION_DEFAULT_PATH
 -#define GDM_SESSION_DEFAULT_PATH "/usr/local/bin:/usr/bin:/bin"
-+#define GDM_SESSION_DEFAULT_PATH "/usr/pkg/bin:/usr/bin:/bin"
++#define GDM_SESSION_DEFAULT_PATH "${LOCALBASE}/bin:/usr/bin:/bin"
  #endif
  
  #ifndef GDM_SESSION_ROOT_UID
-@@ -131,6 +135,10 @@ struct GdmSessionWorkerPrivate
+@@ -125,6 +129,10 @@ struct GdmSessionWorkerPrivate
  
          int               exit_code;
  
@@ -62,7 +69,7 @@ Subject: session: drop session-type property
          pam_handle_t     *pam_handle;
  
          GPid              child_pid;
-@@ -145,6 +153,7 @@ struct GdmSessionWorkerPrivate
+@@ -139,6 +147,7 @@ struct GdmSessionWorkerPrivate
          char             *hostname;
          char             *username;
          char             *log_file;
@@ -70,9 +77,9 @@ Subject: session: drop session-type property
          char             *session_id;
          uid_t             uid;
          gid_t             gid;
-@@ -207,6 +216,204 @@ G_DEFINE_TYPE_WITH_CODE (GdmSessionWorke
-                          G_IMPLEMENT_INTERFACE (GDM_DBUS_TYPE_WORKER,
-                                                 worker_interface_init))
+@@ -213,6 +222,204 @@ G_DEFINE_TYPE_WITH_CODE (GdmSessionWorke
+                                                 worker_interface_init)
+                          G_ADD_PRIVATE (GdmSessionWorker))
  
 +#ifdef WITH_CONSOLE_KIT
 +static gboolean
@@ -275,7 +282,17 @@ Subject: session: drop session-type property
  /* adapted from glib script_execute */
  static void
  script_execute (const gchar *file,
-@@ -754,6 +961,7 @@ gdm_session_worker_stop_auditor (GdmSess
+@@ -664,7 +871,9 @@ gdm_session_worker_process_pam_message (
+         char    *user_answer;
+         gboolean res;
+         char    *utf8_msg;
++#ifdef PAM_RADIO_TYPE
+         char	*msg;
++#endif
+ 
+         if (response != NULL) {
+                 *response = NULL;
+@@ -868,6 +1077,7 @@ gdm_session_worker_stop_auditor (GdmSess
          worker->priv->auditor = NULL;
  }
  
@@ -283,27 +300,23 @@ Subject: session: drop session-type property
  static void
  on_release_display (int signal)
  {
-@@ -879,6 +1087,7 @@ jump_to_vt (GdmSessionWorker  *worker,
+@@ -1010,6 +1220,7 @@ jump_to_vt (GdmSessionWorker  *worker,
  
          close (active_vt_tty_fd);
  }
 +#endif
  
  static void
- gdm_session_worker_uninitialize_pam (GdmSessionWorker *worker,
-@@ -909,9 +1118,11 @@ gdm_session_worker_uninitialize_pam (Gdm
+ gdm_session_worker_set_state (GdmSessionWorker      *worker,
+@@ -1126,7 +1337,6 @@ gdm_session_worker_initialize_pam (GdmSe
+ {
+         struct pam_conv        pam_conversation;
+         int                    error_code;
+-        char tty_string[256];
  
-         gdm_session_worker_stop_auditor (worker);
+         g_assert (worker->priv->pam_handle == NULL);
  
-+#ifdef WITH_SYSTEMD
-         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;
-@@ -1036,10 +1247,12 @@ gdm_session_worker_initialize_pam (GdmSe
+@@ -1193,10 +1403,12 @@ gdm_session_worker_initialize_pam (GdmSe
                  }
          }
  
@@ -317,7 +330,22 @@ Subject: session: drop session-type property
  
          if (strcmp (service, "gdm-launch-environment") == 0) {
                  gdm_session_worker_set_environment_variable (worker, "XDG_SESSION_CLASS", "greeter");
-@@ -1342,7 +1555,7 @@ _lookup_passwd_info (const char *usernam
+@@ -1205,12 +1417,14 @@ gdm_session_worker_initialize_pam (GdmSe
+         g_debug ("GdmSessionWorker: state SETUP_COMPLETE");
+         gdm_session_worker_set_state (worker, GDM_SESSION_WORKER_STATE_SETUP_COMPLETE);
+ 
++#ifdef WITH_SYSTEMD
+         /* Temporarily set PAM_TTY with the login VT,
+            PAM_TTY will be reset with the users VT right before the user session is opened */
+         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;
++#endif
+ 
+  out:
+         if (error_code != PAM_SUCCESS) {
+@@ -1506,7 +1720,7 @@ _lookup_passwd_info (const char *usernam
                  if (passwd_entry->pw_shell != NULL && passwd_entry->pw_shell[0] != '\0') {
                          *shellp = g_strdup (passwd_entry->pw_shell);
                  } else {
@@ -326,7 +354,7 @@ Subject: session: drop session-type property
                  }
          }
          ret = TRUE;
-@@ -1595,6 +1808,26 @@ gdm_session_worker_get_environment (GdmS
+@@ -1759,6 +1973,26 @@ gdm_session_worker_get_environment (GdmS
          return (const char * const *) pam_getenvlist (worker->priv->pam_handle);
  }
  
@@ -353,7 +381,7 @@ Subject: session: drop session-type property
  static gboolean
  run_script (GdmSessionWorker *worker,
              const char       *dir)
-@@ -1625,6 +1858,9 @@ session_worker_child_watch (GPid        
+@@ -1789,6 +2023,9 @@ session_worker_child_watch (GPid        
                   : WIFSIGNALED (status) ? WTERMSIG (status)
                   : -1);
  
@@ -363,7 +391,7 @@ Subject: session: drop session-type property
  
          gdm_session_worker_uninitialize_pam (worker, PAM_SUCCESS);
  
-@@ -1813,12 +2049,14 @@ gdm_session_worker_start_session (GdmSes
+@@ -1979,6 +2216,7 @@ gdm_session_worker_start_session (GdmSes
  
          error_code = PAM_SUCCESS;
  
@@ -371,22 +399,23 @@ Subject: session: drop session-type property
          /* 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. */
-         if (worker->priv->display_mode == GDM_SESSION_DISPLAY_MODE_NEW_VT) {
-                 jump_to_vt (worker, worker->priv->session_vt);
+@@ -1987,6 +2225,7 @@ gdm_session_worker_start_session (GdmSes
+                         jump_to_vt (worker, worker->priv->session_vt);
+                 }
          }
 +#endif
  
-         session_pid = fork ();
- 
-@@ -1865,6 +2103,7 @@ gdm_session_worker_start_session (GdmSes
-                         _exit (2);
+         if (!worker->priv->is_program_session && !run_script (worker, GDMCONFDIR "/PostLogin")) {
+                 g_set_error (error,
+@@ -2049,6 +2288,7 @@ gdm_session_worker_start_session (GdmSes
+                         _exit (EXIT_FAILURE);
                  }
  
 +#ifdef WITH_SYSTEMD
                  /* Take control of the tty
                   */
                  if (needs_controlling_terminal) {
-@@ -1872,6 +2111,7 @@ gdm_session_worker_start_session (GdmSes
+@@ -2056,6 +2296,7 @@ gdm_session_worker_start_session (GdmSes
                                  g_debug ("GdmSessionWorker: could not take control of tty: %m");
                          }
                  }
@@ -394,7 +423,7 @@ Subject: session: drop session-type property
  
  #ifdef HAVE_LOGINCAP
                  if (setusercontext (NULL, passwd_entry, passwd_entry->pw_uid, LOGIN_SETALL) < 0) {
-@@ -2016,6 +2256,7 @@ gdm_session_worker_start_session (GdmSes
+@@ -2187,11 +2428,13 @@ gdm_session_worker_start_session (GdmSes
          return TRUE;
  }
  
@@ -402,7 +431,33 @@ Subject: session: drop session-type property
  static gboolean
  set_up_for_new_vt (GdmSessionWorker *worker)
  {
-@@ -2073,6 +2314,7 @@ fail:
+         int initial_vt_fd;
+         char vt_string[256], tty_string[256];
++        struct vt_stat vt_state = { 0 };
+         int session_vt = 0;
+ 
+         /* open the initial vt.  We need it for two scenarios:
+@@ -2209,6 +2452,11 @@ set_up_for_new_vt (GdmSessionWorker *wor
+                 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 = GDM_INITIAL_VT;
+         } else {
+@@ -2222,6 +2470,7 @@ set_up_for_new_vt (GdmSessionWorker *wor
+                 }
+         }
+ 
++        worker->priv->login_vt = vt_state.v_active;
+         worker->priv->session_vt = session_vt;
+ 
+         g_assert (session_vt > 0);
+@@ -2287,6 +2536,7 @@ fail:
          close (fd);
          return FALSE;
  }
@@ -410,36 +465,45 @@ Subject: session: drop session-type property
  
  static gboolean
  set_up_for_current_vt (GdmSessionWorker  *worker,
-@@ -2161,6 +2403,7 @@ gdm_session_worker_open_session (GdmSess
-                         return FALSE;
-                 }
-                 break;
+@@ -2354,12 +2604,14 @@ set_up_for_current_vt (GdmSessionWorker 
+          }
+ #endif
+ 
 +#ifdef WITH_SYSTEMD
+         if (g_strcmp0 (worker->priv->display_seat_id, "seat0") == 0) {
+                 g_debug ("GdmSessionWorker: setting XDG_VTNR to current vt");
+                 set_xdg_vtnr_to_current_vt (worker);
+         } else {
+                 g_debug ("GdmSessionWorker: not setting XDG_VTNR since not seat0");
+         }
++#endif
+ 
+         return TRUE;
+ out:
+@@ -2385,6 +2637,7 @@ gdm_session_worker_open_session (GdmSess
+                 break;
          case GDM_SESSION_DISPLAY_MODE_NEW_VT:
          case GDM_SESSION_DISPLAY_MODE_LOGIND_MANAGED:
++#ifdef WITH_SYSTEMD
                  if (!set_up_for_new_vt (worker)) {
-@@ -2171,6 +2414,7 @@ gdm_session_worker_open_session (GdmSess
+                         g_set_error (error,
+                                      GDM_SESSION_WORKER_ERROR,
+@@ -2392,6 +2645,7 @@ gdm_session_worker_open_session (GdmSess
+                                      "Unable to open VT");
                          return FALSE;
                  }
-                 break;
 +#endif
+                 break;
          }
  
-         flags = 0;
-@@ -2200,7 +2444,9 @@ gdm_session_worker_open_session (GdmSess
+@@ -2414,7 +2668,17 @@ gdm_session_worker_open_session (GdmSess
          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
          session_id = gdm_session_worker_get_environment_variable (worker, "XDG_SESSION_ID");
 +#endif
- 
-         /* FIXME: should we do something here?
-          * Note that error return status from PreSession script should
-@@ -2210,6 +2456,14 @@ gdm_session_worker_open_session (GdmSess
-          */
-         run_script (worker, GDMCONFDIR "/PreSession");
- 
++
 +#ifdef WITH_CONSOLE_KIT
 +        register_ck_session (worker);
 +
@@ -447,11 +511,10 @@ Subject: session: drop session-type property
 +                session_id = get_ck_session_id (worker);
 +        }
 +#endif
-+
+ 
          if (session_id != NULL) {
                  g_free (worker->priv->session_id);
-                 worker->priv->session_id = session_id;
-@@ -2314,6 +2568,19 @@ gdm_session_worker_handle_set_session_na
+@@ -2523,6 +2787,19 @@ gdm_session_worker_handle_set_session_na
  }
  
  static gboolean
@@ -471,7 +534,34 @@ Subject: session: drop session-type property
  gdm_session_worker_handle_set_session_display_mode (GdmDBusWorker         *object,
                                                      GDBusMethodInvocation *invocation,
                                                      const char            *str)
-@@ -3121,6 +3388,7 @@ worker_interface_init (GdmDBusWorkerIfac
+@@ -2949,6 +3226,7 @@ gdm_session_worker_handle_open (GdmDBusW
+         return TRUE;
+ }
+ 
++#ifdef SUPPORTS_PAM_EXTENSIONS
+ static char **
+ filter_extensions (const char * const *extensions)
+ {
+@@ -2974,6 +3252,7 @@ filter_extensions (const char * const *e
+ 
+         return filtered_extensions;
+ }
++#endif
+ 
+ static gboolean
+ gdm_session_worker_handle_initialize (GdmDBusWorker         *object,
+@@ -2993,8 +3272,10 @@ gdm_session_worker_handle_initialize (Gd
+         while (g_variant_iter_loop (&iter, "{sv}", &key, &value)) {
+                 if (g_strcmp0 (key, "service") == 0) {
+                         worker->priv->service = g_variant_dup_string (value, NULL);
++#ifdef SUPPORTS_PAM_EXTENSIONS
+                 } else if (g_strcmp0 (key, "extensions") == 0) {
+                         worker->priv->extensions = filter_extensions (g_variant_get_strv (value, NULL));
++#endif
+                 } 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 +3715,7 @@ worker_interface_init (GdmDBusWorkerIfac
          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;
diff --git a/gdm/patches/patch-daemon_gdm-session_c b/gdm/patches/patch-daemon_gdm-session_c
index a22a806a22..4d6db97c2b 100644
--- a/gdm/patches/patch-daemon_gdm-session_c
+++ b/gdm/patches/patch-daemon_gdm-session_c
@@ -1,4 +1,4 @@
-$OpenBSD: patch-daemon_gdm-session_c,v 1.6 2015/11/17 17:48:40 ajacoutot Exp $
+$OpenBSD: patch-daemon_gdm-session_c,v 1.22 2020/05/14 15:25:54 ajacoutot Exp $
 
 REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit)
 From 9be58c9ec9a3a411492a5182ac4b0d51fdc3a323 Mon Sep 17 00:00:00 2001
@@ -12,20 +12,21 @@ From: Ray Strode <rstrode%redhat.com@localhost>
 Date: Fri, 12 Jun 2015 14:33:40 -0400
 Subject: session: drop session-type property
 
---- daemon/gdm-session.c.orig	2015-11-17 17:16:04.000000000 +0000
+Index: daemon/gdm-session.c
+--- daemon/gdm-session.c.orig	2020-05-04 20:11:25.000000000 +0000
 +++ daemon/gdm-session.c
-@@ -3071,6 +3071,10 @@ gdm_session_get_display_mode (GdmSession
-                  self->priv->is_program_session? "yes" : "no",
-                  self->priv->display_seat_id);
+@@ -3238,6 +3238,10 @@ gdm_session_bypasses_xsession (GdmSessio
+         g_return_val_if_fail (self != NULL, FALSE);
+         g_return_val_if_fail (GDM_IS_SESSION (self), FALSE);
  
 +        if (!LOGIND_RUNNING()) {
 +                return GDM_SESSION_DISPLAY_MODE_REUSE_VT;
 +        }
 +
  #ifdef ENABLE_WAYLAND_SUPPORT
-         /* Wayland sessions are for now assumed to run in a
-          * mutter-launch-like environment, so we allocate
-@@ -3112,6 +3116,27 @@ gdm_session_select_program (GdmSession *
+         if (gdm_session_is_wayland_session (self)) {
+                 bypasses_xsession = TRUE;
+@@ -3333,6 +3337,27 @@ gdm_session_select_program (GdmSession *
  }
  
  void
@@ -37,7 +38,7 @@ Subject: session: drop session-type property
 +
 +        g_debug ("GdmSession: selecting session type '%s'", text);
 +
-+        g_hash_table_iter_init (&iter, self->priv->conversations);
++        g_hash_table_iter_init (&iter, self->conversations);
 +        while (g_hash_table_iter_next (&iter, &key, &value)) {
 +                GdmSessionConversation *conversation;
 +
diff --git a/gdm/patches/patch-data_Makefile_am b/gdm/patches/patch-data_Makefile_am
index 6a533e6fe2..6ee64066fc 100644
--- a/gdm/patches/patch-data_Makefile_am
+++ b/gdm/patches/patch-data_Makefile_am
@@ -1,7 +1,9 @@
-$OpenBSD: patch-data_Makefile_am,v 1.1 2015/10/18 13:25:54 ajacoutot Exp $
---- data/Makefile.am.orig	2015-11-17 17:16:04.000000000 +0000
+$OpenBSD: patch-data_Makefile_am,v 1.10 2019/11/02 16:34:15 ajacoutot Exp $
+
+Index: data/Makefile.am
+--- data/Makefile.am.orig
 +++ data/Makefile.am
-@@ -192,6 +192,7 @@ if ENABLE_GDM_XSESSION
+@@ -220,6 +220,7 @@ if ENABLE_GDM_XSESSION
  Xsession: $(srcdir)/Xsession.in
  	sed	-e 's,[@]XSESSION_SHELL[@],$(XSESSION_SHELL),g' \
  		-e 's,[@]libexecdir[@],$(libexecdir),g' \
@@ -9,7 +11,7 @@ $OpenBSD: patch-data_Makefile_am,v 1.1 2015/10/18 13:25:54 ajacoutot Exp $
  		<$(srcdir)/Xsession.in >Xsession
  Xsession_files += Xsession
  CLEANFILES += Xsession
-@@ -271,7 +272,7 @@ endif
+@@ -293,7 +294,7 @@ endif
  	if test '!' -d $(DESTDIR)$(logdir); then \
  		$(mkinstalldirs) $(DESTDIR)$(logdir); \
  		chmod 755 $(DESTDIR)$(logdir); \
@@ -18,7 +20,7 @@ $OpenBSD: patch-data_Makefile_am,v 1.1 2015/10/18 13:25:54 ajacoutot Exp $
  	fi
  
  	system=`uname`; \
-@@ -294,36 +295,36 @@ endif
+@@ -316,29 +317,29 @@ endif
  	if test '!' -d $(DESTDIR)$(xauthdir); then \
  		$(mkinstalldirs) $(DESTDIR)$(xauthdir); \
  		chmod 0711 $(DESTDIR)$(xauthdir); \
@@ -26,14 +28,6 @@ $OpenBSD: patch-data_Makefile_am,v 1.1 2015/10/18 13:25:54 ajacoutot Exp $
 +		chown root:676 $(DESTDIR)$(xauthdir) || : ; \
  	fi
  
- 	if test -n "$(systemdsystemunit)" -a '!' -d $(DESTDIR)$(SYSTEMD_SYSTEM_UNIT_DIR); then \
- 		$(mkinstalldirs) $(DESTDIR)$(SYSTEMD_SYSTEM_UNIT_DIR); \
- 		chmod 0755 $(DESTDIR)$(SYSTEMD_SYSTEM_UNIT_DIR); \
--		chown root:root $(DESTDIR)$(SYSTEMD_SYSTEM_UNIT_DIR) || : ; \
-+		chown root:wheel $(DESTDIR)$(SYSTEMD_SYSTEM_UNIT_DIR) || : ; \
- 		$(INSTALL_DATA) $(builddir)/$(systemdsystemunit) $(DESTDIR)$(SYSTEMD_SYSTEM_UNIT_DIR)/$(systemdsystemunit); \
- 	fi
- 
  	if test '!' -d $(DESTDIR)$(screenshotdir); then \
  		$(mkinstalldirs) $(DESTDIR)$(screenshotdir); \
  		chmod 0755 $(DESTDIR)$(screenshotdir); \
diff --git a/gdm/patches/patch-libgdm_gdm-user-switching_c b/gdm/patches/patch-libgdm_gdm-user-switching_c
index e04b5b329f..ce57d7eab0 100644
--- a/gdm/patches/patch-libgdm_gdm-user-switching_c
+++ b/gdm/patches/patch-libgdm_gdm-user-switching_c
@@ -12,7 +12,7 @@ From: Ray Strode <rstrode%redhat.com@localhost>
 Date: Fri, 12 Jun 2015 13:48:52 -0400
 Subject: require logind support
 
---- libgdm/gdm-user-switching.c.orig	2015-11-17 17:16:04.000000000 +0000
+--- libgdm/gdm-user-switching.c.orig	2020-05-04 20:11:25.000000000 +0000
 +++ libgdm/gdm-user-switching.c
 @@ -31,12 +31,25 @@
  #include <glib-object.h>
@@ -153,12 +153,7 @@ Subject: require logind support
 +        return TRUE;
 +}
 +
- static gboolean
--activate_session_id (GDBusConnection  *connection,
--                     GCancellable     *cancellable,
--                     const char       *seat_id,
--                     const char       *session_id,
--                     GError          **error)
++static gboolean
 +session_is_login_window (GDBusConnection *connection,
 +                         const char      *session_id)
 +{
@@ -341,7 +336,12 @@ Subject: require logind support
 +
 +#ifdef WITH_SYSTEMD
 +
-+static gboolean
+ static gboolean
+-activate_session_id (GDBusConnection  *connection,
+-                     GCancellable     *cancellable,
+-                     const char       *seat_id,
+-                     const char       *session_id,
+-                     GError          **error)
 +activate_session_id_for_systemd (GDBusConnection  *connection,
 +                                 GCancellable     *cancellable,
 +                                 const char       *seat_id,
@@ -374,7 +374,7 @@ Subject: require logind support
  {
          gboolean        ret;
          int             res;
-@@ -238,9 +543,9 @@ goto_login_session (GDBusConnection  *co
+@@ -236,9 +541,9 @@ goto_login_session (GDBusConnection  *co
                  return FALSE;
          }
  
@@ -386,7 +386,7 @@ Subject: require logind support
  
                  if (res) {
                          ret = TRUE;
-@@ -259,10 +564,11 @@ goto_login_session (GDBusConnection  *co
+@@ -257,10 +562,11 @@ goto_login_session (GDBusConnection  *co
  
          return ret;
  }
@@ -399,7 +399,7 @@ Subject: require logind support
  {
          GDBusConnection *connection;
          gboolean retval;
-@@ -271,8 +577,23 @@ gdm_goto_login_session_sync (GCancellabl
+@@ -269,8 +575,23 @@ gdm_goto_login_session_sync (GCancellabl
          if (!connection)
                  return FALSE;
  


Home | Main Index | Thread Index | Old Index