Dear Graham,
I'm now confused in the interpretation of the RFC. Howard from the
OpenLDAP team yetserday answered me:
"> The database backend "back_perl" expects LDIF entries beginning with
"dn:" and
Show quoted text> ending with an empty line. RFC2849 only describes that an entry is
everything
Show quoted text> except an empty line and a line not beginning (after a CR/LF) with a
single
Show quoted text> white space character.
Wrong. The grammar in RFC2849 quite explicitly states:
ldif-file = ldif-content / ldif-changes
ldif-content = version-spec 1*(1*SEP ldif-attrval-record)
ldif-changes = version-spec 1*(1*SEP ldif-change-record)
ldif-attrval-record = dn-spec SEP 1*attrval-spec
ldif-change-record = dn-spec SEP *control changerecord
That means an LDIF file must start with 0 or 1 version-specs, then a
dn-spec.
And, all records must end with LF or CR/LF.
Show quoted text> After some testing with back_perl I noticed that the LDIF entries
produced by
Show quoted text> the perl module Net::LDAP::LDIF were not acceptet because they are
beginning
Show quoted text> with an empty line and ending only with a simple CR charakter.
>
> This behavior breaks RFC2849. After changing LDIF.pm from that module
to produce
Show quoted text> the CR after the entry back_perl accepts this entries too.
>
> IMHO this is a misbehavior so I'm very glad if You'll take a look at
this
Show quoted text> issue.
Apparently it Net::LDAP::LDIF is broken. Since that is not a piece of
OpenLDAP
Software I don't see what we can do about it. This ITS will be closed.
Contact
the author of Net::LDAP::LDIF to pursue this further.
--"
Who is wrong and who is in right now?
To avoid in running problems already solved by newer software releases I
installed the actual release of OpenLDAP (2.4.8) and
the Net::LDAP::LDIF module (0.35) and I run into the same problematic.
I for myself want to understand what's going wrong and how to make my
software better and to learn.
Because of the differences between the interpretation of the RFC it's
very important for me to hear Your opinion again regarding this issue.
I'm very glad if You take a look at this.
Thanks in advance for Your advice!
Regards Uwe
Am Samstag, den 05.04.2008, 15:52 -0400 schrieb Graham Barr via RT:
Show quoted text> <URL:
http://rt.cpan.org/Ticket/Display.html?id=34689 >
>
> On Apr 5, 2008, at 10:36 AM, Uwe Werler via RT wrote:
> > But after rereading the RFC again I have now to disagree with You. The
> > RFC says that an LDIF file MUST begin with a version number of 1:
>
> No it does not.
>
> > Notes on LDIF Syntax
> >
> > 1) For the LDIF format described in this document, the version
> > number MUST be "1". If the version number is absent,
> > implementations MAY choose to interpret the contents as an
> > older LDIF file format, supported by the University of
> > Michigan ldap-3.3 implementation [8].
>
> It says there that it must for LDIF described by that document.
>
> LDIF existed before that document. The existance of the version line
> is how to tell the difference.
>
> > That means that the first line of the file MUST contain the version
> > spec. Applications MAY accept the file if this line/spec is missing.
>
> And if you tell NetLLKDAP::LDIF that you want to write version 1 then
> it will write the version line
>
> > The line itself is followed by a SEP and by a ldif-attrval-record:
>
> The line followed by 1 OR MORE SEP
>
> >
> > ldif-content = version-spec 1*(1*SEP ldif-attrval-record)
> >
> > The ldif-attrval-record itself consists if a dn-spec followed by a SEP
> > and attrval-spec.
>
> correct
>
> > ldif-attrval-record = dn-spec SEP 1*attrval-spec
> >
> > The attributes itself are described in AttributeDescription
> > followed by
> > the value specification and ENDING with a SEP:
>
> correct
>
> > attrval-spec = AttributeDescription value-spec SEP
> >
> > That means that the file SHOULD be as followed:
> >
> > version-spec FILL version-number(CR LF / LF)
>
> There can be more (CR CR/LF) in here
>
> > dn-spec FILL distinguishedName(CR LF / LF)
> > AttributeDescription FILL value-spec(CR LF / LF)
> >
> > As example:
> >
> > version: 1(CR LF / LF)
> > dn: distinguishedName(CR LF / LF)
> > attribute: value(CR LF / LF)
> > attribute: value(CR LF / LF)
> >
> > dn: distinguishedName(CR LF / LF)
> > attribute: value(CR LF / LF)
> > attribute: value(CR LF / LF)
> >
> > dn: distinguishedName(CR LF / LF)
> > attribute: value(CR LF / LF)
> > attribute: value(CR LF / LF)
>
> With the extra line after the version line, which is legal, that is
> exactly what Net::LDAP::LDIF will output if you tell it you want
> version 1
>
> > and so on. The same applies naturally for the change records.
> >
> > That means if You leave the first line with the version number
> > blank the
> > first line MUST contain an entry starting with a DN. And after each
> > entry MUST be (CR LF / LF) eg. empty line.
>
> No. Nowhere in the spec does it say that there MUST be an empty line
> following each entry. The spec states that each entry is preceeded by
> 1 or more SEP
>
> Graham.
>
>