]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#9596 Let libldap keep explicit port 0 as that
authorOndřej Kuzník <ondra@mistotebe.net>
Tue, 16 Jul 2019 17:04:01 +0000 (19:04 +0200)
committerQuanah Gibson-Mount <quanah@openldap.org>
Tue, 14 Dec 2021 16:30:54 +0000 (16:30 +0000)
libraries/libldap/url.c

index 72066a942fde1433e8655c13e796f442d30ca56b..d25e0a2854cfa42d8744a839f8ebdbd49fdb7a72 100644 (file)
@@ -940,6 +940,7 @@ ldap_url_parse_ext( LDAP_CONST char *url_in, LDAPURLDesc **ludpp, unsigned flags
                        q = strchr( url, ':' );
                }
 
+               i = !q; /* i is set iff we don't have a port specified */
                if ( q != NULL ) {
                        char    *next;
 
@@ -968,7 +969,7 @@ ldap_url_parse_ext( LDAP_CONST char *url_in, LDAPURLDesc **ludpp, unsigned flags
                        }
                }
 
-               if ( ( flags & LDAP_PVT_URL_PARSE_DEF_PORT ) && ludp->lud_port == 0 ) {
+               if ( ( flags & LDAP_PVT_URL_PARSE_DEF_PORT ) && i ) {
                        if ( strcmp( ludp->lud_scheme, "ldaps" ) == 0 ) {
                                ludp->lud_port = LDAPS_PORT;
                        } else {