5.115.3 ProcessDirSyncSearchRequest

 procedure ProcessDirSyncSearchRequest(
   [in] searchArg:  DirSyncSearchArg,
   [in] dirSyncControlValue: DirSyncControlValue,
   [out] searchResultEntryList: SearchResultEntryList,
   [out] dirSyncResponseControl: Control
   ) : ULONG

Informative summary of behavior: The ProcessDirSyncSearchRequest procedure processes an LDAP search request with an LDAP_SERVER_DIRSYNC_OID control. It creates a list of search result entries and the LDAP_SERVER_DIRSYNC_OID response control.

 err: ULONG
 msgIn: DRS_MSG_GETCHGREQ_V10
 msgOut: DRS_MSG_GETCHGREPLY_NATIVE
 filter: LDAPString
 replFlags: ULONG
  
 /* Transform the LDAP search request with LDAP_SERVER_DIRSYNC_OID control to
    a replication GetChanges request. */
  
 err := DirSyncReqToGetChgReq(searchArg, dirSyncControlValue, msgIn)
 if err ≠ 0 then
    return err
 endif
  
 replFlags := dirSyncControlValue.flags
    
 filter := searchArg.pfilter
  
 /* Perform access checks unless client has specified object-level security */
  
 if not (LDAP_DIRSYNC_OBJECT_SECURITY in replFlags) then
    err := SecurityCheckForChanges(msgIn, filter)
    if err ≠ 0 then
       return err
    endif
 endif
  
 /* Perform normal replication (Get replication changes). */
  
 err := GetReplChanges(null, filter, replFlags, msgIn, msgOut) 
 if err ≠ 0 then
    return err
 endif
  
 /* Transform the replication GetChanges reply to reply for the LDAP search
    request with LDAP_SERVER_DIRSYNC_OID control. */
  
 err := GetChgReplyToSearchResult(msgOut, searchResultEntryList,
                                  dirSyncResponseControl)
 if err ≠ 0 then
    return err
 endif
  
 return 0 /* success */