Issue 7780 - constraint_attribute <attr> <size|count> 0 cause segfault
Summary: constraint_attribute <attr> <size|count> 0 cause segfault
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-10 04:40 UTC by SATOH Fumiyasu
Modified: 2015-07-02 17:44 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description SATOH Fumiyasu 2014-01-10 04:40:39 UTC
Full_Name: SATOH Fumiyasu
Version: master
OS: 
URL: ftp://ftp.openldap.org/incoming/0001-Fix-segfault-by-constraint_attribute-attr-size-count.patch
Submission from: (NULL) (240b:10:2640:bf0:2268:9dff:fec7:5444)


If slapd.conf has the following config, slapd segfault at startup.

  overlay constraint
  constraint_attribute memberUid size 0
  # or
  constraint_attribute memberUid count 0
Comment 1 Ondřej Kuzník 2014-09-15 22:11:52 UTC
On Fri, Jan 10, 2014 at 04:40:39AM +0000, fumiyas@osstech.co.jp wrote:
> If slapd.conf has the following config, slapd segfault at startup.
> 
>   overlay constraint
>   constraint_attribute memberUid size 0
>   # or
>   constraint_attribute memberUid count 0

Hi,
I've uploaded a fix to this issue and #7781 to
ftp://ftp.openldap.org/incoming/Ondrej-Kuznik-20140915-ITS-7780-7781.tgz
could you confirm it fixes the issues for you?

The above patch is derived from OpenLDAP Software. All of the
modifications to OpenLDAP Software represented in the above patches
were developed by Ondřej Kuzník <ondra@mistotebe.net>. I have not
assigned rights and/or interest in this work to any party. 

I, Ondřej Kuzník, hereby place the above modifications to OpenLDAP
Software (and only these modifications) into the public domain. Hence,
these modifications may be freely used and/or redistributed for any
purpose with or without attribution and/or other notice. 

Cheers,
Ondrej

Comment 2 Howard Chu 2014-12-16 19:53:18 UTC
changed notes
changed state Open to Test
moved from Incoming to Contrib
Comment 3 Howard Chu 2014-12-16 19:59:21 UTC
changed notes
changed state Test to Open
moved from Contrib to Incoming
Comment 4 Howard Chu 2014-12-17 15:33:21 UTC
Hello Ondrej,
   I tried your patch but it breaks test064-constraint.

-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/

Comment 5 Howard Chu 2014-12-18 19:40:10 UTC
changed notes
changed state Open to Test
moved from Incoming to Software Bugs
Comment 6 Ondřej Kuzník 2014-12-18 21:42:09 UTC
On Wed, Dec 17, 2014 at 03:33:32PM +0000, hyc@symas.com wrote:
> Hello Ondrej,
>    I tried your patch but it breaks test064-constraint.

Hi Howard,
there is useless code that caused it to read an unitialized variable. A
fix removing that code is at
ftp://ftp.openldap.org/incoming/Ondrej-Kuznik-20141218-ITS-7781.patch

Thanks for identifying and fixing the problem in the meantime.

Comment 7 Ondřej Kuzník 2014-12-18 21:51:51 UTC
On Thu, Dec 18, 2014 at 09:42:18PM +0000, ondra@mistotebe.net wrote:
> Hi Howard,
> there is useless code that caused it to read an unitialized variable. A
> fix removing that code is at
> ftp://ftp.openldap.org/incoming/Ondrej-Kuznik-20141218-ITS-7781.patch

Nevermind that, that code is needed and I should be running static analysers
more often when it's late.

Comment 8 Howard Chu 2014-12-19 01:13:08 UTC
ondra@mistotebe.net wrote:
> On Wed, Dec 17, 2014 at 03:33:32PM +0000, hyc@symas.com wrote:
>> Hello Ondrej,
>>     I tried your patch but it breaks test064-constraint.
>
> Hi Howard,
> there is useless code that caused it to read an unitialized variable. A
> fix removing that code is at
> ftp://ftp.openldap.org/incoming/Ondrej-Kuznik-20141218-ITS-7781.patch
>
> Thanks for identifying and fixing the problem in the meantime.
>
Ok. But looking at this patch, the lines in question actually are 
needed, since they take care of errors in the cases for CONSTRAINT_COUNT 
and CONSTRAINT_SET.

-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/

Comment 9 Michael Ströder 2014-12-19 02:41:38 UTC
hyc@symas.com wrote:
> ondra@mistotebe.net wrote:
>> On Wed, Dec 17, 2014 at 03:33:32PM +0000, hyc@symas.com wrote:
>>> Hello Ondrej,
>>>     I tried your patch but it breaks test064-constraint.
>>
>> Hi Howard,
>> there is useless code that caused it to read an unitialized variable. A
>> fix removing that code is at
>> ftp://ftp.openldap.org/incoming/Ondrej-Kuznik-20141218-ITS-7781.patch
>>
>> Thanks for identifying and fixing the problem in the meantime.
>>
> Ok. But looking at this patch, the lines in question actually are 
> needed, since they take care of errors in the cases for CONSTRAINT_COUNT 
> and CONSTRAINT_SET.

Just because I'm curious:

What's the use-case for setting size and count to zero?

If one wants to forbid an attribute completely one should probably use NOT in
a DIT content rule for the STRUCTURAL object class.
(This does not mean that this shouldn't be fixed though.)

Just my 2 cents.

Ciao, Michael.


Comment 10 Ondřej Kuzník 2014-12-20 08:14:52 UTC
On Fri, Dec 19, 2014 at 02:41:55AM +0000, michael@stroeder.com wrote:
> Just because I'm curious:
> 
> What's the use-case for setting size and count to zero?
> 
> If one wants to forbid an attribute completely one should probably use
> NOT in a DIT content rule for the STRUCTURAL object class.
> (This does not mean that this shouldn't be fixed though.)

I personally thought that OpenLDAP did not implement DIT content rules
at all.

Comment 11 Michael Ströder 2014-12-20 11:55:17 UTC
ondra@mistotebe.net wrote:
> On Fri, Dec 19, 2014 at 02:41:55AM +0000, michael@stroeder.com wrote:
>> Just because I'm curious:
>>
>> What's the use-case for setting size and count to zero?
>>
>> If one wants to forbid an attribute completely one should probably use
>> NOT in a DIT content rule for the STRUCTURAL object class.
>> (This does not mean that this shouldn't be fixed though.)
> 
> I personally thought that OpenLDAP did not implement DIT content rules
> at all.

DIT *content* rules are implemented and I'm using NOT quite often to reject
attributes I don't need in a deployment. Kind of a local profile for standard
schema.

DIT *structure* rules and name forms are not supported yet.

Ciao, Michael.

Comment 12 Quanah Gibson-Mount 2014-12-21 01:34:32 UTC
changed notes
changed state Test to Release
Comment 13 OpenLDAP project 2015-07-02 17:44:45 UTC
fixed in master
fixed in RE25
fixed in RE24
Comment 14 Quanah Gibson-Mount 2015-07-02 17:44:45 UTC
changed notes
changed state Release to Closed