https://bugs.openldap.org/show_bug.cgi?id=9328
Issue ID: 9328 Summary: CLDAP ldap_result hangs if nobody listens on the port Product: OpenLDAP Version: unspecified Hardware: All OS: All Status: UNCONFIRMED Severity: normal Priority: --- Component: libraries Assignee: bugs@openldap.org Reporter: pbrezina@redhat.com Target Milestone: ---
When using LDAP over UDP, calling ldap_result() hangs if there is nobody listening on the remote port.
The problem is that it calls recvfrom() twice, the first attempt returns ECONNREFUSED but this is ignored. The seconds read then blocks/timeouts/returns EAGAIN depending on the sockets settings, however we know that we will never receive any data so it should return an error. See [1]
poll([{fd=20, events=POLLIN|POLLPRI}], 1, 0) = 1 ([{fd=20, revents=POLLERR}]) recvfrom(20, 0x18dade0, 16256, 0, 0x18dad60, [128]) = -1 ECONNREFUSED (Connection refused) recvfrom(20, <unfinished ...>) = ?
[1] https://git.openldap.org/pbrezina/openldap/-/blob/master/libraries/libldap/r...