A bug with getsockopt(SOL_LOCAL, LOCAL_PEERCRED) ?

Gleb Popov arrowd at freebsd.org
Fri Apr 23 08:47:10 UTC 2021


On Thu, Apr 22, 2021 at 11:59 PM Mark Millard <marklmi at yahoo.com> wrote:

> So s2 gets the pid of the ncat and s gets the pid of a.out.
>
> Is that what you expected?
> <...>
> So s2 gets the pid of the nc and s gets the pid of a.out.
>
> Same question applies.
>
<...>
> Were you expecting s2 to get the pid of nc and
> s to get the pid of a.out under FreeBSD as well?
> Would that be getting what you want?
>
> ===
> Mark Millard
> marklmi at yahoo.com
> ( dsl-only.net went
> away in early 2018-Mar)
>
>
Most probably, yes. I'm not 100% as I'm still trying to reach authors of
https://github.com/CollaboraOnline/online/blob/master/net/Socket.cpp#L811
and ask them what this code does.
On one hand, [1] hints that creds for the listening socket should indeed
match the user that started the program.
On the other hand, log message at [2] looks like they think that creds
contain credentials of the connected user. Like, the authors also mistaken
the listening socket with an accepted one.
I'm confused by this and keep asking on Collabora IRC and forums, but
didn't get an answer yet.

[1]:
https://github.com/CollaboraOnline/online/blob/master/net/Socket.cpp#L833
[2]:
https://github.com/CollaboraOnline/online/blob/master/net/Socket.cpp#L844


More information about the freebsd-hackers mailing list