gdm r5644 - in trunk: . gui/simple-greeter



Author: mccann
Date: Wed Jan 30 02:23:48 2008
New Revision: 5644
URL: http://svn.gnome.org/viewvc/gdm?rev=5644&view=rev

Log:
2008-01-29  William Jon McCann  <mccann jhu edu>

	* configure.ac:
	* gui/simple-greeter/gdm-greeter-login-window.c:
	(get_show_restart_buttons), (switch_mode):
	Fix RBAC patch so it works on Linux.



Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/gui/simple-greeter/gdm-greeter-login-window.c

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Wed Jan 30 02:23:48 2008
@@ -92,14 +92,16 @@
 AC_SUBST(SIMPLE_GREETER_LIBS)
 
 PKG_CHECK_MODULES(POLKIT_GNOME,
-  polkit >= $POLICYKIT_REQUIRED_VERSION,
-  have_polkit=yes,
-  have_polkit=no)
+        polkit-gnome >= $POLICYKIT_REQUIRED_VERSION,
+        have_polkit=yes,
+        have_polkit=no)
 if test "x$have_polkit" = "xyes" ; then
        AC_DEFINE(HAVE_POLKIT_GNOME, [], [Define if we have polkit])
 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

Modified: trunk/gui/simple-greeter/gdm-greeter-login-window.c
==============================================================================
--- trunk/gui/simple-greeter/gdm-greeter-login-window.c	(original)
+++ trunk/gui/simple-greeter/gdm-greeter-login-window.c	Wed Jan 30 02:23:48 2008
@@ -54,7 +54,7 @@
 #include <dbus/dbus-glib.h>
 #include <dbus/dbus-glib-lowlevel.h>
 
-#if HAVE_POLKIT_GNOME
+#ifdef HAVE_POLKIT_GNOME
 #include <polkit-gnome/polkit-gnome.h>
 #endif
 
@@ -203,24 +203,30 @@
         }
 }
 
-#ifdef ENABLE_RBAC_SHUTDOWN
-static char *
-get_user_name (uid_t uid)
+static gboolean
+get_show_restart_buttons (GdmGreeterLoginWindow *login_window)
 {
-        struct passwd *pwent;
-        char          *name;
+        gboolean show;
 
-        name = NULL;
+        show = TRUE;
 
-        pwent = getpwuid (uid);
+#ifdef ENABLE_RBAC_SHUTDOWN
+        {
+                char *username;
 
-        if (pwent != NULL) {
-                name = g_strdup (pwent->pw_name);
+                username = g_get_user_name ();
+                if (username == NULL || !chkauthattr (RBAC_SHUTDOWN_KEY, username)) {
+                        show = FALSE;
+                        g_debug ("Not showing stop/restart buttons for user %s due to RBAC key %s",
+                                 username, RBAC_SHUTDOWN_KEY);
+                } else {
+                        g_debug ("Showing stop/restart buttons for user %s due to RBAC key %s",
+                                 username, RBAC_SHUTDOWN_KEY);
+                }
         }
-
-        return name;
-}
 #endif
+        return show;
+}
 
 static void
 switch_mode (GdmGreeterLoginWindow *login_window,
@@ -229,26 +235,12 @@
         const char *default_name;
         GtkWidget  *user_chooser;
         GtkWidget  *box;
-        gchar      *username;
         gboolean    show_restart_shutdown = TRUE;
-        uid_t       uid;
 
         /* FIXME: do animation */
         default_name = NULL;
 
-#ifdef ENABLE_RBAC_SHUTDOWN
-        uid      = getuid ();
-        username = get_user_name (uid);
-
-        if (username == NULL || !chkauthattr (RBAC_SHUTDOWN_KEY, username)) {
-                show_restart_shutdown = FALSE;
-                g_debug ("Not showing stop/restart buttons for user %s due to RBAC key %s",
-                         username, RBAC_SHUTDOWN_KEY);
-        } else {
-                g_debug ("Showing stop/restart buttons for user %s due to RBAC key %s",
-                         username, RBAC_SHUTDOWN_KEY);
-        }
-#endif
+        show_restart_shutdown = get_show_restart_buttons (login_window);
 
         switch (number) {
         case MODE_SELECTION:



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