Bug 733443

Summary: large targetattr list with syntax errors cause server to crash or hang
Product: Red Hat Enterprise Linux 6 Reporter: Rich Megginson <rmeggins>
Component: 389-ds-baseAssignee: Rich Megginson <rmeggins>
Status: CLOSED ERRATA QA Contact: Chandrasekar Kannan <ckannan>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.2CC: amessina, amsharma, benl, dpal, jgalipea
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 389-ds-base-1.2.9.8-1.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 733103 Environment:
Last Closed: 2011-12-06 17:56:15 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 733103    
Bug Blocks: 690318, 708096    

Description Rich Megginson 2011-08-25 17:47:08 UTC
+++ This bug was initially created as a clone of Bug #733103 +++

For example, an aci like this:
aci: (targetattr = "physicalDeliveryOfficeName || homePhone || preferredDeliveryMethod || jpegPhoto || nsAIMid || mozillaHomeCountryName || audio || internationaliSDNNumber || postalAddress || roomNumber || mozillaWorkStreet2 || givenName || mozillaSecondEmail || userPKCS12 || userPassword || teletexTerminalIdentifier || mobile || manager || objectClass || userSMIMECertificate || mozillaHomeStreet || destinationIndicator || telexNumber || employeeNumber || secretary || uid || userCertificate || st || mozillaCustom4 || mozillaCustom3 || mozillaCustom2 || mozillaCustom1 || description || mozillaHomePostalCode || mail || labeledUri || businessCategory || x500UniqueIdentifier || ou || seeAlso || photo || mozillaNickname || mozillaHomeLocalityName || shadowLastChange || title || street || departmentNumber || mozillaHomeStreet2 || mozillaUseHtmlMail || mozillaHomeState || o || cn || l || initials || telephoneNumber || mozillaHomeUrl || x121Address") (version 3.0; acl "Authenticated user self access"; allow (read,compare,search,write)(userdn = "ldap:///self");)

where one or more of the attributes in the targetattr list are not defined, and the list contains more than 5 elements.

Adding this aci will cause the server to either crash or hang.

--- Additional comment from rmeggins on 2011-08-24 15:17:15 EDT ---

Created attachment 519695 [details]
0001-Bug-733103-large-targetattr-list-with-syntax-errors-.patch

--- Additional comment from rmeggins on 2011-08-24 16:08:23 EDT ---

To ssh://git.fedorahosted.org/git/389/ds.git
   7e43a28..91c6799  master -> master
commit 91c6799b07ca48bce85482136ceb244b484fc91b
Author: Rich Megginson <rmeggins>
Date:   Wed Aug 24 13:13:35 2011 -0600
    Reviewed by: nhosoi (Thanks!)
    Branch: master
    Fix Description: If we need to realloc the list to hold more target attributes,
    the list is not NULL terminated.  If there are syntax errors in the aci, the
    function returns with an unterminated list, and this will either cause the
    loop in the free code to go off the end of the list or crash with a segfault.
    The fix is to make sure the list is always NULL terminated.
    Platforms tested: RHEL6 x86_64
    Flag Day: no
    Doc impact: no

Comment 2 Amita Sharma 2011-09-27 07:05:11 UTC
[root@snmaptest fourwaymmr]# ldapmodify -h localhost -p 389 -D "cn=Directory
Manager" -w Secret123 << EOF
> dn: dc=example,dc=com
> changetype: modify
> replace: aci
> aci: (targetattr = "physicalDeliveryOfficeName || homePhone || preferredDeliveryMethod || jpegPhoto || nsAIMid || mozillaHomeCountryName || audio ||internationaliSDNNumber || postalAddress || roomNumber || mozillaWorkStreet2 || givenName || mozillaSecondEmail || userPKCS12 || userPassword || teletexTerminalIdentifier || mobile || manager || objectClass || userSMIMECertificate || mozillaHomeStreet || destinationIndicator || telexNumber || employeeNumber || secretary || uid || userCertificate || st || mozillaCustom4 || mozillaCustom3 || mozillaCustom2 || mozillaCustom1 || description || mozillaHomePostalCode || mail || labeledUri || businessCategory || x500UniqueIdentifier || ou || seeAlso || photo || mozillaNickname || mozillaHomeLocalityName || shadowLastChange || title || street || departmentNumber || mozillaHomeStreet2 || mozillaUseHtmlMail || mozillaHomeState || o || cn || l || initials || telephoneNumber || mozillaHomeUrl || x121Address") (version 3.0; acl "Authenticated user self access"; allow (read,compare,search,write)(userdn="ldap:///cn=Userami,dc=example,dc=com");)
> EOF
modifying entry "dc=example,dc=com"

No Crash found, hence VERIFIED.

Comment 3 errata-xmlrpc 2011-12-06 17:56:15 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/RHEA-2011-1711.html