<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>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.</p>
<p>I agree that it's just broken on platforms that have
getpeereid().</p>
<p>-- Aaron<br>
</p>
<div class="moz-cite-prefix">On 1/18/23 11:43 AM, Jeremy Huddleston
Sequoia wrote:<br>
</div>
<blockquote type="cite" cite="mid:496C7293-7B6C-4EC3-AE68-EAA0B22E5000@freedesktop.org">
<div>After implementing <span style="caret-color: rgb(0, 0, 0);
color: rgb(0, 0, 0);">DetermineClientCmd for darwin (</span><a href="https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1040" moz-do-not-send="true" class="moz-txt-link-freetext">https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1040</a><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">), we
still have an issue. We still do not know the pid of the peer
(which we need to pass </span><span style="caret-color: rgb(0,
0, 0); color: rgb(0, 0, 0);">DetermineClientCmd).</span></div>
<div><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><br>
</span></div>
<div><font color="#000000">We expect to determine the pid in
GetLocalClientCreds(). Looking into that function, I expect
it to be failing on other UNIX as well. </font><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">GetLocalClientCreds()
prefers </span><span style="caret-color: rgb(0, 0, 0); color:
rgb(0, 0, 0);">getpeereid() if </span><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">getpeereid()
is available. </span><span style="caret-color: rgb(0, 0, 0);
color: rgb(0, 0, 0);">getpeereid(), however, only returns uid
and gid. If </span><font color="#000000"><span style="caret-color: rgb(0, 0, 0);">getpeereid() is not
available, the implementation will try </span></font><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">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 </span><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">getpeereid()
is NOT available and </span><span style="caret-color: rgb(0,
0, 0); color: rgb(0, 0, 0);">getpeerucred() or </span><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">SO_PEERCRED</span><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"> are
available.</span></div>
<div><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><br>
</span></div>
<div><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">Am
I missing something? How is </span><span style="caret-color:
rgb(0, 0, 0); color: rgb(0, 0, 0);">this ssh detection working
on other UNIX systems that have </span><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">getpeereid </span><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">right
now (or is it not)?.</span></div>
<div>
<div><br>
<blockquote type="cite">
<div>On Jan 17, 2023, at 01:06, Jeremy Huddleston Sequoia
<a class="moz-txt-link-rfc2396E" href="mailto:jeremyhu@apple.com"><jeremyhu@apple.com></a> wrote:</div>
<br class="Apple-interchange-newline">
<div>
<div>Yep, thanks for the pointer. Looks like
DetermineClientCmd() needs to be implemented for darwin.<br>
<br>
<blockquote type="cite">On Jan 16, 2023, at 01:14,
Michel Dänzer <a class="moz-txt-link-rfc2396E" href="mailto:michel@daenzer.net"><michel@daenzer.net></a> wrote:<br>
<br>
On 1/16/23 06:31, Jeremy Huddleston Sequoia wrote:<br>
<blockquote type="cite"><br>
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?<br>
</blockquote>
<br>
ComputeLocalClient attempts to detect SSH clients and
treats them as non-local. Maybe this isn't working on
macos for some reason?<br>
<br>
<br>
-- <br>
Earthling Michel Dänzer |
<a class="moz-txt-link-freetext" href="https://redhat.com">https://redhat.com</a><br>
Libre software enthusiast | Mesa and
Xwayland developer<br>
<br>
</blockquote>
<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
</body>
</html>