Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Apr 2021 12:58:08 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        Gleb Popov <arrowd@freebsd.org>
Cc:        Konstantin Belousov <kostikbel@gmail.com>, freebsd-hackers <freebsd-hackers@freebsd.org>
Subject:   Re: A bug with getsockopt(SOL_LOCAL, LOCAL_PEERCRED) ?
Message-ID:  <E6626DFC-2014-412C-AEA2-ECE57835B058@yahoo.com>
In-Reply-To: <CALH631=3hqvfraume467OM%2BqGqp854sGJFfhO8b61mF%2BkbsJ2Q@mail.gmail.com>
References:  <CALH631kLCApctk4iQJj6br0Pzeb6qsh9g3jz_SA8hH91ftQGDQ@mail.gmail.com> <YHiQ6qEjS2w8uYpS@kib.kiev.ua> <CALH631=3hqvfraume467OM%2BqGqp854sGJFfhO8b61mF%2BkbsJ2Q@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help


On 2021-Apr-15, at 12:21, Gleb Popov <arrowd at freebsd.org> wrote:

> On Thu, Apr 15, 2021 at 10:16 PM Konstantin Belousov <kostikbel at =
gmail.com>
> wrote:
>=20
>> You are calling getsockopt(2) in the listen socket, not on the =
connected
>> one.
>> Replace s with s2 in the call.
>>=20
>=20
> The `man unix ` says:
>=20
> The credentials presented to the server (the
> listen(2) caller) are those of the client
> when it called connect(2); the credentials
> presented to the client (the connect(2)
> caller) are those of the server when it
> called listen(2).
>=20
> This is what I actually want - to find out credentials of the =
connected
> user.

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.

=3D=3D=3D
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E6626DFC-2014-412C-AEA2-ECE57835B058>