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.

93 lines
2.7 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1993.
  5. //
  6. // File: authen.hxx
  7. //
  8. // Contents: Authenticator verification classes and code
  9. //
  10. // Classes: CAuthenticatorList
  11. //
  12. // Functions:
  13. //
  14. // History: 4-03-93 WadeR Created
  15. //
  16. //----------------------------------------------------------------------------
  17. #ifndef _INC_AUTHEN_HXX_
  18. #define _INC_AUTHEN_HXX_
  19. const ULONG uDefaultMaxCount = 1;
  20. #if DBG
  21. // 20 minutes is the default max age.
  22. const LARGE_INTEGER tsDefault = { 0, 429 };
  23. #else
  24. // 5 minutes is the default max age.
  25. const LARGE_INTEGER tsDefault = { 300ul * 10000000ul, 0 };
  26. #endif
  27. //+---------------------------------------------------------------------------
  28. //
  29. // Class: CAuthenticatorList ()
  30. //
  31. // Purpose: Keep track of authenticators, preventing replays.
  32. //
  33. // Interface:
  34. // CAuthenticatorList -- constructor, takes the max authn age.
  35. // ~CAuthenticator -- frees all resources
  36. // Check -- makes sure authenticator is OK.
  37. // Private:
  38. // _Table -- RTL_GENERIC_TABLE storing authenticators
  39. // _tsMaxAge -- Max age an auth is allowed to be.
  40. // Compare -- compares two authenticators
  41. // Allocate -- allocates memory
  42. // Free -- frees memory
  43. // Age -- deletes old authenticators.
  44. //
  45. // History: 4-04-93 WadeR Created
  46. //
  47. // Notes: Compare, Allocate and Free are static global functions.
  48. //
  49. //----------------------------------------------------------------------------
  50. class CAuthenticatorList
  51. {
  52. private:
  53. RTL_GENERIC_TABLE _Table;
  54. LARGE_INTEGER _tsMaxAge;
  55. ULONG _uMaxCount;
  56. BOOLEAN _fDebug;
  57. RTL_CRITICAL_SECTION _Mutex;
  58. ULONG Age( const LARGE_INTEGER&, const LARGE_INTEGER& );
  59. BOOLEAN _fMutexInitialized;
  60. public:
  61. CAuthenticatorList( LARGE_INTEGER = tsDefault, ULONG = uDefaultMaxCount, BOOLEAN = FALSE);
  62. ~CAuthenticatorList();
  63. KERBERR Check(
  64. IN PVOID Buffer,
  65. IN ULONG BufferLength,
  66. IN OPTIONAL PVOID OptionalBuffer,
  67. IN OPTIONAL ULONG OptionalBufferLength,
  68. IN PLARGE_INTEGER Time,
  69. IN BOOLEAN Insert,
  70. IN BOOLEAN PurgeEntry,
  71. IN BOOLEAN fCheckReplay
  72. );
  73. void SetMaxAge(
  74. IN LARGE_INTEGER MaxAge
  75. );
  76. NTSTATUS Init();
  77. };
  78. #endif // _INC_AUTHEN_HXX_