mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-30 13:30:57 +08:00
Handle *lud_host == '\0'
(likely should modify parsers and other codes to disallow such)
This commit is contained in:
parent
aacd6e78f4
commit
6442964059
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user