At runtime logind will be used if available, otherwise CK.
AC_SUBST(GREETER_USER)
AC_DEFINE_UNQUOTED(GREETER_USER, "$GREETER_USER", User to run greeter as)
-AC_ARG_ENABLE(consolekit,
- AS_HELP_STRING([--enable-consolekit],
- [Build with ConsoleKit support @<:@default=yes@:>@]),,
- enable_consolekit=yes)
-AM_CONDITIONAL(ENABLE_CONSOLEKIT, test x$enable_consolekit = xyes)
-
-if test x$enable_consolekit = xyes; then
- AC_DEFINE(WITH_CONSOLEKIT, 1, [Define if ConsoleKit support is enabled])
- AC_DEFINE(LOGIND_RUNNING(), 0,
- [Define to a check for whether the system is running logind])
-fi
-
-AC_ARG_ENABLE(logind,
- AS_HELP_STRING([--enable-logind],
- [Build with systemd logind support @<:@default=no@:>@]),,
- enable_logind=no)
-AM_CONDITIONAL(ENABLE_LOGIND, test x$enable_logind = xyes)
-
-if test x$enable_logind = xyes; then
- AC_DEFINE(WITH_LOGIND, 1, [Define if systemd logind support is enabled])
- AC_DEFINE(LOGIND_RUNNING(), (access("/run/systemd/seats/", F_OK) >= 0),
- [Define to a check for whether the system is running logind])
-fi
-
-if test x$enable_consolekit = xno -a x$enable_logind = xno; then
- AC_MSG_ERROR(one of --enable-consolekit or --enable-logind must be supplied)
-fi
-
dnl ###########################################################################
dnl Documentation
dnl ###########################################################################
liblightdm-qt: $compile_liblightdm_qt4
liblightdm-qt5: $compile_liblightdm_qt5
Enable tests: $enable_tests
- ConsoleKit support: $enable_consolekit
- logind support: $enable_logind
"
#include "session-child.h"
#include "session.h"
#include "console-kit.h"
+#include "systemd-logind.h"
#include "privileges.h"
#include "xauthority.h"
gsize env_length;
gsize command_argc;
gchar **command_argv;
-#ifdef WITH_CONSOLEKIT
GVariantBuilder ck_parameters;
-#endif
int return_code;
int authentication_result;
gchar *authentication_result_string;
XAuthority *xauthority = NULL;
gchar *xauth_filename;
GDBusConnection *bus;
-#ifdef WITH_CONSOLEKIT
gchar *console_kit_cookie = NULL;
-#endif
-#ifdef WITH_LOGIND
gchar *systemd_logind_session = NULL;
-#endif
const gchar *path;
GError *error = NULL;
if (!bus)
return EXIT_FAILURE;
-#ifdef WITH_LOGIND
if (LOGIND_RUNNING ())
{
- *systemd_logind_session = logind_get_session_id ();
+ systemd_logind_session = logind_get_session_id ();
write_string (systemd_logind_session);
}
-#endif
-#ifdef WITH_CONSOLEKIT
- /* Open a Console Kit session */
- if (!LOGIND_RUNNING())
+ else
{
+ /* Open a Console Kit session */
g_variant_builder_init (&ck_parameters, G_VARIANT_TYPE ("(a(sv))"));
g_variant_builder_open (&ck_parameters, G_VARIANT_TYPE ("a(sv)"));
g_variant_builder_add (&ck_parameters, "(sv)", "unix-user", g_variant_new_int32 (user_get_uid (user)));
g_free (value);
}
}
-#endif
/* Write X authority */
if (xauthority)
_exit (EXIT_FAILURE);
}
-#ifdef WITH_CONSOLEKIT
/* Close the Console Kit session */
if (console_kit_cookie)
ck_close_session (console_kit_cookie);
-#endif
/* Close the session */
pam_close_session (pam_handle, 0);
#include "session.h"
#include "configuration.h"
-#ifdef WITH_CONSOLEKIT
#include "console-kit.h"
-#endif
-#ifdef WITH_LOGIND
#include "systemd-logind.h"
-#endif
#include "guest-account.h"
enum {
/* Remote host this session is being controlled from */
gchar *remote_host_name;
-#ifdef WITH_CONSOLEKIT
/* Console kit cookie */
gchar *console_kit_cookie;
-#endif
-#ifdef WITH_LOGIND
/* logind session */
gchar *systemd_logind_session;
-#endif
/* Environment to set in child */
GList *env;
return session->priv->username;
}
-#ifdef WITH_CONSOLEKIT
const gchar *
session_get_console_kit_cookie (Session *session)
{
g_return_val_if_fail (session != NULL, NULL);
return session->priv->console_kit_cookie;
}
-#endif
void
session_respond (Session *session, struct pam_response *response)
for (i = 0; i < argc; i++)
write_string (session, argv[i]);
-#ifdef WITH_LOGIND
if (LOGIND_RUNNING ())
session->priv->systemd_logind_session = read_string_from_child (session);
-#endif
-#ifdef WITH_CONSOLEKIT
- if (!LOGIND_RUNNING ())
+ else
session->priv->console_kit_cookie = read_string_from_child (session);
-#endif
}
void
{
g_return_if_fail (session != NULL);
if (getuid () == 0)
- {
-#ifdef WITH_LOGIND
- if (LOGIND_RUNNING ())
- logind_lock_session (session->priv->systemd_logind_session);
-#endif
-#ifdef WITH_CONSOLEKIT
- if (!LOGIND_RUNNING ())
- ck_lock_session (session->priv->console_kit_cookie);
-#endif
- }
+ {
+ if (LOGIND_RUNNING ())
+ logind_lock_session (session->priv->systemd_logind_session);
+ else
+ ck_lock_session (session->priv->console_kit_cookie);
+ }
}
void
{
g_return_if_fail (session != NULL);
if (getuid () == 0)
- {
-#ifdef WTIH_LOGIND
- if (LOGIND_RUNNING ())
- logind_unlock_session (session->priv->systemd_logind_session);
-#endif
-#ifdef WITH_CONSOLEKIT
- if (!LOGIND_RUNNING ())
- ck_unlock_session (session->priv->console_kit_cookie);
-#endif
- }
+ {
+ if (LOGIND_RUNNING ())
+ logind_unlock_session (session->priv->systemd_logind_session);
+ else
+ ck_unlock_session (session->priv->console_kit_cookie);
+ }
}
void
if (self->priv->xauthority)
g_object_unref (self->priv->xauthority);
g_free (self->priv->remote_host_name);
-#ifdef WITH_LOGIND
g_free (self->priv->systemd_logind_session);
-#endif
-#ifdef WITH_CONSOLEKIT
g_free (self->priv->console_kit_cookie);
-#endif
g_list_free_full (self->priv->env, g_free);
G_OBJECT_CLASS (session_parent_class)->finalize (object);
#include "accounts.h"
#include "xauthority.h"
+#define LOGIND_RUNNING() (access ("/run/systemd/seats/", F_OK) >= 0)
+
G_BEGIN_DECLS
#define SESSION_TYPE (session_get_type())