socket -> UID

Larry McVoy lm at snafu.Sun.COM
Tue Jan 16 16:56:20 AEST 1990


In article <832 at unipas.fmi.uni-passau.de> hessmann at unipas.fmi.uni-passau.de (Georg Hessmann) writes:
>Two processes communicate with the help of a socket. 
>(Socket has the type PF_INET, SOCK_STREAM)
>The first process runs as a background demon (using inetd) and waits
>for incoming messages from the second process.
>
>Problem:
>How can the first process obtain the UID and GID of the second process 
>right from the socket without any extra message from the second process.
>
>We want to disable/enable services of process one for certain 
>UID's and GID's without changing the source code of the second process.

Well, this is a bummer.  You can do it if really have to, but it requires
that
(1) both sockets must be on the same machine, and
(2) having an indepth knowledge that machine's socket implementation.

If you have both of those, the inetd-like process could open /dev/kmem and
grovel around, looking for the socket that was sending, and figure out
to whom it belonged (I think).  You don't want to try this at home, campers,
so the real answer is: "you can't."
---
What I say is my opinion.  I am not paid to speak for Sun, I'm paid to hack.
    Besides, I frequently read news when I'n drjhgungh, err, um, drunk.



More information about the Comp.unix.wizards mailing list