[gnome-power-manager] Do not require PolicyKit to get the brightness values as these are already accessable by all users



commit 9b0e1ae4f18a57f9aff2f89ccc156f0a4c46580f
Author: Richard Hughes <richard hughsie com>
Date:   Mon Jun 7 16:13:36 2010 +0100

    Do not require PolicyKit to get the brightness values as these are already accessable by all users
    
    This also fixes the random dialog when launching a session
    using VNC

 src/gpm-backlight-helper.c |   42 +++++++++++++++++++++++-------------------
 src/gpm-brightness.c       |    2 +-
 2 files changed, 24 insertions(+), 20 deletions(-)
---
diff --git a/src/gpm-backlight-helper.c b/src/gpm-backlight-helper.c
index b89f7dc..27aed09 100644
--- a/src/gpm-backlight-helper.c
+++ b/src/gpm-backlight-helper.c
@@ -192,25 +192,6 @@ main (gint argc, gchar *argv[])
 		goto out;
 	}
 
-	/* get calling process */
-	uid = getuid ();
-	euid = geteuid ();
-	if (uid != 0 || euid != 0) {
-		/* TRANSLATORS: only able to install profiles as root */
-		g_print ("%s\n", _("This program can only be used by the root user"));
-		retval = GCM_BACKLIGHT_HELPER_EXIT_CODE_ARGUMENTS_INVALID;
-		goto out;
-	}
-
-	/* check we're not being spoofed */
-	pkexec_uid_str = g_getenv ("PKEXEC_UID");
-	if (pkexec_uid_str == NULL) {
-		/* TRANSLATORS: the program must never be directly run */
-		g_print ("%s\n", _("This program must only be run through pkexec"));
-		retval = GCM_BACKLIGHT_HELPER_EXIT_CODE_INVALID_USER;
-		goto out;
-	}
-
 	/* find device */
 	filename = gcm_backlight_helper_get_best_backlight ();
 	if (filename == NULL) {
@@ -234,6 +215,8 @@ main (gint argc, gchar *argv[])
 
 		/* just print the contents to stdout */
 		g_print ("%s", contents);
+		retval = GCM_BACKLIGHT_HELPER_EXIT_CODE_SUCCESS;
+		goto out;
 	}
 
 	/* GetSteps */
@@ -250,6 +233,27 @@ main (gint argc, gchar *argv[])
 
 		/* just print the contents to stdout */
 		g_print ("%s", contents);
+		retval = GCM_BACKLIGHT_HELPER_EXIT_CODE_SUCCESS;
+		goto out;
+	}
+
+	/* get calling process */
+	uid = getuid ();
+	euid = geteuid ();
+	if (uid != 0 || euid != 0) {
+		/* TRANSLATORS: only able to install profiles as root */
+		g_print ("%s\n", _("This program can only be used by the root user"));
+		retval = GCM_BACKLIGHT_HELPER_EXIT_CODE_ARGUMENTS_INVALID;
+		goto out;
+	}
+
+	/* check we're not being spoofed */
+	pkexec_uid_str = g_getenv ("PKEXEC_UID");
+	if (pkexec_uid_str == NULL) {
+		/* TRANSLATORS: the program must never be directly run */
+		g_print ("%s\n", _("This program must only be run through pkexec"));
+		retval = GCM_BACKLIGHT_HELPER_EXIT_CODE_INVALID_USER;
+		goto out;
 	}
 
 	/* SetBrightness */
diff --git a/src/gpm-brightness.c b/src/gpm-brightness.c
index 323b37a..cc8233f 100644
--- a/src/gpm-brightness.c
+++ b/src/gpm-brightness.c
@@ -102,7 +102,7 @@ gpm_brightness_helper_get_value (const gchar *argument)
 	gchar *command = NULL;
 
 	/* get the data */
-	command = g_strdup_printf ("pkexec " SBINDIR "/gnome-power-backlight-helper --%s", argument);
+	command = g_strdup_printf (SBINDIR "/gnome-power-backlight-helper --%s", argument);
 	ret = g_spawn_command_line_sync (command,
 					 &stdout_data, NULL, &exit_status, &error);
 	if (!ret) {



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