mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-23 16:19:35 -05:00
Check if inet_addr() returns 0xffffffff as well as -1.
It returns (int)0xffffffff on OSF1 which has 64-bit long, so `unsigned long address; ... if((address = inet_addr(str)) == -1)' fails.
This commit is contained in:
parent
523fd2c891
commit
ce5dcbc522
2 changed files with 10 additions and 2 deletions
|
|
@ -105,7 +105,10 @@ cldap_open( char *host, int port )
|
|||
}
|
||||
}
|
||||
|
||||
if ( (address = inet_addr( host )) == (unsigned long) -1L ) {
|
||||
address = inet_addr( host );
|
||||
/* This was just a test for -1 until OSF1 let inet_addr return
|
||||
unsigned int, which is narrower than 'unsigned long address' */
|
||||
if ( address == 0xffffffff || address == (unsigned long) -1 ) {
|
||||
if ( (hp = gethostbyname( host )) == NULL ) {
|
||||
errno = EHOSTUNREACH;
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -54,7 +54,11 @@ ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address,
|
|||
|
||||
connected = use_hp = 0;
|
||||
|
||||
if ( host != NULL && ( address = inet_addr( host )) == (unsigned long) -1L ) {
|
||||
if ( host != NULL ) {
|
||||
address = inet_addr( host );
|
||||
/* This was just a test for -1 until OSF1 let inet_addr return
|
||||
unsigned int, which is narrower than 'unsigned long address' */
|
||||
if ( address == 0xffffffff || address == (unsigned long) -1 ) {
|
||||
if ( (hp = gethostbyname( host )) == NULL ) {
|
||||
#ifdef HAVE_WINSOCK
|
||||
errno = WSAGetLastError();
|
||||
|
|
@ -64,6 +68,7 @@ ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address,
|
|||
return( -1 );
|
||||
}
|
||||
use_hp = 1;
|
||||
}
|
||||
}
|
||||
|
||||
rc = -1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue