Peer to peer D-BUS / gLib

John (J5) Palmieri johnp at redhat.com
Mon Feb 20 11:17:45 PST 2006


On Mon, 2006-02-20 at 11:02 -0800, James Kent wrote:
> I was able to modify the example in dbus-0.60/glib/examples to work with peer-to-peer communication between the client and service processes but ran into two issues.
> 
> First, I hit a NULL pointer dereference in glib/dbus-gproxy.c in the function dbus_g_proxy_constructor.  In the peer-to-peer case, proxy->name is NULL, causing the line:
> 
>   proxy->for_owner = (proxy->name[0] == ':');
> 
> to deref the NULL pointer.  Replacing this line with:
> 
>   if (proxy->name == NULL)
>     proxy->for_owner = TRUE;
>   else
>     proxy->for_owner = (proxy->name[0] == ':');
> 
> fixes the problem.

Can you provide a patch?  Thanks.

> Second, I still had to use the internal macro DBUS_G_CONNECTION_FROM_CONNECTION in one place, in the server process's connection handler.  I'd like to suggest that the signature of the function dbus_connection_setup_with_g_main be changed from:
> 
> void            dbus_connection_setup_with_g_main (DBusConnection  *connection,
>                                                    GMainContext    *context);
> 
> to:
> 
> DBusGConnection* dbus_connection_setup_with_g_main (DBusConnection  *connection,
>                                                    GMainContext    *context);
> 
> That would have allowed me to access the DBusGConnection pointer I needed.
> 
> If you would like to include the modified sample using peer-to-peer direct connections in the glib/examples distribution, let me know.
> 

You don't need to call dbus_connection_setup_with_g_main as it is called
via dbus_g_bus_get and dbus_g_connection_open.

-- 
John (J5) Palmieri <johnp at redhat.com>



More information about the dbus mailing list