[PATCH xdm] Implement ConsoleKit support.
Dan Nicholson
dbn.lists at gmail.com
Wed May 4 05:53:40 PDT 2011
2011/2/24 Fernando Tarlá Cardoso Lemos <fernandotcl at gmail.com>:
> Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=17325
>
> Since ConsoleKit 0.4.2, the sessions created by ck-launch-session are no
> longer marked as local and active. This means that distributions can't simply
> call ck-launch-session in Xsession.d anymore to get an active local ConsoleKit
> session. Instead, XDM must create the session directly, providing info such as
> the UID of the user and the tty used to log in (like GDM does).
>
> It's important that locally logged in users get active local ConsoleKit
> sessions because that's used by PolicyKit to determine whether certain actions
> are allowed or not (according to a set of policies, of course). As an example
> of how this can be used, UDisks can automount devices for locally logged in
> users without a password prompt with their default PolicyKit policy.
>
> This patch allows XDM to create a ConsoleKit session. This is disabled at
> build time by default, you need to enable it with --with-consolekit. It relies
> on a very lightweight library called libck-connector (which is distributed
> with ConsoleKit) to do the DBus magic required for the creation of the active
> local session.
>
> I did not author this patch. I fetched it from the OpenSUSE repositories[1].
> It seems to have been initially created by Takashi Iwai and perhaps adapted by
> Stefan Dirsch[2].
>
> [1]: https://build.opensuse.org/package/view_file?file=xdm-consolekit.diff&package=xorg-x11&project=openSUSE:11.3:Update:Test&srcmd5=5e43d91b0bf84c8a82fc23b1cb550931
> [2]: https://bugs.freedesktop.org/show_bug.cgi?id=17325
>
> Signed-off-by: Fernando Tarlá Cardoso Lemos <fernandotcl at gmail.com>
> ---
> configure.ac | 14 ++++++++
> include/dm.h | 3 ++
> man/xdm.man | 6 +++
> xdm/resource.c | 13 ++++++-
> xdm/session.c | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 5 files changed, 137 insertions(+), 1 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 38717d0..6f3f9ce 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -359,6 +359,20 @@ PKG_CHECK_MODULES(DMCP, xdmcp)
> PKG_CHECK_MODULES(XLIB, x11)
> PKG_CHECK_MODULES(AUTH, xau)
>
> +# ConsoleKit support
> +AC_ARG_WITH(consolekit, AC_HELP_STRING([--with-consolekit], [Use ConsoleKit]),
> + [USE_CONSOLEKIT=$withval], [USE_CONSOLEKIT=yes])
You say in the commit message that this defaults to off, but here this
sets USE_CONSOLEKIT=yes as the default.
> +if test x"$USE_CONSOLEKIT" != xno; then
> + PKG_CHECK_MODULES(CK_CONNECTOR, ck-connector,
> + [USE_CONSOLEKIT=yes], [USE_CONSOLEKIT=no])
Here we just check if CK is available and continue whether it is or
not. However, if this feature defaults to off and someone explicitly
turns it on passing --with-consolekit, then I think it should fail if
CK isn't available. That would make things cleaner since the following
conditional would be unnecessary. It would be like:
if test x"$USE_CONSOLEKIT" != xno; then
# this will fail if ck-connector not found
PKG_CHECK_MODULES(CK_CONNECTOR, ck-connector)
# put actions needed for CK here
fi
> + if test x"$USE_CONSOLEKIT" = xyes; then
> + AC_DEFINE([USE_CONSOLEKIT], 1, [Define to 1 to use ConsoleKit])
> + XDM_CFLAGS="$XDM_CFLAGS $CK_CONNECTOR_CFLAGS"
> + XDM_LIBS="$XDM_LIBS $CK_CONNECTOR_LIBS"
> + fi
> +fi
> +dnl AM_CONDITIONAL(USE_CONSOLEKIT, test$USE_CONSOLEKIT = xyes)
This last line can be removed since conditional isn't used anywhere.
The code looked reasonable to me, but I didn't follow it that closely.
--
Dan
More information about the xorg-devel
mailing list