You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
179 lines
6.0 KiB
179 lines
6.0 KiB
--- a/configure.ac 2016-11-03 20:16:02.842071344 +0100
|
|
+++ b/configure.ac 2016-11-03 20:15:34.612071850 +0100
|
|
@@ -183,11 +183,12 @@
|
|
|
|
AM_CONDITIONAL(BUILD_TEST, [test "x$enable_test" = "xyes"])
|
|
|
|
-dnl ---------------------------------------------------------------------------
|
|
-dnl - Select wether to use libsystemd-login or ConsoleKit for session tracking
|
|
-dnl ---------------------------------------------------------------------------
|
|
+dnl -----------------------------------------------------------------------------------
|
|
+dnl - Select wether to use libsystemd-login, elogind or ConsoleKit for session tracking
|
|
+dnl -----------------------------------------------------------------------------------
|
|
|
|
have_libsystemd=no
|
|
+have_elogind=no
|
|
SESSION_TRACKING=ConsoleKit
|
|
|
|
AC_ARG_ENABLE([libsystemd-login],
|
|
@@ -220,6 +221,29 @@
|
|
fi
|
|
fi
|
|
fi
|
|
+
|
|
+AC_ARG_ENABLE([libelogind],
|
|
+ [AS_HELP_STRING([--enable-libelogind[=@<:@auto/yes/no@:>@]], [Use libelogind (auto/yes/no)])],
|
|
+ [enable_libelogind=$enableval],
|
|
+ [enable_libelogind=auto])
|
|
+if test "$enable_libelogind" != "no"; then
|
|
+ PKG_CHECK_MODULES([LIBELOGIND],
|
|
+ [libelogind],
|
|
+ [have_libelogind=yes],
|
|
+ [have_libelogind=no])
|
|
+ if test "$have_libelogind" = "yes"; then
|
|
+ SESSION_TRACKING=libelogind
|
|
+ AC_DEFINE([HAVE_LIBELOGIND], 1, [Define to 1 if libelogind is available])
|
|
+ save_LIBS=$LIBS
|
|
+ LIBS=$LIBELOGIND_LIBS
|
|
+ AC_CHECK_FUNCS(sd_uid_get_display)
|
|
+ LIBS=$save_LIBS
|
|
+ else
|
|
+ if test "$enable_libelogind" = "yes"; then
|
|
+ AC_MSG_ERROR([libelogind support requested but libelogind not found])
|
|
+ fi
|
|
+ fi
|
|
+fi
|
|
|
|
AS_IF([test "x$cross_compiling" != "xyes" ], [
|
|
AS_IF([test "$have_libsystemd" = "yes"], [
|
|
@@ -245,6 +245,10 @@
|
|
AC_SUBST(LIBSYSTEMD_LIBS)
|
|
AM_CONDITIONAL(HAVE_LIBSYSTEMD, [test "$have_libsystemd" = "yes"], [Using libsystemd])
|
|
|
|
+AC_SUBST(LIBELOGIND_CFLAGS)
|
|
+AC_SUBST(LIBELOGIND_LIBS)
|
|
+AM_CONDITIONAL(HAVE_LIBELOGIND, [test "$have_libelogind" = "yes"], [Using libelogind])
|
|
+
|
|
dnl ---------------------------------------------------------------------------
|
|
dnl - systemd unit / service files
|
|
dnl ---------------------------------------------------------------------------
|
|
--- a/src/polkitbackend/Makefile.am 2016-11-04 04:40:46.930116006 +0100
|
|
+++ b/src/polkitbackend/Makefile.am 2016-11-04 04:42:14.586114436 +0100
|
|
@@ -42,21 +42,28 @@
|
|
libpolkit_backend_1_la_SOURCES += \
|
|
polkitbackendsessionmonitor.h polkitbackendsessionmonitor-systemd.c
|
|
else
|
|
+if HAVE_LIBELOGIND
|
|
+libpolkit_backend_1_la_SOURCES += \
|
|
+ polkitbackendsessionmonitor.h polkitbackendsessionmonitor-systemd.c
|
|
+else
|
|
libpolkit_backend_1_la_SOURCES += \
|
|
polkitbackendsessionmonitor.h polkitbackendsessionmonitor.c
|
|
endif
|
|
+endif
|
|
|
|
libpolkit_backend_1_la_CFLAGS = \
|
|
-D_POLKIT_COMPILATION \
|
|
-D_POLKIT_BACKEND_COMPILATION \
|
|
$(GLIB_CFLAGS) \
|
|
$(LIBSYSTEMD_CFLAGS) \
|
|
+ $(LIBELOGIND_CFLAGS) \
|
|
$(LIBJS_CFLAGS) \
|
|
$(NULL)
|
|
|
|
libpolkit_backend_1_la_LIBADD = \
|
|
$(GLIB_LIBS) \
|
|
$(LIBSYSTEMD_LIBS) \
|
|
+ $(LIBELOGIND_LIBS) \
|
|
$(top_builddir)/src/polkit/libpolkit-gobject-1.la \
|
|
$(EXPAT_LIBS) \
|
|
$(LIBJS_LIBS) \
|
|
--- a/src/polkit/Makefile.am 2016-11-04 04:41:02.756115723 +0100
|
|
+++ b/src/polkit/Makefile.am 2016-11-04 04:42:49.428113812 +0100
|
|
@@ -85,19 +85,26 @@
|
|
libpolkit_gobject_1_la_SOURCES += \
|
|
polkitunixsession-systemd.c polkitunixsession.h
|
|
else
|
|
+if HAVE_LIBELOGIND
|
|
+libpolkit_gobject_1_la_SOURCES += \
|
|
+ polkitunixsession-systemd.c polkitunixsession.h
|
|
+else
|
|
libpolkit_gobject_1_la_SOURCES += \
|
|
polkitunixsession.c polkitunixsession.h
|
|
endif
|
|
+endif
|
|
|
|
libpolkit_gobject_1_la_CFLAGS = \
|
|
-D_POLKIT_COMPILATION \
|
|
$(GLIB_CFLAGS) \
|
|
$(LIBSYSTEMD_CFLAGS) \
|
|
+ $(LIBELOGIND_CFLAGS) \
|
|
$(NULL)
|
|
|
|
libpolkit_gobject_1_la_LIBADD = \
|
|
$(GLIB_LIBS) \
|
|
$(LIBSYSTEMD_LIBS) \
|
|
+ $(LIBELOGIND_LIBS) \
|
|
$(NULL)
|
|
|
|
libpolkit_gobject_1_la_LDFLAGS = -export-symbols-regex '(^polkit_.*)'
|
|
--- a/src/polkitbackend/polkitbackendjsauthority.c 2017-06-27 09:22:03.375841040 +0200
|
|
+++ b/src/polkitbackend/polkitbackendjsauthority.c 2017-06-27 09:25:33.815845141 +0200
|
|
@@ -39,6 +39,10 @@
|
|
#include <systemd/sd-login.h>
|
|
#endif /* HAVE_LIBSYSTEMD */
|
|
|
|
+#ifdef HAVE_LIBELOGIND
|
|
+#include <elogind/sd-login.h>
|
|
+#endif /* HAVE_LIBELOGIND */
|
|
+
|
|
#include <jsapi.h>
|
|
|
|
#include "initjs.h" /* init.js */
|
|
@@ -793,7 +797,7 @@
|
|
g_assert_not_reached ();
|
|
}
|
|
|
|
-#ifdef HAVE_LIBSYSTEMD
|
|
+#if defined(HAVE_LIBSYSTEMD) || defined(HAVE_LIBELOGIND)
|
|
if (sd_pid_get_session (pid, &session_str) == 0)
|
|
{
|
|
if (sd_session_get_seat (session_str, &seat_str) == 0)
|
|
@@ -801,7 +805,7 @@
|
|
/* do nothing */
|
|
}
|
|
}
|
|
-#endif /* HAVE_LIBSYSTEMD */
|
|
+#endif /* HAVE_LIBSYSTEMD or HAVE_LIBELOGIND */
|
|
|
|
g_assert (POLKIT_IS_UNIX_USER (user_for_subject));
|
|
uid = polkit_unix_user_get_uid (POLKIT_UNIX_USER (user_for_subject));
|
|
--- a/src/polkitbackend/polkitbackendsessionmonitor-systemd.c 2016-11-04 04:44:29.650112018 +0100
|
|
+++ b/src/polkitbackend/polkitbackendsessionmonitor-systemd.c 2016-11-04 04:46:52.718109455 +0100
|
|
@@ -25,7 +25,11 @@
|
|
#include <grp.h>
|
|
#include <string.h>
|
|
#include <glib/gstdio.h>
|
|
+#ifdef HAVE_LIBSYSTEMD
|
|
#include <systemd/sd-login.h>
|
|
+#else
|
|
+#include <elogind/sd-login.h>
|
|
+#endif /* HAVE_LIBSYSTEMD versus HAVE_LIBELOGIND */
|
|
#include <stdlib.h>
|
|
|
|
#include <polkit/polkit.h>
|
|
--- a/src/polkit/polkitunixsession-systemd.c 2016-11-04 04:44:29.651112017 +0100
|
|
+++ b/src/polkit/polkitunixsession-systemd.c 2016-11-04 04:47:07.160109197 +0100
|
|
@@ -30,7 +30,11 @@
|
|
#include "polkiterror.h"
|
|
#include "polkitprivate.h"
|
|
|
|
+#ifdef HAVE_LIBSYSTEMD
|
|
#include <systemd/sd-login.h>
|
|
+#else
|
|
+#include <elogind/sd-login.h>
|
|
+#endif /* HAVE_LIBSYSTEMD versus HAVE_ELOGIND */
|
|
|
|
/**
|
|
* SECTION:polkitunixsession
|