On Tue, 2011-06-07 at 19:27 +0200, Robert Millan wrote: > 2011/6/7 Guillem Jover <guillem@debian.org>: > >> > Actually, it'd be great if someone made a library out of it. > > > > We already have it in libbsd as of 0.3.0: > > > > <http://cgit.freedesktop.org/libbsd/tree/src/getpeereid.c> > > Very nice! > > Sounds like the best solution for #610716 would be to use > libbsd then. > > CCing Arthur de Jong (nss-ldapd developer) as will probably > like to know. Thanks for the heads-up. I'll have a look to see if I can switch to using that. For reference, the implementation I currently use is here: http://arthurdejong.org/viewvc/nss-pam-ldapd/nss-pam-ldapd/compat/getpeercred.c If you need any code from the above I'm fine to relicence it under the same BSD license as is in use for getpeereid.c. getpeercred() also tries to get the remote process ID which may also be useful in some cases. I think the fallthrough in the libbsd one however isn't conforming to notes in the included manual page: This mechanism is reliable; there is no way for either side to influence the credentials returned to its peer except by calling the appropriate system call because it returns the current process' uid instead. -- -- arthur - adejong@debian.org - http://people.debian.org/~adejong --
Attachment:
signature.asc
Description: This is a digitally signed message part