Issue 1786 - Autogrow configuration file token array
Summary: Autogrow configuration file token array
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: 2002-05-01 02:07 UTC by jwm@horde.net
Modified: 2014-08-01 21:06 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 jwm@horde.net 2002-05-01 02:07:34 UTC
Full_Name: John Morrissey
Version: HEAD
OS: n/a
URL: http://horde.net/~jwm/software/openldap-dyngrow.patch
Submission from: (NULL) (24.93.15.178)


OpenLDAP (including recent HEAD) uses a staticly-defined array of a fixed size
to store configuration file tokens. This presents a problem for, in particular,
large objectclass definitions.

I've patched HEAD to dynamically grow the array as much as needed.

Comment 1 Kurt Zeilenga 2002-05-01 16:11:32 UTC
moved from Incoming to Software Bugs
Comment 2 ando@openldap.org 2002-05-02 06:48:25 UTC
changed notes
changed state Open to Test
moved from Software Bugs to Software Enhancements
Comment 3 ando@openldap.org 2002-05-02 06:49:33 UTC
John,

your patch has been applied to HEAD with changes; 
please test. Thanks for contributing.

Pierangelo.
Comment 4 jwm@horde.net 2002-05-02 13:44:05 UTC
I'm just curious: why was the NULL-return checking on ch_realloc() added?
I deliberately didn't check the return value because ch_realloc() checks
for a failed BER allocation and asserts and exits if an allocation fails.
AFAICT, the logging will never be called.

john

Comment 5 ando@openldap.org 2002-05-02 14:33:18 UTC
jwm@horde.net wrote:
> 
> I'm just curious: why was the NULL-return checking on ch_realloc() added?
> I deliberately didn't check the return value because ch_realloc() checks
> for a failed BER allocation and asserts and exits if an allocation fails.
> AFAICT, the logging will never be called.

That's because the cn_realloc internal might change in the future, so it
is good practice to use a temporary and check the return value, to
retain
control of the previously alloc'd memory (and dispose of it, in case).
Remember that *realloc in case of failure does not alter the previously
alloced memory.  cargv should be freed to clean up the heap, but since
in this specific case a memory failure while reading the configuration 
would likely result in an abort, I didn't take care of it.

Note that there was also an off by one bug when checking if cargv was
full.

Pierangelo.

-- 
Dr. Pierangelo Masarati               | voice: +39 02 2399 8309
Dip. Ing. Aerospaziale                | fax:   +39 02 2399 8334
Politecnico di Milano                 |
mailto:pierangelo.masarati@polimi.it
via La Masa 34, 20156 Milano, Italy   |
http://www.aero.polimi.it/~masarati

Comment 6 Kurt Zeilenga 2002-06-06 22:42:09 UTC
changed notes
changed state Test to Release
Comment 7 Kurt Zeilenga 2002-06-09 22:09:25 UTC
changed notes
changed state Release to Closed
Comment 8 OpenLDAP project 2014-08-01 21:06:57 UTC
applied to HEAD with changes
included in re21