]> rtime.felk.cvut.cz Git - sojka/lightdm.git/commitdiff
Remove the conditionals and always build CK and logind support
authorIain Lane <iain.lane@canonical.com>
Thu, 18 Apr 2013 14:05:04 +0000 (15:05 +0100)
committerIain Lane <iain.lane@canonical.com>
Thu, 18 Apr 2013 14:05:04 +0000 (15:05 +0100)
At runtime logind will be used if available, otherwise CK.

configure.ac
src/session-child.c
src/session.c
src/session.h

index d93d3bed23895c9eecf8b1593c8ef1aba9e0a388..224b1bdf0273c1d6af025eddc88cd2bb20551aca 100644 (file)
@@ -171,34 +171,6 @@ AC_ARG_WITH(greeter-user,
 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 ###########################################################################
@@ -254,6 +226,4 @@ echo "
         liblightdm-qt:            $compile_liblightdm_qt4
         liblightdm-qt5:           $compile_liblightdm_qt5
         Enable tests:             $enable_tests
-        ConsoleKit support:       $enable_consolekit
-        logind support:           $enable_logind
 "
index b5ef5325ff81e1b242b3d143a856b5047fff86f0..af3b4922f1f08f2bac3dd9bf39b07a54b3757946 100644 (file)
@@ -20,6 +20,7 @@
 #include "session-child.h"
 #include "session.h"
 #include "console-kit.h"
+#include "systemd-logind.h"
 #include "privileges.h"
 #include "xauthority.h"
 
@@ -178,9 +179,7 @@ session_child_run (int argc, char **argv)
     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;
@@ -194,12 +193,8 @@ session_child_run (int argc, char **argv)
     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;
@@ -429,17 +424,14 @@ session_child_run (int argc, char **argv)
     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)));
@@ -468,7 +460,6 @@ session_child_run (int argc, char **argv)
             g_free (value);
         }
     }
-#endif
 
     /* Write X authority */
     if (xauthority)
@@ -640,11 +631,9 @@ session_child_run (int argc, char **argv)
             _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);
index e07237c1d6611c9c4ca7a6d60af9ff56177282f6..9a3759626bb9f08dd763abb024a754cce049691a 100644 (file)
 
 #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 {
@@ -87,15 +83,11 @@ struct SessionPrivate
     /* 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;
@@ -450,14 +442,12 @@ session_get_username (Session *session)
     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)
@@ -574,14 +564,10 @@ session_run (Session *session, gchar **argv)
     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
@@ -589,16 +575,12 @@ session_lock (Session *session)
 {    
     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
@@ -606,16 +588,12 @@ session_unlock (Session *session)
 {    
     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
@@ -672,12 +650,8 @@ session_finalize (GObject *object)
     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);
index 52a6e9e8dd1a53938c34b0e1560299828051cd0f..f1f4a46c89770672098b9ad7a0f73941e3307c74 100644 (file)
@@ -19,6 +19,8 @@
 #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())