git: a69eab30db5a - main - x11/gdm: Update to 41.3
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 31 Jan 2022 21:06:40 UTC
The branch main has been updated by nc: URL: https://cgit.FreeBSD.org/ports/commit/?id=a69eab30db5aa908c31f17217000bd16a44b2496 commit a69eab30db5aa908c31f17217000bd16a44b2496 Author: Neel Chauhan <nc@FreeBSD.org> AuthorDate: 2022-01-28 22:51:56 +0000 Commit: Neel Chauhan <nc@FreeBSD.org> CommitDate: 2022-01-31 21:06:19 +0000 x11/gdm: Update to 41.3 Differential Revision: https://reviews.freebsd.org/D34088 --- x11/gdm/Makefile | 110 ++- x11/gdm/distinfo | 6 +- x11/gdm/files/gdm-launch-environment.in | 7 +- x11/gdm/files/gdm-password.in | 3 - x11/gdm/files/patch-Makefile.in | 20 - x11/gdm/files/patch-common_Makefile.in | 10 - x11/gdm/files/patch-common_gdm-address.c | 27 - x11/gdm/files/patch-common_gdm-common.c | 601 ++++++++------ x11/gdm/files/patch-common_gdm-common.h | 69 +- x11/gdm/files/patch-common_gdm-log.c | 41 +- x11/gdm/files/patch-config.h.in | 69 -- x11/gdm/files/patch-configure | 431 ---------- x11/gdm/files/patch-daemon_Makefile.in | 94 --- .../files/patch-daemon_gdm-display-access-file.c | 36 + x11/gdm/files/patch-daemon_gdm-display.c | 16 + .../files/patch-daemon_gdm-launch-environment.c | 37 - .../files/patch-daemon_gdm-local-display-factory.c | 260 +++--- x11/gdm/files/patch-daemon_gdm-manager.c | 897 ++------------------- x11/gdm/files/patch-daemon_gdm-server.c | 184 +++-- x11/gdm/files/patch-daemon_gdm-session-record.c | 141 ++++ .../files/patch-daemon_gdm-session-worker-job.c | 12 +- x11/gdm/files/patch-daemon_gdm-session-worker.c | 296 +++---- x11/gdm/files/patch-daemon_gdm-session-worker.xml | 12 - x11/gdm/files/patch-daemon_gdm-session.c | 70 +- x11/gdm/files/patch-daemon_gdm-session.h | 19 - x11/gdm/files/patch-daemon_gdm-x-session.c | 20 + .../files/patch-daemon_gdm-xdmcp-display-factory.c | 11 - x11/gdm/files/patch-daemon_main.c | 28 + x11/gdm/files/patch-daemon_meson.build | 18 + x11/gdm/files/patch-data_61-gdm.rules.in | 23 + x11/gdm/files/patch-data_Init.in | 65 +- x11/gdm/files/patch-data_PostSession.in | 14 + x11/gdm/files/patch-data_PreSession.in | 14 + x11/gdm/files/patch-data_Xsession.in | 21 - ...ch-data_applications_mime-dummy-handler.desktop | 10 - .../patch-data_dconf_defaults_00-upstream-settings | 11 - x11/gdm/files/patch-data_gdm.conf-custom.in | 12 - x11/gdm/files/patch-data_gdm.schemas.in.in | 11 - x11/gdm/files/patch-data_gnome-login.session.in | 7 - x11/gdm/files/patch-data_meson.build | 77 ++ .../files/patch-data_pam-exherbo_gdm-autologin.pam | 20 + .../patch-data_pam-exherbo_gdm-fingerprint.pam | 25 + ...tch-data_pam-exherbo_gdm-launch-environment.pam | 25 + .../files/patch-data_pam-exherbo_gdm-password.pam | 20 + .../files/patch-data_pam-exherbo_gdm-smartcard.pam | 28 + .../files/patch-data_pam-redhat_gdm-autologin.pam | 10 - .../patch-data_pam-redhat_gdm-fingerprint.pam | 10 - .../files/patch-data_pam-redhat_gdm-password.pam | 10 - x11/gdm/files/patch-data_pam-redhat_gdm-pin.pam | 10 - .../files/patch-data_pam-redhat_gdm-smartcard.pam | 10 - x11/gdm/files/patch-libgdm_gdm-user-switching.c | 406 +--------- x11/gdm/files/patch-meson.build | 52 ++ x11/gdm/files/patch-pam__gdm_pam__gdm.c | 18 + x11/gdm/pkg-plist | 18 +- 54 files changed, 1558 insertions(+), 2914 deletions(-) diff --git a/x11/gdm/Makefile b/x11/gdm/Makefile index 58603bb0d607..95758917e2e8 100644 --- a/x11/gdm/Makefile +++ b/x11/gdm/Makefile @@ -1,10 +1,9 @@ # Created by: Joe Marcus Clarke <marcus@FreeBSD.org> PORTNAME= gdm -PORTVERSION= 3.28.4 -PORTREVISION= 6 +PORTVERSION= 41.3 CATEGORIES= x11 gnome -MASTER_SITES= GNOME +MASTER_SITES= GNOME/sources/${PORTNAME}/${PORTVERSION:C/^([0-9]+)\..*/\1/} DIST_SUBDIR= gnome MAINTAINER= gnome@FreeBSD.org @@ -13,28 +12,28 @@ COMMENT= GNOME 3 display manager LICENSE= GPLv2 LICENSE_FILE= ${WRKSRC}/COPYING -BUILD_DEPENDS= zenity>=3.0.0:x11/zenity \ +BUILD_DEPENDS= iso-codes>=0:misc/iso-codes \ itstool:textproc/itstool \ - iso-codes>=0:misc/iso-codes -LIB_DEPENDS= libck-connector.so:sysutils/consolekit2 \ - libaccountsservice.so:sysutils/accountsservice \ - libfribidi.so:converters/fribidi \ + zenity>=3.0.0:x11/zenity +LIB_DEPENDS= libaccountsservice.so:sysutils/accountsservice \ + libcanberra-gtk3.so:audio/libcanberra-gtk3 \ libcanberra.so:audio/libcanberra \ - libcanberra-gtk3.so:audio/libcanberra-gtk3 -RUN_DEPENDS= zenity>=3.0.0:x11/zenity \ - gnome-settings-daemon>=3.0.0:sysutils/gnome-settings-daemon \ + libck-connector.so:sysutils/consolekit2 \ + libfribidi.so:converters/fribidi +RUN_DEPENDS= at-spi2-core>=0:accessibility/at-spi2-core \ + gnome-icon-theme-symbolic>=0:x11-themes/gnome-icon-theme-symbolic \ gnome-keyring-3:security/gnome-keyring \ gnome-session>=3.0.0:x11/gnome-session \ - gnome-icon-theme-symbolic>=0:x11-themes/gnome-icon-theme-symbolic \ + gnome-settings-daemon>=3.0.0:sysutils/gnome-settings-daemon \ + iso-codes>=0:misc/iso-codes \ polkit-gnome>=0.105:sysutils/polkit-gnome \ - at-spi2-core>=0:accessibility/at-spi2-core \ - iso-codes>=0:misc/iso-codes + zenity>=3.0.0:x11/zenity # used in scripts -RUN_DEPENDS+= xrdb:x11/xrdb \ - setxkbmap:x11/setxkbmap \ - xsetroot:x11/xsetroot \ +RUN_DEPENDS+= setxkbmap:x11/setxkbmap \ xhost:x11/xhost \ xmodmap:x11/xmodmap \ + xrdb:x11/xrdb \ + xsetroot:x11/xsetroot \ xterm:x11/xterm USERS= gdm @@ -42,7 +41,8 @@ GROUPS= gdm video PORTSCOUT= limitw:1,even -USES= cpe gettext gmake gnome libtool localbase:ldflags pathfix pkgconfig tar:xz xorg +USES= cpe gettext gnome libtool localbase:ldflags meson pathfix \ + pkgconfig tar:xz xorg CPE_VENDOR= gnome CPE_PRODUCT= gnome_display_manager USE_GNOME= cairo dconf gtk30 intltool introspection @@ -50,43 +50,35 @@ USE_LDCONFIG= yes USE_XORG= x11 xau xcb xdmcp xorgproto USE_RC_SUBR= gdm USE_GNOME_SUBR= yes -GNU_CONFIGURE= yes GLIB_SCHEMAS= org.gnome.login-screen.gschema.xml -CONFIGURE_ARGS= --disable-static \ - --mandir=${PREFIX}/man \ - --with-lang-file=${PREFIX}/etc/gdm/locale.conf \ - --with-at-spi-registryd-directory=${LOCALBASE}/libexec \ - --with-custom-conf=${PREFIX}/etc/gdm/custom.conf \ - --with-dbus-sys=${PREFIX}/etc/dbus-1/system.d \ - --with-log-dir=/var/log/gdm \ - --localstatedir=/var \ - --without-selinux \ - --without-libaudit \ - --with-console-kit \ - --with-working-directory=${PREFIX}/etc/gdm/home \ - --with-sysconfsubdir=gdm \ - --with-pid-file=/var/run/gdm.pid \ - --with-dmconfdir=${LOCALBASE}/share/xsessions \ - --with-screenshot-dir=/var/run/gdm/greeter \ - --enable-authentication-scheme=pam \ - --without-plymouth \ - --without-systemd \ - --with-user=gdm \ - --with-group=gdm \ - --with-initial-vt=09 \ - --enable-gdm-xsession \ - --disable-wayland-support \ - --with-systemd=no +MESON_ARGS= -Dat-spi-registryd-dir=${PREFIX}/libexec \ + -Dcustom-conf=${PREFIX}/etc/gdm/custom.conf \ + -Ddbus-sys=${PREFIX}/etc/dbus-1/system.d \ + -Ddefault-pam-config=none \ + -Ddmconfdir=${PREFIX}/share/xsessions \ + -Dgdm-xsession=true \ + -Dgroup=gdm \ + -Dinitial-vt=05 \ + -Dlang-file=${PREFIX}/etc/gdm/locale.conf \ + -Dlibaudit=disabled \ + -Dlog-dir=/var/log/gdm \ + -Dpid-file=/var/run/gdm.pid \ + -Dplymouth=disabled \ + -Dscreenshot-dir=/var/run/gdm/greeter \ + -Dselinux=disabled \ + -Dsysconfsubdir=gdm \ + -Dsystemd-journal=false \ + -Duser-display-server=false \ + -Duser=gdm \ + -Dwayland-support=false \ + -Dworking-dir=/var/db/gdm \ + -Dxauth-dir=/var/run/gdm # this is a hack until we can get our own pam dir and dir in order. -CONFIGURE_ARGS+=--with-default-pam-config=redhat -CPPFLAGS+= -DHAS_SA_LEN +CPPFLAGS+= -DHAS_SA_LEN -DWITH_CONSOLE_KIT=1 INSTALL_TARGET= install-strip -SUB_FILES+= gdm-launch-environment \ - gdm-password \ - gdm-autologin \ - client.conf \ +SUB_FILES+= client.conf gdm-autologin gdm-launch-environment gdm-password \ locale.conf GDMDIR?= ${PREFIX}/etc/gdm @@ -95,17 +87,11 @@ GNOME_LOCALSTATEDIR= /var OPTIONS_DEFINE= IPV6 -IPV6_CONFIGURE_ENABLE= ipv6 +IPV6_MESON_ENABLE= ipv6 .include <bsd.port.options.mk> -.if defined(WITH_DEBUG) -CONFIGURE_ARGS+= --enable-debug -.endif - post-patch: - @${REINPLACE_CMD} -e 's|root:root|root:wheel|g' \ - ${WRKSRC}/data/Makefile.in @${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|g' \ -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \ -e 's|/bin/bash|/bin/sh|g' \ @@ -113,7 +99,7 @@ post-patch: @${REINPLACE_CMD} -e 's|/usr/X11R6|${LOCALBASE}|g' \ -e 's|/usr/bin/X|${LOCALBASE}/bin/X|g' \ -e 's|/usr/bin/Xorg|${LOCALBASE}/bin/Xorg|g' \ - ${WRKSRC}/configure ${WRKSRC}/daemon/*.c ${WRKSRC}/po/*.po + ${WRKSRC}/meson.build ${WRKSRC}/daemon/*.c ${WRKSRC}/po/*.po @${REINPLACE_CMD} -e 's|/at-spi-registryd|/at-spi2-registryd|g' \ ${WRKSRC}/chooser/gdm-host-chooser.c \ ${WRKSRC}/chooser/chooser-main.c @@ -128,9 +114,8 @@ post-patch: ${WRKSRC}/data/applications/gnome-shell.desktop \ post-install: - ${INSTALL_DATA} ${WRKSRC}/data/gdm.conf-custom \ + ${MV} ${STAGEDIR}${PREFIX}/etc/gdm/custom.conf \ ${STAGEDIR}${PREFIX}/etc/gdm/custom.conf.sample - @${RM} ${STAGEDIR}${PREFIX}/etc/gdm/custom.conf ${MV} ${STAGEDIR}${PREFIX}/etc/gdm/PostSession/Default \ ${STAGEDIR}${PREFIX}/etc/gdm/PostSession/Default.sample ${MV} ${STAGEDIR}${PREFIX}/etc/gdm/PreSession/Default \ @@ -162,6 +147,11 @@ post-install: ${INSTALL_DATA} ${WRKDIR}/locale.conf \ ${STAGEDIR}${PREFIX}/etc/gdm/locale.conf.sample + ${MKDIR} ${STAGEDIR}/var/cache/gdm + ${MKDIR} ${STAGEDIR}/var/log/gdm + ${MKDIR} ${STAGEDIR}/var/run/gdm + ${MKDIR} ${STAGEDIR}/var/run/gdm/greeter + @${RM} ${STAGEDIR}${PREFIX}/lib/udev/rules.d/61-gdm.rules @${RMDIR} ${STAGEDIR}${PREFIX}/lib/udev/rules.d @${RMDIR} ${STAGEDIR}${PREFIX}/lib/udev diff --git a/x11/gdm/distinfo b/x11/gdm/distinfo index 4b458637a880..01635d103c86 100644 --- a/x11/gdm/distinfo +++ b/x11/gdm/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1538669234 -SHA256 (gnome/gdm-3.28.4.tar.xz) = 799f524278eb1a663c1d693589878c12ce8fad2293a66ef336e9626e1f933a3b -SIZE (gnome/gdm-3.28.4.tar.xz) = 1133508 +TIMESTAMP = 1643405191 +SHA256 (gnome/gdm-41.3.tar.xz) = bb0b650a7cea90f09a33284fbd02975315407efc18e814009852d1bcad3437d4 +SIZE (gnome/gdm-41.3.tar.xz) = 807452 diff --git a/x11/gdm/files/gdm-launch-environment.in b/x11/gdm/files/gdm-launch-environment.in index f2de8abe8311..506f08d89ffb 100644 --- a/x11/gdm/files/gdm-launch-environment.in +++ b/x11/gdm/files/gdm-launch-environment.in @@ -1,12 +1,11 @@ -# $OpenBSD: gdm-launch-environment,v 1.3 2012/10/10 08:47:14 ajacoutot Exp $ +# $OpenBSD: gdm-launch-environment,v 1.5 2016/04/26 08:59:48 ajacoutot Exp $ # # gdm-launch-environment settings for pam(3) auth required pam_permit.so -account required pam_nologin.so -account include system +account required pam_permit.so -password include system +password required pam_permit.so session include system diff --git a/x11/gdm/files/gdm-password.in b/x11/gdm/files/gdm-password.in index f0ac0cfe9eb3..01ca683c7967 100644 --- a/x11/gdm/files/gdm-password.in +++ b/x11/gdm/files/gdm-password.in @@ -3,8 +3,6 @@ # gdm-password settings for pam(3) auth include system -auth optional %%LOCALBASE%%/lib/pam_ck_connector.so -auth optional %%LOCALBASE%%/lib/pam_gnome_keyring.so account required pam_nologin.so account include system @@ -12,4 +10,3 @@ account include system password include system session include system -session optional %%LOCALBASE%%/lib/pam_gnome_keyring.so auto_start diff --git a/x11/gdm/files/patch-Makefile.in b/x11/gdm/files/patch-Makefile.in deleted file mode 100644 index 1589e0c8ed27..000000000000 --- a/x11/gdm/files/patch-Makefile.in +++ /dev/null @@ -1,20 +0,0 @@ ---- Makefile.in.orig 2018-01-14 11:27:57.277621000 +0100 -+++ Makefile.in 2018-01-14 11:28:53.422079000 +0100 -@@ -162,7 +162,7 @@ - ETAGS = etags - CTAGS = ctags - CSCOPE = cscope --DIST_SUBDIRS = data common pam-extensions daemon libgdm utils pam_gdm \ -+DIST_SUBDIRS = data common pam-extensions daemon libgdm utils \ - po tests chooser docs - am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ - $(top_srcdir)/data/dconf/gdm.in AUTHORS COPYING ChangeLog \ -@@ -472,7 +472,7 @@ - top_builddir = @top_builddir@ - top_srcdir = @top_srcdir@ - NULL = --SUBDIRS = data common pam-extensions daemon libgdm utils pam_gdm po \ -+SUBDIRS = data common pam-extensions daemon libgdm utils po \ - tests $(NULL) $(am__append_1) $(am__append_2) - ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} - EXTRA_DIST = \ diff --git a/x11/gdm/files/patch-common_Makefile.in b/x11/gdm/files/patch-common_Makefile.in deleted file mode 100644 index 87f2cc911408..000000000000 --- a/x11/gdm/files/patch-common_Makefile.in +++ /dev/null @@ -1,10 +0,0 @@ ---- common/Makefile.in.orig 2014-03-21 08:15:10.657611891 +0000 -+++ common/Makefile.in 2014-03-21 08:17:08.641605278 +0000 -@@ -548,6 +548,7 @@ - $(NULL) - - libgdmcommon_la_LIBADD = \ -+ -lexecinfo \ - $(SYSTEMD_LIBS) \ - $(NULL) - diff --git a/x11/gdm/files/patch-common_gdm-address.c b/x11/gdm/files/patch-common_gdm-address.c deleted file mode 100644 index 9a4e620ba8d3..000000000000 --- a/x11/gdm/files/patch-common_gdm-address.c +++ /dev/null @@ -1,27 +0,0 @@ ---- common/gdm-address.c.orig 2010-01-13 17:32:59.000000000 +0000 -+++ common/gdm-address.c 2010-01-17 12:55:48.000000000 +0000 -@@ -29,6 +29,8 @@ - #include <stropts.h> - #endif - #include <string.h> -+#include <sys/types.h> -+#include <sys/param.h> - #ifdef HAVE_SYS_SOCKET_H - #include <sys/socket.h> - #endif -@@ -37,7 +39,6 @@ - #endif - #include <netdb.h> - #include <sys/ioctl.h> --#include <net/if.h> - - #ifndef G_OS_WIN32 - #include <sys/select.h> -@@ -47,6 +48,7 @@ - #include <winsock2.h> - #include <ws2tcpip.h> - #endif -+#include <net/if.h> - - #include <glib-object.h> - diff --git a/x11/gdm/files/patch-common_gdm-common.c b/x11/gdm/files/patch-common_gdm-common.c index 567c0853796e..cb4900ae4994 100644 --- a/x11/gdm/files/patch-common_gdm-common.c +++ b/x11/gdm/files/patch-common_gdm-common.c @@ -1,22 +1,8 @@ -$OpenBSD: patch-common_gdm-common_c,v 1.4 2015/10/18 13:25:54 ajacoutot Exp $ - -REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) -From 9be58c9ec9a3a411492a5182ac4b0d51fdc3a323 Mon Sep 17 00:00:00 2001 -From: Ray Strode <rstrode@redhat.com> -Date: Fri, 12 Jun 2015 13:48:52 -0400 -Subject: require logind support - -REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) -From 1ac67f522f5690c27023d98096ca817f12f7eb88 Mon Sep 17 00:00:00 2001 -From: Ray Strode <rstrode@redhat.com> -Date: Fri, 12 Jun 2015 13:28:01 -0400 -Subject: drop consolekit support - ---- common/gdm-common.c.orig Sun Oct 18 14:26:27 2015 -+++ common/gdm-common.c Sun Oct 18 14:24:34 2015 -@@ -39,12 +39,25 @@ - #include "mkdtemp.h" - #endif +--- common/gdm-common.c.orig 2022-01-12 14:15:56 UTC ++++ common/gdm-common.c +@@ -36,7 +36,9 @@ + + #include "gdm-common.h" +#ifdef WITH_SYSTEMD #include <systemd/sd-login.h> @@ -24,390 +10,485 @@ Subject: drop consolekit support #define GDM_DBUS_NAME "org.gnome.DisplayManager" #define GDM_DBUS_LOCAL_DISPLAY_FACTORY_PATH "/org/gnome/DisplayManager/LocalDisplayFactory" - #define GDM_DBUS_LOCAL_DISPLAY_FACTORY_INTERFACE "org.gnome.DisplayManager.LocalDisplayFactory" - -+#ifdef WITH_CONSOLE_KIT -+#define CK_NAME "org.freedesktop.ConsoleKit" -+#define CK_PATH "/org/freedesktop/ConsoleKit" -+#define CK_INTERFACE "org.freedesktop.ConsoleKit" -+ -+#define CK_MANAGER_PATH "/org/freedesktop/ConsoleKit/Manager" -+#define CK_MANAGER_INTERFACE "org.freedesktop.ConsoleKit.Manager" -+#define CK_SEAT_INTERFACE "org.freedesktop.ConsoleKit.Seat" -+#define CK_SESSION_INTERFACE "org.freedesktop.ConsoleKit.Session" -+#endif -+ - G_DEFINE_QUARK (gdm-common-error, gdm_common_error); - - const char * -@@ -343,15 +356,306 @@ create_transient_display (GDBusConnection *connection, +@@ -352,6 +354,412 @@ create_transient_display (GDBusConnection *connection, return TRUE; } +#ifdef WITH_CONSOLE_KIT ++int ++sd_seat_can_graphical(const char *seat) ++{ ++ // XXX ++ return 1; ++} + - static gboolean --activate_session_id (GDBusConnection *connection, -- const char *seat_id, -- const char *session_id) -+get_current_session_id (GDBusConnection *connection, -+ char **session_id) - { - GError *local_error = NULL; - GVariant *reply; - - reply = g_dbus_connection_call_sync (connection, ++int ++sd_session_get_service(const char *session, ++ char **service) ++{ ++ GError *local_error = NULL; ++ GVariant *reply; ++ const char *value; ++ g_autoptr(GDBusConnection) connection = NULL; ++ ++ if (session == NULL || !g_variant_is_object_path (session)) ++ return -ENXIO; ++ ++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error); ++ if (connection == NULL) { ++ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message); ++ return -ENXIO; ++ } ++ ++ reply = g_dbus_connection_call_sync (connection, + CK_NAME, -+ CK_MANAGER_PATH, -+ CK_MANAGER_INTERFACE, -+ "GetCurrentSession", -+ NULL, /* parameters */ -+ G_VARIANT_TYPE ("(o)"), ++ session, ++ CK_SESSION_INTERFACE, ++ "GetSessionService", ++ NULL, ++ G_VARIANT_TYPE ("(s)"), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, &local_error); + if (reply == NULL) { -+ g_warning ("Unable to determine session: %s", local_error->message); ++ g_warning ("Unable to determine session service: %s", local_error ? local_error->message : ""); + g_error_free (local_error); -+ return FALSE; ++ return -ENXIO; + } + -+ g_variant_get (reply, "(o)", session_id); ++ g_variant_get (reply, "(s)", &value); + g_variant_unref (reply); + -+ return TRUE; ++ *service = g_strdup (value); ++ ++ return 0; +} + -+static gboolean -+get_seat_id_for_session (GDBusConnection *connection, -+ const char *session_id, -+ char **seat_id) ++int ++sd_session_get_uid(const char *session, ++ uid_t *uid) +{ + GError *local_error = NULL; + GVariant *reply; ++ g_autoptr(GDBusConnection) connection = NULL; ++ uid_t local_uid; ++ ++ if (session == NULL || !g_variant_is_object_path (session)) ++ return -ENXIO; ++ ++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error); ++ if (connection == NULL) { ++ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message); ++ return -ENXIO; ++ } + + reply = g_dbus_connection_call_sync (connection, + CK_NAME, -+ session_id, ++ session, + CK_SESSION_INTERFACE, -+ "GetSeatId", -+ NULL, /* parameters */ -+ G_VARIANT_TYPE ("(o)"), ++ "GetUnixUser", ++ NULL, ++ G_VARIANT_TYPE ("(u)"), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, &local_error); + if (reply == NULL) { -+ g_warning ("Unable to determine seat: %s", local_error->message); ++ g_warning ("Unable to get session for unix service: %s", local_error ? local_error->message : ""); + g_error_free (local_error); -+ return FALSE; ++ return -ENXIO; + } + -+ g_variant_get (reply, "(o)", seat_id); ++ g_variant_get (reply, "(u)", &local_uid); + g_variant_unref (reply); + -+ return TRUE; -+} -+ -+static char * -+get_current_seat_id (GDBusConnection *connection) -+{ -+ gboolean res; -+ char *session_id; -+ char *seat_id; ++ *uid = local_uid; + -+ session_id = NULL; -+ seat_id = NULL; -+ -+ res = get_current_session_id (connection, &session_id); -+ if (res) { -+ res = get_seat_id_for_session (connection, session_id, &seat_id); -+ } -+ g_free (session_id); -+ -+ return seat_id; ++ return 0; +} + -+static gboolean -+activate_session_id_for_ck (GDBusConnection *connection, -+ const char *seat_id, -+ const char *session_id) ++int ++sd_seat_get_sessions(const char *seat, ++ char ***sessions, ++ uid_t **uid, ++ unsigned int *n_uids) +{ + GError *local_error = NULL; + GVariant *reply; ++ GVariantIter *iter; ++ gchar *value = NULL; ++ glong nchild; ++ g_autoptr(GDBusConnection) connection = NULL; ++ ++ if (seat == NULL || !g_variant_is_object_path (seat)) ++ return -ENXIO; ++ ++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error); ++ if (connection == NULL) { ++ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message); ++ return -ENXIO; ++ } + + reply = g_dbus_connection_call_sync (connection, + CK_NAME, -+ seat_id, ++ seat, + CK_SEAT_INTERFACE, -+ "ActivateSession", -+ g_variant_new ("(o)", session_id), ++ "GetSessions", + NULL, ++ G_VARIANT_TYPE ("(ao)"), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, &local_error); + if (reply == NULL) { -+ g_warning ("Unable to activate session: %s", local_error->message); ++ g_warning ("Unable to list sessions: %s", local_error->message); + g_error_free (local_error); -+ return FALSE; ++ return -ENXIO; + } + ++ g_variant_get (reply, "(ao)", &iter); + g_variant_unref (reply); + -+ return TRUE; ++ nchild = g_variant_iter_n_children(iter); ++ *sessions = calloc(nchild, sizeof(gchar *)); ++ if (*sessions == NULL) { ++ g_warning ("Unable to allocate memory for sessions array: %s", g_strerror(errno)); ++ return -ENOMEM; ++ } ++ ++ while (g_variant_iter_next (iter, "o", &value)) { ++ (*sessions)[nchild - 1] = g_strdup(value); ++ } ++ (*sessions)[nchild] = NULL; ++ ++ g_variant_iter_free (iter); ++ ++ return 0; +} + -+static gboolean -+session_is_login_window (GDBusConnection *connection, -+ const char *session_id) ++int ++sd_session_get_seat(const char *session, ++ char **seat) +{ + GError *local_error = NULL; + GVariant *reply; + const char *value; -+ gboolean ret; ++ g_autoptr(GDBusConnection) connection = NULL; ++ ++ if (session == NULL || !g_variant_is_object_path (session)) ++ return -ENXIO; ++ ++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error); ++ if (connection == NULL) { ++ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message); ++ return -ENXIO; ++ } + + reply = g_dbus_connection_call_sync (connection, + CK_NAME, -+ session_id, ++ session, + CK_SESSION_INTERFACE, -+ "GetSessionType", -+ NULL, -+ G_VARIANT_TYPE ("(s)"), ++ "GetSeatId", ++ NULL, /* parameters */ ++ G_VARIANT_TYPE ("(o)"), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, &local_error); + if (reply == NULL) { -+ g_warning ("Unable to determine session type: %s", local_error->message); ++ g_warning ("Unable to determine seat: %s", local_error ? local_error->message : ""); + g_error_free (local_error); -+ return FALSE; -+ } -+ -+ g_variant_get (reply, "(&s)", &value); -+ -+ if (value == NULL || value[0] == '\0' || strcmp (value, "LoginWindow") != 0) { -+ ret = FALSE; -+ } else { -+ ret = TRUE; ++ return -ENXIO; + } + ++ g_variant_get (reply, "(o)", &value); + g_variant_unref (reply); + -+ return ret; ++ *seat = g_strdup(value); ++ ++ return 0; +} + -+static gboolean -+seat_can_activate_sessions (GDBusConnection *connection, -+ const char *seat_id) ++int ++sd_pid_get_session(pid_t pid, char **session) +{ + GError *local_error = NULL; + GVariant *reply; -+ gboolean ret; ++ const char *value; ++ g_autoptr(GDBusConnection) connection = NULL; ++ ++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error); ++ if (connection == NULL) { ++ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message); ++ return -ENXIO; ++ } + + reply = g_dbus_connection_call_sync (connection, + CK_NAME, -+ seat_id, -+ CK_SEAT_INTERFACE, -+ "CanActivateSessions", -+ NULL, -+ G_VARIANT_TYPE ("(b)"), ++ CK_MANAGER_PATH, ++ CK_MANAGER_INTERFACE, ++ "GetSessionForUnixProcess", ++ g_variant_new ("(u)", pid), ++ G_VARIANT_TYPE ("(o)"), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, &local_error); + if (reply == NULL) { -+ g_warning ("Unable to determine if can activate sessions: %s", local_error->message); ++ g_warning ("Unable to list sessions: %s", local_error ? local_error->message : ""); + g_error_free (local_error); -+ return FALSE; ++ return -ENXIO; + } + -+ g_variant_get (reply, "(b)", &ret); ++ g_variant_get (reply, "(o)", &value); + g_variant_unref (reply); + -+ return ret; ++ *session = g_strdup (value); ++ ++ return 0; +} + -+static const char ** -+seat_get_sessions (GDBusConnection *connection, -+ const char *seat_id) ++int ++sd_session_get_type(const char *session, char **type) +{ + GError *local_error = NULL; + GVariant *reply; -+ const char **value; ++ const char *value; ++ g_autoptr(GDBusConnection) connection = NULL; ++ ++ if (session == NULL || !g_variant_is_object_path (session)) ++ return -ENXIO; ++ ++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error); ++ if (connection == NULL) { ++ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message); ++ return -ENXIO; ++ } + + reply = g_dbus_connection_call_sync (connection, + CK_NAME, -+ seat_id, -+ CK_SEAT_INTERFACE, -+ "GetSessions", ++ session, ++ CK_SESSION_INTERFACE, ++ "GetSessionType", + NULL, -+ G_VARIANT_TYPE ("(ao)"), ++ G_VARIANT_TYPE ("(s)"), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, &local_error); + if (reply == NULL) { -+ g_warning ("Unable to list sessions: %s", local_error->message); ++ g_warning ("Unable to determine session type: %s", local_error ? local_error->message : ""); + g_error_free (local_error); -+ return FALSE; ++ return -ENXIO; + } + -+ g_variant_get (reply, "(^ao)", &value); ++ g_variant_get (reply, "(s)", &value); + g_variant_unref (reply); + -+ return value; ++ *type = g_strdup (value); ++ ++ return 0; +} + -+static gboolean -+get_login_window_session_id_for_ck (GDBusConnection *connection, -+ const char *seat_id, -+ char **session_id) ++int ++sd_session_get_class(const char *session, char **class) +{ -+ gboolean can_activate_sessions; -+ const char **sessions; -+ int i; -+ -+ *session_id = NULL; -+ sessions = NULL; ++ GError *local_error = NULL; ++ GVariant *reply; ++ const gchar *value; ++ g_autoptr(GDBusConnection) connection = NULL; + -+ g_debug ("checking if seat can activate sessions"); ++ if (session == NULL || !g_variant_is_object_path (session)) ++ return -ENXIO; + -+ can_activate_sessions = seat_can_activate_sessions (connection, seat_id); -+ if (! can_activate_sessions) { -+ g_debug ("seat is unable to activate sessions"); -+ return FALSE; ++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error); ++ if (connection == NULL) { ++ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message); ++ return -ENXIO; + } + -+ sessions = seat_get_sessions (connection, seat_id); -+ for (i = 0; sessions [i] != NULL; i++) { -+ const char *ssid; ++ reply = g_dbus_connection_call_sync (connection, ++ CK_NAME, ++ session, ++ CK_SESSION_INTERFACE, ++ "GetSessionClass", ++ NULL, ++ G_VARIANT_TYPE ("(s)"), ++ G_DBUS_CALL_FLAGS_NONE, ++ -1, ++ NULL, &local_error); ++ if (reply == NULL) { ++ g_warning ("Unable to determine session class: %s", local_error ? local_error->message : ""); ++ g_error_free (local_error); ++ return -ENXIO; ++ } + -+ ssid = sessions [i]; ++ g_variant_get (reply, "(s)", &value); ++ g_variant_unref (reply); + -+ if (session_is_login_window (connection, ssid)) { -+ *session_id = g_strdup (ssid); -+ break; -+ } -+ } -+ g_free (sessions); ++ *class = g_strdup(value); + -+ return TRUE; ++ return 0; +} + -+static gboolean -+goto_login_session_for_ck (GDBusConnection *connection, -+ GError **error) ++int ++sd_session_get_state(const char *session, char **state) +{ -+ gboolean ret; -+ gboolean res; -+ char *session_id; -+ char *seat_id; ++ GError *local_error = NULL; ++ GVariant *reply; ++ const char *value; ++ g_autoptr(GDBusConnection) connection = NULL; + -+ ret = FALSE; ++ if (session == NULL || !g_variant_is_object_path (session)) ++ return -ENXIO; + -+ /* First look for any existing LoginWindow sessions on the seat. -+ If none are found, create a new one. */ ++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error); ++ if (connection == NULL) { ++ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message); ++ return -ENXIO; ++ } + -+ seat_id = get_current_seat_id (connection); -+ if (seat_id == NULL || seat_id[0] == '\0') { -+ g_debug ("seat id is not set; can't switch sessions"); -+ g_set_error (error, GDM_COMMON_ERROR, 0, _("Could not identify the current session.")); ++ reply = g_dbus_connection_call_sync (connection, ++ CK_NAME, ++ session, ++ CK_SESSION_INTERFACE, ++ "GetSessionState", ++ NULL, ++ G_VARIANT_TYPE ("(s)"), ++ G_DBUS_CALL_FLAGS_NONE, ++ -1, ++ NULL, &local_error); ++ if (reply == NULL) { ++ g_warning ("Unable to determine session state: %s", local_error ? local_error->message : ""); ++ g_error_free (local_error); ++ return -ENXIO; ++ } + -+ return FALSE; ++ g_variant_get (reply, "(s)", &value); ++ g_variant_unref (reply); ++ ++ *state = g_strdup (value); ++ ++ return 0; ++} ++ ++int ++sd_uid_get_sessions(uid_t uid, int require_active, char ***sessions) ++{ ++ GError *local_error = NULL; ++ GVariant *reply; ++ GVariantIter *iter; ++ gchar *value = NULL; ++ glong nchild; ++ g_autoptr(GDBusConnection) connection = NULL; ++ ++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error); ++ if (connection == NULL) { ++ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message); ++ return -ENXIO; + } + -+ res = get_login_window_session_id_for_ck (connection, seat_id, &session_id); -+ if (! res) { -+ g_set_error (error, GDM_COMMON_ERROR, 1, _("User unable to switch sessions.")); -+ return FALSE; ++ reply = g_dbus_connection_call_sync (connection, ++ CK_NAME, ++ CK_MANAGER_PATH, ++ CK_MANAGER_INTERFACE, ++ "GetSessionsForUnixUser", ++ g_variant_new ("(u)", uid), ++ G_VARIANT_TYPE ("(ao)"), ++ G_DBUS_CALL_FLAGS_NONE, ++ -1, ++ NULL, &local_error); ++ if (reply == NULL) { ++ g_warning ("Unable to list sessions: %s", local_error ? local_error->message : ""); ++ g_error_free (local_error); ++ return -ENXIO; + } + -+ if (session_id != NULL) { -+ res = activate_session_id_for_ck (connection, seat_id, session_id); -+ if (res) { -+ ret = TRUE; -+ } ++ g_variant_get (reply, "(ao)", &iter); ++ g_variant_unref (reply); ++ ++ nchild = g_variant_iter_n_children(iter); ++ *sessions = calloc(nchild, sizeof(gchar *)); ++ if (*sessions == NULL) { ++ g_warning ("Unable to allocate memory for sessions array: %s", g_strerror(errno)); ++ return -ENOMEM; *** 4635 LINES SKIPPED ***