rust-lang / socket2

Advanced configuration options for sockets.
https://docs.rs/socket2
Apache License 2.0
683 stars 227 forks source link

Add `Socket::passcred`/`set_passcred` for working with `SO_PASSCRED`. #506

Closed tobz closed 7 months ago

tobz commented 7 months ago

This PR adds the ability to get and set the value of SO_PASSCRED on sockets.

Theoretically, FreeBSD does support the equivalent behavior, but does so via differently named constants/values, so I've opted to constrain this implementation to Linux only for now.

tobz commented 7 months ago

When you say smoke test, what are you thinking? Like an integration test that only runs on Linux and actually sets the option on a Unix domain socket?

tobz commented 7 months ago

Just went ahead and added a test which hopefully fits your definition of "smoke test."

tobz commented 7 months ago

Woops, thought I added a test but I had committed to the wrong branch.

Should be all set now.

tobz commented 7 months ago

@Thomasdezeeuw Small bump.

Not in a rush, but I have the feeling this might have fallen off your radar after the approval. 😄

Thomasdezeeuw commented 7 months ago

Not in a rush, but I have the feeling this might have fallen off your radar after the approval. 😄

Hadn't fallen off my radar, but $dayjob got busy, then my open source work is the first on the chopping block I'm afraid.

Test looks good, for future reference we have a little test! macro to help with this: https://github.com/rust-lang/socket2/blob/21ba6609efe09a7e27d62d2c29ff61bab88b970d/tests/socket.rs#L1326. But merging as is.

Thanks @tobz!

tobz commented 7 months ago

Doh! Sorry about the pushiness. Totally understand $dayjob cutting into open source time. 😓

Thanks again for approving/merging! Is there a general cadence you follow for cutting releases? I'm already using a Git ref at the moment, so I'm fine continuing to do so for a little while... but mostly curious. :)

Thomasdezeeuw commented 7 months ago

Doh! Sorry about the pushiness. Totally understand $dayjob cutting into open source time. 😓

:+1:

Thanks again for approving/merging! Is there a general cadence you follow for cutting releases? I'm already using a Git ref at the moment, so I'm fine continuing to do so for a little while... but mostly curious. :)

Not really, I mostly make releases on request. We don't see too many changes