Hi guys and gals!
This is a summary on what I found out about detecting the remote host from
telnet/rlogin connections to a linux box:
1. tcsh cannot determine the remote host with getpeername(), as this
function requires a socket, and tcsh is connected to a pty. tcsh then
falls back on the utmp host entry, but that is limited to 16 chars.
2. Both tcpd (a general wrapper for tcp connections, from NetKit-A) and
telnetd/rlogind can determine the remote host. E.g. tcpd logs contacts
via syslog, indicating the remote host. One can set a REMOTEHOST
environment in tcpd, but unfortunately this is being erased by
telnetd, that sets up a new environment. So the only `clean' solution
was to edit both telnetd/rlogind (from NetKit-B) to set up the
environment. The problems I have reported before were due to a silly
mistake on my behalf. I'm sorry for having taken your time for
looking at that. This environment variable now makes its way through
login (the -p [preserve environment] option is used by both daemons)
and the shell (e.g. bash,tcsh) - voila!
3. As login is usually called with -h <hostname>, one could set the
environment in login, too.
Best regards
Marek
--
***************************************************************************
* -----------------------\ http://saftsack.fs.uni-bayreuth.de/~marek *
* Unteres Tor 12 \------------------------------------------------*
* Tel/FAX +49-921-511824 for PGP Public Key *
***************************************************************************