Hi, I am working through a book (Mastering OpenLDAP, Packtpub) which is based on openldap 2.3.
The book talks in chapter 3 how to modify/add/delete attributes for a dn. It instructs to put the bellow in an ldif file and read it with ldapmodify. The writerś point here is that I am supposed to add both a "description" and "title" without separating out the additions with a dash (-).
It never works for me and always comes with a syntax error.
non working ldif file: dn: uid=nicholas,ou=Users,dc=home changetype: modify add: description title # <- 2 attributes description: This is a test title: Cartesian philosopher
Error: ldapmodify: wrong attributeType at line 4, entry "uid=nicholas,ou=Users,dc=home"
The ldif file that does work is below.
Working ldif file: dn: uid=nicholas,ou=Users,dc=home changetype: modify add: description description: This is a test - add: title title: Cartesian philosopher
Now am I doing something wrong, is the book using functionality that is not available in openldap version 2.4 or something else?
Any pointers and help much appreciated.
Thx infirit
Following RFC2849 (LDIF), it seems the multiple attributes on a single line isn't supported.
mod-spec = ("add:" / "delete:" / "replace:") FILL AttributeDescription SEP *attrval-spec "-" SEP
AttributeDescription = AttributeType [";" options]
AttributeType = ldap-oid / (ALPHA *(attr-type-chars))
attrval-spec = AttributeDescription value-spec SEP
value-spec = ":" ( FILL 0*1(SAFE-STRING) / ":" FILL (BASE64-STRING) / "<" FILL url)
FILL = *SPACE
SEP = (CR LF / LF)
2013/3/13 infirit infirit@gmail.com
Hi, I am working through a book (Mastering OpenLDAP, Packtpub) which is based on openldap 2.3.
The book talks in chapter 3 how to modify/add/delete attributes for a dn. It instructs to put the bellow in an ldif file and read it with ldapmodify. The writerś point here is that I am supposed to add both a "description" and "title" without separating out the additions with a dash (-).
It never works for me and always comes with a syntax error.
non working ldif file: dn: uid=nicholas,ou=Users,dc=home changetype: modify add: description title # <- 2 attributes description: This is a test title: Cartesian philosopher
Error: ldapmodify: wrong attributeType at line 4, entry "uid=nicholas,ou=Users,dc=home"
The ldif file that does work is below.
Working ldif file: dn: uid=nicholas,ou=Users,dc=home changetype: modify add: description description: This is a test
add: title title: Cartesian philosopher
Now am I doing something wrong, is the book using functionality that is not available in openldap version 2.4 or something else?
Any pointers and help much appreciated.
Thx infirit
On Wed, 13 Mar 2013, infirit wrote:
Hi, I am working through a book (Mastering OpenLDAP, Packtpub) which is based on openldap 2.3.
The book talks in chapter 3 how to modify/add/delete attributes for a dn. It instructs to put the bellow in an ldif file and read it with ldapmodify. The writer? point here is that I am supposed to add both a "description" and "title" without separating out the additions with a dash (-).
It never works for me and always comes with a syntax error.
non working ldif file: dn: uid=nicholas,ou=Users,dc=home changetype: modify add: description title # <- 2 attributes description: This is a test title: Cartesian philosopher
Error: ldapmodify: wrong attributeType at line 4, entry "uid=nicholas,ou=Users,dc=home"
The ldif file that does work is below.
Working ldif file: dn: uid=nicholas,ou=Users,dc=home changetype: modify add: description description: This is a test
add: title title: Cartesian philosopher
Now am I doing something wrong, is the book using functionality that is not available in openldap version 2.4 or something else?
The non-working syntax doesn't work because it doesn't match the syntax specified in RFC 2849. It *looks* kinda like LDIF, but it really isn't. You should contact the book author so they can fix it for a future printing.
Philip Guenther
openldap-technical@openldap.org