]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/os-ip.c
Commit preliminary fix for ldap.conf base usage.
[openldap] / libraries / libldap / os-ip.c
index 4642144b20d46cab062319fa5b65d6ac35d99026..1b22917a46e95c5f996beb6a58801bbf0b4a3dc2 100644 (file)
@@ -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;
@@ -174,7 +179,7 @@ ldap_host_connected_to( Sockbuf *sb )
        if (( hp = gethostbyaddr( (char *) &sin.sin_addr,
            sizeof( sin.sin_addr ), AF_INET )) != NULL ) {
                if ( hp->h_name != NULL ) {
-                       return( strdup( hp->h_name ));
+                       return( ldap_strdup( hp->h_name ));
                }
        }
 
@@ -254,7 +259,7 @@ ldap_is_read_ready( LDAP *ld, Sockbuf *sb )
 
 
 void *
-ldap_new_select_info()
+ldap_new_select_info( void )
 {
        struct selectinfo       *sip;
 
@@ -288,6 +293,8 @@ do_ldap_select( LDAP *ld, struct timeval *timeout )
                tblsize = sysconf( _SC_OPEN_MAX );
 #elif defined( HAVE_GETDTABLESIZE )
                tblsize = getdtablesize();
+#else
+               tblsize = FD_SETSIZE;
 #endif /* !USE_SYSCONF */
 
 #ifdef FD_SETSIZE