SCM_RIGHTS: XTrans vs ssh forwarding with MIT-SHM clients

Jeremy Huddleston Sequoia jeremyhu at freedesktop.org
Wed Jan 18 19:43:11 UTC 2023


After implementing DetermineClientCmd for darwin (https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1040), we still have an issue.  We still do not know the pid of the peer (which we need to pass DetermineClientCmd).

We expect to determine the pid in GetLocalClientCreds().  Looking into that function, I expect it to be failing on other UNIX as well.  GetLocalClientCreds() prefers getpeereid() if getpeereid() is available.  getpeereid(), however, only returns uid and gid.  If getpeereid() is not available, the implementation will try getpeerucred() or SO_PEERCRED (both of which *DO* return the pid in addition to uid/gid).  So it looks like this should only be working if getpeereid() is NOT available and getpeerucred() or SO_PEERCRED are available.

Am I missing something?  How is this ssh detection working on other UNIX systems that have getpeereid right now (or is it not)?.

> On Jan 17, 2023, at 01:06, Jeremy Huddleston Sequoia <jeremyhu at apple.com> wrote:
> 
> Yep, thanks for the pointer.  Looks like DetermineClientCmd() needs to be implemented for darwin.
> 
>> On Jan 16, 2023, at 01:14, Michel Dänzer <michel at daenzer.net> wrote:
>> 
>> On 1/16/23 06:31, Jeremy Huddleston Sequoia wrote:
>>> 
>>> How should this work?  Why hasn't this been reported as an issue on other platforms?  This all seems pretty platform agnostic, so I'd expect this to be an issue on other platforms as well.  Is it not?  If not, why not?
>> 
>> ComputeLocalClient attempts to detect SSH clients and treats them as non-local. Maybe this isn't working on macos for some reason?
>> 
>> 
>> -- 
>> Earthling Michel Dänzer            |                  https://redhat.com
>> Libre software enthusiast          |         Mesa and Xwayland developer
>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.x.org/archives/xorg-devel/attachments/20230118/36c12cc7/attachment.htm>


More information about the xorg-devel mailing list