Issue 7168 - [PATCH] Fix count constraint when using multiple modifications
Summary: [PATCH] Fix count constraint when using multiple modifications
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: 2.4.29
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-16 14:09 UTC by jsynacek@redhat.com
Modified: 2014-08-01 21:04 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 jsynacek@redhat.com 2012-02-16 14:09:53 UTC
Full_Name: Jan Synacek
Version: 2.4.29
OS: Fedora 16
URL: http://jsynacek.fedorapeople.org/openldap/jsynacek-20120216-constraint-count.patch
Submission from: (NULL) (209.132.186.34)


Constraint overlay doesn't take into account multiple modifications when using
count.

Example: If count for 'description' attribute is set e.g. to 2, the following
results in a constraint violation:

dn: cn=usr2, dc=my-domain,dc=com
add: description
description: d1
description: d2
description: d3-viol

However, this passes:

dn: cn=usr2, dc=my-domain,dc=com
add: description
description: d1
-
add: description
description: d2
-
add: description
description: d3

This patch fixes the behavior in case multiple modifications are used.

Original bug report: https://bugzilla.redhat.com/show_bug.cgi?id=742163

The patch is uploaded on fedorapeople.org:
http://jsynacek.fedorapeople.org/openldap/jsynacek-20120216-constraint-count.patch

I wasn't able to use ftp.openldap.org due to 'No space left' error.

The attached file is derived from OpenLDAP Software. All of the modifications
to
OpenLDAP Software represented in the following patch(es) were developed by Red
Hat. Red Hat has not assigned rights and/or interest in this work to any party.
I, Jan Synacek am authorized by Red Hat, my employer, to release this work
under
the following terms.

Red Hat hereby place the following 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.
Comment 1 Howard Chu 2012-06-07 13:00:24 UTC
jsynacek@redhat.com wrote:
> Full_Name: Jan Synacek
> Version: 2.4.29
> OS: Fedora 16
> URL: http://jsynacek.fedorapeople.org/openldap/jsynacek-20120216-constraint-count.patch
> Submission from: (NULL) (209.132.186.34)
>
>
> Constraint overlay doesn't take into account multiple modifications when using
> count.
>
> Example: If count for 'description' attribute is set e.g. to 2, the following
> results in a constraint violation:
>
> dn: cn=usr2, dc=my-domain,dc=com
> add: description
> description: d1
> description: d2
> description: d3-viol
>
> However, this passes:
>
> dn: cn=usr2, dc=my-domain,dc=com
> add: description
> description: d1
> -
> add: description
> description: d2
> -
> add: description
> description: d3
>
> This patch fixes the behavior in case multiple modifications are used.
>
> Original bug report: https://bugzilla.redhat.com/show_bug.cgi?id=742163
>
> The patch is uploaded on fedorapeople.org:
> http://jsynacek.fedorapeople.org/openldap/jsynacek-20120216-constraint-count.patch
>
> I wasn't able to use ftp.openldap.org due to 'No space left' error.

This code (and the original) don't seem to properly take deletes into account. 
It resets the ce counter to 0 on any delete op, but it should be decrementing 
based on the number of values provided. (And of course, it can only do that if 
the specified value is actually present in the attribute.)

> The attached file is derived from OpenLDAP Software. All of the modifications
> to
> OpenLDAP Software represented in the following patch(es) were developed by Red
> Hat. Red Hat has not assigned rights and/or interest in this work to any party.
> I, Jan Synacek am authorized by Red Hat, my employer, to release this work
> under
> the following terms.
>
> Red Hat hereby place the following 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.
>
>


-- 
   -- 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 2 jsynacek@redhat.com 2012-06-18 12:29:13 UTC
On 06/07/2012 03:00 PM, Howard Chu wrote:
> jsynacek@redhat.com wrote:
>> Full_Name: Jan Synacek
>> Version: 2.4.29
>> OS: Fedora 16
>> URL: http://jsynacek.fedorapeople.org/openldap/jsynacek-20120216-constraint-count.patch
>> Submission from: (NULL) (209.132.186.34)
>>
>>
>> Constraint overlay doesn't take into account multiple modifications when using
>> count.
>>
>> Example: If count for 'description' attribute is set e.g. to 2, the following
>> results in a constraint violation:
>>
>> dn: cn=usr2, dc=my-domain,dc=com
>> add: description
>> description: d1
>> description: d2
>> description: d3-viol
>>
>> However, this passes:
>>
>> dn: cn=usr2, dc=my-domain,dc=com
>> add: description
>> description: d1
>> -
>> add: description
>> description: d2
>> -
>> add: description
>> description: d3
>>
>> This patch fixes the behavior in case multiple modifications are used.
>>
>> Original bug report: https://bugzilla.redhat.com/show_bug.cgi?id=742163
>>
>> The patch is uploaded on fedorapeople.org:
>> http://jsynacek.fedorapeople.org/openldap/jsynacek-20120216-constraint-count.patch
>>
>> I wasn't able to use ftp.openldap.org due to 'No space left' error.
>
> This code (and the original) don't seem to properly take deletes into account. It resets the ce counter to 0 on any delete op, but it should be decrementing based on the number of values provided. (And of course, it can only do that if the specified value is actually present in the attribute.)

I'll fix the patch. I tested only deletes with no additional values.

-- 
Jan Synacek
Software Engineer, BaseOS team Brno, Red Hat


Comment 3 jsynacek@redhat.com 2012-06-19 05:19:15 UTC
On 06/07/2012 03:00 PM, Howard Chu wrote:
> jsynacek@redhat.com wrote:
>> Full_Name: Jan Synacek
>> Version: 2.4.29
>> OS: Fedora 16
>> URL: http://jsynacek.fedorapeople.org/openldap/jsynacek-20120216-constraint-count.patch
>> Submission from: (NULL) (209.132.186.34)
>>
>>
>> Constraint overlay doesn't take into account multiple modifications when using
>> count.
>>
>> Example: If count for 'description' attribute is set e.g. to 2, the following
>> results in a constraint violation:
>>
>> dn: cn=usr2, dc=my-domain,dc=com
>> add: description
>> description: d1
>> description: d2
>> description: d3-viol
>>
>> However, this passes:
>>
>> dn: cn=usr2, dc=my-domain,dc=com
>> add: description
>> description: d1
>> -
>> add: description
>> description: d2
>> -
>> add: description
>> description: d3
>>
>> This patch fixes the behavior in case multiple modifications are used.
>>
>> Original bug report: https://bugzilla.redhat.com/show_bug.cgi?id=742163
>>
>> The patch is uploaded on fedorapeople.org:
>> http://jsynacek.fedorapeople.org/openldap/jsynacek-20120216-constraint-count.patch
>>
>> I wasn't able to use ftp.openldap.org due to 'No space left' error.
>
> This code (and the original) don't seem to properly take deletes into account. It resets the ce counter to 0 on any delete op, but it should be decrementing based on the number of values provided. (And of course, it can only do that if the specified value is actually present in the attribute.)
>

I've updated the patch:
http://jsynacek.fedorapeople.org/openldap/jsynacek-20120619-constraint-count.patch

Also, I've uploaded the tests I use:
http://jsynacek.fedorapeople.org/openldap/constraint-count-tests.tar.bz2


-- 
Jan Synacek
Software Engineer, BaseOS team Brno, Red Hat


Comment 4 Howard Chu 2012-06-25 19:50:39 UTC
Jan Synacek wrote:
> On 06/07/2012 03:00 PM, Howard Chu wrote:
>> This code (and the original) don't seem to properly take deletes into account. It resets the ce counter to 0 on any delete op, but it should be decrementing based on the number of values provided. (And of course, it can only do that if the specified value is actually present in the attribute.)

> I've updated the patch:
> http://jsynacek.fedorapeople.org/openldap/jsynacek-20120619-constraint-count.patch

Thanks, committed to master with additional tweaks.
>
> Also, I've uploaded the tests I use:
> http://jsynacek.fedorapeople.org/openldap/constraint-count-tests.tar.bz2

Looks like a nice start but you should look at the existing test script 
infrastructure, particularly the shell variables we already define, and make 
it conform.

-- 
   -- 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 2012-06-25 19:51:28 UTC
changed notes
changed state Open to Test
moved from Incoming to Software Bugs
Comment 6 Quanah Gibson-Mount 2012-07-26 21:34:17 UTC
changed notes
changed state Test to Partial
Comment 7 Quanah Gibson-Mount 2012-07-27 22:09:42 UTC
changed notes
changed state Partial to Open
Comment 8 Quanah Gibson-Mount 2012-07-27 22:11:48 UTC
--On Tuesday, June 19, 2012 5:19 AM +0000 jsynacek@redhat.com wrote:

> On 06/07/2012 03:00 PM, Howard Chu wrote:
>> jsynacek@redhat.com wrote:
>>> Full_Name: Jan Synacek
>>> Version: 2.4.29
>>> OS: Fedora 16
>>> URL:
>>> http://jsynacek.fedorapeople.org/openldap/jsynacek-20120216-constraint-
>>> count.patch Submission from: (NULL) (209.132.186.34)
>>>

This patch is broken.  See ITS#7340 and discussion on -technical.

--Quanah

--

Quanah Gibson-Mount
Sr. Member of Technical Staff
Zimbra, Inc
A Division of VMware, Inc.
--------------------
Zimbra ::  the leader in open source messaging and collaboration

Comment 9 Howard Chu 2012-08-02 14:03:40 UTC
changed notes
Comment 10 Quanah Gibson-Mount 2012-08-20 15:40:41 UTC
changed notes
changed state Open to Release
Comment 11 Quanah Gibson-Mount 2012-10-12 18:50:23 UTC
changed notes
changed state Release to Closed
Comment 12 OpenLDAP project 2014-08-01 21:04:43 UTC
Fixed in head
Fixed in RE24