Export (0) Print
Expand All

5.114.11 GetUsnUtdVectorFromCookie

procedure GetUsnUtdVectorFromCookie(
  [in] replCookie: LDAPString,
  [in/out] nativeRequest: DRS_MSG_GETCHGREQ_V10
  ): ULONG

Informative summary of behavior: The GetUsnUtdVectorFromCookie procedure extracts the USN vector and the UTD vector from an LDAP_SERVER_DIRSYNC_OID control value (replCookie) and sets the USN vector from (nativeRequest.usnvecFrom) and UTD vector destination (nativeRequest.pUpToDateVecDest).

utdVectorSize: ULONG
minCookieLength: ULONG
/* minimum possible cookie size in bytes; that is, the size of a cookie
when a UTD vector is not present in the cookie. */

minCookieLength := 17*4

/* Validate cookie, and extract USN and UTD vectors. */
If (replCookie.length ≠ 0) then
   If (replCookie.length < minCookieLength) 
      or
      (replCookie.value.signature ≠ "SDSM")
      or
      (replCookie.value.version ≠ 3) 

      return protocolError
   endif

   utdVectorSize := replCookie.value.utdVectorSize
   if (utdVectorSize < sizeof(UPTODATE_VECTOR_V1_EXT)
       or
       replCookie.length < minCookieLength +
                           utdVectorSize) then
      utdVectorSize := 0
   endif

   if (replCookie.value.uuidSourceDsaInvocationId =
                                   DSAObj()!invocationId) then
      nativeRequest.usnvecFrom := replCookie.value.usnVector
   endif

   if (utdVectorSize > 0) then
      Copy utdVectorSize bytes from replCookie.value.utdVector
           to nativeRequest.pUpToDateVecDest

      /* some more validation */
      if (nativeRequest.pUpToDateVecDest.dwVersion ≠ 1
          or
          16 /* (offsetof(UPTODATE_VECTOR,V1.rgCursors[0]) */
           + (nativeRequest.pUpToDateVecDest.V1.cNumCursors 
              * sizeof(UPTODATE_CURSOR_V1))) ≠ utdVectorSize
          or
          replCookie.length ≠ minCookieLength
                              + utdVectorSize) then
          return protocolError
       endif
   Endif
endif

return 0 /* success */
 
Show:
© 2014 Microsoft