SCM_RIGHTS: XTrans vs ssh forwarding with MIT-SHM clients

Aaron Plattner aplattner at nvidia.com
Fri Feb 3 22:11:53 UTC 2023


At least on Arch Linux, getpeereid() is only defined in bsd/unistd.h and 
Meson doesn't seem to find it. HAVE_GETPEEREID is undefined and 
GetLocalClientCreds() ends up in the `defined(SO_PEERCRED)` path.

I agree that it's just broken on platforms that have getpeereid().

-- Aaron

On 1/18/23 11:43 AM, Jeremy Huddleston Sequoia wrote:
> 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/20230203/dda8c118/attachment.htm>


More information about the xorg-devel mailing list