Rust: Peer credentials on Unix socket

Created on 22 Jun 2017  路  8Comments  路  Source: rust-lang/rust

https://github.com/tokio-rs/tokio-uds/pull/13 was recently merged, so I'd like to open an issue of adding same thing to stdlib. TL;DR It allows one to get effective UID and GID of the process which created the remote socket.

I suggest to test it with Tokio now and when there is consensus, we can merge similar change. I need this function, so I'm going to test it anyway.

C-feature-accepted T-libs

Most helpful comment

Since the PR was merged should the labels (and perhaps also the title) be updated to tracking issue?

All 8 comments

Considering that newtypes for pid_t, uid_t and gid_t landed in nix, we shoul consider using same newtypes in std and then simply reexport them in nix.

This seems like a reasonable addition. It looks like there are some extra platforms that require special handling though - Solaris and FreeBSD: https://doxygen.postgresql.org/getpeereid_8c_source.html

The implementation in tokio handles Linux and FreeBSD (incl. macOS). I doesn't handle Solaris because I don't have Solaris machine.

This isn't my area of expertise but I would be interested to see an API proposed for this in a PR.

Hi guys. We're quite keen for something like this in the stdlib. The implementation in the Tokio repository looks good to me, and from a cursory glance it looks like the stdlib can be very similar. I'm happy to give this a crack -- should I submit an RFC first or is a normal code pull request OK? 馃槃

Cheers! 馃檪

The PR which implements this issue is ready for review 馃殌

75148

Since the PR was merged should the labels (and perhaps also the title) be updated to tracking issue?

I would agree with that!
I guess the steps to follow for stabilization are here?

Was this page helpful?
0 / 5 - 0 ratings