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 <jerem...@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 <mic...@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


Reply via email to