On Jul 18, 2006, at 12:27 PM, James F. Hranicky wrote: > Attached is the latest patch. Changes from the original: > > - UNIXSocket::{uid,gid} are replaced with UNIXSocket::peer_cred > that returns a hash of credentials { :uid => uid, ... }. > peer_cred[:uid] and peer_cred[:gid] are defined to be > ruid || euid || -1 and rgid || egid || -1 respectively. > -1 for :uid or :gid will raise an error. > > - UNIXSocket::peer_cred is now a method of BasicSocket, meaning > other sockets can make use of the routine if possible (apparently, > local TCP sockets on Sol10 pass credentials like Unix sockets do). > Depending on what the syscalls return for sockets that don't > support credentials, a system error will be raised if the syscall > fails, otherwise an error should be raised if uid or gid is still > -1. > + if (uid < 0 || gid < 0) > + rb_raise(rb_eSocket, "Invalid credentials: uid %d, gid % > d", uid, gid); Negative UID and GID are valid on some operating systems. -- Eric Hodel - drbrain / segment7.net - http://blog.segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com