4.1.10.6.12 ResolveNameConflict

 procedure ResolveNameConflict(
   replEntinfList: REPLENTINFLIST,
   parentObject: DSName,
   var attributesAndStamps: set of AttributeAndStamp): DN

Informative summary of behavior: The ResolveNameConflict procedure checks whether there is a name conflict (see [MS-ADTS] section 3.1.1) while applying a replicated update. If there is a name conflict, the procedure changes the desired DN of the object for which the replicated update is applied, or changes the DN of the existing object so that there is no name conflict. Following are the input parameters for this procedure:

replEntinfList: The update to be applied.

parentObject: The DSName of the parent object.

attributesAndStamps: The AttributeAndStamp set that corresponds to the replicated update (can be modified by this procedure).

  
 objectRDN: RDN
 objectDN: DN
 rdnValue: unicodestring
 duplicateObject: DSName
 nameAttrStamp: AttributeAndStamp
 guidUpdateObj: GUID
 stampExistingObj: AttributeStamp
 stampUpdateObj: AttributeStamp
  
 objectRDN := leftmost RDN of replEntinfList.Entinf.pName^.StringName
 rdnValue := AttributeValue portion of objectRDN (see [RFC2253])
 objectDN := objectRDN followed by RDNs of 
             parentObject!distinguishedName
 duplicateObject := select one d from children parentObject where 
     (d!name = rdnValue)
 if (not duplicateObject = null) and 
    (not duplicateObject!objectGUID = 
           replEntinfList.Entinf.pName^.Guid^) then
   /* There already exists a child object (duplicateObject) of 
    * parentObject whose name attribute value will be same as the name
    * attribute value of the object being renamed/added. */
   guidUpdateObj := replEntinfList.Entinf.pName^.Guid^
   nameAttrStamp := select v from attributesAndStamps where
       (v.attribute = name)
   stampUpdateObj := nameAttrStamp.stamp
   stampExistingObj := AttrStamp(duplicateObject, name)
   if   (stampExistingObj.timeChanged > stampUpdateObject.timeChanged)
     or ((stampExistingObj.timeChanged = 
            stampUpdateObject.timeChanged)
           and (existingObject!objectGUID > guidUpdateObject)) then
     /* Rename the replicated object. */
     newDN = MakeConflictDN(objectDN, guidUpdateObj)
  
     /* Remove existing attribute stamp for name and add in a new one
      * so that the update is seen as an originating update. */     
     attributesAndStamps := attributesAndStamps - {nameAttrStamp}
     nameAttrStamp := originating update stamp
            /* See MS-ADTS section 3.1.1.1.9 */
     attributeAndStamps := attributeAndStamps + {nameAttrStamp}
     return newDN
   else
     /* Rename the existing object. */
     newDN = MakeConflictDN(
               existingObject!distinguishedName, 
               existingObject!objectGUID)
     newRDN = The left most RDN of newDN
     PerformModifyDNOperation(existingObject!distinguishedName, 
         null, newRDN)
     return objectDN
   endif
 else
   return objectDN /* No conflict case */
 endif