SUMMARY 2 (better) rsh, which host is calling me ?

From: Thomas Bleek (
Date: Tue Oct 18 1994 - 19:52:44 CDT

Hi, Managers!
I have to post a 2nd summary. The echo to the summary was very
much better in quality and quantity. I assume, many people are only
reading mails with summaries 8-).

The best way for me is to use getpeername in a little c-program.
See the mail from Harish below.
Other suggested perl-scripts.
I have only included the c-source, I will use. If anybody wants to get
the whole stuff, please send me a mail, lets save resources!
Thanxs to all below, Thomas
BTW: Sun-Managers ist the most helpful list I know ! (Ruud van Poelgeest) (Donald McLachlan) (Joey R. Montilla) (Venkat Chalasani)
"Henry Katz" <>
Veselin Terzic <>
Mic Kaczmarczik <>
Juergen Wagner <gandalf@Csli.Stanford.EDU> (System Administrator - David Rossman)
Bryan Curnutt <curnutt@Stoner.COM>
Harish Malneedi <>
Guy Polis <> (Perry Hutchison) (Juergen Becker)

From: Harish Malneedi <>
Subject: Re: SUMMARY: rsh, which host is calling me ?
In-Reply-To: (Thomas Bleek)
 "SUMMARY: rsh, which host is calling me ?" (Oct 17, 10:52am)
To: (Thomas Bleek)


A small 'c ' code which i am appending to my mail might help you out.
We use this executable to bascially set the display variable for a PC
from which an unix application is invoked via rsh/rexec.

This executable "whoru", figures out which PC is calling it and
based on the IPAddress/hostname, which it derives, sets the DISPLAY variable.
This works only for PC's and not workstations (we didn't had the time
to get to that part yet) may be you can hack the script on those lines
and come up with what you want.
Good Luck.

===========================<< CUT HERE >>===========================

/* Program : WHO aRe yoU?
 * Date : 23-Aug-1994
 * Desc :
 * Designed to provide the remote
 * host IP address during an RSH or
 * REXEC. Used for eXceed and PC's
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in_systm.h>
#include <netinet/in.h>
#include <netinet/ip.h>

   struct sockaddr n;
   struct sockaddr_in *addr;
   int len, x;
   char *inet_ntoa();

   for( x = 0; x <= 2; x++ )
      len = sizeof( struct sockaddr );
      if( getpeername( x, &n, &len ) == 0 )
         addr = (struct sockaddr_in *)&n;
         printf( "%s", inet_ntoa( addr->sin_addr ) );
===========================<< CUT HERE >>===========================

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:09:12 CDT