Novell is now a part of Micro Focus

I need to modify a multi-valued attribute, using...

Articles and Tips: qna

01 Jul 2003


Q.

I need to modify a multi-valued attribute, using an LDIF file. Suppose we have OU container named "test1" and its Other Name attribute is "second name of test1." The Other Name is stored as an "ou" attribute as well.

Now I want to change "second name of test1" to "another name of test1," but without changing "test1" name (RDN). I know this is not trivial, because of the way LDIF handles RDNs. But the similar and simpler version is this: how do I change only one line of the Description attribute (or TelephoneNumber or any other multi-valued attribute). I have two descriptions "desc1" and "desc2" and I want to change only "desc2" to "desc3." The standard method:

changetype: modify replace: description

is too strong because it removes "desc1." Tell me I'm not trying to do something impossible from a basic (RFC, LDAP/LDIF definition) point of view.

A.

There is no way to replace a single value as far as I know. The replace directive drops the entire set of values. You have to drop the value and add a new one as two separate operations.

LDIF Output for user.test:

c:\temp>ldapsearch -h 192.168.1.2 -D
		cn=admin,o=novell -w novell
cn=user
# User,Test
dn: cn=User,o=Test
givenName: FirstName
telephoneNumber: 111
telephoneNumber: 222
telephoneNumber: 333
sn: LastName
objectClass: top
objectClass: inetOrgPerson
objectClass: organizationalPerson
objectClass: person
objectClass: ndsLoginProperties
cn: User


Modification LDIF:
dn: cn=user,o=test
changetype: modify
delete: telephoneNumber
telephoneNumber: 333
-
changetype: modify
add: telephoneNumber
telephoneNumber: 444


User Output:
C:\temp>ldapsearch -h 192.168.1.2 -D
		cn=admin,o=novell -w novell
cn=user
version: 2


#
# filter: cn=user
# requesting: ALL
#


# User,Test
dn: cn=User,o=Test
givenName: FirstName
telephoneNumber: 111
telephoneNumber: 222
telephoneNumber: 444
sn: LastName
objectClass: top
objectClass: inetOrgPerson
objectClass: organizationalPerson
objectClass: person
objectClass: ndsLoginProperties

* Originally published in Novell AppNotes


Disclaimer

The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.

© Copyright Micro Focus or one of its affiliates