4.1.22.2 Server Behavior of the IDL_DRSReplicaModify Method

Informative summary of behavior: The server replaces fields in the repsFrom of the specified NC replica. If ulOptions contains DRS_ASYNC_OP, the server processes the request asynchronously. The client has to include DRS_WRIT_REP in ulOptions if the specified NC replica is a full replica. The server optionally replaces (as specified by ulModifyFields) serverAddress, schedule, and replicaFlags in repsFrom with the corresponding value from pszSourceDRA, rtSchedule, and ulReplicaFlags.

 ULONG
 IDL_DRSReplicaModify(
     [in, ref] DRS_HANDLE hDrs,
     [in] DWORD dwVersion,
     [in, ref, switch_is(dwVersion)]
         DRS_MSG_REPMOD *pmsgMod);
  
 options: DRS_OPTIONS
 nc: DSName
 rf: RepsFrom
 msgIn: DRS_MSG_REPMOD_V1
  
 ValidateDRSInput(hDrs, 7)
  
 msgIn := pmsgMod^.V1
  
 /* Validate input parameters */
 if msgIn.pNC = null
    or msgIn.pNC^ = ""
    or (msgIn.pszSourceDRA = null
        and msgIn.uuidSourceDRA = null)
    or (DRS_UPDATE_ADDRESS in msgIn.ulModifyFields
        and (msgIn.pszSourceDRA = null
             or msgIn.pszSourceDRA = ""))
    or (DRS_UPDATE_SCHEDULE in msgIn.ulModifyFields
        and msgIn.rtSchedule = null)
    or msgIn.ulModifyFields = 0
    or msgIn.ulModifyFields -
       {DRS_UPDATE_ADDRESS, DRS_UPDATE_SCHEDULE, DRS_UPDATE_FLAGS}
       ≠ {}
    or msgIn.ulOptions – {DRS_ASYNC_OP} ≠ {} then
   return ERROR_DS_DRA_INVALID_PARAMETER
 endif
  
 /* Validate the specified NC */
 options := msgIn.ulOptions
 nc := msgIn.pNC^
  
 if not ObjExists(nc) then
   return ERROR_DS_DRA_BAD_NC
 endif
  
 if not AccessCheckCAR(nc, DS-Replication-Manage-Topology) then
   return ERROR_DS_DRA_ACCESS_DENIED
 endif
  
 if DRS_ASYNC_OP in options then
   Asynchronous Processing: Initiate a logical thread of control
    to process the remainder of this request asynchronously
   return 0
 endif
  
 /* Find the specified repsFrom. */
 if (msgIn.uuidSourceDRA ≠ null ) then
   rf := select one v from nc!repsFrom
     where (v.uuidDsa = msgIn.uuidSourceDRA)
 else
   rf := select one v from nc!repsFrom
     where (v.serverAddress = msgIn.pszSourceDRA)
 end if
  
 if rf = null then
   return ERROR_DS_DRA_NO_REPLICA
 endif
  
 /* Update the specified repsFrom. */
 nc!repsFrom := nc!repsFrom - {rf}
 if  DRS_UPDATE_ADDRESS in msgIn.ulModifyFields then
   rf.serverAddress := msgIn.pszSourceDRA
 endif
 if DRS_UPDATE_SCHEDULE in msgIn.ulModifyFields then
   rf.schedule := msgIn.rtSchedule
 endif
 if DRS_UPDATE_FLAGS in msgIn.ulModifyFields then
   rf.replicaFlags := msgIn.ulReplicaFlags
 endif
 nc!repsFrom := nc!repsFrom + {rf}
  
 return 0