Skip Menu |

This queue is for tickets about the perl-ldap CPAN distribution.

Report information
The Basics
Id: 7868
Status: resolved
Priority: 0/
Queue: perl-ldap

People
Owner: Nobody in particular
Requestors: jd [...] onix.de
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.3202
Fixed in: (no value)



Subject: bug with url attribute
Using: perl-ldap-0.3202 This is perl, v5.8.4 Linux elwood 2.4.26 #1 Sun May 16 18:26:09 CEST 2004 i686 GNU/Linux Upgrading to 0.3202 introduced a nasty bug in LDIF parsing: Taken a simple LDIF containing a attribute like attr: <p>blasfasel</p> will break parsing with unsupported URL type at ./myscript Debugging LDIF.pm discovered that there is no distinction between "attr: <" and "attr:<", but both is treated as a url attribute. This seems to violate LDIF RFC (2849). I marked this bug "important", because it breaks existing (previously working) scripts. Regards, Joerg Delker
From: Graham Barr <gbarr [...] pobox.com>
Subject: Re: [cpan #7868] bug with url attribute
Date: Tue, 5 Oct 2004 07:27:45 +0100
To: bug-perl-ldap [...] rt.cpan.org
RT-Send-Cc:
On 4 Oct 2004, at 22:34, Guest via RT wrote: Show quoted text
> Taken a simple LDIF containing a attribute like > attr: <p>blasfasel</p> > will break parsing with > unsupported URL type at ./myscript > > Debugging LDIF.pm discovered that there is no distinction between > "attr: <" and "attr:<", but both is treated as a url attribute.
Please try this patch. Graham. Index: lib/Net/LDAP/LDIF.pm =================================================================== --- lib/Net/LDAP/LDIF.pm (revision 430) +++ lib/Net/LDAP/LDIF.pm (working copy) @@ -9,7 +9,7 @@ require Net::LDAP::Entry; use vars qw($VERSION); -$VERSION = "0.15"; +$VERSION = "0.15_01"; my %mode = qw(w > r < a >>); @@ -224,7 +224,7 @@ last; } - $line =~ s/^([-;\w]+):\s*// and $attr = $1; + $line =~ s/^([-;\w]+):// and $attr = $1; # base64 encoded attribute: decode it if ($line =~ s/^:\s*//) { @@ -240,7 +240,10 @@ $line = $self->_read_url_attribute($line, @ldif); return if !defined($line); } - + else { + $line =~ s/^\s*//; + } + if( defined($modattr) && $attr ne $modattr ) { $self->_error("LDAP entry is not valid", @ldif); return;
From: Graham Barr <gbarr [...] pobox.com>
Subject: Re: [cpan #7868] bug with url attribute
Date: Tue, 5 Oct 2004 09:47:04 +0100
To: bug-perl-ldap [...] rt.cpan.org
RT-Send-Cc:
On 4 Oct 2004, at 22:34, Guest via RT wrote: Show quoted text
> Taken a simple LDIF containing a attribute like > attr: <p>blasfasel</p> > will break parsing with > unsupported URL type at ./myscript > > Debugging LDIF.pm discovered that there is no distinction between > "attr: <" and "attr:<", but both is treated as a url attribute. > > This seems to violate LDIF RFC (2849).
Well. Yes and no. attr: <p>blasfasel</p> is not valid LDIF according to RFC 2849 value-spec = ":" ( FILL 0*1(SAFE-STRING) / ":" FILL (BASE64-STRING) / "<" FILL url) SAFE-CHAR = %x01-09 / %x0B-0C / %x0E-7F ; any value <= 127 decimal except NUL, LF, ; and CR SAFE-INIT-CHAR = %x01-09 / %x0B-0C / %x0E-1F / %x21-39 / %x3B / %x3D-7F ; any value <= 127 except NUL, LF, CR, ; SPACE, colon (":", ASCII 58 decimal) ; and less-than ("<" , ASCII 60 decimal) SAFE-STRING = [SAFE-INIT-CHAR *SAFE-CHAR] So while LDIF.pm allowing a space between : and < is not strictly correct. The spec also states that < is not a valid first character of a value, so it should be base64 encoded. Graham.