-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Description
On Linux, the definitions to pass Unix credentials over sockets via SCM_CREDENTIALS like Ucred are exposed and there are helper functions like UnixCredentials to convert between raw and structured representations. FreeBSD has a similar capability via SCM_CREDS (see its unix manpage), which is not part of x/sys right now. This is not POSIX-standardized as far as I can tell.
At the minimum, we could include struct cmsgcred as part of the Go types (I'm happy to contribute here). Ideally we'd also add matching FreeBSD-implementations for UnixCredentials and ParseUnixCredentials, though signature and semantics would be slightly different (on FreeBSD, it's recommended to pass a zeroed buffer since the kernel apparently fills the fields, while on Linux the sender can explicitly set the fields as long as it has appropriate privileges).