Abstract namespace connections (Connection refused)
hp at pobox.com
Thu Feb 14 15:06:17 PST 2008
On Thu, Feb 14, 2008 at 5:18 PM, @4u <fd4u at vplace.de> wrote:
> What does the D-BUS do? Does it append NUL bytes?
I think not.
> If a C programmer finds this line:
> memcpy(unix_addr->sun_path, xparam->inputs.name, xparam->inputs.namelen);
> Does it mean that NUL bytes are their or not?
I believe the relevant thing is the length of sockaddr_un passed to
connect() or listen(), rather than this memcpy().
dbus does this:
connect (fd, (struct sockaddr*) &addr, _DBUS_STRUCT_OFFSET (struct
sockaddr_un, sun_path) + path_len)
Where path_len is strlen("/tmp/whatever") + 1, the +1 is because
abstract sockets have the leading nul in front.
If the connect() or listen() just does sizeof(struct sockaddr_un) then
it will always get a bunch of trailing garbage bytes in the abstract
More information about the dbus