Handle *lud_host == '\0'

(likely should modify parsers and other codes to disallow such)
This commit is contained in:
Kurt Zeilenga 2000-10-17 20:30:14 +00:00
parent aacd6e78f4
commit 6442964059
2 changed files with 12 additions and 6 deletions

View File

@ -252,6 +252,7 @@ ldap_int_open_connection(
char *sasl_host = NULL;
int sasl_ssf = 0;
#endif
char *host;
int port;
long addr;
@ -262,11 +263,15 @@ ldap_int_open_connection(
port = htons( (short) srv->lud_port );
addr = 0;
if ( srv->lud_host == NULL || *srv->lud_host == 0 )
if ( srv->lud_host == NULL || *srv->lud_host == 0 ) {
host = NULL;
addr = htonl( INADDR_LOOPBACK );
} else {
host = srv->lud_host;
}
rc = ldap_connect_to_host( ld, conn->lconn_sb, 0,
srv->lud_host, addr, port, async );
host, addr, port, async );
if ( rc == -1 ) return rc;

View File

@ -351,10 +351,11 @@ find_connection( LDAP *ld, LDAPURLDesc *srv, int any )
for ( lc = ld->ld_conns; lc != NULL; lc = lc->lconn_next ) {
for ( ls = srv; ls != NULL; ls = ls->lud_next ) {
if ( lc->lconn_server->lud_host != NULL &&
ls->lud_host != NULL && strcasecmp(
ls->lud_host, lc->lconn_server->lud_host ) == 0
*lc->lconn_server->lud_host != '\0' &&
ls->lud_host != NULL && *ls->lud_host != '\0' &&
strcasecmp( ls->lud_host, lc->lconn_server->lud_host ) == 0
&& ls->lud_port == lc->lconn_server->lud_port ) {
return( lc );
return lc;
}
if ( !any ) {
break;
@ -362,7 +363,7 @@ find_connection( LDAP *ld, LDAPURLDesc *srv, int any )
}
}
return( NULL );
return NULL;
}