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