From: Kurt Zeilenga Date: Mon, 8 Oct 2001 17:58:47 +0000 (+0000) Subject: Fix -lldap high port bug X-Git-Tag: OPENLDAP_REL_ENG_2_0_16~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f7c06f8413686357e803cff496c1d780d3de445;p=thirdparty%2Fopenldap.git Fix -lldap high port bug --- diff --git a/CHANGES b/CHANGES index 20c0fe1a02..8563dee646 100644 --- a/CHANGES +++ b/CHANGES @@ -1,22 +1,25 @@ OpenLDAP 2.0 Change Log OpenLDAP 2.0.16 Engineering - Fixed CR/LF handling (ITS#1328) Fixed slapd/slurpd maxargs bug (ITS#1343) Fixed slapd ManageDSAIT warning Fixed slurpd server down reject fix (ITS#1183) Fixed -llber ber_realloc bug (ITS#1346) Fixed -lldap multi-level referral chase bug (ITS#1346) + Fixed -lldap high port bug + Fixed CR/LF handling (ITS#1328) Updated slapd/-lldap getaddrinfo handling Updated -lldap_r pthread stack size Updated slapd acl assert checks Removed -lldbm use of Berkeley CDB + Updated -lldbm to use r/w lock with DB_THREAD Added back-ldbm idl_check() code Build environment Updated ltconfig for MacOS X 10.1 (ITS#1361) Updated slapd.conf with ACL example Updated pthread detection - Adjust test 7 read/write ratio + Updated test005 /dev/null diff for Tru64 compat + Updated test007 read/write ratio OpenLDAP 2.0.15 Release Fixed -lldap TLS external handling diff --git a/libraries/libldap/open.c b/libraries/libldap/open.c index 987427684a..950ccc8142 100644 --- a/libraries/libldap/open.c +++ b/libraries/libldap/open.c @@ -262,7 +262,7 @@ ldap_int_open_connection( switch ( ldap_pvt_url_scheme2proto( srv->lud_scheme ) ) { case LDAP_PROTO_TCP: - port = htons( (short) srv->lud_port ); + port = srv->lud_port; addr = 0; if ( srv->lud_host == NULL || *srv->lud_host == 0 ) { diff --git a/libraries/libldap/os-ip.c b/libraries/libldap/os-ip.c index 372d22ddfd..31367114da 100644 --- a/libraries/libldap/os-ip.c +++ b/libraries/libldap/os-ip.c @@ -286,7 +286,7 @@ int ldap_connect_to_host(LDAP *ld, Sockbuf *sb, int proto, const char *host, - unsigned long address, int port, int async) + unsigned long address, int port, int async ) { struct sockaddr_in sin; ber_socket_t s = AC_SOCKET_INVALID; @@ -306,7 +306,7 @@ ldap_connect_to_host(LDAP *ld, Sockbuf *sb, hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; - snprintf(serv, sizeof serv, "%d", ntohs(port)); + snprintf(serv, sizeof serv, "%d", port ); if ( err = getaddrinfo(host, serv, &hints, &res) ) { osip_debug(ld, "ldap_connect_to_host: getaddrinfo failed: %s\n", AC_GAI_STRERROR(err), 0, 0); @@ -389,7 +389,6 @@ ldap_connect_to_host(LDAP *ld, Sockbuf *sb, rc = s = -1; for ( i = 0; !use_hp || (hp->h_addr_list[i] != 0); ++i, rc = -1 ) { - s = ldap_int_socket( ld, PF_INET, SOCK_STREAM ); if ( s == AC_SOCKET_INVALID ) { /* use_hp ? continue : break; */ @@ -403,13 +402,13 @@ ldap_connect_to_host(LDAP *ld, Sockbuf *sb, (void)memset((char *)&sin, '\0', sizeof(struct sockaddr_in)); sin.sin_family = AF_INET; - sin.sin_port = port; + sin.sin_port = htons((short) port); p = (char *)&sin.sin_addr; q = use_hp ? (char *)hp->h_addr_list[i] : (char *)&address; AC_MEMCPY(p, q, sizeof(sin.sin_addr) ); osip_debug(ld, "ldap_connect_to_host: Trying %s:%d\n", - inet_ntoa(sin.sin_addr),ntohs(sin.sin_port),0); + inet_ntoa(sin.sin_addr),port,0); rc = ldap_pvt_connect(ld, s, (struct sockaddr *)&sin, sizeof(struct sockaddr_in),