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

kqueue channel getPeerCredentials does not return PID #9213

Closed
EliyahuStern opened this issue Jun 2, 2019 · 2 comments · Fixed by #9219
Closed

kqueue channel getPeerCredentials does not return PID #9213

EliyahuStern opened this issue Jun 2, 2019 · 2 comments · Fixed by #9219
Milestone

Comments

@EliyahuStern
Copy link
Contributor

EliyahuStern commented Jun 2, 2019

Calling KQueueDomainSocketChannel#peerCredentials returns PeerCredentials with PID field not set.

The reason for that is given in the following note:

// TODO: getting the PID may require reading/sending "ancillary data" via SCM_CREDENTIALS which is not desirable.

but the above note is not necessarily true. It is also possible to get the peer PID using get_sock_opts with LOCAL_PEERPID (see https://stackoverflow.com/questions/38185024/check-sender-when-listening-to-unix-socket/38207320#answer-38207320%E2%80%8F).

@normanmaurer
Copy link
Member

@EliyahuStern would you be interested to submit a pr ?

@EliyahuStern
Copy link
Contributor Author

@normanmaurer sure, just created #9219

normanmaurer pushed a commit that referenced this issue Jun 4, 2019
…s. (#9219)


Motivation:

This resolves a TODO from the initial transport-native-kqueue implementation, supplying the user with the pid of the local peer client/server process.

Modification:

Inside netty_kqueue_bsdsocket_getPeerCredentials, Call getsockopt with LOCAL_PEERPID and pass it to PeerCredentials constructor.
Add a test case in KQueueSocketTest.

Result:

PeerCredentials now have pid field set. Fixes #9213
normanmaurer pushed a commit that referenced this issue Jun 4, 2019
…s. (#9219)


Motivation:

This resolves a TODO from the initial transport-native-kqueue implementation, supplying the user with the pid of the local peer client/server process.

Modification:

Inside netty_kqueue_bsdsocket_getPeerCredentials, Call getsockopt with LOCAL_PEERPID and pass it to PeerCredentials constructor.
Add a test case in KQueueSocketTest.

Result:

PeerCredentials now have pid field set. Fixes #9213
@normanmaurer normanmaurer added this to the 4.1.37.Final milestone Jun 4, 2019
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 a pull request may close this issue.

2 participants