Commit 9be58c9e authored by Ray Strode's avatar Ray Strode

require logind support

Now that consolekit support is gone, this commit drops all
the conditionalizing of logind support.

https://bugzilla.gnome.org/show_bug.cgi?id=743940
parent 1ac67f52
......@@ -39,9 +39,7 @@
#include "mkdtemp.h"
#endif
#ifdef WITH_SYSTEMD
#include <systemd/sd-login.h>
#endif
#define GDM_DBUS_NAME "org.gnome.DisplayManager"
#define GDM_DBUS_LOCAL_DISPLAY_FACTORY_PATH "/org/gnome/DisplayManager/LocalDisplayFactory"
......@@ -345,12 +343,10 @@ create_transient_display (GDBusConnection *connection,
return TRUE;
}
#ifdef WITH_SYSTEMD
static gboolean
activate_session_id_for_systemd (GDBusConnection *connection,
const char *seat_id,
const char *session_id)
activate_session_id (GDBusConnection *connection,
const char *seat_id,
const char *session_id)
{
GError *local_error = NULL;
GVariant *reply;
......@@ -377,8 +373,8 @@ activate_session_id_for_systemd (GDBusConnection *connection,
}
static gboolean
get_login_window_session_id_for_systemd (const char *seat_id,
char **session_id)
get_login_window_session_id (const char *seat_id,
char **session_id)
{
gboolean ret;
int res, i;
......@@ -446,8 +442,8 @@ out:
}
static gboolean
goto_login_session_for_systemd (GDBusConnection *connection,
GError **error)
goto_login_session (GDBusConnection *connection,
GError **error)
{
gboolean ret;
int res;
......@@ -501,9 +497,9 @@ goto_login_session_for_systemd (GDBusConnection *connection,
return FALSE;
}
res = get_login_window_session_id_for_systemd (seat_id, &session_id);
res = get_login_window_session_id (seat_id, &session_id);
if (res && session_id != NULL) {
res = activate_session_id_for_systemd (connection, seat_id, session_id);
res = activate_session_id (connection, seat_id, session_id);
if (res) {
ret = TRUE;
......@@ -522,7 +518,6 @@ goto_login_session_for_systemd (GDBusConnection *connection,
return ret;
}
#endif
gboolean
gdm_goto_login_session (GError **error)
......@@ -538,13 +533,7 @@ gdm_goto_login_session (GError **error)
return FALSE;
}
#ifdef WITH_SYSTEMD
if (LOGIND_RUNNING()) {
return goto_login_session_for_systemd (connection, error);
}
#endif
return FALSE;
return goto_login_session (connection, error);
}
static void
......
......@@ -33,9 +33,6 @@
#define GDM_CUSTOM_SESSION "custom"
/* 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()
......
......@@ -30,9 +30,7 @@
#include <unistd.h>
#include <syslog.h>
#ifdef WITH_SYSTEMD
#include <systemd/sd-daemon.h>
#endif
#include <glib.h>
#include <glib/gstdio.h>
......@@ -135,27 +133,7 @@ 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);
/* 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;
#ifdef LOG_PERROR
options |= LOG_PERROR;
#endif
openlog (prg_name, options, LOG_DAEMON);
}
}
void
......
......@@ -245,10 +245,6 @@ AC_ARG_WITH(tcp-wrappers,
with_tcp_wrappers=auto)
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]),
......@@ -878,26 +874,8 @@ dnl - Check for systemd support
dnl ---------------------------------------------------------------------------
PKG_CHECK_MODULES(SYSTEMD,
[libsystemd-login >= 186 libsystemd-daemon],
[have_systemd=yes], [have_systemd=no])
[libsystemd-login >= 186 libsystemd-daemon])
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)
......@@ -1615,7 +1593,6 @@ echo \
" Xinerama support: ${XINERAMA_SUPPORT}
XDMCP support: ${XDMCP_SUPPORT}
SELinux support: ${use_selinux}
systemd support: ${use_systemd}
systemd unit dir: ${with_systemdsystemunitdir}
plymouth support: ${use_plymouth}
wayland support: ${use_wayland}
......
......@@ -59,10 +59,8 @@ struct GdmLocalDisplayFactoryPrivate
/* FIXME: this needs to be per seat? */
guint num_failures;
#ifdef WITH_SYSTEMD
guint seat_new_id;
guint seat_removed_id;
#endif
};
enum {
......@@ -196,16 +194,8 @@ store_display (GdmLocalDisplayFactory *factory,
static const char *
get_seat_of_transient_display (GdmLocalDisplayFactory *factory)
{
const char *seat_id = NULL;
/* FIXME: don't hardcode seat */
#ifdef WITH_SYSTEMD
if (LOGIND_RUNNING() > 0) {
seat_id = SYSTEMD_SEAT0_PATH;
}
#endif
return seat_id;
return SYSTEMD_SEAT0_PATH;
}
/*
......@@ -230,19 +220,7 @@ gdm_local_display_factory_create_transient_display (GdmLocalDisplayFactory *fact
g_debug ("GdmLocalDisplayFactory: Creating transient display");
#ifdef WITH_SYSTEMD
if (LOGIND_RUNNING() > 0) {
display = gdm_local_display_new ();
}
#endif
if (display == NULL) {
guint32 num;
num = take_next_display_number (factory);
display = gdm_legacy_display_new (num);
}
display = gdm_local_display_new ();
seat_id = get_seat_of_transient_display (factory);
g_object_set (display,
......@@ -394,14 +372,12 @@ create_display (GdmLocalDisplayFactory *factory,
g_debug ("GdmLocalDisplayFactory: Adding display on seat %s", seat_id);
#ifdef WITH_SYSTEMD
if (g_strcmp0 (seat_id, "seat0") == 0) {
display = gdm_local_display_new ();
if (session_type != NULL) {
g_object_set (G_OBJECT (display), "session-type", session_type, NULL);
}
}
#endif
if (display == NULL) {
guint32 num;
......@@ -426,8 +402,6 @@ create_display (GdmLocalDisplayFactory *factory,
return display;
}
#ifdef WITH_SYSTEMD
static void
delete_display (GdmLocalDisplayFactory *factory,
const char *seat_id) {
......@@ -564,8 +538,6 @@ gdm_local_display_factory_stop_monitor (GdmLocalDisplayFactory *factory)
}
}
#endif
static gboolean
gdm_local_display_factory_start (GdmDisplayFactory *base_factory)
{
......@@ -573,14 +545,8 @@ gdm_local_display_factory_start (GdmDisplayFactory *base_factory)
g_return_val_if_fail (GDM_IS_LOCAL_DISPLAY_FACTORY (factory), FALSE);
#ifdef WITH_SYSTEMD
if (LOGIND_RUNNING()) {
gdm_local_display_factory_start_monitor (factory);
return gdm_local_display_factory_sync_seats (factory);
}
#endif
return FALSE;
gdm_local_display_factory_start_monitor (factory);
return gdm_local_display_factory_sync_seats (factory);
}
static gboolean
......@@ -590,9 +556,7 @@ gdm_local_display_factory_stop (GdmDisplayFactory *base_factory)
g_return_val_if_fail (GDM_IS_LOCAL_DISPLAY_FACTORY (factory), FALSE);
#ifdef WITH_SYSTEMD
gdm_local_display_factory_stop_monitor (factory);
#endif
return TRUE;
}
......@@ -739,9 +703,7 @@ gdm_local_display_factory_finalize (GObject *object)
g_hash_table_destroy (factory->priv->used_display_numbers);
#ifdef WITH_SYSTEMD
gdm_local_display_factory_stop_monitor (factory);
#endif
G_OBJECT_CLASS (gdm_local_display_factory_parent_class)->finalize (object);
}
......
This diff is collapsed.
......@@ -43,9 +43,7 @@
#include <linux/vt.h>
#endif
#ifdef WITH_SYSTEMD
#include <systemd/sd-daemon.h>
#endif
#ifdef ENABLE_SYSTEMD_JOURNAL
#include <systemd/sd-journal.h>
......@@ -127,18 +125,8 @@ G_DEFINE_TYPE (GdmServer, gdm_server, G_TYPE_OBJECT)
char *
gdm_server_get_display_device (GdmServer *server)
{
#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) {
g_object_notify (G_OBJECT (server), "display-device");
}
return g_strdup (server->priv->display_device);
/* systemd finds the display device out on its own based on the display */
return NULL;
}
static void
......@@ -240,8 +228,6 @@ gdm_server_init_command (GdmServer *server)
#define X_SERVER_ARG_FORMAT " -background none -noreset -verbose %s%s"
#ifdef WITH_SYSTEMD
/* 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
......@@ -256,10 +242,6 @@ gdm_server_init_command (GdmServer *server)
* 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;
}
#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 */
......@@ -282,9 +264,8 @@ gdm_server_init_command (GdmServer *server)
return;
fallback:
#endif
server->priv->command = g_strdup_printf (X_SERVER X_SERVER_ARG_FORMAT, verbosity, debug_options);
}
static gboolean
......@@ -334,12 +315,10 @@ gdm_server_resolve_command_line (GdmServer *server,
argv[len++] = g_strdup (server->priv->auth_file);
}
#ifdef WITH_SYSTEMD
if (LOGIND_RUNNING() && server->priv->display_seat_id != NULL) {
if (server->priv->display_seat_id != NULL) {
argv[len++] = g_strdup ("-seat");
argv[len++] = g_strdup (server->priv->display_seat_id);
}
#endif
if (server->priv->disable_tcp && ! query_in_arglist) {
argv[len++] = g_strdup ("-nolisten");
......
......@@ -36,9 +36,7 @@
#include <sys/prctl.h>
#endif
#ifdef WITH_SYSTEMD
#include <systemd/sd-daemon.h>
#endif
#ifdef ENABLE_SYSTEMD_JOURNAL
#include <systemd/sd-journal.h>
......
......@@ -28,11 +28,9 @@
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
#ifdef WITH_SYSTEMD
#include <sys/ioctl.h>
#include <sys/vt.h>
#include <sys/kd.h>
#endif
#include <errno.h>
#include <grp.h>
#include <pwd.h>
......@@ -51,9 +49,7 @@
#include <X11/Xauth.h>
#ifdef WITH_SYSTEMD
#include <systemd/sd-daemon.h>
#endif
#ifdef ENABLE_SYSTEMD_JOURNAL
#include <systemd/sd-journal.h>
......@@ -759,7 +755,6 @@ gdm_session_worker_stop_auditor (GdmSessionWorker *worker)
worker->priv->auditor = NULL;
}
#ifdef WITH_SYSTEMD
static void
on_release_display (int signal)
{
......@@ -885,7 +880,6 @@ jump_to_vt (GdmSessionWorker *worker,
close (active_vt_tty_fd);
}
#endif
static void
gdm_session_worker_uninitialize_pam (GdmSessionWorker *worker,
......@@ -916,11 +910,9 @@ gdm_session_worker_uninitialize_pam (GdmSessionWorker *worker,
gdm_session_worker_stop_auditor (worker);
#ifdef WITH_SYSTEMD
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;
......@@ -1045,12 +1037,10 @@ gdm_session_worker_initialize_pam (GdmSessionWorker *worker,
}
}
#ifdef WITH_SYSTEMD
/* set seat ID */
if (seat_id != NULL && seat_id[0] != '\0' && LOGIND_RUNNING()) {
if (seat_id != NULL && seat_id[0] != '\0') {
gdm_session_worker_set_environment_variable (worker, "XDG_SEAT", seat_id);
}
#endif
if (strcmp (service, "gdm-launch-environment") == 0) {
gdm_session_worker_set_environment_variable (worker, "XDG_SESSION_CLASS", "greeter");
......@@ -1700,14 +1690,12 @@ gdm_session_worker_start_session (GdmSessionWorker *worker,
error_code = PAM_SUCCESS;
#ifdef WITH_SYSTEMD
/* 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. */
if (worker->priv->display_mode == GDM_SESSION_DISPLAY_MODE_NEW_VT) {
jump_to_vt (worker, worker->priv->session_vt);
}
#endif
session_pid = fork ();
......@@ -1754,7 +1742,6 @@ gdm_session_worker_start_session (GdmSessionWorker *worker,
_exit (2);
}
#ifdef WITH_SYSTEMD
/* Take control of the tty
*/
if (needs_controlling_terminal) {
......@@ -1762,7 +1749,6 @@ gdm_session_worker_start_session (GdmSessionWorker *worker,
g_debug ("GdmSessionWorker: could not take control of tty: %m");
}
}
#endif
#ifdef HAVE_LOGINCAP
if (setusercontext (NULL, passwd_entry, passwd_entry->pw_uid, LOGIN_SETALL) < 0) {
......@@ -1903,7 +1889,6 @@ gdm_session_worker_start_session (GdmSessionWorker *worker,
return TRUE;
}
#ifdef WITH_SYSTEMD
static gboolean
set_up_for_new_vt (GdmSessionWorker *worker)
{
......@@ -1961,7 +1946,6 @@ fail:
close (fd);
return FALSE;
}
#endif
static gboolean
set_up_for_current_vt (GdmSessionWorker *worker,
......@@ -2050,7 +2034,6 @@ gdm_session_worker_open_session (GdmSessionWorker *worker,
return FALSE;
}
break;
#ifdef WITH_SYSTEMD
case GDM_SESSION_DISPLAY_MODE_NEW_VT:
case GDM_SESSION_DISPLAY_MODE_LOGIND_MANAGED:
if (!set_up_for_new_vt (worker)) {
......@@ -2061,7 +2044,6 @@ gdm_session_worker_open_session (GdmSessionWorker *worker,
return FALSE;
}
break;
#endif
}
flags = 0;
......@@ -2091,9 +2073,7 @@ gdm_session_worker_open_session (GdmSessionWorker *worker,
g_debug ("GdmSessionWorker: state SESSION_OPENED");
worker->priv->state = GDM_SESSION_WORKER_STATE_SESSION_OPENED;
#ifdef WITH_SYSTEMD
session_id = gdm_session_worker_get_environment_variable (worker, "XDG_SESSION_ID");
#endif
/* FIXME: should we do something here?
* Note that error return status from PreSession script should
......
......@@ -2945,10 +2945,6 @@ gdm_session_get_display_mode (GdmSession *self)
self->priv->is_program_session? "yes" : "no",
self->priv->display_seat_id);
if (!LOGIND_RUNNING()) {
return GDM_SESSION_DISPLAY_MODE_REUSE_VT;
}
#ifdef ENABLE_WAYLAND_SUPPORT
/* Wayland sessions are for now assumed to run in a
* mutter-launch-like environment, so we allocate
......
......@@ -31,9 +31,7 @@
#include <glib-object.h>
#include <gio/gio.h>
#ifdef WITH_SYSTEMD
#include <systemd/sd-login.h>
#endif
#include "common/gdm-common.h"
#include "gdm-user-switching.h"
......@@ -69,14 +67,12 @@ create_transient_display (GDBusConnection *connection,
return TRUE;
}
#ifdef WITH_SYSTEMD
static gboolean
activate_session_id_for_systemd (GDBusConnection *connection,
GCancellable *cancellable,
const char *seat_id,
const char *session_id,
GError **error)
activate_session_id (GDBusConnection *connection,
GCancellable *cancellable,
const char *seat_id,
const char *session_id,
GError **error)
{
GVariant *reply;
......@@ -101,8 +97,8 @@ activate_session_id_for_systemd (GDBusConnection *connection,
}
static gboolean
get_login_window_session_id_for_systemd (const char *seat_id,
char **session_id)
get_login_window_session_id (const char *seat_id,
char **session_id)
{
gboolean ret;
int res, i;
......@@ -186,9 +182,9 @@ out:
}
static gboolean
goto_login_session_for_systemd (GDBusConnection *connection,
GCancellable *cancellable,
GError **error)
goto_login_session (GDBusConnection *connection,
GCancellable *cancellable,
GError **error)
{
gboolean ret;
int res;
......@@ -242,9 +238,9 @@ goto_login_session_for_systemd (GDBusConnection *connection,
return FALSE;
}
res = get_login_window_session_id_for_systemd (seat_id, &session_id);
res = get_login_window_session_id (seat_id, &session_id);
if (res && session_id != NULL) {
res = activate_session_id_for_systemd (connection, cancellable, seat_id, session_id, error);
res = activate_session_id (connection, cancellable, seat_id, session_id, error);
if (res) {
ret = TRUE;
......@@ -263,11 +259,10 @@ goto_login_session_for_systemd (GDBusConnection *connection,
return ret;
}
#endif
gboolean
gdm_goto_login_session_sync (GCancellable *cancellable,
GError **error)
GError **error)
{
GDBusConnection *connection;
gboolean retval;
......@@ -276,16 +271,8 @@ gdm_goto_login_session_sync (GCancellable *cancellable,
if (!connection)
return FALSE;
#ifdef WITH_SYSTEMD
if (LOGIND_RUNNING()) {
retval = goto_login_session_for_systemd (connection,
cancellable,
error);
g_object_unref (connection);
return retval;
}
#endif
retval = goto_login_session (connection, cancellable, error);
return FALSE;
g_object_unref (connection);
return retval;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment