Thursday, April 5, 2007

OpenLDAP - Add initial entries

Most of us who have downloaded and installed OpenLdap face this issue. When ldapadd is used to add entries to the LDAP directory thru an LDIF file, we get the following error


adding new entry "dc=<MYDOMAIN>,dc=<COM> "
ldap_add: Invalid syntax (21)
additional info: objectclass: value #0 invalid per syntax


The root cause is that the sample LDIF file that accompanies the OpenLdap install has an extra space at the end of the objectclass syntax. Note the space after dc=<COM>. Trim the trailing space and the error is resolved.