hal/hald/linux2/addons addon-acpi.c, 1.15, 1.16 addon-keyboard.c, 1.3, 1.4 addon-pmu.c, 1.5, 1.6 addon-storage.c, 1.17, 1.18

David Zeuthen david at kemper.freedesktop.org
Wed Feb 22 13:10:08 PST 2006


Update of /cvs/hal/hal/hald/linux2/addons
In directory kemper:/tmp/cvs-serv5468/hald/linux2/addons

Modified Files:
	addon-acpi.c addon-keyboard.c addon-pmu.c addon-storage.c 
Log Message:
2006-02-22  David Zeuthen  <davidz at redhat.com>

        Patch from Martin Pitt <martin at piware.de>.

        * hald/linux2/probing/shared.h (drop_privileges): Take an
        additional parameter "keep_auxgroups"

        * hald/linux2/addons/addon-storage.c (main): Add some comment that
        we *could* drop privileges provided we were in the right group

        * hald/linux2/addons/addon-pmu.c (main): Drop privileges

        * hald/linux2/addons/addon-keyboard.c (main): Pass right parameter
        to drop_privileges

        * hald/linux2/addons/addon-acpi.c (main): Drop privileges



Index: addon-acpi.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/addons/addon-acpi.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- addon-acpi.c	13 Feb 2006 14:35:31 -0000	1.15
+++ addon-acpi.c	22 Feb 2006 21:10:06 -0000	1.16
@@ -161,6 +161,12 @@
 	DBusError error;
 	FILE *eventfp;
 
+	/* If we don't even consider the /proc ACPI interface, drop privileges
+	 * right away */
+#ifndef ACPI_PROC
+	drop_privileges (0);
+#endif
+
 	if (getenv ("HALD_VERBOSE") != NULL)
 		is_verbose = TRUE;
 
@@ -171,15 +177,20 @@
 		return 1;
 	}
 
-	while (1)
-	{
 #ifdef ACPI_PROC
-		/* If we can connect directly to the kernel then do so. */
-		if ((eventfp = acpi_get_event_fp_kernel ())) {
-			main_loop (ctx, eventfp);
-			dbg ("Lost connection to kernel acpi event source - retry connect");
-		}
+	/* If we can connect directly to the kernel then do so. */
+	eventfp = acpi_get_event_fp_kernel ();
+	drop_privileges (0);
+
+	if (eventfp) {
+		main_loop (ctx, eventfp);
+		dbg ("Lost connection to kernel acpi event source - exiting");
+		return 1;
+	}
 #endif
+
+	while (1)
+	{
 #ifdef ACPI_ACPID
 		/* Else, try to use acpid. */
 		if ((eventfp = acpi_get_event_fp_acpid ())) {

Index: addon-keyboard.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/addons/addon-keyboard.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- addon-keyboard.c	9 Feb 2006 16:41:43 -0000	1.3
+++ addon-keyboard.c	22 Feb 2006 21:10:06 -0000	1.4
@@ -189,7 +189,7 @@
 	if (!eventfp)
 		goto out;
 
-	drop_privileges();
+	drop_privileges (0);
 
 	while (1)
 	{

Index: addon-pmu.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/addons/addon-pmu.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- addon-pmu.c	18 Jan 2006 23:22:33 -0000	1.5
+++ addon-pmu.c	22 Feb 2006 21:10:06 -0000	1.6
@@ -99,6 +99,8 @@
                 goto out;
 	}
 
+        drop_privileges (0);
+
 	while (1) {
 		int n;
 

Index: addon-storage.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/addons/addon-storage.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- addon-storage.c	19 Feb 2006 00:47:43 -0000	1.17
+++ addon-storage.c	22 Feb 2006 21:10:06 -0000	1.18
@@ -270,7 +270,10 @@
 	char *support_media_changed_str;
 	int support_media_changed;
 
-	
+	/* We could drop privs if we know that the haldaemon user is
+	 * to be able to access block devices...
+	 */
+        /*drop_privileges (1);*/
 
 	if ((udi = getenv ("UDI")) == NULL)
 		goto out;




More information about the hal-commit mailing list