On Mon, 18 Jan 1999 [EMAIL PROTECTED] wrote:
> > + if(inet_aton(AuthHost, &hident.Value.InetAddress))
>
> inet_aton returns 0 on success
Not here it doesn't.
>From the Linux inet_aton man page:
inet_aton() converts the Internet host address cp from the
standard numbers-and-dots notation into binary data and
stores it in the structure that inp points to. inet_aton
returns nonzero if the address is valid, zero if not.
>From the Linux libc info page:
- Function: int inet_aton (const char *NAME, struct in_addr *ADDR)
This function converts the Internet host address NAME from the
standard numbers-and-dots notation into binary data and stores it
in the `struct in_addr' that ADDR points to. `inet_aton' returns
nonzero if the address is valid, zero if not.
>From the IRIX man page:
The inet_aton routine interprets the specified character
string as an Internet address, placing the address into the structure
provided. It returns 1 if the string was successfully interpreted, or 0
if the string is invalid.
I've attached the inet_aton() compatibility routine I use in ORBit, in
case it is of any use...
-- Elliot
"In film you will find four basic story lines. Man versus man, man
versus nature, nature versus nature, and dog versus vampire."
- Steven Spielberg
#include "config.h"
#ifndef HAVE_INET_ATON
#include <netinet/in.h>
#include <string.h>
int inet_aton(const char *cp, struct in_addr *inp)
{
union {
unsigned int n;
char parts[4];
} u;
int a=0,b=0,c=0,d=0, i;
i = sscanf(cp, "%d.%d.%d.%d%*s", &a, &b, &c, &d);
if(i != 4)
return 0;
u.parts[0] = a;
u.parts[1] = b;
u.parts[2] = c;
u.parts[3] = d;
inp->s_addr = u.n;
return 1;
}
#endif