Skip to content

Conversation

KJTsanaktsidis
Copy link
Contributor

@KJTsanaktsidis KJTsanaktsidis commented Nov 28, 2022

Depending on the platform, Unix sockets can support fetching the credentials of a remote peer, or pushing credentials to a remote peer, through a variety of socket options and ancillary message types.

Currently, Ruby is able to parse these ancillary data and socket option structures, but the only way this is exposed back to Ruby code is through the #inspect method. Parsing inspect strings is not a robust way to write programs!

This change adds a type Socket::Credentials, which is a structure for holding the various kinds of credentials that unixen support passing between processes. It also implements Socket::AncillaryData#credentials and Socket::Option#credentials, to allow parsing these credentials from ancillary data/socket options respectively.

fixes https://bugs.ruby-lang.org/issues/19179

@KJTsanaktsidis KJTsanaktsidis force-pushed the ktsanaktsidis/recv_io_multi branch 5 times, most recently from d21165b to 294f8c2 Compare December 3, 2022 07:12
@KJTsanaktsidis KJTsanaktsidis changed the title Implement Socket::AncillaryData::unix_credentials Implement a Socket::Credentials struct for handling unix socket creds Dec 3, 2022
@KJTsanaktsidis KJTsanaktsidis force-pushed the ktsanaktsidis/recv_io_multi branch from 294f8c2 to 69ab0fa Compare December 3, 2022 07:19
Depending on the platform, Unix sockets can support fetching the
credentials of a remote peer, or pushing credentials to a remote peer,
through a variety of socket options and ancillary message types.

Currently, Ruby is able to parse these ancillary data and socket option
structures, but the only way this is exposed back to Ruby code is
through the #inspect method. Parsing inspect strings is not a robust way
to write programs!

This change adds a type Socket::Credentials, which is a structure for
holding the various kinds of credentials that unixen support passing
between processes. It also implements Socket::AncillaryData#credentials
and Socket::Option#credentials, to allow parsing these credentials from
ancillary data/socket options respectively.
@KJTsanaktsidis KJTsanaktsidis force-pushed the ktsanaktsidis/recv_io_multi branch from 69ab0fa to 449045b Compare December 3, 2022 07:30
@KJTsanaktsidis KJTsanaktsidis marked this pull request as ready for review December 4, 2022 02:01
@ioquatix
Copy link
Member

ioquatix commented Dec 4, 2022

Oh this is pretty neat.

@KJTsanaktsidis
Copy link
Contributor Author

Hey @ioquatix , now that 3.2 has been released, wondering if you could have a squizz at this? Thanks!

@hsbt
Copy link
Member

hsbt commented Jan 4, 2023

This feature needs to approval from @matz or @akr . We should discuss this on redmine, not github.

@KJTsanaktsidis
Copy link
Contributor Author

Yup, I already had a ticket open for this from last year - nobody looked at it! 😢 https://bugs.ruby-lang.org/issues/19179. Figured it was too close to Ruby 3.2 release and everyone was focused on that.

I'm not sure how to actually ping people on redmine to take a look though, i can't seem to tag or assign anybody?

@ioquatix
Copy link
Member

ioquatix commented Jan 4, 2023

We should add it to the next developer meeting.

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.

3 participants