Bug 701227

Summary: Segmentation fault (core dumped) in ldapmodify
Product: Red Hat Enterprise Linux 6 Reporter: Amita Sharma <amsharma>
Component: openldapAssignee: Jan Vcelak <jvcelak>
Status: CLOSED ERRATA QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1CC: jplans, jvcelak, omoris, ovasik, rmeggins, rvokal, tsmetana
Target Milestone: rc   
Target Release: 6.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openldap-2.4.23-16.el6 Doc Type: Bug Fix
Doc Text:
- pass LDIF input file to any openldap client tool (e.g. ldapadd) while some line is splitted (by '\n') but missing correct indentation (the next line has to be indented by one space character) - client tool crashes with segmentation fault - the unusual situation is now handled by the tools - requested operation succeeds/fails, but the tool does not crash
Story Points: ---
Clone Of:
: 716855 (view as bug list) Environment:
Last Closed: 2011-12-06 12:12:30 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:    
Bug Blocks: 716855    
Attachments:
Description Flags
proposed patch
rmeggins: review+
upstream patch none

Description Amita Sharma 2011-05-02 07:54:05 UTC
Steps to reproduce:


1) find or create an attribute which has an ORDERING matching rule
(and not via inheritance - that's another bug)

ldapmodify -x -h localhost -p 1389 -D "cn=directory manager" -w ggg -v <<
EOF
dn: cn=schema
changetype: modify
add: attributetypes
attributeTypes: (1.3.6.1.4.1.34217.1.1.1.2.6 NAME
'nzCoSkyReceiveMarketingNewsLetter' DESC 'Whether the user opts to receive SKY
TV news letters' EQUALITY booleanMatch ORDERING booleanMatch SYNTAX
1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE)

add attributeTypes:
(1.3.6.1.4.1.34217.1.1.1.2.6 NAME 'nzCoSkyReceiveMarketingNewsLetter' DESC
'Whether the user opts to receive SKY TV news letters' EQUALITY booleanMatch
ORDERING booleanMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE)
modifying entry "cn=schema"
modify complete

2) add or change the index for the attribute to have an nsMatchingRule
with one of the l10n matching rules defined by the collation plugin
e.g. 2.16.840.1.113730.3.3.2.11.1 for en or en-US
[root@rheltest slapd-rheltest]# ldapmodify -a -D "cn=directory manager" -w
ggg -p 1389 -h localhost << EOF
>  dn: cn=nzCoSkyReceiveMarketingNewsletter,cn=index,cn=userRoot,cn=ldbm
>  database,cn=plugins,cn=config
>  changetype: add
>  objectClass: top
>  objectClass: nsIndex
>  cn:nzCoSkyReceiveMarketingNewsletter
>  nsSystemIndex:false
>  nsIndexType:eq
>  nsMatchingRule: 2.16.840.1.113730.3.3.2.6.1
>  nsMatchingRule: 2.16.840.1.113730.3.3.2.11.1
>  EOF
ldapmodify: invalid format (line 2) entry:
"cn=nzCoSkyReceiveMarketingNewsletter,cn=index,cn=userRoot,cn=ldbm"
Segmentation fault (core dumped) 

Note: The dn: .. line must be all one line.  It looks like the line ends at cn=ldbm and a new line begins at database,. 
But still it should not be a Segmentation fault (core dumped).

Comment 1 Rich Megginson 2011-05-02 14:43:43 UTC
looks like the problem is if the dn: line continues but does not begin with a space char (as in proper LDIF continuation line wrapping) ldapmodify will crash.

Comment 5 Jan Vcelak 2011-06-22 09:56:55 UTC
Created attachment 505957 [details]
proposed patch

Attaching proposed patch.

I have also created an upstream report and submitted the patch:
http://www.openldap.org/its/index.cgi?findid=6978

Comment 6 Jan Vcelak 2011-06-24 07:05:50 UTC
Created attachment 509682 [details]
upstream patch

Upstream included a different fix,

Comment 7 Jan Vcelak 2011-07-18 15:55:10 UTC
Fix included in openldap-2.4.23-16.el6

Comment 9 Jan Vcelak 2011-08-15 09:10:38 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:
- pass LDIF input file to any openldap client tool (e.g. ldapadd) while some line is splitted (by '\n') but missing correct indentation (the next line has to be indented by one space character)
- client tool crashes with segmentation fault
- the unusual situation is now handled by the tools
- requested operation succeeds/fails, but the tool does not crash

Comment 11 errata-xmlrpc 2011-12-06 12:12:30 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-1514.html