char *sasl_host = NULL;
int sasl_ssf = 0;
#endif
+ char *host;
int port;
long addr;
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;
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;
}
}
- return( NULL );
+ return NULL;
}