hal/hald hald_dbus.c,1.34,1.35
David Zeuthen
david at freedesktop.org
Wed Apr 27 11:53:41 PDT 2005
Update of /cvs/hal/hal/hald
In directory gabe:/tmp/cvs-serv10203/hald
Modified Files:
hald_dbus.c
Log Message:
2005-04-27 David Zeuthen <davidz at redhat.com>
* hald/linux2/osspec_linux.h: Remove prototype for the function
hal_util_get_device_file().
* hald/linux2/osspec.c (hal_util_get_udevinfo_path): Remove
(hal_util_get_device_file): Remove
* hald/linux2/coldplug.c (hal_util_get_udevinfo_path): Move from
osspec.c
(hal_util_get_sysfs_to_dev_map): New function
(coldplug_synthesize_events): Get the sysfs->dev map in one go using
'udevinfo -d' available in udev since at least version 057.
* configure.in: Bump dbus requirement to 0.33 since the new dbus is
out.
2005-04-27 David Zeuthen <davidz at redhat.com>
* libhal/libhal.c (libhal_device_set_property_helper): Don't leak the
DBusMessage objects
* hald/hald_dbus.c (sender_has_privileges): Don't leak the error and
actually return FALSE if sender is unprivileged. Also fix up spelling.
Index: hald_dbus.c
===================================================================
RCS file: /cvs/hal/hal/hald/hald_dbus.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- hald_dbus.c 11 Apr 2005 18:51:50 -0000 1.34
+++ hald_dbus.c 27 Apr 2005 18:53:39 -0000 1.35
@@ -1132,22 +1132,24 @@
HAL_DEBUG (("base_svc = %s", user_base_svc));
dbus_error_init (&error);
- if ((user_uid = dbus_bus_get_unix_user (connection, user_base_svc, &error)) == (unsigned long) -1) {
- HAL_WARNING (("Could not get uid for connection"));
+ user_uid = dbus_bus_get_unix_user (connection, user_base_svc, &error);
+ if (user_uid == (unsigned long) -1 || dbus_error_is_set (&error)) {
+ HAL_WARNING (("Could not get uid for connection: %s %s", error.name, error.message));
+ dbus_error_free (&error);
goto out;
}
HAL_INFO (("uid for caller is %ld", user_uid));
if (user_uid != 0 && user_uid != geteuid()) {
- HAL_WARNING (("uid %d is doesn't have the right priviledges", user_uid));
+ HAL_WARNING (("uid %d is not privileged", user_uid));
goto out;
}
ret = TRUE;
out:
- return TRUE;
+ return ret;
}
/** Set a property on a device.
@@ -1217,51 +1219,36 @@
case DBUS_TYPE_STRING:
{
const char *v;
-
dbus_message_iter_get_basic (&iter, &v);
-
rc = hal_device_property_set_string (device, key, v);
-
break;
}
case DBUS_TYPE_INT32:
{
dbus_int32_t v;
-
dbus_message_iter_get_basic (&iter, &v);
-
rc = hal_device_property_set_int (device, key, v);
-
break;
}
case DBUS_TYPE_UINT64:
{
dbus_uint64_t v;
-
dbus_message_iter_get_basic (&iter, &v);
-
rc = hal_device_property_set_uint64 (device, key, v);
-
break;
}
case DBUS_TYPE_DOUBLE:
{
double v;
-
dbus_message_iter_get_basic (&iter, &v);
-
rc = hal_device_property_set_double (device, key, v);
-
break;
}
case DBUS_TYPE_BOOLEAN:
{
dbus_bool_t v;
-
dbus_message_iter_get_basic (&iter, &v);
-
rc = hal_device_property_set_bool (device, key, v);
-
break;
}
default:
More information about the hal-commit
mailing list