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);
}
......
......@@ -34,9 +34,7 @@
#include <glib/gstdio.h>
#include <glib-object.h>
#ifdef WITH_SYSTEMD
#include <systemd/sd-login.h>
#endif
#include "gdm-common.h"
......@@ -204,10 +202,9 @@ plymouth_quit_without_transition (void)
}
#endif
#ifdef WITH_SYSTEMD
static char *
get_session_id_for_pid_systemd (pid_t pid,
GError **error)
get_session_id_for_pid (pid_t pid,
GError **error)
{
char *session, *gsession;
int ret;
......@@ -232,27 +229,11 @@ get_session_id_for_pid_systemd (pid_t pid,
return NULL;
}
}
#endif
static char *
get_session_id_for_pid (GDBusConnection *connection,
pid_t pid,
GError **error)
{
#ifdef WITH_SYSTEMD
if (LOGIND_RUNNING()) {
return get_session_id_for_pid_systemd (pid, error);
}
#endif
return NULL;
}
#ifdef WITH_SYSTEMD
static gboolean
get_uid_for_systemd_session_id (const char *session_id,
uid_t *uid,
GError **error)
get_uid_for_session_id (const char *session_id,
uid_t *uid,
GError **error)
{
int ret;
......@@ -269,22 +250,6 @@ get_uid_for_systemd_session_id (const char *session_id,
return TRUE;
}
#endif
static gboolean
get_uid_for_session_id (GDBusConnection *connection,
const char *session_id,
uid_t *uid,
GError **error)
{
#ifdef WITH_SYSTEMD
if (LOGIND_RUNNING()) {
return get_uid_for_systemd_session_id (session_id, uid, error);
}
#endif
return FALSE;
}
static gboolean
lookup_by_session_id (const char *id,
......@@ -298,11 +263,10 @@ lookup_by_session_id (const char *id,
return g_strcmp0 (current, looking_for) == 0;
}
#ifdef WITH_SYSTEMD
static gboolean
is_systemd_login_session (GdmManager *self,
const char *session_id,
GError **error)
is_login_session (GdmManager *self,
const char *session_id,
GError **error)
{
char *session_class = NULL;
int ret;
......@@ -327,28 +291,11 @@ is_systemd_login_session (GdmManager *self,
g_free (session_class);
return TRUE;
}
#endif
static gboolean
is_login_session (GdmManager *self,
GDBusConnection *connection,
const char *session_id,
GError **error)
{
#ifdef WITH_SYSTEMD
if (LOGIND_RUNNING()) {
return is_systemd_login_session (self, session_id, error);
}
#endif
return FALSE;
}
#ifdef WITH_SYSTEMD
static gboolean
activate_session_id_for_systemd (GdmManager *manager,
const char *seat_id,
const char *session_id)
activate_session_id (GdmManager *manager,
const char *seat_id,
const char *session_id)
{
GError *error = NULL;
GVariant *reply;
......@@ -375,31 +322,16 @@ activate_session_id_for_systemd (GdmManager *manager,
return TRUE;
}
#endif
static gboolean
activate_session_id (GdmManager *manager,
const char *seat_id,
const char *session_id)
{
#ifdef WITH_SYSTEMD
if (LOGIND_RUNNING()) {
return activate_session_id_for_systemd (manager, seat_id, session_id);
}
#endif
return FALSE;
}
#ifdef WITH_SYSTEMD
static gboolean
session_unlock_for_systemd (GdmManager *manager,
const char *ssid)
session_unlock (GdmManager *manager,
const char *ssid)
{
GError *error = NULL;
GVariant *reply;
g_debug ("Unlocking session %s", ssid);
reply = g_dbus_connection_call_sync (manager->priv->connection,
"org.freedesktop.login1",
"/org/freedesktop/login1",
......@@ -422,23 +354,6 @@ session_unlock_for_systemd (GdmManager *manager,
return TRUE;
}
#endif
static gboolean
session_unlock (GdmManager *manager,
const char *ssid)
{
g_debug ("Unlocking session %s", ssid);
#ifdef WITH_SYSTEMD
if (LOGIND_RUNNING()) {
return session_unlock_for_systemd (manager, ssid);
}
#endif
return TRUE;
}
static GdmSession *
find_session_for_user_on_seat (GdmManager *manager,
......@@ -470,11 +385,10 @@ find_session_for_user_on_seat (GdmManager *manager,
return NULL;
}
#ifdef WITH_SYSTEMD
static gboolean
is_systemd_remote_session (GdmManager *self,
const char *session_id,
GError **error)
is_remote_session (GdmManager *self,
const char *session_id,
GError **error)
{
char *seat;
int ret;
......@@ -500,27 +414,10 @@ is_systemd_remote_session (GdmManager *self,
return is_remote;
}
#endif
static gboolean
is_remote_session (GdmManager *self,
GDBusConnection *connection,
const char *session_id,
GError **error)
{
#ifdef WITH_SYSTEMD
if (LOGIND_RUNNING()) {
return is_systemd_remote_session (self, session_id, error);
}
#endif
return FALSE;
}
#ifdef WITH_SYSTEMD
static char *
get_seat_id_for_systemd_session_id (const char *session_id,
GError **error)
get_seat_id_for_session_id (const char *session_id,
GError **error)
{
int ret;
char *seat, *out_seat;
......@@ -545,26 +442,10 @@ get_seat_id_for_systemd_session_id (const char *session_id,
return out_seat;
}
#endif
static char *
get_seat_id_for_session_id (GDBusConnection *connection,
const char *session_id,
GError **error)
{
#ifdef WITH_SYSTEMD
if (LOGIND_RUNNING()) {
return get_seat_id_for_systemd_session_id (session_id, error);
}
#endif
return NULL;
}
#ifdef WITH_SYSTEMD
static char *
get_tty_for_systemd_session_id (const char *session_id,
GError **error)
get_tty_for_session_id (const char *session_id,
GError **error)
{
int ret;
char *tty, *out_tty;
......@@ -588,20 +469,6 @@ get_tty_for_systemd_session_id (const char *session_id,
return out_tty;
}
#endif
static char *
get_tty_for_session_id (const char *session_id,
GError **error)
{
#ifdef WITH_SYSTEMD
if (LOGIND_RUNNING()) {
return get_tty_for_systemd_session_id (session_id, error);
}
#endif
return NULL;
}
static void
get_display_and_details_for_bus_sender (GdmManager *self,
......@@ -645,7 +512,7 @@ get_display_and_details_for_bus_sender (GdmManager *self,
goto out;
}
session_id = get_session_id_for_pid (connection, pid, &error);
session_id = get_session_id_for_pid (pid, &error);
if (session_id == NULL) {
g_debug ("GdmManager: Error while retrieving session id for sender: %s",
......@@ -659,7 +526,7 @@ get_display_and_details_for_bus_sender (GdmManager *self,
}
if (out_is_login_screen != NULL) {
*out_is_login_screen = is_login_session (self, connection, session_id, &error);
*out_is_login_screen = is_login_session (self, session_id, &error);
if (error != NULL) {
g_debug ("GdmManager: Error while checking if sender is login screen: %s",
......@@ -669,7 +536,7 @@ get_display_and_details_for_bus_sender (GdmManager *self,
}
}
if (!get_uid_for_session_id (connection, session_id, &session_uid, &error)) {
if (!get_uid_for_session_id (session_id, &session_uid, &error)) {
g_debug ("GdmManager: Error while retrieving uid for session: %s",
error->message);
g_error_free (error);
......@@ -686,7 +553,7 @@ get_display_and_details_for_bus_sender (GdmManager *self,
}
if (out_seat_id != NULL) {
*out_seat_id = get_seat_id_for_session_id (connection, session_id, &error);
*out_seat_id = get_seat_id_for_session_id (session_id, &error);
if (error != NULL) {
g_debug ("GdmManager: Error while retrieving seat id for session: %s",
......@@ -696,7 +563,7 @@ get_display_and_details_for_bus_sender (GdmManager *self,
}
if (out_is_remote != NULL) {
*out_is_remote = is_remote_session (self, connection, session_id, &error);
*out_is_remote = is_remote_session (self, session_id, &error);
if (error != NULL) {
g_debug ("GdmManager: Error while retrieving remoteness for session: %s",
......@@ -1060,8 +927,7 @@ on_reauthentication_client_rejected (GdmSession *session,
* same audit session, ignore it since it doesn't "own" the
* reauthentication session
*/
client_session_id = get_session_id_for_pid (self->priv->connection,
pid_of_client,
client_session_id = get_session_id_for_pid (pid_of_client,
NULL);
session_id = g_object_get_data (G_OBJECT (session), "caller-session-id");
......@@ -1273,20 +1139,16 @@ static gboolean
display_is_on_seat0 (GdmDisplay *display)
{
gboolean is_on_seat0 = TRUE;
char *seat_id = NULL;
#ifdef WITH_SYSTEMD
if (LOGIND_RUNNING()) {
char *seat_id = NULL;
g_object_get (G_OBJECT (display), "seat-id", &seat_id, NULL);
g_object_get (G_OBJECT (display), "seat-id", &seat_id, NULL);
if (g_strcmp0 (seat_id, "seat0") != 0) {
is_on_seat0 = FALSE;
}
if (g_strcmp0 (seat_id, "seat0") != 0) {
is_on_seat0 = FALSE;
}
g_free (seat_id);
g_free (seat_id);
}
#endif
return is_on_seat0;
}
......@@ -1884,12 +1746,8 @@ static char *
get_display_device (GdmManager *manager,
GdmDisplay *display)
{
#ifdef WITH_SYSTEMD
if (LOGIND_RUNNING()) {
/* systemd finds the display device out on its own based on the display */
return NULL;
}
#endif
/* systemd finds the display device out on its own based on the display */
return NULL;
}
static void
......
......@@ -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)