From: Kurt Zeilenga Date: Thu, 21 Feb 2002 15:39:35 +0000 (+0000) Subject: If port is zero, use default. X-Git-Tag: OPENLDAP_REL_ENG_2_MP~399 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3d9cf98daded3bdbed51833eb6a56227764fd08a;p=openldap If port is zero, use default. --- diff --git a/libraries/libldap/open.c b/libraries/libldap/open.c index 486f62b8c4..244dde7317 100644 --- a/libraries/libldap/open.c +++ b/libraries/libldap/open.c @@ -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 ); diff --git a/libraries/libldap/os-ip.c b/libraries/libldap/os-ip.c index 3968734597..de03b7f68b 100644 --- a/libraries/libldap/os-ip.c +++ b/libraries/libldap/os-ip.c @@ -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; }