Issue 6645 - Yet Another LDIF Wrap Patch
Summary: Yet Another LDIF Wrap Patch
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: 2010-09-09 17:39 UTC by ando@openldap.org
Modified: 2014-08-01 21:05 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 ando@openldap.org 2010-09-09 10:40:10 UTC
moved from Incoming to Contrib
Comment 1 ando@openldap.org 2010-09-09 17:39:55 UTC
Full_Name: Pierangelo Masarati
Version: HEAD/re24
OS: irrelevant
URL: ftp://ftp.openldap.org/incoming/pierangelo-masarati-2010-09-09-ldif-wrap.1.patch
Submission from: (NULL) (129.72.165.135)
Submitted by: ando


The subject should be self-explanatory.  It is only exploited by slapcat, via
the -o ldif-wrap=<n> option (<n> < 0: default; <n> == 0: no wrap; <n> > 0: wrap
value); extending ldapsearch is trivial.

I'm *NOT* going to commit this unless there is unanimous consensus ;)

Enjoy.  p.
Comment 2 Howard Chu 2010-09-09 21:51:49 UTC
masarati@aero.polimi.it wrote:
> Full_Name: Pierangelo Masarati
> Version: HEAD/re24
> OS: irrelevant
> URL: ftp://ftp.openldap.org/incoming/pierangelo-masarati-2010-09-09-ldif-wrap.1.patch
> Submission from: (NULL) (129.72.165.135)
> Submitted by: ando
>
>
> The subject should be self-explanatory.  It is only exploited by slapcat, via
> the -o ldif-wrap=<n>  option (<n>  <  0: default;<n>  == 0: no wrap;<n>  >  0: wrap
> value); extending ldapsearch is trivial.
>
> I'm *NOT* going to commit this unless there is unanimous consensus ;)

Not thrilled with the magic constant 2^31-1. Seems like you should have just 
used "if ( wrap && len > wrap )" instead of a word-size-dependent magic.

-- 
   -- 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 4 Hallvard Furuseth 2010-09-10 17:30:22 UTC
hyc@symas.com writes:
> Not thrilled with the magic constant 2^31-1. Seems like you should have just 
> used "if ( wrap && len > wrap )" instead of a word-size-dependent magic.

The code just needs to be a little less clever:-)  Pass -1 to a
'ber_len_t wrap'.  The constant (ber_len_t)-1 will prevent wrapping:
"if (len > (ber_len_t)-1)" always fails.

But if we are going to have smarter LDIF output, I'm more interested in
an option to avoid base64 encoding of valid UTF-8 strings.  Also one
to force base64-encoding for caller-specified attributes.  Or just
a bitflag to ldif_sput() after the caller checks the attribute type.

-- 
Hallvard

Comment 5 ando@openldap.org 2010-09-10 17:48:04 UTC
> hyc@symas.com writes:
>> Not thrilled with the magic constant 2^31-1. Seems like you should have
>> just
>> used "if ( wrap && len > wrap )" instead of a word-size-dependent magic.
>
> The code just needs to be a little less clever:-)  Pass -1 to a
> 'ber_len_t wrap'.  The constant (ber_len_t)-1 will prevent wrapping:
> "if (len > (ber_len_t)-1)" always fails.

Thanks.

> But if we are going to have smarter LDIF output, I'm more interested in
> an option to avoid base64 encoding of valid UTF-8 strings.  Also one
> to force base64-encoding for caller-specified attributes.  Or just
> a bitflag to ldif_sput() after the caller checks the attribute type.

See ldif_must_b64_encode_register() :)

We already use it to force encoding of olcRootPW and other password-like
attrs in proxy backends.

p.

Comment 6 ando@openldap.org 2010-09-10 19:41:09 UTC
> hyc@symas.com writes:
>> Not thrilled with the magic constant 2^31-1. Seems like you should have
>> just
>> used "if ( wrap && len > wrap )" instead of a word-size-dependent magic.
>
> The code just needs to be a little less clever:-)  Pass -1 to a
> 'ber_len_t wrap'.  The constant (ber_len_t)-1 will prevent wrapping:
> "if (len > (ber_len_t)-1)" always fails.

<ftp://ftp.openldap.org/incoming/pierangelo-masarati-2010-09-09-ldif-wrap.3.patch>

Includes documentation.  Thanks for checking this.

p.

Comment 7 ando@openldap.org 2010-12-07 01:15:22 UTC
changed notes
changed state Open to Test
Comment 8 ando@openldap.org 2010-12-10 05:21:24 UTC
moved from Contrib to Development
Comment 9 Quanah Gibson-Mount 2011-01-04 10:57:53 UTC
changed notes
changed state Test to Release
Comment 10 Quanah Gibson-Mount 2011-02-14 12:36:18 UTC
changed notes
changed state Release to Closed
Comment 11 OpenLDAP project 2014-08-01 21:05:03 UTC
Added to HEAD
Added to RE24