Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added a fifth case for the ModifyDN operation

...

This request is used to move entries or to rename entries or to move and rename entries. Its counterpart in a ldif file is a 'changetype: moddn' or a 'changetype: modrdn' operation (moddn or modrdn are synonymous).

There are four five cases :

  1. we change the RDN, we don't change the superior and we don't delete the old RDN
  2. we change the RDN, we don't change the superior and we delete the old RDN
  3. we change the RDN, we change the superior and we don't delete the old RDN
  4. we change the RDN, we change the superior and we delete the old RDN
  5. we don't change the RDN, we change the superior (this is a Move operation)

The following table gives an example for each of those cases applied on the initial entry :

...

case

deleteoldrdn

new superior

modifying ldif

resulting entry

reverse ldif

1

no

none

dn: cn=test, dc=example, dc=com
changetype: moddn
deleteoldrdn: 0
newrdn: cn=joe

dn: cn=joe, dc=example, dc=com
objectclass: top
objectclass: person
cn: test
cn: joe
sn: This is a test

dn: cn=joe, dc=example, dc=com
changetype: moddn
deleteoldrdn: 1
newrdn: cn=test 
1

2

yes

none

dn: cn=test, dc=example, dc=com
changetype: moddn
deleteoldrdn: 1
newrdn: cn=joe

dn: cn=joe, dc=example, dc=com
objectclass: top
objectclass: person
cn: test
cn: joe
sn: This is a test

dn: cn=joe, dc=example, dc=com
changetype: moddn
deleteoldrdn: 1
newrdn: cn=test  
1

3

no

ou=system

dn: cn=test, dc=example, dc=org
changetype: moddn
deleteoldrdn: 0
newrdn: cn=joe
newsuperior: ou=system

dn: cn=joe, ou=system
objectclass: top
objectclass: person
cn: test
cn: joe
sn: This is a test

dn: cn=joe, ou=system
changetype: moddn
deleteoldrdn: 1
newrdn: cn=test  
newsuperior: dc=example, dc=com
1

4

yes

ou=system

dn: cn=test, dc=example, dc=org
changetype: moddn
deleteoldrdn: 1
newrdn: cn=joe
newsuperior: ou=system

dn: cn=joe, ou=system
objectclass: top
objectclass: person
cn: test
cn: joe
sn: This is a test

dn: cn=joe, ou=system
changetype: moddn
deleteoldrdn: 1

newrdn: cn=test 
newsuperior: dc=example, dc=com

5

no

ou=system

dn: cn=test, dc=example, dc=org
changetype: moddn
newrdn: cn=test
newsuperior: ou=system

dn: cn=test, ou=system
objectclass: top
objectclass: person
cn: test
sn: This is a test

dn: cn=test, ou=system
changetype: moddn
newsuperior: dc=example, dc=com
newrdn: cn=test

Computing the reverse LDIF for a ModifyDN request follows the algorithm :

if the newRdn is different from the existing EDN

  then reverseLdif.deleteOldRdn = true
  else reverseLdif.deleteOldRdn = false
if modifyDn.newSuperior not empty 
  then reverseLdif.newSuperior = modifyDn.dn minus the modifyDN.dn.getRDN
reverseLdif.newRdn = modifyDn.dn.getRDN