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.

73 lines
1.8 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Copyright (C) 1995, Microsoft Corporation
  4. //
  5. // File: seccache.hxx
  6. //
  7. // Contents: Security descriptor caches maps sdids to granted/denied
  8. //
  9. // Class: CSecurityCache
  10. //
  11. // History: 25-Sep-95 dlee Created
  12. // 22 Jan 96 Alanw Modified for use in user mode
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. class PCatalog;
  17. // There will almost always be just one security descriptor for the
  18. // objects returned in a given query. If there are more, the cache
  19. // will be grown.
  20. const unsigned cDefaultSecurityDescriptorEntries = 4;
  21. //+-------------------------------------------------------------------------
  22. //
  23. // Class: CSecurityCache
  24. //
  25. // Purpose: Saves results of access check calls.
  26. //
  27. // Notes:
  28. //
  29. //--------------------------------------------------------------------------
  30. class CSecurityCache
  31. {
  32. public:
  33. CSecurityCache( PCatalog & rCat );
  34. ~CSecurityCache();
  35. BOOL IsGranted( ULONG sdidOrdinal,
  36. ACCESS_MASK am );
  37. HANDLE GetToken( void ) {
  38. Win4Assert( INVALID_HANDLE_VALUE != _hToken );
  39. return _hToken;
  40. }
  41. private:
  42. BOOL _IsCached( ULONG sdidOrd, ACCESS_MASK am, BOOL & fGranted ) const;
  43. void InitToken( void );
  44. class CDescriptorEntry
  45. {
  46. public:
  47. ULONG sdidOrd;
  48. ACCESS_MASK am;
  49. BOOL fGranted;
  50. };
  51. CMutexSem _mutex;
  52. CDynArrayInPlace<CDescriptorEntry> _aEntries;
  53. HANDLE _hToken; // security token
  54. PCatalog & _Cat; // for SDID mapping
  55. };