Subject: Re: getpeereid() or equivalent
To: Arne H.Juul <arnej@pvv.ntnu.no>
From: Jason Thorpe <thorpej@shagadelic.org>
List: tech-net
Date: 08/06/2007 09:10:04
On Aug 6, 2007, at 2:08 AM, Arne H. Juul wrote:
> +int
> +getpeereid(int s, uid_t *euid, gid_t *egid)
> +{
> + struct unpcbid cred;
> + socklen_t len = sizeof(cred);
> + if (getsockopt(s, 0, LOCAL_PEEREID, &cred, &len) < 0) {
> + return -1;
> + } else {
> + *euid = cred.unp_euid;
> + *egid = cred.unp_egid;
My only comment ... fill these in conditional on them being non-NULL.
Otherwise, this looks great to me, and it would be nice to get this
into netbsd-4 as well.
Thanks for doing this!
>
> + return 0;
> + }
> +}
-- thorpej