Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

132 lines
2.5 KiB

  1. typedef struct _ADS_LDP {
  2. LIST_ENTRY List ;
  3. LPWSTR Server ;
  4. ULONG RefCount ;
  5. LUID Luid ;
  6. LUID ModifiedId;
  7. DWORD Flags ;
  8. LDAP *LdapHandle ;
  9. CCredentials *pCredentials;
  10. DWORD PortNumber;
  11. DWORD TickCount ;
  12. _ADS_LDP **ReferralEntries;
  13. DWORD nReferralEntries;
  14. BOOL fKeepAround;
  15. DWORD dwLastUsed;
  16. LIST_ENTRY ReferralList;
  17. } ADS_LDP, *PADS_LDP, *PADSLDP ;
  18. extern LUID ReservedLuid ;
  19. #define MAX_BIND_CACHE_SIZE 100
  20. #define MAX_REFERRAL_ENTRIES 32
  21. #define ENTER_BIND_CRITSECT() EnterCriticalSection(&BindCacheCritSect)
  22. #define LEAVE_BIND_CRITSECT() LeaveCriticalSection(&BindCacheCritSect)
  23. #define LDP_CACHE_INVALID (0x00000001)
  24. //
  25. // The following is used to specify ADS_AUTHENTICATION_ENUM flags
  26. // which are to be ignored when deciding whether a cached connection
  27. // can be reused. Set the bits corresponding to the flags to be ignored
  28. // to 1.
  29. //
  30. #define BIND_CACHE_IGNORED_FLAGS (ADS_FAST_BIND \
  31. | ADS_SERVER_BIND \
  32. | ADS_AUTH_RESERVED \
  33. )
  34. DWORD
  35. BindCacheAllocEntry(
  36. ADS_LDP **ppCacheEntry
  37. ) ;
  38. VOID
  39. BindCacheInvalidateEntry(
  40. ADS_LDP *pCacheEntry
  41. ) ;
  42. PADS_LDP
  43. BindCacheLookup(
  44. LPWSTR Address,
  45. LUID Luid,
  46. LUID ModifiedId,
  47. CCredentials& Credentials,
  48. DWORD dwPort
  49. ) ;
  50. BOOL
  51. CanCredentialsBeReused(
  52. CCredentials *pCachedCreds,
  53. CCredentials *pIncomingCreds
  54. );
  55. BOOL
  56. AreCredentialsExplicit(
  57. CCredentials *pCredentials
  58. );
  59. PADS_LDP
  60. GetCacheEntry(
  61. PLDAP pLdap
  62. ) ;
  63. DWORD
  64. BindCacheAdd(
  65. LPWSTR Address,
  66. LUID Luid,
  67. LUID ModifiedId,
  68. CCredentials& Credentials,
  69. DWORD dwPort,
  70. ADS_LDP *pCacheEntry
  71. ) ;
  72. DWORD
  73. BindCacheDeref(
  74. ADS_LDP *pCacheEntry
  75. ) ;
  76. DWORD
  77. BindCacheDerefHelper(
  78. ADS_LDP *pCacheEntry,
  79. LIST_ENTRY* DeleteListEntry
  80. ) ;
  81. DWORD
  82. BindCacheGetLuid(
  83. LUID *Luid,
  84. LUID *ModifiedId
  85. ) ;
  86. VOID
  87. BindCacheInit(
  88. VOID
  89. );
  90. VOID
  91. BindCacheCleanup(
  92. VOID
  93. );
  94. BOOL
  95. AddReferralLink(
  96. PADS_LDP pPrimaryEntry,
  97. PADS_LDP pNewEntry
  98. );
  99. BOOL
  100. BindCacheAddRef(
  101. ADS_LDP *pCacheEntry
  102. );
  103. //
  104. // Mark handle so that we keep it around for 5 min after
  105. // last usage and only then delete it.
  106. //
  107. HRESULT
  108. LdapcKeepHandleAround(
  109. ADS_LDP *ld
  110. );