Skip to content
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

Feat(Apple): Add the LOCAL_PEERTOKEN socket option #3929

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

PaulDance
Copy link

Dear maintainers,

This proposes to add the Darwin-only LOCAL_PEERTOKEN constant as a new API. It is a getsockopt option variant that enables retrieving the connected peer's audit token, which enables uniquely identifying the process with respect to the underlying system. It is taken from XNU's sys/un.h header.

Regarding a justification of a use case, this would be for reliably authenticating a peer process that attempts to communicate with the current one after connecting to one of its opened sockets. However, due to it being a simple constant, this is not strictly-speaking necessary. This should therefore be seen as more of an upstreaming and contributing to complete the already-existing APIs as all the other LOCAL_PEER* constants are already included.

One thing this also does in addition is to add the small descriptions from the header as documentation comments in the Rust module, since I could see it was done from time to time, although not always. It is also done for the other similar constants, for completion's sake. If needed, this can be restricted to only LOCAL_PEERTOKEN or even removed entirely.

Cheers,
Paul.

Taken from `sys/un.h`.

Signed-off-by: Paul Mabileau <paul.mabileau@harfanglab.fr>
Signed-off-by: Paul Mabileau <paul.mabileau@harfanglab.fr>
Signed-off-by: Paul Mabileau <paul.mabileau@harfanglab.fr>
@rustbot
Copy link
Collaborator

rustbot commented Sep 17, 2024

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @tgross35 (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@PaulDance PaulDance marked this pull request as ready for review September 17, 2024 11:01
@PaulDance
Copy link
Author

@rustbot label stable-nominated

seems appropriate?

@rustbot rustbot added the stable-nominated This PR should be considered for cherry-pick to libc's stable release branch label Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants