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

raw: Add methods to send and receive msgs with Unix credentials #5

Merged
merged 1 commit into from Sep 17, 2022

Conversation

cgwalters
Copy link
Collaborator

I have several projects that might make use of this crate, and one of them today uses SO_PEERCRED to validate the sender's identity.

Add basic support for this.

I chose to make a small new struct for credentials instead of exposing nix in our public types (perhaps we want to use rustix in the future, etc.)

Closes: #4

@cgwalters
Copy link
Collaborator Author

Was self-reviewing this and I think there's no point in the Cell here, we can just call setsockopt on each invocation of recv_with_credentials(). I expect basically every use case will only call that method exactly once, so additional syscall traffic is irrelevant.

I have several projects that might make use of this crate, and one
of them today uses `SO_PEERCRED` to validate the sender's identity.

Add basic support for this.

I chose to make a small new struct for credentials
instead of exposing nix in our public types (perhaps we want to use
rustix in the future, etc.)

Closes: mitsuhiko#4
@mitsuhiko
Copy link
Owner

This looks very reasonable. Thank you!

@mitsuhiko mitsuhiko merged commit 4243ac3 into mitsuhiko:main Sep 17, 2022
@mitsuhiko
Copy link
Owner

I released this but I had to feature gate it to linux since credentials in the nix crate are only implemented there.

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.

support for SO_PEERCRED
2 participants