hal/tools hal-storage-mount.c, 1.5,
1.6 hal-system-lcd-get-brightness, 1.11,
1.12 hal-system-lcd-set-brightness, 1.12,
1.13 hal-system-power-hibernate, 1.14,
1.15 hal-system-power-reboot, 1.8,
1.9 hal-system-power-shutdown, 1.8,
1.9 hal-system-power-suspend, 1.14,
1.15 hal-system-storage-eject, 1.12,
1.13 hal-system-storage-unmount, 1.13, 1.14
David Zeuthen
david at kemper.freedesktop.org
Mon Jun 5 16:56:02 PDT 2006
- Previous message: hal/privileges Makefile.am, NONE, 1.1 hal-power-hibernate.privilege,
NONE, 1.1 hal-power-poweroff.privilege, NONE,
1.1 hal-power-reboot.privilege, NONE,
1.1 hal-power-suspend.privilege, NONE,
1.1 hal-storage-fixed-mount-all-options.privilege, NONE,
1.1 hal-storage-fixed-mount.privilege, NONE,
1.1 hal-storage-removable-mount-all-options.privilege, NONE,
1.1 hal-storage-removable-mount.privilege, NONE, 1.1
- Next message: hal ChangeLog, 1.913, 1.914 Makefile.am, 1.17, 1.18 configure.in,
1.129, 1.130
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvs/hal/hal/tools
In directory kemper:/tmp/cvs-serv27813/tools
Modified Files:
hal-storage-mount.c hal-system-lcd-get-brightness
hal-system-lcd-set-brightness hal-system-power-hibernate
hal-system-power-reboot hal-system-power-shutdown
hal-system-power-suspend hal-system-storage-eject
hal-system-storage-unmount
Log Message:
2006-06-05 David Zeuthen <davidz at redhat.com>
* hald/hald_dbus.c:
(hald_exec_method): Export a new environment variable with the
unique name for callers system bus connection called
HAL_METHOD_INVOKED_BY_SYSTEMBUS_CONNECTION_NAME
* policy/*: Move these to privileges instead
* privileges/*: Moved from policy/txt/*
* Makefile.am: Fix up subdirs
* configure.in: Adjust for new dirs and remove comment about
libhal-policy. Require PolicyKit >= 0.2 (which is polkit CVS).
Don't read weird options from the polkit pc file.
* tools/*: Update to new PolicyKit API and DTRT so things work
using hald/run-hald.sh
Index: hal-storage-mount.c
===================================================================
RCS file: /cvs/hal/hal/tools/hal-storage-mount.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- hal-storage-mount.c 14 May 2006 18:49:53 -0000 1.5
+++ hal-storage-mount.c 5 Jun 2006 23:56:00 -0000 1.6
@@ -419,7 +419,7 @@
static void
handle_mount (LibHalContext *hal_ctx, LibPolKitContext *pol_ctx, const char *udi,
LibHalVolume *volume, LibHalDrive *drive, const char *device,
- const char *invoked_by_uid, pid_t invoked_by_pid)
+ const char *invoked_by_uid, const char *invoked_by_syscon_name)
{
int i, j;
DBusError error;
@@ -453,9 +453,9 @@
#endif
#ifdef DEBUG
- printf ("device = %s\n", device);
- printf ("invoked by uid = %s\n", invoked_by_uid);
- printf ("invoked by pid = %d\n", invoked_by_pid);
+ printf ("device = %s\n", device);
+ printf ("invoked by uid = %s\n", invoked_by_uid);
+ printf ("invoked by system bus connection = %s\n", invoked_by_syscon_name);
#endif
if (volume != NULL) {
@@ -660,29 +660,31 @@
if (pol_is_fixed) {
if (pol_change_uid) {
- privilege = "hal-storage-fixed-mount-change-uid";
+ privilege = "hal-storage-fixed-mount-all-options";
} else {
privilege = "hal-storage-fixed-mount";
}
} else {
if (pol_change_uid) {
- privilege = "hal-storage-removable-mount-change-uid";
+ privilege = "hal-storage-removable-mount-all-options";
} else {
privilege = "hal-storage-removable-mount";
}
}
#ifdef DEBUG
- printf ("using privilege %s for uid %s, pid %d\n", privilege, invoked_by_uid, invoked_by_pid);
+ printf ("using privilege %s for uid %s, system_bus_connection %s\n", privilege, invoked_by_uid,
+ invoked_by_syscon_name);
#endif
if (libpolkit_is_uid_allowed_for_privilege (pol_ctx,
- invoked_by_pid,
+ invoked_by_syscon_name,
invoked_by_uid,
privilege,
udi,
&allowed_by_privilege,
- &is_temporary_privilege) != LIBPOLKIT_RESULT_OK) {
+ &is_temporary_privilege,
+ NULL) != LIBPOLKIT_RESULT_OK) {
printf ("cannot lookup privilege\n");
unknown_error ();
}
@@ -819,8 +821,7 @@
DBusConnection *system_bus = NULL;
LibPolKitContext *pol_ctx = NULL;
char *invoked_by_uid;
- char *invoked_by_pid_str;
- pid_t invoked_by_pid;
+ char *invoked_by_syscon_name;
device = getenv ("HAL_PROP_BLOCK_DEVICE");
if (device == NULL)
@@ -832,11 +833,7 @@
invoked_by_uid = getenv ("HAL_METHOD_INVOKED_BY_UID");
- invoked_by_pid_str = getenv ("HAL_METHOD_INVOKED_BY_PID");
- if (invoked_by_pid_str != NULL)
- invoked_by_pid = atoi (invoked_by_pid_str);
- else
- invoked_by_pid = -1;
+ invoked_by_syscon_name = getenv ("HAL_METHOD_INVOKED_BY_SYSTEMBUS_CONNECTION_NAME");
dbus_error_init (&error);
if ((hal_ctx = libhal_ctx_init_direct (&error)) == NULL) {
@@ -864,7 +861,8 @@
if (drive == NULL) {
usage ();
} else {
- handle_mount (hal_ctx, pol_ctx, udi, NULL, drive, device, invoked_by_uid, invoked_by_pid);
+ handle_mount (hal_ctx, pol_ctx, udi, NULL, drive, device, invoked_by_uid,
+ invoked_by_syscon_name);
}
} else {
@@ -879,7 +877,8 @@
if (drive == NULL)
unknown_error ();
- handle_mount (hal_ctx, pol_ctx, udi, volume, drive, device, invoked_by_uid, invoked_by_pid);
+ handle_mount (hal_ctx, pol_ctx, udi, volume, drive, device, invoked_by_uid,
+ invoked_by_syscon_name);
}
Index: hal-system-lcd-get-brightness
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-lcd-get-brightness,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- hal-system-lcd-get-brightness 17 May 2006 20:12:17 -0000 1.11
+++ hal-system-lcd-get-brightness 5 Jun 2006 23:56:00 -0000 1.12
@@ -15,8 +15,10 @@
exit 1
fi
-if [ -n "$HALD_UNAME_S" -a -x $0-$HALD_UNAME_S ]; then
- exec $0-$HALD_UNAME_S $@
+# TODO: check privilege
+
+if [ -n "$HALD_UNAME_S" -a -x ./$HALD_UNAME_S/hal-system-lcd-get-brightness-$HALD_UNAME_S ]; then
+ exec ./$HALD_UNAME_S/hal-system-lcd-get-brightness-$HALD_UNAME_S $@
else
echo "org.freedesktop.Hal.Device.UnknownError" >&2
echo "No back-end for your operating system" >&2
Index: hal-system-lcd-set-brightness
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-lcd-set-brightness,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- hal-system-lcd-set-brightness 17 May 2006 20:12:17 -0000 1.12
+++ hal-system-lcd-set-brightness 5 Jun 2006 23:56:00 -0000 1.13
@@ -16,6 +16,8 @@
exit 1
fi
+# TODO: check privilege
+
# read value for set brightness
read value
@@ -28,8 +30,8 @@
export value
-if [ -n "$HALD_UNAME_S" -a -x $0-$HALD_UNAME_S ]; then
- exec $0-$HALD_UNAME_S $@
+if [ -n "$HALD_UNAME_S" -a -x ./$HALD_UNAME_S/hal-system-lcd-set-brightness-$HALD_UNAME_S ]; then
+ exec ./$HALD_UNAME_S/hal-system-lcd-set-brightness-$HALD_UNAME_S $@
else
echo "org.freedesktop.Hal.Device.UnknownError" >&2
echo "No back-end for your operating system" >&2
Index: hal-system-power-hibernate
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-power-hibernate,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- hal-system-power-hibernate 17 May 2006 20:12:17 -0000 1.14
+++ hal-system-power-hibernate 5 Jun 2006 23:56:00 -0000 1.15
@@ -1,18 +1,20 @@
#!/bin/sh
-POLICY=hal-power-hibernate
+PRIVILEGE=hal-power-hibernate
if [ "$HAL_METHOD_INVOKED_BY_UID" != "0" ] ; then
- RESULT=$(polkit-is-privileged --privilege $POLICY --user $HAL_METHOD_INVOKED_BY_UID 2>&1)
+ RESULT=$(polkit-is-privileged --privilege $PRIVILEGE \
+ --user $HAL_METHOD_INVOKED_BY_UID \
+ --system-bus-unique-name $HAL_METHOD_INVOKED_BY_SYSTEMBUS_CONNECTION_NAME 2>&1)
IS_PRIVILEGED=$?
if [ "$IS_PRIVILEGED" != "0" ] ; then
echo org.freedesktop.Hal.Device.PermissionDeniedByPolicy >&2
- echo $POLICY refused uid $HAL_METHOD_INVOKED_BY_UID >&2
+ echo $PRIVILEGE refused uid $HAL_METHOD_INVOKED_BY_UID >&2
exit 1
fi
fi
-if [ -n "$HALD_UNAME_S" -a -x $0-$HALD_UNAME_S ]; then
- exec $0-$HALD_UNAME_S $@
+if [ -n "$HALD_UNAME_S" -a -x ./$HALD_UNAME_S/hal-system-power-hibernate-$HALD_UNAME_S ]; then
+ exec ./$HALD_UNAME_S/hal-system-power-hibernate-$HALD_UNAME_S $@
else
echo "org.freedesktop.Hal.Device.UnknownError" >&2
echo "No back-end for your operating system" >&2
Index: hal-system-power-reboot
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-power-reboot,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- hal-system-power-reboot 17 May 2006 20:12:17 -0000 1.8
+++ hal-system-power-reboot 5 Jun 2006 23:56:00 -0000 1.9
@@ -1,18 +1,20 @@
#!/bin/sh
-POLICY=hal-power-reboot
+PRIVILEGE=hal-power-reboot
if [ "$HAL_METHOD_INVOKED_BY_UID" != "0" ] ; then
- RESULT=$(polkit-is-privileged --privilege $POLICY --user $HAL_METHOD_INVOKED_BY_UID 2>&1)
+ RESULT=$(polkit-is-privileged --privilege $PRIVILEGE \
+ --user $HAL_METHOD_INVOKED_BY_UID \
+ --system-bus-unique-name $HAL_METHOD_INVOKED_BY_SYSTEMBUS_CONNECTION_NAME 2>&1)
IS_PRIVILEGED=$?
if [ "$IS_PRIVILEGED" != "0" ] ; then
echo org.freedesktop.Hal.Device.PermissionDeniedByPolicy >&2
- echo $POLICY refused uid $HAL_METHOD_INVOKED_BY_UID >&2
+ echo $PRIVILEGE refused uid $HAL_METHOD_INVOKED_BY_UID >&2
exit 1
fi
fi
-if [ -n "$HALD_UNAME_S" -a -x $0-$HALD_UNAME_S ]; then
- exec $0-$HALD_UNAME_S $@
+if [ -n "$HALD_UNAME_S" -a -x ./$HALD_UNAME_S/hal-system-power-reboot-$HALD_UNAME_S ]; then
+ exec ./$HALD_UNAME_S/hal-system-power-reboot-$HALD_UNAME_S $@
else
echo "org.freedesktop.Hal.Device.UnknownError" >&2
echo "No back-end for your operating system" >&2
Index: hal-system-power-shutdown
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-power-shutdown,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- hal-system-power-shutdown 17 May 2006 20:12:17 -0000 1.8
+++ hal-system-power-shutdown 5 Jun 2006 23:56:00 -0000 1.9
@@ -1,18 +1,20 @@
#!/bin/sh
-POLICY=hal-power-poweroff
+PRIVILEGE=hal-power-poweroff
if [ "$HAL_METHOD_INVOKED_BY_UID" != "0" ] ; then
- RESULT=$(polkit-is-privileged --privilege $POLICY --user $HAL_METHOD_INVOKED_BY_UID 2>&1)
+ RESULT=$(polkit-is-privileged --privilege $PRIVILEGE \
+ --user $HAL_METHOD_INVOKED_BY_UID \
+ --system-bus-unique-name $HAL_METHOD_INVOKED_BY_SYSTEMBUS_CONNECTION_NAME 2>&1)
IS_PRIVILEGED=$?
if [ "$IS_PRIVILEGED" != "0" ] ; then
echo org.freedesktop.Hal.Device.PermissionDeniedByPolicy >&2
- echo $POLICY refused uid $HAL_METHOD_INVOKED_BY_UID >&2
+ echo $PRIVILEGE refused uid $HAL_METHOD_INVOKED_BY_UID >&2
exit 1
fi
fi
-if [ -n "$HALD_UNAME_S" -a -x $0-$HALD_UNAME_S ]; then
- exec $0-$HALD_UNAME_S $@
+if [ -n "$HALD_UNAME_S" -a -x ./$HALD_UNAME_S/hal-system-power-shutdown-$HALD_UNAME_S ]; then
+ exec ./$HALD_UNAME_S/hal-system-power-shutdown-$HALD_UNAME_S $@
else
echo "org.freedesktop.Hal.Device.UnknownError" >&2
echo "No back-end for your operating system" >&2
Index: hal-system-power-suspend
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-power-suspend,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- hal-system-power-suspend 17 May 2006 20:12:17 -0000 1.14
+++ hal-system-power-suspend 5 Jun 2006 23:56:00 -0000 1.15
@@ -1,18 +1,20 @@
#!/bin/sh
-POLICY=hal-power-suspend
+PRIVILEGE=hal-power-suspend
if [ "$HAL_METHOD_INVOKED_BY_UID" != "0" ] ; then
- RESULT=$(polkit-is-privileged --privilege $POLICY --user $HAL_METHOD_INVOKED_BY_UID 2>&1)
+ RESULT=$(polkit-is-privileged --privilege $PRIVILEGE \
+ --user $HAL_METHOD_INVOKED_BY_UID \
+ --system-bus-unique-name $HAL_METHOD_INVOKED_BY_SYSTEMBUS_CONNECTION_NAME 2>&1)
IS_PRIVILEGED=$?
if [ "$IS_PRIVILEGED" != "0" ] ; then
echo org.freedesktop.Hal.Device.PermissionDeniedByPolicy >&2
- echo $POLICY refused uid $HAL_METHOD_INVOKED_BY_UID >&2
+ echo $PRIVILEGE refused uid $HAL_METHOD_INVOKED_BY_UID >&2
exit 1
fi
fi
-if [ -n "$HALD_UNAME_S" -a -x $0-$HALD_UNAME_S ]; then
- exec $0-$HALD_UNAME_S $@
+if [ -n "$HALD_UNAME_S" -a -x ./$HALD_UNAME_S/hal-system-power-suspend-$HALD_UNAME_S ]; then
+ exec ./$HALD_UNAME_S/hal-system-power-suspend-$HALD_UNAME_S $@
else
echo "org.freedesktop.Hal.Device.UnknownError" >&2
echo "No back-end for your operating system" >&2
Index: hal-system-storage-eject
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-storage-eject,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- hal-system-storage-eject 17 May 2006 20:12:17 -0000 1.12
+++ hal-system-storage-eject 5 Jun 2006 23:56:00 -0000 1.13
@@ -36,8 +36,8 @@
# fi
#fi
-if [ -n "$HALD_UNAME_S" -a -x $0-$HALD_UNAME_S ]; then
- exec $0-$HALD_UNAME_S $@
+if [ -n "$HALD_UNAME_S" -a -x ./$HALD_UNAME_S/hal-system-storage-eject-$HALD_UNAME_S ]; then
+ exec ./$HALD_UNAME_S/hal-system-storage-eject-$HALD_UNAME_S $@
else
echo "org.freedesktop.Hal.Device.UnknownError" >&2
echo "No back-end for your operating system" >&2
Index: hal-system-storage-unmount
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-storage-unmount,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- hal-system-storage-unmount 17 May 2006 20:12:17 -0000 1.13
+++ hal-system-storage-unmount 5 Jun 2006 23:56:00 -0000 1.14
@@ -58,8 +58,8 @@
export MOUNT_POINT
-if [ -n "$HALD_UNAME_S" -a -x $0-$HALD_UNAME_S ]; then
- exec $0-$HALD_UNAME_S $@
+if [ -n "$HALD_UNAME_S" -a -x ./$HALD_UNAME_S/hal-system-storage-unmount-$HALD_UNAME_S ]; then
+ exec ./$HALD_UNAME_S/hal-system-storage-unmount-$HALD_UNAME_S $@
else
echo "org.freedesktop.Hal.Device.UnknownError" >&2
echo "No back-end for your operating system" >&2
- Previous message: hal/privileges Makefile.am, NONE, 1.1 hal-power-hibernate.privilege,
NONE, 1.1 hal-power-poweroff.privilege, NONE,
1.1 hal-power-reboot.privilege, NONE,
1.1 hal-power-suspend.privilege, NONE,
1.1 hal-storage-fixed-mount-all-options.privilege, NONE,
1.1 hal-storage-fixed-mount.privilege, NONE,
1.1 hal-storage-removable-mount-all-options.privilege, NONE,
1.1 hal-storage-removable-mount.privilege, NONE, 1.1
- Next message: hal ChangeLog, 1.913, 1.914 Makefile.am, 1.17, 1.18 configure.in,
1.129, 1.130
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the hal-commit
mailing list