Implementing LOCAL_CREDS socket credentials

Julio M. Merino Vidal jmmv84 at gmail.com
Sun Aug 27 12:30:14 PDT 2006


On 8/27/06, Havoc Pennington <hp at redhat.com> wrote:
> Julio M. Merino Vidal wrote:
> > I've got the above working more or less in D-Bus but have hit a
> > problem that I've been unable to resolve so far.  As far as I can
> > tell, there is currently no way to guarantee that 2) is executed after
> > 1), so there is a race condition that prevents this from working
> > safely.
>
> Does anything break if the server just always sets LOCAL_CREDS, even if
> it doesn't end up reading the local creds?

Not that I know of, although I could expect it to be less efficient.

The problem is, could this work?  If I understand it correctly, the
client sends a "AUTH EXTERNAL" message and immediately afterwards the
'\0' credentials byte.  The server cannot set the flag in between
these two messages.  Another approach could be to set the flag and
retrieve the credentials from the "AUTH EXTERNAL" message itself.  But
if this is the very first message in the connection, the server cannot
set the flag appropriately.  (Because the socket needs to be
connected; it's not possible to set LOCAL_CREDS before an accept(2).)

-- 
Julio M. Merino Vidal <jmmv84 at gmail.com>
The Julipedia - http://julipedia.blogspot.com/


More information about the dbus mailing list