[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Remote IP for inetd "daemon"



On Wed, 19 Sep 2001 15:06:24 +0200, "Marcel Hicking" writes:
>The problem is the redirect.
>When redirecting, the prog doesn't
>get peername anymore.

Ah, thanks!

So now I simply send the IP to stderr and everything´s fine:

  if (getpeername((int) 1,
        (struct sockaddr *) & name, (socklen_t *) & namelen) == 0) {
    if ((temp_domain = (char *) inet_ntoa(name.sin_addr)))
      fprintf (stderr,"%s", temp_domain);

test.sh:
#!/bin/bash
/usr/local/bin/getpeername 2>/tmp/peer.ip
exit

It isn´t too useful to have the information but being unable to use it 
 ;-)

cheers,
&rw
-- 
/ Ing. Robert Waldner |  <r.waldner@xsoft.at>  \
\     Xsoft GmbH      | T: +43 1 796 36 36 692 /


Attachment: pgpA6xDHUEL_m.pgp
Description: PGP signature


Reply to: