Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!uunet!mtxinu!ed From: ed@mtxinu.COM (Ed Gould) Newsgroups: comp.unix.wizards Subject: Re: Given a filedescriptor, how can I find source IP?? Message-ID: <1991Mar26.064131.24485@mtxinu.COM> Date: 26 Mar 91 06:41:31 GMT References: <1991Mar22.201818.25515@msuinfo.cl.msu.edu> <1991Mar23.041824.3130@msuinfo.cl.msu.edu> Reply-To: ed@mtxinu.COM (Ed Gould) Organization: mt Xinu, Berkeley Lines: 17 >Remember boys and girls, "getpeername()" only works on sockets. >I guess I was not clear - the program does not open a socket - >it inherits some filedescriptors (0 1 and 2). A program can inherit sockets, just as it can inherit files. "File" descriptors can refer to either. If you're asking about the child of a telnet session - which has pseudo-terminals connected to 0, 1, and 2 - then you are out of luck. In general, there is no way to track backwards through the descriptor of a pty to its controlling process and then through one of that processe's descriptors to the foreign machine. -- Ed Gould mt Xinu, 2560 Ninth St., Berkeley, CA 94710 USA ed@mtxinu.COM +1 415 644 0146 "I'll fight them as a woman, not a lady. I'll fight them as an engineer."