Source code of Windows XP (NT5)
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.

87 lines
2.4 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. #if DBG
  20. // 20 minutes is the default max age.
  21. const LARGE_INTEGER tsDefault = { 0, 429 };
  22. #else
  23. // 5 minutes is the default max age.
  24. const LARGE_INTEGER tsDefault = { 300ul * 10000000ul, 0 };
  25. #endif
  26. //+---------------------------------------------------------------------------
  27. //
  28. // Class: CAuthenticatorList ()
  29. //
  30. // Purpose: Keep track of authenticators, preventing replays.
  31. //
  32. // Interface:
  33. // CAuthenticatorList -- constructor, takes the max authn age.
  34. // ~CAuthenticator -- frees all resources
  35. // Check -- makes sure authenticator is OK.
  36. // Private:
  37. // _Table -- RTL_GENERIC_TABLE storing authenticators
  38. // _tsMaxAge -- Max age an auth is allowed to be.
  39. // Compare -- compares two authenticators
  40. // Allocate -- allocates memory
  41. // Free -- frees memory
  42. // Age -- deletes old authenticators.
  43. //
  44. // History: 4-04-93 WadeR Created
  45. //
  46. // Notes: Compare, Allocate and Free are static global functions.
  47. //
  48. //----------------------------------------------------------------------------
  49. class CAuthenticatorList
  50. {
  51. private:
  52. RTL_GENERIC_TABLE _Table;
  53. LARGE_INTEGER _tsMaxAge;
  54. RTL_CRITICAL_SECTION _Mutex;
  55. ULONG Age( const LARGE_INTEGER& );
  56. public:
  57. CAuthenticatorList( LARGE_INTEGER = tsDefault);
  58. ~CAuthenticatorList();
  59. KERBERR Check(
  60. IN PVOID Buffer,
  61. IN ULONG BufferLength,
  62. IN OPTIONAL PVOID OptionalBuffer,
  63. IN OPTIONAL ULONG OptionalBufferLength,
  64. IN PLARGE_INTEGER Time,
  65. IN BOOLEAN Insert
  66. );
  67. LARGE_INTEGER GetMaxAge() const
  68. { return _tsMaxAge; };
  69. void SetMaxAge(
  70. IN LARGE_INTEGER MaxAge
  71. );
  72. };
  73. #endif // _INC_AUTHEN_HXX_