Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

No Format
dn: cn=test, dc=example, dc=com
objectclass: top
objectclass: person
cn: test
sn: This is a testcreatorsName:  dc=admin, ou=systemcreateTimestamp: 20071010150132ZmodifiersName:  dc=admin, ou=systemmodifyTimestamp:  20071010150133Z

 if if we have a delRequest which ldif is :

No Format
dn: cn=test, dc=example, dc=com
changetype: delete

 the the reversed ldif should be :

No Format
dn: cn=test, dc=example, dc=comchangetype: add
objectclass: top
objectclass: person
cn: test
sn: This is a test

...

We will separate the ModifyDN into 3 different cases : 

  • A simple move operation : we change the superior, the RDN remains the same
  • A rename operation : the RDN is changed
  • A move and rename operation : a combinaison of both previous operations

 Move Move operation

This is the simplest one : we change the superior, without changing the entry's attributes nor the RDN

 the the following entry :

No Format
cn=test, dc=example, dc=orgobjectClass: personobjectClass: topcn: test

...

Generally speaking, the revert operation may be a simple one or a combinaison of a moddn and a add/delete operation, depending on the case.

There are 14 13 cases :

  1. The initial RDN is simple, the target RDN is simple, we don't delete the oldRDN : We just have to remove the newly added AVA if it's not present into the original entry
  2. The initial RDN is simple, the target RDN is simple, we delete the oldRDN : We have to add the old AVA and to remove the newly added AVA if it's not present into the original entry
  3. The initial RDN is composite, the target is simple, they don't overlap, we don't delete the oldRDN : We just have to remove the newly added AVA if it's not present into the original entry
  4. The initial RDN is composite, the target is simple, they don't overlap, we delete the oldRDN : We have to add the original AVAs, and to remove the newly added AVAs if it's not present into the original entry
  5. The initial RDN is composite, the target is simple, they overlap, we don't delete the oldRDN : Nothing special to doThe initial RDN is composite, the target is simple, they overlap, we delete the oldRDN : We have to add the removed AVAs except the one which is in the new RDN
  6. The initial RDN is simple, the target RDN is composite, they don't overlap, we don't delete the oldRDN : We have to remove all the new AVAs
  7. The initial RDN is simple, the target RDN is composite, they don't overlap, we delete the oldRDN : We have to remove all the new AVAs and to add the old AVA
  8. The initial RDN is simple, the target RDN is composite, they overlap, we don't delete the oldRDN : We have to remove all the new AVAs except the one whgich is in the old RDN
  9. The initial RDN is simple, the target RDN is composite, they overlap, we delete the oldRDN : We have to remove all the new AVAs except the one which is in the old RDN
  10. The initial RDN is composite, the target RDN is composite, they don't overlap, we don't delete the oldRDN : We have to remove all the new AVAs which are not present in the original entry
  11. The initial RDN is composite, the target RDN is composite, they don't overlap, we delete the oldRDN : We have to remove all the new AVAs which are not present in the original entry and add all the removed AVAs from the original entry
  12. The initial RDN is composite, the target RDN is composite, they overlap, we don't delete the oldRDN : We have to remove all the new AVAs which are not present in the original entry.
  13. The initial RDN is composite, the target RDN is composite, they overlap, we delete the oldRDN : We have to remove all the new AVAs which are not present in the original entry and add all the removed AVAs from the original entry
    Case 11 and 13 are equivalent, so are case 12 and 14. They need two operations to be applied.

We also have sub cases, depending in the presence (or not) of the new RDN AVAs into the initial entry. Rge following table expose all the different cases (28), assuming that the two subcases are :

  1. The  The initial entry does not contain any of the RDN AVA
  2. The  The initial entry contains at least one of the RDN AVA which is not part of the original RDN

One special and important point : we can't use the deleteOldDN for composite operation, as this may lead to the deletion of a mandatory attribute, hence generating an error when applying the revert operation.

case

orginal entry

target RDN

case
entry

orginal entry

target RDN

deleteoldrdn

forward ldif

resulting entry

reverse ldif

1.1

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

cn=joe

no

dn: cn=test, ou=system
changetype: moddn
newrdn: cn=joe
deleteoldrdn: 0

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
newrdn: cn=test
deleteoldrdn: 1

1.2

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

cn=small

no

dn: cn=test, ou=system
changetype: moddn
newrdn: cn=small
deleteoldrdn: 0

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

dn: cn=small, ou=system
changetype: moddn
newrdn: cn=test
deleteoldrdn: 0

2.1

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

cn=joe

yes

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

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

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

2.2

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

cn=joesmall

yes

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

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

dn: cn=joe, ou=system
changetype: moddn
newrdn: cn=test
deleteoldrdn: 0

3

cn=small+cn=test

cn=joe

no

dn: cn=small+cn=test,ou=system
changetype objectclass: moddn top
newrdn objectclass: person
cn: test
cn: small
sn: This is a test

cn=joe

N/A

dn: cn=small+cn=test, ou=system
changetype: moddn
newrdn: cn=joe
=joe
deleteoldrdn: 0

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

dn: cn=joe, ou=system
changetype: moddn
deleteoldrdn: 1
newrdn: cn=small+cn=test

 

 

 

 

 

 

 

4 cn=small+cn=test

cn=joe

yes

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

cn=big

N/A

dn: cn=small+cn=test, ou=system
changetype: moddn
newrdn: cn=joe big
deleteoldrdn: 1 0

dn: cn=joebig, ou=system
objectclass: top
objectclass: person
[cn: joetest]
[cn: small]
cn: big
sn: This is a test

dn: cn=joebig, ou=system
changetype: moddn
deleteoldrdn: 1 0
newrdn: cn=small+cn=test

 

 

 

 

 

 

 

5

cn=small+cn=test
objectclass: top
objectclass: person
cn: test
cn: small
sn: This is a

5

cn=small+cn= test

cn=test

no N/A

dn: cn=small+cn=test, ou=system
changetype: moddn
newrdn: cn=test
deleteoldrdn: 0

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

dn: cn=test, ou=system
changetype: moddn
deleteoldrdn: 0
newrdn: cn=small+cn=test  

 

 

 

 

 

 

6 6.1

cn=small+cn=test

cn=test

yes

test
objectclass: top
objectclass: person
cn: test
cn: small
sn: This is a test

cn=joe+cn=plumber

no

dn: dn: cn=small+ cn=test, ou=system
changetype: moddn
newrdn: cn=joe+cn=test plumber
deleteoldrdn: 1 0

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

dn: cn=testjoe+cn=plumber, ou=system
changetype: moddn
deleteoldrdn: 0 1
newrdn: cn=small+test

6.2

cn=test

 

 

 

 

 

 

 

7

cn= objectclass: top
objectclass: person
cn: test
cn: small
sn: This is a test

cn=joe+cn=plumber small

no

dn: cn=test, ou=system
changetype: moddn
newrdn: cn=joe+cn=plumber small
deleteoldrdn: 0

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

8

cn=test

cn=joe+cn=plumber

yes

dn: cn=joe+cn=plumbersmall, ou=system
changetype:   moddn
deleteoldrdn: 10
newrdn: cn=test

 

 

 

 

 

 

 


and

dn: cn=test,ou=system
changetype: moddn modify
newrdn delete: cn
cn: joe
-

7.1

cn=test
objectclass: top
objectclass: person
cn: test
cn: small
sn: This is a test

cn=joe+cn=plumber

yes

dn: cn=test, ou=system
changetype: moddn
newrdn: cn=joe+cn=plumber
=joe+cn=plumber
deleteoldrdn: 1

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

dn: cn=joe+cn=plumber, ou=system
changetype:   moddn
deleteoldrdn: 1newrdn1
newrdn: cn=test  test

 

 

 

 

 

 

 

7.2

cn=test
objectclass: top
objectclass: person
cn: test
cn: small
sn: This is a

9

cn= test

cn=smalljoe+cn=test small

no yes

dn: cn=test, ou=system
changetype: moddn
newrdn: cn=smalljoe+cn=test small
deleteoldrdn: 0 1

dn: cn=smalljoe+cn=testsmall, ou=system
objectclass: top
objectclass: person
cn: small
cn: test joe
cn: plumber
sn: This is a test  

dn: cn=smalljoe+cn=testsmall, ou=system
changetype: moddn
deleteoldrdn: 10
newrdn: cn=test

 

 

 

 

 

 

 


and

dn: cn=test,ou=system
changetype: modify
delete: cn
cn: joe
-

8.1 10

cn=test
objectclass: top
objectclass: person
cn: test
cn: big
sn: This is a test

cn=small+cn=test

yes no

dn: cn=test, ou=system
changetype: moddn
newrdn: cn=small+cn=test
deleteoldrdn: 1

 

 

 

 

 

 

 

 

 

0

11

dn:

cn=small+cn=test

cn=joe+cn=plumber

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

dn: cn=small+cn=test, ou=system
changetype: moddn
deleteoldrdn: 1
newrdn: test

8.2

cn=joe+cn=plumber
deleteoldrdn: 0

 

 

 

 

 

 

 

 

 

test
objectclass: top
objectclass: person
cn: test
cn: big
sn: This is a test

cn=big+cn=test+
cn=small

no

dn:

12

cn=small+cn=test

cn=joe+cn=plumber

yes

dn: cn=small+ cn=test, ou=system
changetype: moddn
newrdn: cn=joebig+cn=plumber
deleteoldrdn: 1

 

 

 

 

 

 

 

 

 

test+
cn=small
deleteoldrdn: 0

13

cn=small+cn=test

dn:

cn=big+cn=test

no

dn: +cn=small+cn=test,
ou=system
changetype objectclass: moddn top
newrdn objectclass: person
cn=: big +
cn=: test
deleteoldrdncn: 0

 

 

 

 

 

 

 

 

 

small
sn: This is a test

14

cn=small+cn=test

dn:

cn=big+cn=test

yes

dn: +cn=small+cn=test,
ou=system
changetype: moddn
deleteoldrdn: 0
newrdn: test

and

dn: cn=big+cn=test
deleteoldrdn: 1

 

 

 

 

 

 

 

 

 

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

if the newRdn is different from the existing RDN

test, ou=system
changetype: modify
cn: delete
cn: small
-

9.1

cn=test
objectclass: top
objectclass: person
cn: test
cn: big
sn: This is a test

cn=small+cn=test

yes

dn: cn=test, ou=system
changetype: moddn
newrdn: cn=small+cn=test
deleteoldrdn: 1

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

dn: cn=small+cn=test,ou=system
changetype: moddn
deleteoldrdn: 1
newrdn: test

9.2

cn=test
objectclass: top
objectclass: person
cn: test
cn: big
sn: This is a test

cn=big+cn=test+
cn=small

yes

dn: cn=test, ou=system
changetype: moddn
newrdn: cn=big+cn=test+
cn=small
deleteoldrdn: 1

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

dn: cn=big+cn=test+cn=small,
ou=system
changetype: moddn
deleteoldrdn: 0
newrdn: test

and

dn: cn=test, ou=system
changetype: modify
cn: delete
cn: small
-

10.1

cn=small+cn=test
objectclass: top
objectclass: person
cn: test
cn: big
cn: small
sn: This is a test

cn=joe+cn=plumber

no

dn: cn=small+cn=test, ou=system
changetype: moddn
newrdn: cn=joe+cn=plumber
deleteoldrdn: 0

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

dn: cn=joe+cn=plumber, ou=system
changetype: moddn
deleteoldrdn: 1
newrdn: cn=small+cn=test

10.2

cn=small+cn=test
objectclass: top
objectclass: person
cn: test
cn: big
cn: small
sn: This is a test

cn=joe+cn=big

no

dn: cn=small+cn=test, ou=system
changetype: moddn
newrdn: cn=joe+cn=big
deleteoldrdn: 0

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

dn: cn=joe+cn=big, ou=system
changetype: moddn
deleteoldrdn: 0
newrdn: cn=small+cn=test

and

dn: cn=small+cn=test, ou=system
changetype: modify
cn: delete
cn: small
-

11.1

cn=small+cn=test
objectclass: top
objectclass: person
cn: test
cn: big
cn: small
sn: This is a test

cn=joe+cn=plumber

yes

dn: cn=small+cn=test, ou=system
changetype: moddn
newrdn: cn=joe+cn=plumber
deleteoldrdn: 1

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

dn: cn=joe+cn=plumber, ou=system
changetype: moddn
deleteoldrdn: 1
newrdn: cn=small+cn=test

11.2

cn=small+cn=test
objectclass: top
objectclass: person
cn: test
cn: big
cn: small
sn: This is a test

cn=joe+cn=big

yes

dn: cn=small+cn=test, ou=system
changetype: moddn
newrdn: cn=joe+cn=big
deleteoldrdn: 1

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

dn: cn=joe+cn=big, ou=system
changetype: moddn
deleteoldrdn: 0
newrdn: cn=small+cn=test

and

dn: cn=small+cn=test, ou=system
changetype: modify
cn: delete
cn: joe
-

12.1

cn=small+cn=test
objectclass: top
objectclass: person
cn: test
cn: big
cn: small
sn: This is a test

cn=joe+cn=test

no

dn: cn=small+cn=test, ou=system
changetype: moddn
newrdn: cn=joe+cn=test
deleteoldrdn: 0

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

dn: cn=joe+cn=test, ou=system
changetype: moddn
deleteoldrdn: 1
newrdn: cn=small+cn=test

12.2

cn=small+cn=test
objectclass: top
objectclass: person
cn: test
cn: big
cn: small
sn: This is a test

cn=big+cn=test

no

dn: cn=small+cn=test, ou=system
changetype: moddn
newrdn: cn=big+cn=test
deleteoldrdn: 0

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

dn: cn=big+cn=test, ou=system
changetype: moddn
deleteoldrdn: 0
newrdn: cn=small+cn=test

13.1

cn=small+cn=test
objectclass: top
objectclass: person
cn: test
cn: big
cn: small
sn: This is a test

cn=joe+cn=test

yes

dn: cn=small+cn=test, ou=system
changetype: moddn
newrdn: cn=joe+cn=test
deleteoldrdn: 1

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

dn: cn=joe+cn=test, ou=system
changetype: moddn
deleteoldrdn: 1
newrdn: cn=small+cn=test

13.2

cn=small+cn=test
objectclass: top
objectclass: person
cn: test
cn: big
cn: small
sn: This is a test

cn=big+cn=test

yes

dn: cn=small+cn=test, ou=system
changetype: moddn
newrdn: cn=big+cn=test
deleteoldrdn: 1

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

dn: cn=big+cn=test, ou=system
changetype: moddn
deleteoldrdn: 0
newrdn: cn=small+cn=test

The following picture represent all the different cases as a decision tree :Image Added
   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