diff -up gdm-2.26.1/configure.ac.polkit1 gdm-2.26.1/configure.ac --- gdm-2.26.1/configure.ac.polkit1 2009-05-13 18:15:11.618938539 -0400 +++ gdm-2.26.1/configure.ac 2009-05-13 18:15:58.034936628 -0400 @@ -62,7 +62,6 @@ PANGO_REQUIRED_VERSION=1.3.0 LIBGLADE_REQUIRED_VERSION=1.99.2 SCROLLKEEPER_REQUIRED_VERSION=0.1.4 GCONF_REQUIRED_VERSION=2.6.1 -POLICYKIT_REQUIRED_VERSION=0.8 GNOME_PANEL_REQUIRED_VERSION=2.0.0 LIBXKLAVIER_REQUIRED_VERSION=3.5 #FONTCONFIG_REQUIRED_VERSION=2.6.0 @@ -142,30 +141,6 @@ AC_SUBST(HAVE_LIBXKLAVIER) AC_SUBST(LIBXKLAVIER_CFLAGS) AC_SUBST(LIBXKLAVIER_LIBS) -PKG_CHECK_MODULES(POLKIT_GNOME, - polkit-gnome >= $POLICYKIT_REQUIRED_VERSION, - have_polkit=yes, - have_polkit=no) - -AC_ARG_ENABLE([polkit], - AS_HELP_STRING([--enable-polkit], - [Enable PolicyKit support @<:@default=auto@:>@]), - enable_polkit=$enableval, enable_polkit=auto) - -if test "x$enable_polkit" != "xno"; then - if test "x$enable_polkit" = "xyes" -a "x$have_polkit" = "xno"; then - AC_MSG_ERROR([PolicyKit support explicitly requested but dependencies not found]) - fi - - if test "x$have_polkit" = "xyes" ; then - AC_DEFINE(HAVE_POLKIT_GNOME, [], [Define if we have polkit]) - fi -fi -AM_CONDITIONAL(HAVE_POLKIT_GNOME, test x$have_polkit = xyes) -AC_SUBST(HAVE_POLKIT_GNOME) -AC_SUBST(POLKIT_GNOME_CFLAGS) -AC_SUBST(POLKIT_GNOME_LIBS) - PKG_CHECK_MODULES(SIMPLE_CHOOSER, dbus-glib-1 >= $DBUS_GLIB_REQUIRED_VERSION gtk+-2.0 >= $GTK_REQUIRED_VERSION diff -up gdm-2.26.1/gui/simple-greeter/gdm-greeter-login-window.c.polkit1 gdm-2.26.1/gui/simple-greeter/gdm-greeter-login-window.c --- gdm-2.26.1/gui/simple-greeter/gdm-greeter-login-window.c.polkit1 2009-05-13 18:15:11.730937911 -0400 +++ gdm-2.26.1/gui/simple-greeter/gdm-greeter-login-window.c 2009-05-13 18:15:11.811971897 -0400 @@ -59,10 +59,6 @@ #include #include -#ifdef HAVE_POLKIT_GNOME -#include -#endif - #include "gdm-marshal.h" #include "gdm-settings-client.h" @@ -1292,119 +1288,6 @@ try_system_restart (DBusGConnection *con return res; } -#ifdef HAVE_POLKIT_GNOME -static void -system_restart_auth_cb (PolKitAction *action, - gboolean gained_privilege, - GError *error, - GdmGreeterLoginWindow *login_window) -{ - GError *local_error; - DBusGConnection *connection; - gboolean res; - - g_debug ("GdmGreeterLoginWindow: system restart auth callback gained=%s", gained_privilege ? "yes" : "no"); - - if (! gained_privilege) { - if (error != NULL) { - g_warning ("GdmGreeterLoginWindow: system restart error: %s", error->message); - } - return; - } - - local_error = NULL; - connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &local_error); - if (connection == NULL) { - g_warning ("Unable to get system bus connection: %s", local_error->message); - g_error_free (local_error); - return; - } - - res = try_system_restart (connection, &local_error); - if (! res) { - g_warning ("Unable to restart system: %s", local_error->message); - g_error_free (local_error); - return; - } -} - -static void -system_stop_auth_cb (PolKitAction *action, - gboolean gained_privilege, - GError *error, - GdmGreeterLoginWindow *login_window) -{ - GError *local_error; - DBusGConnection *connection; - gboolean res; - - g_debug ("GdmGreeterLoginWindow: system stop auth callback gained=%s", gained_privilege ? "yes" : "no"); - - if (! gained_privilege) { - if (error != NULL) { - g_warning ("GdmGreeterLoginWindow: system stop error: %s", error->message); - } - return; - } - - local_error = NULL; - connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &local_error); - if (connection == NULL) { - g_warning ("Unable to get system bus connection: %s", local_error->message); - g_error_free (local_error); - return; - } - - res = try_system_stop (connection, &local_error); - if (! res) { - g_warning ("Unable to stop system: %s", local_error->message); - g_error_free (local_error); - return; - } -} - -static PolKitAction * -get_action_from_error (GError *error) -{ - PolKitAction *action; - char *paction; - char *p; - - action = polkit_action_new (); - - paction = NULL; - if (g_str_has_prefix (error->message, "Not privileged for action: ")) { - paction = g_strdup (error->message + strlen ("Not privileged for action: ")); - p = strchr (paction, ' '); - if (p != NULL) { - *p = '\0'; - } - } - g_debug ("GdmGreeterLoginWindow: Requesting priv for '%s'", paction); - - polkit_action_set_action_id (action, paction); - - g_free (paction); - - return action; -} - -static PolKitResult -get_result_from_error (GError *error) -{ - PolKitResult result = POLKIT_RESULT_UNKNOWN; - const char *p; - - p = strrchr (error->message, ' '); - if (p != NULL) { - p++; - polkit_result_from_string_representation (p, &result); - } - - return result; -} -#endif - static void do_system_restart (GdmGreeterLoginWindow *login_window) { @@ -1421,69 +1304,12 @@ do_system_restart (GdmGreeterLoginWindow } res = try_system_restart (connection, &error); -#ifdef HAVE_POLKIT_GNOME - if (! res) { + if (!res) { g_debug ("GdmGreeterLoginWindow: unable to restart system: %s: %s", dbus_g_error_get_name (error), error->message); - - if (dbus_g_error_has_name (error, "org.freedesktop.ConsoleKit.Manager.NotPrivileged")) { - PolKitAction *action; - PolKitAction *action2; - PolKitResult result; - GtkWidget *dialog; - guint xid; - pid_t pid; - - result = get_result_from_error (error); - action = get_action_from_error (error); - - if (result == POLKIT_RESULT_NO) { - action2 = polkit_action_new (); - polkit_action_set_action_id (action2, - "org.freedesktop.consolekit.system.restart-multiple-users"); - dialog = gtk_message_dialog_new (GTK_WINDOW (login_window), - GTK_DIALOG_MODAL, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - _("Failed to restart computer")); - if (polkit_action_equal (action, action2)) { - gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), - _("You are not allowed to restart the computer " - "because multiple users are logged in")); - } - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); - - polkit_action_unref (action); - polkit_action_unref (action2); - - g_error_free (error); - - return; - } - - xid = 0; - pid = getpid (); - - g_error_free (error); - error = NULL; - res = polkit_gnome_auth_obtain (action, - xid, - pid, - (PolKitGnomeAuthCB) system_restart_auth_cb, - login_window, - &error); - polkit_action_unref (action); - - if (! res) { - g_warning ("Unable to request privilege for action: %s", error->message); - g_error_free (error); - } - - } + g_error_free (error); } -#endif } static void @@ -1502,67 +1328,12 @@ do_system_stop (GdmGreeterLoginWindow *l } res = try_system_stop (connection, &error); -#ifdef HAVE_POLKIT_GNOME - if (! res) { + if (!res) { g_debug ("GdmGreeterLoginWindow: unable to stop system: %s: %s", dbus_g_error_get_name (error), error->message); - - if (dbus_g_error_has_name (error, "org.freedesktop.ConsoleKit.Manager.NotPrivileged")) { - PolKitAction *action; - PolKitAction *action2; - PolKitResult result; - GtkWidget *dialog; - guint xid; - pid_t pid; - - xid = 0; - pid = getpid (); - - result = get_result_from_error (error); - action = get_action_from_error (error); - - if (result == POLKIT_RESULT_NO) { - action2 = polkit_action_new (); - polkit_action_set_action_id (action2, - "org.freedesktop.consolekit.system.stop-multiple-users"); - dialog = gtk_message_dialog_new (GTK_WINDOW (login_window), - GTK_DIALOG_MODAL, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - _("Failed to stop computer")); - if (polkit_action_equal (action, action2)) { - gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), - _("You are not allowed to stop the computer " - "because multiple users are logged in")); - } - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); - - polkit_action_unref (action); - polkit_action_unref (action2); - - return; - } - - g_error_free (error); - error = NULL; - res = polkit_gnome_auth_obtain (action, - xid, - pid, - (PolKitGnomeAuthCB) system_stop_auth_cb, - login_window, - &error); - polkit_action_unref (action); - - if (! res) { - g_warning ("Unable to request privilege for action: %s", error->message); - g_error_free (error); - } - - } + g_error_free (error); } -#endif } static void diff -up gdm-2.26.1/gui/simple-greeter/Makefile.am.polkit1 gdm-2.26.1/gui/simple-greeter/Makefile.am --- gdm-2.26.1/gui/simple-greeter/Makefile.am.polkit1 2009-05-13 18:15:11.512938382 -0400 +++ gdm-2.26.1/gui/simple-greeter/Makefile.am 2009-05-13 18:15:11.814939276 -0400 @@ -24,7 +24,6 @@ AM_CPPFLAGS = \ $(DISABLE_DEPRECATED_CFLAGS) \ $(GTK_CFLAGS) \ $(SIMPLE_GREETER_CFLAGS) \ - $(POLKIT_GNOME_CFLAGS) \ $(NULL) @INTLTOOL_SCHEMAS_RULE@ @@ -101,7 +100,6 @@ test_greeter_login_window_LDADD = \ libgdmuser.la \ $(COMMON_LIBS) \ $(SIMPLE_GREETER_LIBS) \ - $(POLKIT_GNOME_LIBS) \ $(RBAC_LIBS) \ $(NULL) @@ -262,7 +260,6 @@ test_user_chooser_LDADD = \ libgdmuser.la \ $(COMMON_LIBS) \ $(SIMPLE_GREETER_LIBS) \ - $(POLKIT_GNOME_LIBS) \ $(NULL) test_user_manager_SOURCES = \ @@ -273,7 +270,6 @@ test_user_manager_LDADD = \ libgdmuser.la \ $(COMMON_LIBS) \ $(SIMPLE_GREETER_LIBS) \ - $(POLKIT_GNOME_LIBS) \ $(NULL) libexec_PROGRAMS = \ @@ -344,7 +340,6 @@ gdm_simple_greeter_LDADD = \ $(COMMON_LIBS) \ $(EXTRA_GREETER_LIBS) \ $(SIMPLE_GREETER_LIBS) \ - $(POLKIT_GNOME_LIBS) \ $(RBAC_LIBS) \ $(LIBXKLAVIER_LIBS) \ $(NULL)