mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-28 10:39:34 -05:00
If port is zero, use default.
This commit is contained in:
parent
9e8f3053cb
commit
3d9cf98dad
2 changed files with 22 additions and 5 deletions
|
|
@ -239,6 +239,14 @@ ldap_int_open_connection(
|
|||
host = srv->lud_host;
|
||||
}
|
||||
|
||||
if( !port ) {
|
||||
if( strcmp(srv->lud_scheme, "ldaps") == 0 ) {
|
||||
port = LDAPS_PORT;
|
||||
} else {
|
||||
port = LDAP_PORT;
|
||||
}
|
||||
}
|
||||
|
||||
rc = ldap_connect_to_host( ld, conn->lconn_sb,
|
||||
proto, host, addr, port, async );
|
||||
|
||||
|
|
@ -256,6 +264,7 @@ ldap_int_open_connection(
|
|||
#endif
|
||||
break;
|
||||
#ifdef LDAP_CONNECTIONLESS
|
||||
|
||||
case LDAP_PROTO_UDP:
|
||||
port = srv->lud_port;
|
||||
|
||||
|
|
@ -266,6 +275,9 @@ ldap_int_open_connection(
|
|||
} else {
|
||||
host = srv->lud_host;
|
||||
}
|
||||
|
||||
if( !port ) port = LDAP_PORT;
|
||||
|
||||
LDAP_IS_UDP(ld) = 1;
|
||||
rc = ldap_connect_to_host( ld, conn->lconn_sb,
|
||||
proto, host, addr, port, async );
|
||||
|
|
|
|||
|
|
@ -318,13 +318,18 @@ ldap_connect_to_host(LDAP *ld, Sockbuf *sb,
|
|||
char *ha_buf=NULL, *p, *q;
|
||||
int socktype;
|
||||
|
||||
osip_debug(ld, "ldap_connect_to_host: %s\n",host,0,0);
|
||||
|
||||
switch(proto) {
|
||||
case LDAP_PROTO_TCP: socktype = SOCK_STREAM; break;
|
||||
case LDAP_PROTO_UDP: socktype = SOCK_DGRAM; break;
|
||||
default: osip_debug(ld, "ldap_connect_to_host: unknown proto: %d\n",
|
||||
proto, 0, 0);
|
||||
case LDAP_PROTO_TCP: socktype = SOCK_STREAM;
|
||||
osip_debug(ld, "ldap_connect_to_host: TCP %s:%d\n",host,port,0);
|
||||
break;
|
||||
case LDAP_PROTO_UDP: socktype = SOCK_DGRAM;
|
||||
osip_debug(ld, "ldap_connect_to_host: TCP %s:%d\n",host,port,0);
|
||||
break;
|
||||
|
||||
default:
|
||||
osip_debug(ld, "ldap_connect_to_host: unknown proto: %d\n",
|
||||
proto, 0, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue