Denebe
Denebe

Reputation: 1

LDAP - ldapmodify - add two attributes in one operation doesn't work

I read this book : "Mastering OpenLDAP". It is an old book - 2007 - the version of Openldap is the 2.3 in this book.

I use Openldap 2.5 (Ubuntu 22.04).

It is written that I can add two attributes by using ldapmodify this way:

dn: uid=nicholas,ou=Users,dc=example,dc=com
changetype: modify
add: description title
description: This is a test
title: Cartesian philosopher

but when I try it, it doesn't work:

thierry@thierry-VirtualBox:~$ ldapmodify -x -w secret -D 'cn=Manager,dc=example,dc=com'
dn: uid=nicholas,ou=Users,dc=example,dc=com
changetype: modify
add: description title
description: This is a test
title: Cartesian philosopher

ldapmodify: wrong attributeType at line 4, entry "uid=nicholas,ou=Users,dc=example,dc=com"

Although it works well if I add one attribute, and then another. Why ?

thierry@thierry-VirtualBox:~$ ldapmodify -x -w secret -D 'cn=Manager,dc=example,dc=com'
dn: uid=nicholas,ou=Users,dc=example,dc=com
changetype: modify
add: description
description: This is a test

modifying entry "uid=nicholas,ou=Users,dc=example,dc=com"

^C
thierry@thierry-VirtualBox:~$ ldapmodify -x -w secret -D 'cn=Manager,dc=example,dc=com'
dn: uid=nicholas,ou=Users,dc=example,dc=com
changetype: modify
add: title
title: Cartesian philosopher

modifying entry "uid=nicholas,ou=Users,dc=example,dc=com"

^C
thierry@thierry-VirtualBox:~$ ldapsearch -x -w secret -D 'cn=Manager,dc=example,dc=com' -LLL '(uid=nicholas)'
dn: uid=nicholas,ou=Users,dc=example,dc=com
cn: Nicholas Malebranche
sn: Malebranche
uid: nicholas
ou: Users
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
title: Cartesian philosopher
description: This is a test

Thank you for your help.

Upvotes: 0

Views: 323

Answers (1)

Gabriel Luci
Gabriel Luci

Reputation: 40868

The manpage has an example of making multiple changes:

dn: cn=Modify Me,dc=example,dc=com
changetype: modify
replace: mail
mail: [email protected]
-
add: title
title: Grand Poobah
-
add: jpegPhoto
jpegPhoto:< file:///tmp/modme.jpeg
-
delete: description
-

So in your case, yours should look something like this:

dn: uid=nicholas,ou=Users,dc=example,dc=com
changetype: modify
add: description
description: This is a test
-
add: title
title: Cartesian philosopher
-

Upvotes: 1

Related Questions