Bug 8381

Summary: dbus_connection_get_unix_user fails
Product: dbus Reporter: frederic heem <frederic.heem>
Component: coreAssignee: Havoc Pennington <hp>
Status: RESOLVED NOTABUG QA Contact: John (J5) Palmieri <johnp>
Severity: normal    
Priority: high    
Version: unspecified   
Hardware: Other   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description frederic heem 2006-09-21 08:38:53 UTC
Inside a server callback (those that are magically called by the glib 
bindings), dbus_connection_get_unix_user is called to get the user id of the 
client but fails. In _dbus_auth_get_identity, it copies the 
credentials : "*credentials = auth->authorized_identity". 
All fields of auth->authorized_identity are set to DBUS_PID_UNSET.
Any ideas ?
Comment 1 John (J5) Palmieri 2006-09-24 09:23:14 UTC
Are you calling DBusConnection methods on a DBusGConnection?
Comment 2 frederic heem 2006-10-03 01:37:24 UTC
dbus_g_connection_get_connection is used to convert DBusGConnection to  
DBusConnection. Hence, dbus_connection_get_unix_user gets the correct 
connection.
Comment 3 John (J5) Palmieri 2006-10-03 08:05:30 UTC
closing 
Comment 4 frederic heem 2006-10-04 01:36:40 UTC
There is a misunderstanding, dbus_connection_get_unix_user gets the correct 
connection but fails.
Actually, I cannot any unit test case for dbus_connection_get_unix_user in 
dbus.
Comment 5 Havoc Pennington 2006-10-04 06:10:12 UTC
are you using a tcp connection, or on windows? it won't work in either of 
those cases.
Comment 6 frederic heem 2006-10-04 06:56:51 UTC
Neither tcp nor windows is used
Comment 7 John (J5) Palmieri 2006-10-04 07:29:13 UTC
Do you have a test case you can attach?  What version of D-Bus are you using and
on what distribution?

BTW Sorry about closing the bug.  I thought you said you used the get_connection
API and get_unix_user worked.
Comment 8 frederic heem 2006-10-04 07:34:08 UTC
dbus 0.93, dbus-glib-0.73, fedora core 5
For the test case, just call dbus_connection_get_unix_user inside a call back 
that are called by the glib binding
Comment 9 John (J5) Palmieri 2006-10-04 07:48:19 UTC
Attaching a test case would be nice because of time constraints and we would be
sure that it fails on your machine.
Comment 10 frederic heem 2006-10-04 08:00:04 UTC
The easiest way would be to add a permanent test case in test-dbus-glib.c
Comment 11 John (J5) Palmieri 2006-10-28 05:42:47 UTC
As it turns out the code in question was trying to get the unix user from a
connection which was opened by the app.  You can only get the unix user off of
connections passed to a server.  I am not sure if the glib bindings can do this
yet.  The best place to ask is on the mailing list

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.