tapmodo / node-ldif

Nodejs LDIF (LDAP Data Interchange Format) parser based on RFC2849
9 stars 7 forks source link

It seems that values starting with < are not handled correctly #3

Closed pavelhoral closed 7 years ago

pavelhoral commented 7 years ago

The following record will fail to parse:

dn: cn=foo
bar: <BAZ

This is a valid LDIF because according to RFC it is part of SAFE-INIT-CHARS:

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)
pavelhoral commented 7 years ago

Btw. my suspicion is that the parser is trying to handle the attribute as URL:

bar:< file:///tmp/baz.jpg

However the additional space should make all the difference.

pavelhoral commented 7 years ago

Ok... the error is on my side. The RFC states that the < (0x3C) is excluded and not included. So there is nothing wrong with this parser.

I was getting confused because I had these values inside LDIF generated from a different tool. It is a nice feature for XML based values though to have them in plain text instead of unreadable Base 64...