version 1.35, 2003/08/06 13:44:33
|
version 1.36, 2003/08/06 14:58:22
|
|
|
| |
struct hostent *entry; | struct hostent *entry; |
if (isalpha(hostname[0])) | if (isalpha(hostname[0])) |
entry = gethostbyname((char *)hostname); |
|
else |
|
{ | { |
// KS 20020926 Temp change to bypass the gethostbyaddress |
#ifdef PEGASUS_PLATFORM_SOLARIS_SPARC_CC |
// and simply use whatever address was supplied. |
#define HOSTENT_BUFF_SIZE 8192 |
// This needs to be verified. Drops following two |
char buf[HOSTENT_BUFF_SIZE]; |
// lines and replace with memset through return lines. |
int h_errorp; |
#ifdef PEGASUS_SNIA_INTEROP_TEST |
struct hostent hp; |
memset(&address, 0, sizeof(address)); |
|
address.sin_family = AF_INET; |
entry = gethostbyname_r((char *)hostname, &hp, buf, |
address.sin_addr.s_addr = inet_addr((char *)hostname); |
HOSTENT_BUFF_SIZE, &h_errorp); |
address.sin_port = htons(port); |
|
return true; |
|
#else | #else |
unsigned long tmp = inet_addr((char *)hostname); |
entry = gethostbyname((char *)hostname); |
entry = gethostbyaddr((char *)&tmp, sizeof(tmp), AF_INET); |
|
#endif | #endif |
|
|
} |
|
|
|
if (!entry) | if (!entry) |
|
{ |
return false; | return false; |
|
} |
| |
memset(&address, 0, sizeof(address)); | memset(&address, 0, sizeof(address)); |
memcpy(&address.sin_addr, entry->h_addr, entry->h_length); | memcpy(&address.sin_addr, entry->h_addr, entry->h_length); |
address.sin_family = entry->h_addrtype; | address.sin_family = entry->h_addrtype; |
address.sin_port = htons(port); | address.sin_port = htons(port); |
|
} |
|
else |
|
{ |
|
unsigned long tmp_addr = inet_addr((char *)hostname); |
|
if(tmp_addr == 0xFFFFFFFF) |
|
{ |
|
return false; |
|
} |
|
memset(&address, 0, sizeof(address)); |
|
address.sin_family = AF_INET; |
|
address.sin_addr.s_addr = tmp_addr; |
|
address.sin_port = htons(port); |
|
} |
| |
return true; | return true; |
} | } |