Bug 750622 - Fix Coverity (11104) Resource leak: ids_sasl_user_to_entry (slapd/saslbind.c)
Summary: Fix Coverity (11104) Resource leak: ids_sasl_user_to_entry (slapd/saslbind.c)
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: 389
Classification: Retired
Component: Security - SASL
Version: 1.2.10
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
Assignee: Noriko Hosoi
QA Contact: Chandrasekar Kannan
URL: https://vm-025.idm.lab.bos.redhat.com...
Whiteboard:
Depends On:
Blocks: 389_1.2.10 752607 757898
TreeView+ depends on / blocked
 
Reported: 2011-11-01 19:25 UTC by Noriko Hosoi
Modified: 2015-01-04 23:51 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Previously, allocated memory was not correctly released in the underlying code for the SASL GSSAPI authentication method, when checking the Simple Authentication and Security Layer (SASL) identity mappings. This problem could cause memory leaks when processing SASL bind requests, which eventually caused the LDAP server to terminate unexpectedly with a segmentation fault. This update adds function calls that are needed to free allocated memory correctly. Memory leaks no longer occur and the LDAP server no longer crashes in this scenario.
Clone Of:
: 757898 (view as bug list)
Environment:
Last Closed: 2012-01-10 20:55:55 UTC


Attachments (Terms of Use)
git patch file (master) (1.91 KB, patch)
2011-11-02 17:03 UTC, Noriko Hosoi
nhosoi: review?
rmeggins: review+
Details | Diff


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1835 normal SHIPPED_LIVE redhat-ds-base bug fix update 2011-12-20 00:52:11 UTC

Description Noriko Hosoi 2011-11-01 19:25:19 UTC
Description of problem:
> sasl_map_domap allocates strings for "base" and "filter" in it; the
> caller ids_sasl_user_to_entry releases them only when the function 
> returns non-NULL regexmatch (matched), but even if the return value 
> is NULL (did not match), the strings are allocated.
> 
> Fix: underlying function sasl_map_check should free "base" and "filter"
> if mapping did not match.

Comment 1 Noriko Hosoi 2011-11-02 17:03:37 UTC
Created attachment 531391 [details]
git patch file (master)

Bug Description: sasl_map_domap allocates strings for "base" and
"filter" in it; the caller ids_sasl_user_to_entry releases them
only when the function returns non-0 regexmatch (matched), but
even if the return value is 0 (did not match), the strings are
allocated.
    
Fix Description: underlying function sasl_map_check frees "base"
and "filter" if mapping did not match.

Comment 2 Noriko Hosoi 2011-11-02 23:08:17 UTC
Reviewed by Rich (Thank you!!)

Pushed to master.

commit 6af5ece3ca029271f2b2180c24bad546e2d64c45
Author: Noriko Hosoi <nhosoi@jiji.usersys.redhat.com>
Date:   Tue Nov 1 16:03:57 2011 -0700

    Bug 750622 - Fix Coverity (11104) Resource leak:
                 ids_sasl_user_to_entry (slapd/saslbind.c)

$ git merge 6af5ece3ca029271f2b2180c24bad546e2d64c45
Updating c077173..6af5ece
Fast-forward
 ldap/servers/slapd/sasl_map.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

$ git push
Counting objects: 11, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 874 bytes, done.
Total 6 (delta 4), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
   c077173..6af5ece  master -> master

Note: I bumped up the priority/severity high.

Comment 6 Amita Sharma 2011-12-08 12:04:07 UTC
Based on comment#5, marking the bug as VERIFIED.

Comment 7 errata-xmlrpc 2011-12-19 19:52:47 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, and where to find the updated
files, follow the link below.

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

http://rhn.redhat.com/errata/RHBA-2011-1835.html

Comment 8 Rich Megginson 2012-01-10 20:54:20 UTC
Upstream ticket:
https://fedorahosted.org/389/ticket/255

Comment 9 Miroslav Svoboda 2012-01-17 11:31:20 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Previously, allocated memory was not correctly released in the underlying code for the SASL GSSAPI authentication method, when checking the Simple Authentication and Security Layer (SASL) identity mappings. This problem could cause memory leaks when processing SASL bind requests, which eventually caused the LDAP server to terminate unexpectedly with a segmentation fault. This update adds function calls that are needed to free allocated memory correctly. Memory leaks no longer occur and the LDAP server no longer crashes in this scenario.


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