procedure NameObject(
   replEntinfList: REPLENTINFLIST,
   sourcePrefixTable: PrefixTable,
   nc: DSName,
   attributesAndStamps: set of AttributeAndStamp): DWORD

Informative summary of behavior: The NameObject procedure performs the necessary steps to identify an unused name for an object, whether it is being added new or renamed. This procedure has the following input parameters:

  • replEntinfList: The replicated update to be applied.

  • sourcePrefixTable: The prefix table from the server to translate attribute IDs.

  • nc: The root of the NC replica that is replicated.

  • attributesAndStamps: The AttributeAndStamp set that corresponds to the replicated update.

The method returns a Windows error code if it encounters an error while updating the object.

 parentObject: DSNAME 
 newParentObject: DSNAME
 parentObject := select one o from all-ts-included where 
   (o!objectGUID = replEntinfList.pParentGuid^)
 if (parentObject = null) then
   /* The client will stop processing the reply message. It will
    * resend the IDL_DRSGetNCChanges request with DRS_GET_ANC set in
    * ulFlags. It is an error for this condition to occur if the
    * request already included DRS_GET_ANC in ulFlags.
 if (not GetObjectNC(parentObject) = nc) then
   /* If parentObject exists in an NC replica other than that 
    * being replicated, the client stops processing the response.
    * This condition indicates that parentObject has moved from one
    * NC replica to another and that update has not yet been applied
    * to the client NC replica containing parentObject.
    * This will be rectified when the client replicates the NC
    * replica containing parentObject.
 /* Find an appropriate parent object for the object. If the parent
  * object is deleted and if the new object is not a deleted object
  * then FindBestParentObject will return DSName of "Lost and Found
  * container". Otherwise, the parent object will remain the same. */
 newParentObject := FindBestParentObject(parentObject, replEntinfList, 
     sourcePrefixTable, nc, attributesAndStamps)
 /* Check whether there is a name conflict (see [MS-ADTS] section 
  * 3.1.1) and resolve it before adding the object. */
 newObjectDN := ResolveNameConflict(replEntinfList, newParentObject,
     sourcePrefixTable, attributesAndStamps)
 /* Set the new DN in the ENTINF. */
 Copy the value of newObjectDN to replEntinfList.Entinf.pName^.StringName
 and update the value in replEntinfList.Entinf.pName^.structLen and 
 replEntinfList.Entinf.pName^.NameLen accordingly.