Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 2032742

Summary: IPA LDAP bind_and_check_pwp memory leak
Product: Red Hat Enterprise Linux 8 Reporter: Marc Sauton <msauton>
Component: 389-ds-baseAssignee: Pierre Rogier <progier>
Status: CLOSED ERRATA QA Contact: RHDS QE <ds-qe-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 8.5CC: aadhikar, ldap-maint, mreynolds, progier, sgouvern, tbordaz, tmihinto
Target Milestone: rcKeywords: TestCaseProvided, Triaged
Target Release: 8.7Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard: sync-to-jira
Fixed In Version: 389-ds-base-1.4.3.30-3.module+el8.7.0+15600+347cafc6 Doc Type: Bug Fix
Doc Text:
Cause: Some SASL contexts were not freed properly in somr error cases. Consequence: A moderate memory leak occurs during SASL bind when SASL library reports an error. Fix: That leak is now fixed. Result:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-08 09:38:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Comment 1 Pierre Rogier 2022-01-07 15:24:32 UTC
The leak is due to a change in libldap API:
Digging in the old man page:
Note  LDAP_OPT_ERROR_STRING returns a pointer to an internal static string table, and ldap_memfree should not be called when using this session option.
And the new one:
LDAP_OPT_DIAGNOSTIC_MESSAGE
Sets/gets a string containing the error string associated to the LDAP handle. This option was formerly known as LDAP_OPT_ERROR_STRING. outvalue must be a char **, and the caller is responsible of freeing the returned string by calling ldap_memfree(3), while invalue must be a char *; the library duplicates the corresponding string.

So it looks like we will have to review the whole code for all slapi_ldap_get_lderrno calls:
  if the call has a message address it should be freed after use  by a call to a new slapi_ldap_free_lderrno_msg function
  that free the message if LDAP_OPT_DIAGNOSTIC_MESSAGE is defined.

Comment 6 thierry bordaz 2022-06-10 11:51:05 UTC
Fixed in 389-ds-base-1.4.3.30-3.module+el8.7.0+15600+347cafc6 => MODIFIED

Comment 10 Akshay Adhikari 2022-08-05 17:12:57 UTC
# PYTHONPATH=src/lib389/ py.test -v dirsrvtests/tests/suites/replication/sasl_m2_test.py
============================================================================ test session starts =================================================================
platform linux -- Python 3.6.8, pytest-7.0.1, pluggy-1.0.0 -- /usr/bin/python3.6
cachedir: .pytest_cache
389-ds-base: 1.4.3.30-4.1asan.el8
nss: 3.79.0-8.el8_6
nspr: 4.34.0-3.el8_6
openldap: 2.4.46-18.el8
cyrus-sasl: not installed
FIPS: disabled
rootdir: /root/389-ds-base/dirsrvtests, configfile: pytest.ini
collected 2 items                                                                                                                                                           

dirsrvtests/tests/suites/replication/sasl_m2_test.py::test_repl_sasl_md5_auth PASSED                                                                                  [ 50%]
dirsrvtests/tests/suites/replication/sasl_m2_test.py::test_repl_sasl_leak SKIPPED (Tescase using valgring cannot run on asan enabled build)                           [100%]

======================================================================= 1 passed, 1 skipped in 41.15s ============================================================

Marking it as VERIFIED.

Comment 12 errata-xmlrpc 2022-11-08 09:38:12 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 (389-ds:1.4 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-2022:7552