RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1989919 - CLDAP ldap_result hangs if nobody listens on the port
Summary: CLDAP ldap_result hangs if nobody listens on the port
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: openldap
Version: 7.9
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: LDAP Maintainers
QA Contact: RHDS QE
URL:
Whiteboard:
Depends On:
Blocks: 1973796
TreeView+ depends on / blocked
 
Reported: 2021-08-04 10:45 UTC by Simon Pichugin
Modified: 2021-09-21 11:12 UTC (History)
8 users (show)

Fixed In Version: openldap-2.4.44-24.el7_9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-08-31 09:11:21 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker IDMDS-1524 0 None None None 2021-08-04 11:29:35 UTC
Red Hat Issue Tracker IDMDS-1525 0 None None None 2021-08-04 11:30:40 UTC
Red Hat Issue Tracker RHELPLAN-92266 0 None None None 2021-08-04 10:50:05 UTC
Red Hat Product Errata RHBA-2021:3334 0 None None None 2021-08-31 09:11:25 UTC

Description Simon Pichugin 2021-08-04 10:45:22 UTC
This bug was initially created as a copy of Bug #1875361

I am copying this bug because: 
bz1973796 depends on the fix so we need to backport the change to RHEL 7.9.z


SSSD wants to perform multiple CLDAP pings to Active Directory in parallel. However openldap has a bug that cause a blocking i/o call when connection to the UDP port can not be established.

Upstream BZ (merged):
https://bugs.openldap.org/show_bug.cgi?id=9328

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/result.c#L489

Reproducer:
$ gcc -ggdb3 -o client ./main.c -lldap
$ strace ./client
...
sendto(3, "0'\2\1\1\4\0c \4\0\n\1\0\n\1\0\2\1\0\2\1\0\1\1\0\207\vobje"..., 41, 0, {sa_family=AF_INET, sin_port=htons(3333), sin_addr=inet_addr("127.0.0.1")}, 16) = 41
poll([{fd=3, events=POLLIN|POLLPRI}], 1, 1000) = 1 ([{fd=3, revents=POLLERR}])
recvfrom(3, 0x493b10, 16256, 0, 0x493a90, [128]) = -1 ECONNREFUSED (Connection refused)
recvfrom(3, 

No LDAP server is running at localhost.

Comment 14 errata-xmlrpc 2021-08-31 09:11:21 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (openldap bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:3334


Note You need to log in before you can comment on or make changes to this bug.