[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Problem when trying to modify the DN



> Hello!
>
> I have a problem when I try to modify the DN of an entry.
>
> The following entries exist in my LDAP:
>
>> dn: cn=10.3.4.190,ou=Computers,dc=tgm,dc=ac,dc=at
>> objectClass: top
>> objectClass: ieee802Device
>> objectClass: ipHost
>> macAddress: 00:02:44:29:e7:a4
>> cn: 10.3.4.190
>> ipHostNumber: 10.3.4.190
>
>> dn: macAddress=00:01:02:4f:c7:98,ou=Computers,dc=tgm,dc=ac,dc=at
>> objectClass: top
>> objectClass: ieee802Device
>> objectClass: ipHost
>> macAddress: 00:01:02:4f:c7:98
>> cn: 10.3.4.191
>> ipHostNumber: 10.3.4.190
>
> When I try to modify the DN of the first entry to
> "macAddress=00:02:44:29:e7:a4,ou=Computers,dc=tgm,dc=ac,dc=at" I get an
> Object Class Violation error, and the logfile states "objectClass ipHost
> needs Attribute cn", but this Attribute is in the Entry.

Apparently you're using modrdn with

deleteoldrdn: 1

which causes an attempt to delete the value of attribute "cn"
together with the rdn change.  You should set deleteoldrdn to 0,
to leave the old valuie, otherwise you have an objectClass
violation (and you wouldn't get the expected result, since
you state that you want to preserve the value of the attribute
"cn". You don't say what API you're using; however, in LDIF
format you'd use

dn: cn=10.3.4.190,ou=Computers,dc=tgm,dc=ac,dc=at
changetype: modrdn
macAddress=00:02:44:29:e7:a4
deleteoldrdn: 0
newrdn:

>
> Is it possible to modify this entry? Exporting this Entry to LDIF,
> changing the DN manually and importing via ldapadd works fine. But I
> can't modify the DN direct.

If you use the C API (the only one I'm familiar with) there's
a dedicated argument:

int ldap_modrdn2(ld, dn, newrdn, deleteoldrdn)

Pierangelo.

-- 
Pierangelo Masarati
mailto:pierangelo.masarati@sys-net.it