Bug 55729 - [PATCH] Add accessor to return the DBusGConnection from the DBusGMethodInvocation
Summary: [PATCH] Add accessor to return the DBusGConnection from the DBusGMethodInvoca...
Status: RESOLVED FIXED
Alias: None
Product: dbus
Classification: Unclassified
Component: GLib (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Simon McVittie
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-07 15:17 UTC by Dan Williams
Modified: 2012-12-04 17:40 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Add accessor to return the DBusGConnection that a DBusGMethodInvocation was invoked on (2.28 KB, patch)
2012-10-07 15:17 UTC, Dan Williams
Details | Splinter Review
Add accessor to return the DBusGConnection that a DBusGMethodInvocation was invoked on (2.34 KB, patch)
2012-10-08 14:37 UTC, Dan Williams
Details | Splinter Review

Description Dan Williams 2012-10-07 15:17:21 UTC
Created attachment 68212 [details] [review]
Add accessor to return the DBusGConnection that a DBusGMethodInvocation was invoked on

For NetworkManager we're adding support for a private bus socket so that NM can be used in early-boot environments without a bus daemon running.  That means we're setting up a DBusServer object on a private socket and making dbus-glib aware of the connections that appear on that socket.

Since the authentication paths depend on which DBusGConnection the method invocation comes from, as the private socket only accepts connections from root, and since messages from the private socket don't have "sender" addresses, we need to figure out which DBusGConnection the DBusGInvocation is associated with so we can short-circuit authentication checks and always allow any connections from the private socket.

Unfortunately we can't get at the DBusGConnection without doing something like:

DBusGConnection *gconn = (DBusGConnection *) context;

which is a complete hack.  So I'd like to formalize this since it seems useful :)
Comment 1 Simon McVittie 2012-10-08 09:45:38 UTC
Comment on attachment 68212 [details] [review]
Add accessor to return the DBusGConnection that a DBusGMethodInvocation was invoked on

Review of attachment 68212 [details] [review]:
-----------------------------------------------------------------

Sounds fine to me, just a couple of comments about the doc-comment.

::: dbus/dbus-gobject.c
@@ +3277,5 @@
>  }
>  
> +/**
> + * dbus_g_method_invocation_get_g_connection:
> + * @context: the method context

There should be some sort of "content" in this doc-comment to placate gtk-doc. In telepathy-glib we usually do this:

/**
 * foo_get_bar:
 * @foo: blah blah blah
 *
 * <!-- Returns: says it all -->
 *
 * Returns: blah blah blah
 */

@@ +3279,5 @@
> +/**
> + * dbus_g_method_invocation_get_g_connection:
> + * @context: the method context
> + *
> + * Returns: the @DBusGConnection from which the method was called.

I'd like a (transfer none) annotation here - dbus-glib isn't introspectable anyway, but it's useful information for gtk-doc too.
Comment 2 Dan Williams 2012-10-08 14:37:12 UTC
Created attachment 68264 [details] [review]
Add accessor to return the DBusGConnection that a DBusGMethodInvocation was invoked on
Comment 3 Simon McVittie 2012-12-04 17:40:06 UTC
Fixed in git for 0.102, thanks


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.