[gnome-settings-daemon] wacom: Check whether we're being called as root



commit 22ee2c3ed48183bda04311343f1cc96d2a39bbad
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Mar 5 15:26:54 2012 +0000

    wacom: Check whether we're being called as root

 plugins/wacom/gsd-wacom-led-helper.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/plugins/wacom/gsd-wacom-led-helper.c b/plugins/wacom/gsd-wacom-led-helper.c
index 32b68ca..e98bf55 100644
--- a/plugins/wacom/gsd-wacom-led-helper.c
+++ b/plugins/wacom/gsd-wacom-led-helper.c
@@ -95,10 +95,19 @@ int main (int argc, char **argv)
 	GOptionContext *context;
 	GUdevClient *client;
 	GUdevDevice *device, *parent;
+	int uid, euid;
 	char *filename;
 	GError *error = NULL;
         const char * const subsystems[] = { "input", NULL };
 
+	/* get calling process */
+	uid = getuid ();
+	euid = geteuid ();
+	if (uid != 0 || euid != 0) {
+		g_print ("This program can only be used by the root user\n");
+		return 1;
+	}
+
 	g_type_init ();
 
 	context = g_option_context_new (NULL);



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