-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
freebsdlike: add SCM_CREDS, struct sockcred #1740
Conversation
r? @JohnTitor (rust_highfive has picked a reviewer for you, use r? to override) |
This change looks good, but you should also define that constant for NetBSD (0x4), OpenBSD (0x2), and OSX (0x3). |
It's already defined for Apple and NetBSD — but it's (correctly) not 0x4 on the latter:
|
And it hasn't been available in OpenBSD since 2012 (I wonder what these "newer APIs" are lol) |
Ahh, good catch. It looks like NetBSD changed it 4 years ago, and wisely added a backwards-compatibility version: NetBSD/src@8e79650 . I was looking at NetBSD 6 source. |
It is present on both FreeBSD and DragonFly
Like on NetBSD, but without a pid field in the struct.
d031538
to
d8764e8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
1216: Add UnixCredentials support on FreeBSD/DragonFly r=asomers a=myfreeweb This allows working with `SCM_CREDS` messages, which are like `SCM_CREDENTIALS` on Linux, but slightly different (always overwritten by the kernel, contain a bit more info — euid and groups). With this PR, it is possible to write portable code that would use the appropriate message for the platform, but one remaining quirk is that `PassCred` thing still has to be present and `cfg`'d to Linux. Adding the `SCM_CREDS` constant to libc: rust-lang/libc#1740 Co-authored-by: Greg V <[email protected]>
SCM_CREDS
is present on both FreeBSD and DragonFly, is used for sendingstruct cmsgcred
control messagesstruct sockcred
is present on FreeBSD, is used withLOCAL_CREDS
socket option