Fix bug # 122905 - ldap_url_search_s does not honor first argument ?

ldap_url_search() now uses the port from the LDAP * if no hostport
	is included in the URL. This is a change in behavior, but the old
	behavior was wrong.
This commit is contained in:
mcs%netscape.com 2002-04-18 01:48:24 +00:00
Родитель 1de980f593
Коммит b5ff0fbc7c
1 изменённых файлов: 11 добавлений и 7 удалений

Просмотреть файл

@ -418,14 +418,18 @@ ldap_url_search( LDAP *ld, const char *url, int attrsonly )
LDAP_SET_LDERRNO( ld, LDAP_NO_MEMORY, NULL, NULL );
err = -1;
} else {
if ( ludp->lud_port == 0 ) {
if (( ludp->lud_options & LDAP_URL_OPT_SECURE ) == 0 ) {
srv->lsrv_port = LDAP_PORT;
} else {
srv->lsrv_port = LDAPS_PORT;
}
} else {
if ( ludp->lud_port != 0 ) {
/* URL includes a port - use it */
srv->lsrv_port = ludp->lud_port;
} else if ( ludp->lud_host == NULL ) {
/* URL has no port or host - use port from ld */
srv->lsrv_port = ld->ld_defport;
} else if (( ludp->lud_options & LDAP_URL_OPT_SECURE ) == 0 ) {
/* ldap URL has a host but no port - use std. port */
srv->lsrv_port = LDAP_PORT;
} else {
/* ldaps URL has a host but no port - use std. port */
srv->lsrv_port = LDAPS_PORT;
}
}