persistent property store - first try

Kay Sievers kay.sievers at vrfy.org
Wed Jun 16 18:07:30 PDT 2004


On Mon, Jun 14, 2004 at 12:18:15PM -0400, Joe Shaw wrote:
> On Sat, 2004-06-12 at 23:37 +0200, David Zeuthen wrote:
> > Yikes, I just checked and D-BUS doesn't export who the remote user is..
> > Hmm; I wonder if we can get this into D-BUS; maybe just the process id
> > of the remote application then we can do a number of things.
> 
> Someone else brought this up recently on the dbus list, but I don't
> think anyone actually hacked it in.  It'd definitely be accepted if
> someone does it, though.

I tried something and posted it to the dbus-list:
  http://freedesktop.org/pipermail/dbus/2004-June/001201.html

It's not really nice, but let's see if we get feedback.

The attached 3 lines in hal_dbus.c are printing the following:

[D] hald_dbus.c:861 device_set_property() : udi=/org/freedesktop/Hal/devices/usb_46d_c00e_1100_-1_noserial, key=save.key3
[D] hald_dbus.c:876 device_set_property() : sender uid=2702
[D] hald_dbus.c:861 device_set_property() : udi=/org/freedesktop/Hal/devices/usb_46d_c00e_1100_-1_noserial, key=save.key3
[D] hald_dbus.c:876 device_set_property() : sender uid=0

Thanks,
Kay
-------------- next part --------------
Index: hald/hald_dbus.c
===================================================================
RCS file: /cvs/hal/hal/hald/hald_dbus.c,v
retrieving revision 1.5
diff -u -r1.5 hald_dbus.c
--- hald/hald_dbus.c	4 May 2004 16:05:35 -0000	1.5
+++ hald/hald_dbus.c	17 Jun 2004 00:22:40 -0000
@@ -836,6 +836,8 @@
 DBusHandlerResult
 device_set_property (DBusConnection * connection, DBusMessage * message)
 {
+	const char *sender;
+	dbus_uint32_t uid;
 	const char *udi;
 	char *key;
 	int type;
@@ -869,6 +871,9 @@
 	dbus_message_iter_next (&iter);
 
 	/** @todo check permissions of the sender vs property to be modified */
+	sender = dbus_message_get_sender (message);
+	uid = dbus_bus_get_sender_uid (connection, sender, NULL);
+	HAL_DEBUG (("sender uid=%i", uid));
 
 	type = dbus_message_iter_get_arg_type (&iter);
 	rc = FALSE;
-------------- next part --------------
_______________________________________________
hal mailing list
hal at freedesktop.org
http://freedesktop.org/mailman/listinfo/hal


More information about the Hal mailing list