[gdm] require logind support



commit 9be58c9ec9a3a411492a5182ac4b0d51fdc3a323
Author: Ray Strode <rstrode redhat com>
Date:   Fri Jun 12 13:48:52 2015 -0400

    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

 common/gdm-common.c                |   31 ++----
 common/gdm-common.h                |    3 -
 common/gdm-log.c                   |   22 ----
 configure.ac                       |   25 +----
 daemon/gdm-local-display-factory.c |   46 +-------
 daemon/gdm-manager.c               |  214 ++++++------------------------------
 daemon/gdm-server.c                |   29 +----
 daemon/gdm-session-worker-job.c    |    2 -
 daemon/gdm-session-worker.c        |   22 +----
 daemon/gdm-session.c               |    4 -
 libgdm/gdm-user-switching.c        |   45 +++-----
 11 files changed, 72 insertions(+), 371 deletions(-)
---
diff --git a/common/gdm-common.c b/common/gdm-common.c
index b4f98f1..5beeebf 100644
--- a/common/gdm-common.c
+++ b/common/gdm-common.c
@@ -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
diff --git a/common/gdm-common.h b/common/gdm-common.h
index d876b66..3302afe 100644
--- a/common/gdm-common.h
+++ b/common/gdm-common.h
@@ -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()
 
diff --git a/common/gdm-log.c b/common/gdm-log.c
index 22d8c7d..8a2d015 100644
--- a/common/gdm-log.c
+++ b/common/gdm-log.c
@@ -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
diff --git a/configure.ac b/configure.ac
index 80d92aa..7d65478 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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}
diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c
index a048b08..612093d 100644
--- a/daemon/gdm-local-display-factory.c
+++ b/daemon/gdm-local-display-factory.c
@@ -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);
 }
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
index 6a62d18..a148f3d 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -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
diff --git a/daemon/gdm-server.c b/daemon/gdm-server.c
index b0376d9..eb7db0e 100644
--- a/daemon/gdm-server.c
+++ b/daemon/gdm-server.c
@@ -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");
diff --git a/daemon/gdm-session-worker-job.c b/daemon/gdm-session-worker-job.c
index c117f70..69dca2e 100644
--- a/daemon/gdm-session-worker-job.c
+++ b/daemon/gdm-session-worker-job.c
@@ -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>
diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c
index 5f49e88..bb4c332 100644
--- a/daemon/gdm-session-worker.c
+++ b/daemon/gdm-session-worker.c
@@ -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
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
index 33a08e3..52fbc17 100644
--- a/daemon/gdm-session.c
+++ b/daemon/gdm-session.c
@@ -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
diff --git a/libgdm/gdm-user-switching.c b/libgdm/gdm-user-switching.c
index 760347f..3d4303e 100644
--- a/libgdm/gdm-user-switching.c
+++ b/libgdm/gdm-user-switching.c
@@ -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;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]