NetBSD LOCAL_CREDS fails when no supplementary groups

Todd Allan todd_allan at picovex.com
Thu Jan 18 13:55:12 PST 2007


Todd Allan wrote:
 > Hello, I've run into a snag sending D-Bus messages on a recent
 > NetBSD-current in single-user mode. The check that fails is:
 >
 > dbus-sysdeps-unix.c: _dbus_read_credentials_unix_socket():
 >
 > if (cmsg.hdr.cmsg_len < sizeof (cmsg) || cmsg.hdr.cmsg_type != SCM_CREDS)
 > {
 > dbus_set_error (error, DBUS_ERROR_FAILED,
 > "Message from recvmsg() was not SCM_CREDS");
 >
 > In NetBSD's case, at least, struct sockcred contains a variable-length
 > array of "supplemental groups", that may contain zero entries:
 >
 > int sc_ngroups; /* number of supplemental groups */
 > gid_t sc_groups[1]; /* variable length */
 >
 > The struct sockcred transmitted with the control message will contain as
 > many sc_groups entries as specified by sc_ngroups. If sc_ngroups == 0,
 > cmsg.hdr.cmsg_len will include zero sc_groups entries, and will be 4
 > bytes smaller than the sizeof(cmsg), which includes a single entry.
 >
 > Processes spawned from the init process context, which has zero
 > supplemental groups in its kauth_cred_t, and which do not have an
 > ancestor that performs a setgroups(2), as does login(1), hit this case.

Attached is one way to allow D-Bus to work in single-user mode on NetBSD.

TAllan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbus-local-creds.patch
Type: text/x-patch
Size: 1089 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20070118/063149ac/dbus-local-creds.bin


More information about the dbus mailing list