CU-SeeMe & DNS

Michael Sattler (msattler@jungle.com)
Fri, 19 May 1995 08:50:57 -0700


>X-Nvlenv-01Date-Posted: 19-May-1995 14:18:11 -0400; at mprserv.orbit
>Date: 19 May 95 13:53:13 EDT
>From: mmielke@orbit.de
>To: msattler@jungle.com
>Subject: CU-SeeMe & DNS
>
>Hello,
>
>here comes a little bit of code doing NS lookup on incoming connections.
>Hope you find it useful. I have been testing this with the latest
>reflector ported
>on a SCO ODT 3.0 machine and it works just fine.
>
>changes to the MAKEFILE:
>_______________________
>CFLAGS = -g -DDEBUG -D_BSD -DGETHOSTBYADDR
>
>---------------------------------
>VSRCS= reflect.c socket.c control.c util.c load.c refutil.c client.c
>distribute.c ocp.c mbone.c dns.c
>
>
> --------
>VOBJS= reflect.o socket.o control.o util.o load.o refutil.o client.o
>distribute.o ocp.o mbone.o dns.o
>
>
> ---------
>#SCO wants this
>LIBC= -lsocket -lnsl_s -lrpc
>
>DNS.C:
>______
>#include <stdio.h>
>#include <sys/types.h>
>#include <sys/stream.h>
>#include <sys/socket.h>
>#include <netdb.h>
>#include <netinet/in.h>
>
>extern int h_errno;
>
>char TheName[80];
>struct hostent *phe;
>
>char *getDNSentry(struct sockaddr_in *iaddr)
> {
> phe = gethostbyaddr((char *) &iaddr->sin_addr,
> sizeof(struct in_addr), AF_INET);
>
> if(phe != (struct hostent *) NULL)
> sprintf(TheName, "%s", phe->h_name);
> else
> sprintf(TheName, "\n[%s (%d)]\n",
> h_errno == HOST_NOT_FOUND ?
> "Authoritative Answer Host not found" :
> h_errno == TRY_AGAIN ?
> "Non-Authoritive Host not found or SERVERFAIL" :
> h_errno == NO_RECOVERY ?
> "Non recoverable errors, FORMERR, REFUSED,NOTIMP" :
> h_errno == NO_DATA || h_errno == NO_ADDRESS ?
> "no data record of requested type" : "???",
> h_errno);
>
> return((char *) &TheName[0]);
> }
>
>changes to OCP.C:
>________________
>near line 290
>
> case CLIENT:
>
> dolog("Client at source %s is opening a connection\n",
> inet_ntoa(csock->sin_addr));
>
>#ifdef GETHOSTBYADDR
> dolog("Client claims to be the host: %s\n", getDNSentry(csock));
>#endif
>
>regards
>Marc
>

-----------------------------------------------------------------------+
Michael Sattler <msattler@jungle.com> http://www.jungle.com/msattler/ |
|
Arguing with an engineer is like mud-wrestling with a pig. |
After a while, you figure out that the pig likes it. |