A bug with getsockopt(SOL_LOCAL, LOCAL_PEERCRED) ?

Gleb Popov arrowd at freebsd.org
Wed Apr 21 18:28:19 UTC 2021


On Thu, Apr 15, 2021 at 10:58 PM Mark Millard <marklmi at yahoo.com> wrote:

> The way I read the above quote and your code and
> related documentation: s2 after the accept4 assignment
> is specific to the client's specific connect and
> will give access to the connected user's credentials
> --but s is not specific to the specific connect in
> question (after that assignment or later) and would
> not give the information that you indicate that you
> want: you need a connection-specific identifier.
>
> In other words, it looks to me like what you quoted
> agrees with what Konstantin reported.
>
> ===
> Mark Millard
> marklmi at yahoo.com
> ( dsl-only.net went
> away in early 2018-Mar)
>
>
This makes sense, thanks.

However, this code works on Linux and seems to return credentials of the
user that started the process. I actually stumbled upon this when porting
this code:
https://github.com/CollaboraOnline/online/blob/master/net/Socket.cpp#L805

Would it make sense if FreeBSD followed Linux semantics in this case? If
not, what are my options for porting the software?


More information about the freebsd-hackers mailing list