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.

94 lines
2.9 KiB

  1. //+------------------------------------------------------------------
  2. //
  3. // Copyright (C) 1993, Microsoft Corporation.
  4. //
  5. // File: accacc.cxx
  6. //
  7. // Classes: CAccountAccess
  8. //
  9. // History: Nov-93 DaveMont Created.
  10. //
  11. //-------------------------------------------------------------------
  12. #include "pch.h"
  13. #include "accacc.hxx"
  14. #if DBG
  15. extern ULONG Debug;
  16. #endif
  17. //+---------------------------------------------------------------------------
  18. //
  19. // Member: CAccountAccess::CAccountAccess, public
  20. //
  21. // Synopsis: initializes data members, constructor will not throw
  22. //
  23. // Arguments: IN - [Name] - principal
  24. // IN - [System] - server/domain
  25. //
  26. //----------------------------------------------------------------------------
  27. CAccountAccess::CAccountAccess(LPWSTR Name, LPWSTR System)
  28. : _mask(0),
  29. _savemask(0),
  30. _foundinheritance(0),
  31. _acetype(0xff),
  32. CAccount(Name, System)
  33. {
  34. }
  35. //+---------------------------------------------------------------------------
  36. //
  37. // Member: CAccountAccess::Init, public
  38. //
  39. // Synopsis: initializes access mask
  40. //
  41. // Arguments: IN [access] - access mask
  42. // IN [dirmask] - access mask for directories
  43. // IN [filespecified] - TRUE if no ACE for files should be written
  44. //
  45. //----------------------------------------------------------------------------
  46. ULONG CAccountAccess::Init(ULONG access, ULONG dirmask, BOOL filespecified)
  47. {
  48. if (access == 0)
  49. {
  50. _savemask = GENERIC_ALL;
  51. _mask = GENERIC_ALL;
  52. _dirmask = GENERIC_ALL;
  53. _acetype = ACCESS_DENIED_ACE_TYPE;
  54. _filespecified = FALSE;
  55. } else
  56. {
  57. _acetype = ACCESS_ALLOWED_ACE_TYPE;
  58. _savemask = access;
  59. _mask = access;
  60. _dirmask = dirmask;
  61. _filespecified = filespecified;
  62. }
  63. return(ERROR_SUCCESS);
  64. }
  65. //+---------------------------------------------------------------------------
  66. //
  67. // Member: CAccountAccess::AddInheritance, public
  68. //
  69. // Synopsis: accumulates inheritance of ACEs with matching SIDS
  70. //
  71. // Arguments: inheritance flags
  72. //
  73. //--------------------------------------------------------------------
  74. void CAccountAccess::AddInheritance(BYTE Flags)
  75. {
  76. if (!(Flags & NO_PROPAGATE_INHERIT_ACE))
  77. {
  78. if (Flags & INHERIT_ONLY_ACE)
  79. {
  80. if (Flags & CONTAINER_INHERIT_ACE)
  81. _foundinheritance |= CONTAINER_INHERIT_ACE;
  82. if (Flags & OBJECT_INHERIT_ACE)
  83. _foundinheritance |= OBJECT_INHERIT_ACE;
  84. } else
  85. {
  86. _foundinheritance |= APPLIES_TO_CONTAINER;
  87. if (Flags & CONTAINER_INHERIT_ACE)
  88. _foundinheritance |= CONTAINER_INHERIT_ACE;
  89. if (Flags & OBJECT_INHERIT_ACE)
  90. _foundinheritance |= OBJECT_INHERIT_ACE;
  91. }
  92. }
  93. }