https://bugs.openldap.org/show_bug.cgi?id=9305
--- Comment #1 from Howard Chu hyc@openldap.org --- (In reply to minfrin@sharp.fm from comment #0)
The ldap_connect_to_host() function needs to return proper error codes.
There are no suitable error codes defined in the LDAP API to give more specific feedback. Just returning the getaddrinfo error code directly would be non-portable and ambiguous. (What happens if libldap was built using gethostbyaddr instead? That has a completely different set of error codes. How is the caller supposed to know what they mean?)