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

Re: Problem when trying to modify the DN

Pierangelo Masarati wrote:

I have a problem when I try to modify the DN of an entry.

The following entries exist in my LDAP:

dn: cn=,ou=Computers,dc=tgm,dc=ac,dc=at
objectClass: top
objectClass: ieee802Device
objectClass: ipHost
macAddress: 00:02:44:29:e7:a4

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

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

aehm, yes

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

oh, I think I've misinterpreted the meaning of this, thanks, I'll try it 2morrow.

dn: cn=,ou=Computers,dc=tgm,dc=ac,dc=at
changetype: modrdn
deleteoldrdn: 0

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)

I've tried with Net::LDAP in perl (and explicitly set deleteoldrdn to 1) and with gq - which seems to have implemented deleteoldrdn=1 so it doesn't work in this case...

Markus Schabel
| TGM - Die Schule der Technik               |
| IT-Service                                 |
| A-1200 Wien, Wexstrasse 19-23              |
| Tel.: +43(1)33126/316 Fax: +43(1)33126/154 |
| eMail: markus.schabel@tgm.ac.at            |