Skip to content

Conversation

@ids1024
Copy link
Contributor

@ids1024 ids1024 commented Sep 26, 2023

I still need to test this to make sure it works properly. Particularly the SCM_CREDENTIALS part.

Apparently FreeBSD, macOS, and DragonFlyBSD have LOCAL_PEERCRED which similar to SO_PEERCRED but with an array of groups. And likewise FreeBSD lists SCM_CREDS with a similar difference... There's also getpeereid on all BSDs but not Linux that gets uid and gid but not pid.

@sunfishcode
Copy link
Member

On the merge conflict here, #855 moved all the sockopt functions out of syscalls.rs and into their own sockopt.rs file, so hopefully you can just move the code here over to the new file.

@ids1024 ids1024 force-pushed the peercred branch 2 times, most recently from ac06965 to 4a0338e Compare October 4, 2023 03:25
@ids1024 ids1024 marked this pull request as ready for review October 4, 2023 03:43
@ids1024
Copy link
Contributor Author

ids1024 commented Oct 4, 2023

I was thinking this would be awkward to test, but actually it's not to hard to just create a socketpair, and there's no need for the socket ends to be in different processes. So this has a test now showing these APIs work and return the correct values.

I also updated UCred to use the Pid/Uid/Gid types instead of raw integers, and updated the cmsg_space! macro to handle ScmCredentials.

Copy link
Member

@sunfishcode sunfishcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this!

@sunfishcode
Copy link
Member

Looks good!

@sunfishcode sunfishcode merged commit 62afd55 into bytecodealliance:main Oct 4, 2023
@sunfishcode
Copy link
Member

This is now released in rustix 0.38.17.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants