On Mon, Jun 12, 2006 at 11:26:20AM -0400, James F. Hranicky wrote: > On Friday 09 June 2006 17:25, Sam Roberts wrote: > > > > Questions and comments welcome, and I'm open to suggestions for > > > changes/improvements. > > > > I tried to do this on OS X recently using DGRAM AF_LOCAL sockets based > > on the examples from Stevens, and failed, possibly due to an error on my > > part, or maybe because the only way to do it is with getpeereid() on a > > connected stream-oriented socket? > > The man page indicates only SOCK_STREAM sockets work with getpeereid: Yes, but credentials are (supposed) to be attached to each message with DGRAM sockets (where there is no single "peer"). [UNPv1] section 14.8 "Receiving sender credentials" describes this, but the book is old, or maybe its not widely implemented, couldn't get the technique working on OS X, have yet to try on Linux. Anyhow, this isn't directly related to your patch, which only works with SOCK_STREAM sockets. Sam UNPv1 - UNIX Network Programming, Volume 1, Second Edition: Networking APIs: Sockets and XTI, Prentice Hall, Richard Stevens, 1998, ISBN 0-13-490012-X, http://www.kohala.com/start/unpv12e.html