Hello list,
I've got records with e.g. multiple mail: entries per dn:
dn: cn=Joe Sixpack,ou=addressbook,dc=example,dc=org [ 8< 8< 8< snip objectclasses and other stuff 8< 8< 8< ] mail: user1@example.com mail: user2@example.com mail: user3@example.com
GUI ldap clients like jxplorer are able to change a single mail: entry. Using "ldapmodify" I replace the first mail: entry, but it will delete the other mail: antries:
#################################################################
change.diff file:
dn: cn=Joe Sixpack,ou=addressbook,dc=example,dc=com changetype: modify replace: mail mail: otheruser@example.com -
#################################################################
invoke:
ldapmodify -x -D "cn=admin,dc=example,dc=com" -W -f change.ldif
#################################################################
result:
dn: cn=Joe Sixpack,ou=addressbook,dc=example,dc=org [ 8< 8< 8< snip objectclasses and other stuff 8< 8< 8< ] mail: otheruser@example.com
#################################################################
Is there a way to tell ldapmodify to change just a particular entry?
R.
Am Freitag, 13. Oktober 2017 14:16 CEST, richard lucassen mailinglists@lucassen.org schrieb:
Hello list,
I've got records with e.g. multiple mail: entries per dn:
dn: cn=Joe Sixpack,ou=addressbook,dc=example,dc=org [ 8< 8< 8< snip objectclasses and other stuff 8< 8< 8< ] mail: user1@example.com mail: user2@example.com mail: user3@example.com
GUI ldap clients like jxplorer are able to change a single mail: entry. Using "ldapmodify" I replace the first mail: entry, but it will delete the other mail: antries: <....>
Is there a way to tell ldapmodify to change just a particular entry?
A change of a single value equals a delete of that value plus an add of the new value, doesn't it?
Cheers, Ralf Mattes
R.
-- richard lucassen http://contact.xaq.nl/
On Fri, 13 Oct 2017 14:29:23 +0200 "Ralf Mattes" rm@mh-freiburg.de wrote:
mail: user1@example.com mail: user2@example.com mail: user3@example.com
Is there a way to tell ldapmodify to change just a particular entry?
A change of a single value equals a delete of that value plus an add of the new value, doesn't it?
Yep, but ldapmodify deletes *all* "mail:" entries. If I tcpdump the stream of a jxplorer session, I see a modify request, which consists of indeed a delete and an add. But the "delete" has an attribute value:
+modification: 2 items +modification: item operation: delete (1) + modification: mail type: mail + vals: 1 item AttributeValue: user2@example.com operation: add (0) + modification: mail type: mail + vals: 1 item AttributeValue: otheruser@example.com
How do I tell ldapmodify just to delete 1 particular item with AttributeValue=X, and not all of them?
R.
Am Freitag, 13. Oktober 2017 17:06 CEST, richard lucassen mailinglists@lucassen.org schrieb:
On Fri, 13 Oct 2017 14:29:23 +0200 "Ralf Mattes" rm@mh-freiburg.de wrote:
mail: user1@example.com mail: user2@example.com mail: user3@example.com
Is there a way to tell ldapmodify to change just a particular entry?
A change of a single value equals a delete of that value plus an add of the new value, doesn't it?
Yep, but ldapmodify deletes *all* "mail:" entries. If I tcpdump the stream of a jxplorer session, I see a modify request, which consists of indeed a delete and an add. But the "delete" has an attribute value:
Off course, that was my whole point - you need to delete the value you want to modify, then add the new value.
+modification: 2 items +modification: item operation: delete (1)
- modification: mail type: mail
- vals: 1 item AttributeValue: user2@example.com
operation: add (0)
- modification: mail type: mail
- vals: 1 item AttributeValue: otheruser@example.com
How do I tell ldapmodify just to delete 1 particular item with AttributeValue=X, and not all of them?
changetype: modify delete: <attribute name> <attribute name>: <attribute value>
HTH, Ralf Mattes
R.
-- richard lucassen http://contact.xaq.nl/
On Fri, 13 Oct 2017 17:16:00 +0200 "Ralf Mattes" rm@mh-freiburg.de wrote:
Yep, but ldapmodify deletes *all* "mail:" entries. If I tcpdump the stream of a jxplorer session, I see a modify request, which consists of indeed a delete and an add. But the "delete" has an attribute value:
Off course, that was my whole point - you need to delete the value you want to modify, then add the new value.
Bit late this reply, sorry for that, but I've got everything under control now. Sometimes things are not so very obvious for people who are new to this matter :-)
R.
richard lucassen wrote:
How do I tell ldapmodify just to delete 1 particular item with AttributeValue=X, and not all of them?
Read about LDIF change records in RFC 2849. Especially the examples section.
https://tools.ietf.org/html/rfc2849
Ciao, Michael.
On Fri, 13 Oct 2017, richard lucassen wrote:
GUI ldap clients like jxplorer are able to change a single mail: entry. Using "ldapmodify" I replace the first mail: entry, but it will delete the other mail: antries:
#################################################################
change.diff file:
dn: cn=Joe Sixpack,ou=addressbook,dc=example,dc=com changetype: modify replace: mail mail: otheruser@example.com
In other words, it did exactly what you told it to do i.e. replace an attribute that happened to have multiple values with one that has but a singe value; you need to specify the entire set of desired values.
What a third-party application does is irrelevant; plainly it hid this detail from you.
openldap-technical@openldap.org