---------------------------- Original Message ----------------------------
Subject: Net::LDAP::LDIF RFC non compliance (I think)
From:    "Erik Ableson" <[EMAIL PROTECTED]>
Date:    Thu, January 27, 2005 6:44 am
To:      [EMAIL PROTECTED]
--------------------------------------------------------------------------

Greetings,

I'm having some problems with the (otherwise excellent) ldifdiff.pl script
output.  I'm importing data into a (shudder) MIIS system and they seem to
have interpreted the RFC 2849 slightly differently than ldifdiff.pl.  They
appear to be working with the assumption that every modify entry must be
terminated by a hyphen.  Hmm, although looking a little closer it appears
that this is the result of the Net::LDAP::LDIF module output.

The RFC examples are a little unclear in that each of the examples that
treat a single modify operation are not terminated by a hyphen, but there
are no examples of an attribute modification of a single attribute.

Output from ldifdiff results in output similar to the following:
dn: cn=Paula Jensen, ou=Product Development, dc=airius, dc=com
changetype: modify
add: postaladdress
postaladdress: 123 Anystreet $ Sunnyvale, CA $ 94086

which is rejected by the import operation. However, manually adding the
terminating hyphen allows the record to be processed.

dn: cn=Paula Jensen, ou=Product Development, dc=airius, dc=com
changetype: modify
add: postaladdress
postaladdress: 123 Anystreet $ Sunnyvale, CA $ 94086
-

Further tests show that MIIS refuses to parse any unterminated modify
record.  That is, it requires a final hyphen to close out each
modification section even when there are multiple modification actions. ie

dn: cn=Paula Jensen, ou=Product Development, dc=airius, dc=com
changetype: modify
add: postaladdress
postaladdress: 123 Anystreet $ Sunnyvale, CA $ 94086
-
delete: telephonenumber

will fail, but

dn: cn=Paula Jensen, ou=Product Development, dc=airius, dc=com
changetype: modify
add: postaladdress
postaladdress: 123 Anystreet $ Sunnyvale, CA $ 94086
-
delete: telephonenumber
-

will work.

In puzzling over the RFC, it would appear to me that the hyphen is in fact
mandatory on all modify records as per : mod-spec                 =
("add:" / "delete:" / "replace:")
                           FILL AttributeDescription SEP
                           *attrval-spec
                           "-" SEP

Although the question remains how well supported this syntax is by the
various directory products out there.

I'm currently puzzling over the code in LDIF.pm to see how to modify this
behaviour so that there is always a terminating hyphen.  I'm thinking that
the obvious modification is to add a print "-\n" on line 493, immediately
following the treatment of the modifications if I understand the code
correctly but I think that may result in doubling the hyphens between
records.  Any insight appreciated.

Otherwise I can always do an after the fact modification of the output
file, searching for unterminated modify entries, but that seems a little
kludgy...

Cheers,

Erik Ableson




Reply via email to