hal: Branch 'master' - 2 commits

David Zeuthen david at kemper.freedesktop.org
Thu Dec 14 18:38:53 PST 2006


 configure.in              |   15 ++++++++++-----
 tools/hal-storage-mount.c |    8 ++++++--
 2 files changed, 16 insertions(+), 7 deletions(-)

New commits:
diff-tree 9d607e21cac65dddaf0c8cb2443865d9ae509393 (from d49163c2d28478288d1a2fb0813f4069f7087116)
Author: Martin Pitt <martin at piware.de>
Date:   Thu Dec 14 21:38:50 2006 -0500

    without PolicyKit, allow only root to mount fixed disks
    
    When building hal without policykit, the mount backend solely relies
    on volume.ignore=true. This seems a bit fragile to me, and since we
    want to integrate mounting of fixed hard disks into the desktop, too
    [1], I added a policy check to the backend.

diff --git a/tools/hal-storage-mount.c b/tools/hal-storage-mount.c
index 12b15db..a69cdb3 100644
--- a/tools/hal-storage-mount.c
+++ b/tools/hal-storage-mount.c
@@ -143,7 +143,6 @@ cannot_remount (const char *device)
 	exit (1);
 }
 
-#ifdef HAVE_POLKIT
 static void
 permission_denied_privilege (const char *privilege, const char *uid)
 {
@@ -151,7 +150,6 @@ permission_denied_privilege (const char 
 	fprintf (stderr, "%s refused uid %s\n", privilege, uid);
 	exit (1);
 }
-#endif
 
 
 /* borrowed from gtk/gtkfilesystemunix.c in GTK+ on 02/23/2006 */
@@ -769,6 +767,12 @@ handle_mount (LibHalContext *hal_ctx, 
 		printf ("caller don't possess privilege\n");
 		permission_denied_privilege (privilege, invoked_by_uid);
 	}
+#else
+        /* root can do everything; only allow handling removable devices
+         * without uid change to non-root users */
+        if (!invoked_by_uid || strcmp(invoked_by_uid, "0"))
+                if (!privilege || strcmp (privilege, "hal-storage-removable-mount"))
+                        permission_denied_privilege (privilege, invoked_by_uid);
 #endif
 
 #ifdef DEBUG
diff-tree d49163c2d28478288d1a2fb0813f4069f7087116 (from 7602464b92f9617b34ea5606426061fe3077820e)
Author: David Zeuthen <davidz at redhat.com>
Date:   Thu Dec 14 21:28:53 2006 -0500

    misc build fixes for libparted and libpci

diff --git a/configure.in b/configure.in
index b01cae7..af075ae 100644
--- a/configure.in
+++ b/configure.in
@@ -108,7 +108,7 @@ if test "x$use_parted" = "xyes" ; then
    AC_DEFINE(USE_PARTED,1,[Whether libparted is to be used])
    AC_CHECK_LIB(uuid, uuid_generate, [], AC_MSG_ERROR([*** uuid library (libuuid) not found]))
    AC_CHECK_LIB(dl, dlopen,          [], AC_MSG_ERROR([*** dl library (libdl) not found]))
-   AC_MSG_CHECKING(for libparted == 1.7.1)
+   AC_MSG_CHECKING(for libparted == 1.7.1, 1.8.0, 1.8.1)
    LDFLAGS=-lparted
    AC_TRY_RUN(
    #include <stdio.h>
@@ -122,7 +122,12 @@ if test "x$use_parted" = "xyes" ; then
 	if ( sscanf( ped_get_version(), "%d.%d.%d", &major, &minor, &micro ) == 3 )
 		printf( "Found libparted %s", ped_get_version() ) ;
 
-        return ! ( major == 1 && minor == 7 && micro == 1 ) ;
+	if ((major == 1 && minor == 7 && micro == 1) ||
+	    (major == 1 && minor == 8 && micro == 0)
+	    (major == 1 && minor == 8 && micro == 1))
+	   return 0;
+
+	return 1;
     }
 	,AC_MSG_RESULT( ),AC_MSG_ERROR(*** Requires libparted == 1.7.1) )
     PARTED_LIBS=-lparted
@@ -243,9 +248,9 @@ fi
 dnl Check for libpci
 AC_CHECK_HEADERS(pci/pci.h, [
 	AC_CHECK_LIB(pci, pci_init, [
-		USE_LIBPCI=yes AM_CONDITIONAL(HAVE_LIBPCI,true)], [
-		USE_LIBPCI=no AM_CONDITIONAL(HAVE_LIBPCI,false)])], [
-	USE_LIBPCI=no AM_CONDITIONAL(HAVE_LIBPCI,false)])
+		USE_LIBPCI=yes; AM_CONDITIONAL(HAVE_LIBPCI,true)], [
+		USE_LIBPCI=no; AM_CONDITIONAL(HAVE_LIBPCI,false)])], [
+	USE_LIBPCI=no; AM_CONDITIONAL(HAVE_LIBPCI,false)])
 
 AC_ARG_WITH(backend, [  --with-backend=<name>   backend to use (linux/solaris/freebsd/dummy)],
                       [


More information about the hal-commit mailing list