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.

1399 lines
41 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows NT **/
  3. /** Copyright(c) Microsoft Corp., 1992 **/
  4. /**********************************************************************/
  5. /*
  6. Security.hxx
  7. This file contains wrapper classes for the Win32 security structures.
  8. Specifically: ACL, SECURITY_DESCRIPTOR, SECURITY_DESCRIPTOR_CONTROL,
  9. and SID. The wrapper classes follow the same name except the class
  10. names will begin with an "OS_".
  11. FILE HISTORY:
  12. Johnl 03-Dec-1991 Created
  13. JohnL 09-Mar-1992 Code review changes
  14. Thomaspa 09-Apr-1992 Added OS_SID::Compare()
  15. JonN 30-Oct-1992 Added OS_SID::QueryLastSubAuthority()
  16. */
  17. #ifndef _SECURITY_HXX_
  18. #define _SECURITY_HXX_
  19. #include "uibuffer.hxx"
  20. /* This error code is returned from the OS_DACL_SUBJECT_ITER and the
  21. * OS_SACL_SUBJECT_ITER when the iterator encounters an ACL that does
  22. * not follow the form of (Deny All)* | (Grants)* or when an unrecognized
  23. * ACE is encountered.
  24. */
  25. #define IERR_UNRECOGNIZED_ACL 14355
  26. // DbgPrint() declaration macro.
  27. #if defined(DEBUG)
  28. #define DBG_PRINT_SEC_IMPLEMENTATION { _DbgPrint(); }
  29. #else
  30. #define DBG_PRINT_SEC_IMPLEMENTATION { ; }
  31. #endif
  32. #define DECLARE_DBG_PRINT_SEC \
  33. void _DbgPrint () const ; \
  34. void DbgPrint () const DBG_PRINT_SEC_IMPLEMENTATION
  35. /*************************************************************************
  36. NAME: OS_OBJECT_WITH_DATA
  37. SYNOPSIS: Base class for all OS_* wrapper classes that potentially
  38. contain their own data (as opposed to pointing at somebody
  39. elses). This is just a convenient place to declare the
  40. BUFFER (as opposed to doing it in each class).
  41. INTERFACE:
  42. PARENT: BASE
  43. USES: BUFFER
  44. CAVEATS:
  45. NOTES:
  46. HISTORY:
  47. Johnl 10-Dec-1991 Created
  48. **************************************************************************/
  49. DLL_CLASS OS_OBJECT_WITH_DATA : public BASE
  50. {
  51. private:
  52. BUFFER _buffOSData ;
  53. protected:
  54. OS_OBJECT_WITH_DATA( UINT cbInitSize = 0 ) ;
  55. ~OS_OBJECT_WITH_DATA() ;
  56. void * QueryPtr( void ) const
  57. { return _buffOSData.QueryPtr() ; }
  58. UINT QueryAllocSize( void ) const
  59. { return _buffOSData.QuerySize() ; }
  60. APIERR Resize( UINT uiNewSize )
  61. { return _buffOSData.Resize( uiNewSize ) ; }
  62. } ;
  63. DLL_CLASS OS_SECURITY_DESCRIPTOR ; // Forward reference
  64. /*************************************************************************
  65. NAME: OS_SID
  66. SYNOPSIS: Wrapper class for an NT SID
  67. INTERFACE:
  68. PARENT: OS_OBJECT_WITH_DATA
  69. USES:
  70. CAVEATS:
  71. NOTES:
  72. HISTORY:
  73. Johnl 09-Dec-1991 Created
  74. **************************************************************************/
  75. DLL_CLASS OS_SID : public OS_OBJECT_WITH_DATA
  76. {
  77. private:
  78. /* This pointer will be aliased either to our internal data buffer
  79. * or to the SID the user passed in.
  80. */
  81. PSID _psid ;
  82. OS_SECURITY_DESCRIPTOR * _pOwner ;
  83. protected:
  84. BOOL IsOwnerAlloc( void ) const
  85. { return ((void *)_psid) != QueryPtr() ; }
  86. public:
  87. OS_SID( PSID psid = NULL,
  88. BOOL fCopy = FALSE,
  89. OS_SECURITY_DESCRIPTOR * pOwner = NULL ) ;
  90. /* Builds a fully qualifed sid from the domain SID and the Relative ID
  91. * of the account in the domain.
  92. */
  93. OS_SID( PSID psidDomain,
  94. ULONG ridAccount,
  95. OS_SECURITY_DESCRIPTOR * pOwner = NULL ) ;
  96. ~OS_SID() ;
  97. /* Returns TRUE if NT thinks this is a valid SID.
  98. */
  99. BOOL IsValid( void ) const ;
  100. /* Returns the size of this SID in bytes. If the SID is not valid, then
  101. * zero is returned.
  102. */
  103. ULONG QueryLength( void ) const ;
  104. /* Places the text string of the Identifier Authority into *pnlsRawID.
  105. * The text string will look something like "1-5-17"
  106. */
  107. APIERR QueryRawID( NLS_STR * pnlsRawID ) const ;
  108. /* Retrieves a user/group name suitable for user consumption.
  109. * If the account is on a remote machine, then pszServer must
  110. * be filled with the remote machine name.
  111. *
  112. * psidFocusedDomain - The doamin SID that the name should be qualified in
  113. * relation to. Defaults to the current user's logged on domain if
  114. * NULL.
  115. *
  116. * OR
  117. *
  118. * pszFocus - indicates how the name should be qualified. If pszFocus
  119. * is NULL, then the focus is assumed to be pszServer. Note that
  120. * this form simply opens up an LSAPolicy and gets the domain sid
  121. * that pszFocus points to (this you should avoid using this form).
  122. */
  123. APIERR QueryName( NLS_STR * pnlsUserName,
  124. const TCHAR * pszServer = NULL,
  125. PSID psidFocusedDomain = NULL ) const ;
  126. #if 0
  127. //
  128. // Nobody should need this form, undef if you do
  129. //
  130. APIERR QueryName( NLS_STR * pnlsUserName,
  131. const TCHAR * pszServer = NULL,
  132. const TCHAR * pszFocus = NULL ) const ;
  133. #endif //0
  134. /* Returns a pointer to the ith sub-authority in this SID.
  135. * An error is returned if you request a sub-authority that is
  136. * out of range.
  137. */
  138. APIERR QuerySubAuthority( UCHAR iSubAuthority,
  139. PULONG * ppulSubAuthority ) const ;
  140. /* Returns a pointer to the count field of of sub-authorities for this
  141. * SID.
  142. */
  143. APIERR QuerySubAuthorityCount( UCHAR * * ppcSubAuthority ) const ;
  144. /* Returns the last SubAuthority, which is the RID for user, group and
  145. * alias SIDs.
  146. */
  147. APIERR QueryLastSubAuthority( PULONG * ppulSubAuthority ) const;
  148. /* Removes the last SubAuthority. This will change user, group and
  149. * alias SIDs into the SID for their domain.
  150. */
  151. APIERR TrimLastSubAuthority( ULONG * pulLastSubAuthority = NULL );
  152. BOOL operator==( const OS_SID & ossid ) const ;
  153. int Compare( const OS_SID * possid ) const
  154. { return ( *this == *possid ? 0 : 1 ); }
  155. APIERR Copy( const OS_SID & ossid ) ;
  156. /* This method can be used to initialize a chunk of memory to a valid
  157. * SID format.
  158. */
  159. static void InitializeMemory( void * pMemToInitAsSID ) ;
  160. APIERR SetPtr( PSID psid ) ;
  161. DECLARE_DBG_PRINT_SEC
  162. /* Conversion operators
  163. */
  164. operator PSID () const
  165. { return _psid ; }
  166. PSID QueryPSID( void ) const
  167. { return _psid ; }
  168. /* Don't use this, use QueryPSID (same thing, just clearer name)
  169. */
  170. PSID QuerySid( void ) const
  171. { return _psid ; }
  172. } ;
  173. /*************************************************************************
  174. NAME: OS_SECURITY_DESCRIPTOR_CONTROL
  175. SYNOPSIS: Simple wrapper class for Win32 SECURITY_DESCRIPTOR_CONTROL
  176. INTERFACE:
  177. PARENT:
  178. USES:
  179. CAVEATS: The third constructor can be used to operate on a
  180. SECURITY_DESCRIPTOR_CONTROL thing in place, however the user
  181. should ensure that the memory being operated on "in place"
  182. should hang around till this object is destructed.
  183. NOTES:
  184. HISTORY:
  185. Johnl 03-Dec-1991 Created
  186. **************************************************************************/
  187. DLL_CLASS OS_SECURITY_DESCRIPTOR_CONTROL
  188. {
  189. private:
  190. /* Don't reference this member!! Reference _psecesccont.
  191. */
  192. SECURITY_DESCRIPTOR_CONTROL _secdesccont ;
  193. /* This pointer will either be aliased to _secdesccont or else
  194. * to the PSECURITY_DESCRIPTOR_CONTROL the user constructs this object
  195. * with.
  196. *
  197. * All operations should be performed on *_psecdesccont.
  198. */
  199. PSECURITY_DESCRIPTOR_CONTROL _psecdesccont ;
  200. public:
  201. OS_SECURITY_DESCRIPTOR_CONTROL( SECURITY_DESCRIPTOR_CONTROL secdesccont )
  202. : _secdesccont( secdesccont ),
  203. _psecdesccont( &_secdesccont )
  204. { ; }
  205. OS_SECURITY_DESCRIPTOR_CONTROL( PSECURITY_DESCRIPTOR_CONTROL psecdesccont = NULL )
  206. : _secdesccont( 0 ),
  207. _psecdesccont( psecdesccont==NULL ? &_secdesccont : psecdesccont )
  208. { ; }
  209. /* IsXXX Methods
  210. */
  211. BOOL IsOwnerDefaulted( void ) const
  212. { return !!(*_psecdesccont & SE_OWNER_DEFAULTED) ; }
  213. BOOL IsGroupDefaulted( void ) const
  214. { return !!(*_psecdesccont & SE_GROUP_DEFAULTED) ; }
  215. BOOL IsDACLPresent( void ) const
  216. { return !!(*_psecdesccont & SE_DACL_PRESENT) ; }
  217. BOOL IsDACLDefaulted( void ) const
  218. { return !!(*_psecdesccont & SE_DACL_DEFAULTED) ; }
  219. BOOL IsSACLPresent( void ) const
  220. { return !!(*_psecdesccont & SE_SACL_PRESENT) ; }
  221. BOOL IsSACLDefaulted( void ) const
  222. { return !!(*_psecdesccont & SE_SACL_DEFAULTED) ; }
  223. BOOL IsSelfRelative( void ) const
  224. { return !!(*_psecdesccont & SE_SELF_RELATIVE) ; }
  225. /* Conversion operators
  226. */
  227. operator PSECURITY_DESCRIPTOR_CONTROL() const
  228. { return _psecdesccont ; }
  229. operator SECURITY_DESCRIPTOR_CONTROL() const
  230. { return *_psecdesccont ; }
  231. PSECURITY_DESCRIPTOR_CONTROL QueryControl( void ) const
  232. { return _psecdesccont ; }
  233. } ;
  234. /*************************************************************************
  235. NAME: OS_SECURITY_INFORMATION
  236. SYNOPSIS: Simple wrapper class for SECURITY_INFORMATION structure
  237. INTERFACE:
  238. PARENT:
  239. USES:
  240. CAVEATS: The third constructor can be used to operate on a
  241. SECURITY_INFORMATION thing in place, however the user
  242. should ensure that the memory being operated on "in place"
  243. should hang around till this object is destructed.
  244. NOTES:
  245. HISTORY:
  246. Johnl 03-Dec-1991 Created
  247. **************************************************************************/
  248. DLL_CLASS OS_SECURITY_INFORMATION
  249. {
  250. private:
  251. /* Don't reference this member! Dereference _psecinformation!!
  252. */
  253. SECURITY_INFORMATION _secinformation ;
  254. /* This pointer will either be aliased to _secinformation or else
  255. * to the PSECURITY_INFORMATION the user constructs this object with.
  256. *
  257. * All operations should be performed on *_psecinformation.
  258. */
  259. PSECURITY_INFORMATION _psecinformation ;
  260. public:
  261. OS_SECURITY_INFORMATION( SECURITY_INFORMATION secinformation = 0 )
  262. : _secinformation( secinformation ),
  263. _psecinformation( &_secinformation )
  264. { ; }
  265. /* This constructor uses the memory pointed at by psecinformation.
  266. * Beware that what we are pointing at doesn't go out of scope or
  267. * otherwise deleted before this object is destructed.
  268. */
  269. OS_SECURITY_INFORMATION( PSECURITY_INFORMATION psecinformation )
  270. : _secinformation( (SECURITY_INFORMATION)0 ),
  271. _psecinformation( psecinformation )
  272. { ; }
  273. /* Boolean query methods
  274. */
  275. BOOL IsOwnerReferenced( void ) const
  276. { return !!(*_psecinformation & OWNER_SECURITY_INFORMATION) ; }
  277. BOOL IsGroupReferenced( void ) const
  278. { return !!(*_psecinformation & GROUP_SECURITY_INFORMATION) ; }
  279. BOOL IsDACLReferenced( void ) const
  280. { return !!(*_psecinformation & DACL_SECURITY_INFORMATION) ; }
  281. BOOL IsSACLReferenced( void ) const
  282. { return !!(*_psecinformation & SACL_SECURITY_INFORMATION) ; }
  283. /* These methods indicate that the object this SECURITY_INFORMATION
  284. * object is associated with references the type specified in the
  285. * method name.
  286. *
  287. * These use "if" instead of the ternary operator because CFront chokes
  288. * on the expression.
  289. */
  290. void SetOwnerReference( BOOL fOwner = TRUE )
  291. { if (fOwner) *_psecinformation |= OWNER_SECURITY_INFORMATION ;
  292. else *_psecinformation &= ~OWNER_SECURITY_INFORMATION; }
  293. void SetGroupReference( BOOL fGroup = TRUE )
  294. { if (fGroup) *_psecinformation |= GROUP_SECURITY_INFORMATION ;
  295. else *_psecinformation &= ~GROUP_SECURITY_INFORMATION; }
  296. void SetDACLReference( BOOL fDACL = TRUE )
  297. { if (fDACL) *_psecinformation |= DACL_SECURITY_INFORMATION ;
  298. else *_psecinformation &= ~DACL_SECURITY_INFORMATION; }
  299. void SetSACLReference( BOOL fSACL = TRUE )
  300. { if ( fSACL ) *_psecinformation |= SACL_SECURITY_INFORMATION ;
  301. else *_psecinformation &= ~SACL_SECURITY_INFORMATION; }
  302. /* Conversion operators
  303. */
  304. operator PSECURITY_INFORMATION() const
  305. { return _psecinformation ; }
  306. operator SECURITY_INFORMATION() const
  307. { return *_psecinformation ; }
  308. PSECURITY_INFORMATION QuerySecurityInformation( void ) const
  309. { return _psecinformation ; }
  310. } ;
  311. /*************************************************************************
  312. NAME: OS_ACE
  313. SYNOPSIS: Wrapper class around an NT ACE
  314. INTERFACE:
  315. PARENT: OS_OBJECT_WITH_DATA
  316. USES: OS_SID
  317. CAVEATS: Since there is no PACE generic type, you will need to
  318. cast the PACCESS_ALLOWED_ACE etc. to (void *) and cast
  319. it again when doing the QueryPtr back to the ACE type.
  320. NOTES: A hierarchy of ACEs are not built up around the OS_ACE since
  321. this is a simple wrapper class. Because of this, QueryType
  322. may return unrecognized types in the future (currently there
  323. are only four defined ACE types).
  324. HISTORY:
  325. Johnl 11-Dec-1991 Created
  326. **************************************************************************/
  327. DLL_CLASS OS_ACE : public OS_OBJECT_WITH_DATA
  328. {
  329. private:
  330. /* Aliased to our data buffer or to an external ACE if the user passed in
  331. * a non-null ACE pointer.
  332. */
  333. PACE_HEADER _pACEHeader ;
  334. /* An ACE contains a SID as part of the ACE, this guy will point
  335. * to this ACE's SID.
  336. */
  337. OS_SID * _possid ;
  338. protected:
  339. BOOL IsOwnerAlloc( void ) const
  340. { return ((void *)_pACEHeader) != QueryPtr() ; }
  341. void * QuerySIDMemory( void ) const ;
  342. public:
  343. OS_ACE( void * pACE = NULL ) ;
  344. ~OS_ACE() ;
  345. /* Query methods about the ACE Header
  346. */
  347. UCHAR QueryType( void ) const
  348. { return _pACEHeader->AceType ; }
  349. WORD QuerySize( void ) const
  350. { return _pACEHeader->AceSize ; }
  351. UCHAR QueryAceFlags( void ) const
  352. { return _pACEHeader->AceFlags ; }
  353. /* Returns the revision level the class OS_ACE operates at (*not* what
  354. * level *this* ACE is at).
  355. */
  356. static ULONG QueryRevision() ;
  357. /* Query methods on the ACE type specific fields. An assertion error
  358. * will occur if these methods are called on an ACE that doesn't have
  359. * the data item queried for or the ACE type is unrecognized.
  360. *
  361. * Note that currently, all known ACEs have exactly these two data members.
  362. */
  363. ACCESS_MASK QueryAccessMask( void ) const ;
  364. APIERR QuerySID( OS_SID * * ppossid ) const ;
  365. /* Returns a pointer to the ACE. Note it will need to be cast
  366. * to the appropriate ACE type.
  367. */
  368. void * QueryACE( void ) const
  369. { return (void *) _pACEHeader ; }
  370. BOOL IsInherittedByNewObjects( void ) const
  371. { return !!( _pACEHeader->AceFlags & OBJECT_INHERIT_ACE) ; }
  372. BOOL IsInherittedByNewContainers( void ) const
  373. { return !!( _pACEHeader->AceFlags & CONTAINER_INHERIT_ACE) ; }
  374. /* The single '!' is correct
  375. */
  376. BOOL IsInheritancePropagated( void ) const
  377. { return !( _pACEHeader->AceFlags & NO_PROPAGATE_INHERIT_ACE) ; }
  378. BOOL IsInheritOnly( void ) const
  379. { return !!( _pACEHeader->AceFlags & INHERIT_ONLY_ACE) ; }
  380. BOOL IsKnownACE( void ) const
  381. { return ( (QueryType() == ACCESS_ALLOWED_ACE_TYPE) ||
  382. (QueryType() == ACCESS_DENIED_ACE_TYPE) ||
  383. (QueryType() == SYSTEM_AUDIT_ACE_TYPE) ||
  384. (QueryType() == SYSTEM_ALARM_ACE_TYPE) ) ;
  385. }
  386. /* SetXXX Methods
  387. */
  388. void SetAccessMask( ACCESS_MASK accmask ) ;
  389. APIERR SetSID( const OS_SID & ossid ) ;
  390. void SetType( UCHAR ucType )
  391. { _pACEHeader->AceType = ucType ; }
  392. void SetInheritFlags( UCHAR ucInheritFlags )
  393. { _pACEHeader->AceFlags = (( _pACEHeader->AceFlags & ~VALID_INHERIT_FLAGS)
  394. | ucInheritFlags) ; }
  395. void SetAceFlags( UCHAR ucFlags )
  396. { _pACEHeader->AceFlags = ucFlags ; }
  397. /* Resizes the ACE, sets the ACE's size field and reallocates memory
  398. * if necessary.
  399. */
  400. APIERR SetSize( UINT cbSize ) ;
  401. void SetInherittedByNewObjects( BOOL fInherittedByObjects = TRUE )
  402. { fInherittedByObjects ? (_pACEHeader->AceFlags |= OBJECT_INHERIT_ACE)
  403. : (_pACEHeader->AceFlags &= ~OBJECT_INHERIT_ACE) ; }
  404. void SetInherittedByNewContainers( BOOL fInherittedByContainers = TRUE )
  405. { fInherittedByContainers ? (_pACEHeader->AceFlags|=CONTAINER_INHERIT_ACE)
  406. : (_pACEHeader->AceFlags &= ~CONTAINER_INHERIT_ACE) ; }
  407. void SetInheritancePropagated( BOOL fInheritancePropagated = TRUE )
  408. { fInheritancePropagated ? (_pACEHeader->AceFlags|=NO_PROPAGATE_INHERIT_ACE)
  409. : (_pACEHeader->AceFlags &= ~NO_PROPAGATE_INHERIT_ACE) ; }
  410. void SetInheritOnly( BOOL fInheritOnly = TRUE )
  411. { fInheritOnly ? (_pACEHeader->AceFlags |= INHERIT_ONLY_ACE)
  412. : (_pACEHeader->AceFlags &= ~INHERIT_ONLY_ACE) ; }
  413. DECLARE_DBG_PRINT_SEC
  414. /* Sets the ACE this OS_ACE is operating on. The ACE pace points to
  415. * must be a valid ACE.
  416. */
  417. APIERR SetPtr( void * pace ) ;
  418. } ;
  419. /*************************************************************************
  420. NAME: OS_ACL
  421. SYNOPSIS: Wrapper class for an NT ACL
  422. INTERFACE:
  423. PARENT: OS_OBJECT_WITH_DATA
  424. USES:
  425. CAVEATS: The allocation size (in OS_OBJECT_WITH_DATA) should
  426. correspond to the AclSize field in the ACL Header.
  427. If one is changed, then the other should be changed.
  428. NOTES:
  429. HISTORY:
  430. Johnl 05-Dec-1991 Created
  431. **************************************************************************/
  432. DLL_CLASS OS_ACL : public OS_OBJECT_WITH_DATA
  433. {
  434. private:
  435. /* Aliased to our internal buffer or to an external ACL if the user
  436. * passed in a non-null ACL pointer.
  437. */
  438. PACL _pACL ;
  439. OS_SECURITY_DESCRIPTOR * _pOwner ;
  440. protected:
  441. BOOL IsOwnerAlloc( void ) const
  442. { return ((void *)_pACL) != QueryPtr() ; }
  443. /* Sets a new size in the ACE Header and reallocates memory if necessary
  444. * and possible.
  445. */
  446. APIERR SetSize( UINT cbNewACLSize, BOOL fForceToNonOwnerAlloced = FALSE) ;
  447. public:
  448. OS_ACL( PACL pACL = NULL,
  449. BOOL fCopy = FALSE,
  450. OS_SECURITY_DESCRIPTOR * pOwner = NULL ) ;
  451. ~OS_ACL() ;
  452. BOOL IsValid( void ) const ;
  453. APIERR QuerySizeInformation( ACL_SIZE_INFORMATION * paclsizeinfo ) const ;
  454. APIERR QueryBytesInUse( PULONG pcbBytesInUse ) const ;
  455. APIERR QueryACECount( PULONG pcAces ) const ;
  456. /* The ACE is *copied* into this ACL. Note that you should avoid
  457. * doing a QueryACE (which references the real ACL) then an AddACE, as
  458. * you will have duplicate ACEs in this ACL. This does not *replace*
  459. * the ace at iAce, it inserts it at that position.
  460. *
  461. * Specify MAXULONG for iAce to append the ACE in the ACL.
  462. */
  463. APIERR AddACE( ULONG iAce, const OS_ACE & posace ) ;
  464. /* The client will declare an OS_ACE and pass its address here. This
  465. * is so we don't have to create one or keep an artificial array laying
  466. * around. The ACE returned will operate on the real ACE in this ACL.
  467. */
  468. APIERR QueryACE( ULONG iAce, OS_ACE * posace ) const ;
  469. APIERR DeleteACE( ULONG iAce ) ;
  470. /* Copies osaclSrc into *this. *this may change from owner ACL to non-
  471. * owner alloced if necessary.
  472. */
  473. APIERR Copy( const OS_ACL & osaclSrc, BOOL fForceToNonOwnerAlloced = TRUE);
  474. /* Search for the next ACE starting at iStart that contains the SID
  475. * equal to ossidKey. If found, pfFound will be set to TRUE, posace
  476. * will point to the found ACE and piAce will contain the index of
  477. * the ACE in the ACL. If an error occurs or pfFound is FALSE, then
  478. * posace and piAce should be ignored.
  479. */
  480. APIERR FindACE( const OS_SID & ossidKey,
  481. BOOL * pfFound,
  482. OS_ACE * posace,
  483. PULONG piAce,
  484. ULONG iStart = 0 ) const ;
  485. DECLARE_DBG_PRINT_SEC
  486. /* Conversion operators
  487. */
  488. operator PACL() const
  489. { return _pACL ; }
  490. operator ACL() const
  491. { return *_pACL ; }
  492. PACL QueryAcl( void ) const
  493. { return _pACL ; }
  494. } ;
  495. /*************************************************************************
  496. NAME: OS_SECURITY_DESCRIPTOR
  497. SYNOPSIS: Simple Wrapper class for Windows SECURITY_DESCRIPTOR object
  498. INTERFACE:
  499. PARENT: OS_OBJECT_WITH_DATA
  500. USES: OS_ACL, OS_SECURITY_DESCRIPTOR_CONTROL
  501. CAVEATS:
  502. NOTES: This class is meant to be used in two ways:
  503. 1) As a method for accessing an existing
  504. security descriptor. This is indicated by passing a
  505. non-Null PSECURITY_DESCRIPTOR to the constructor. If
  506. you do this, then you can only use the Query methods
  507. and a couple of the set methods (you CANNOT use the
  508. SetDACL, SetSACL, SetOwner and SetGroup methods).
  509. 2) As a way to build a security descriptor from scratch.
  510. When you want to build one from scratch, pass in a
  511. NULL security descriptor and one will be created for
  512. you. It will be initialized to contain nothing.
  513. The reason for the above restrictions is because a security
  514. descriptor only contains references to its ACLs, Owner and
  515. Group, thus this causes a memory ownership problem. When
  516. we own the memory, then you can do anything you want. When
  517. somebody else owns the memory, then we can only query its
  518. contents.
  519. HISTORY:
  520. Johnl 04-Dec-1991 Created
  521. **************************************************************************/
  522. DLL_CLASS OS_SECURITY_DESCRIPTOR : public OS_OBJECT_WITH_DATA
  523. {
  524. /* Give access to method UpdateReferencedSecurityObject
  525. */
  526. friend class OS_ACL ;
  527. friend class OS_SID ;
  528. private:
  529. /* Aliased to _buffSecDescData or an external PSECURITY_DESCRIPTOR.
  530. */
  531. PSECURITY_DESCRIPTOR _psecuritydesc ;
  532. /* This member should be updated everytime a set method occurs. This is
  533. * due to not being able to directly access the
  534. * SECURITY_DESCRIPTOR_CONTROL, we can only copy it (and we can't
  535. * set it).
  536. */
  537. SECURITY_DESCRIPTOR_CONTROL _secdesccont ;
  538. /* This member will be aliased to _secdescont, thus the query methods
  539. * will always be up to date.
  540. */
  541. OS_SECURITY_DESCRIPTOR_CONTROL _osSecDescControl ;
  542. /* These will be "newed" as necessary (i.e., if the corresponding
  543. * member is contained in this SECURITY_DESCRIPTOR).
  544. */
  545. OS_ACL * _posaclDACL ;
  546. OS_ACL * _posaclSACL ;
  547. OS_SID * _possidOwner ;
  548. OS_SID * _possidGroup ;
  549. protected:
  550. BOOL IsOwnerAlloc( void ) const
  551. { return ((void *)_psecuritydesc) != QueryPtr() ; }
  552. /* Forces an update of the _secdesccont from the active security
  553. * descriptor. Note that this should be called after any changes
  554. * to the security descriptor.
  555. */
  556. APIERR UpdateControl( void ) ;
  557. /* This method is called by the private members _posaclDACL, _posaclSACL,
  558. * _possidOwner or _possidGroup when the member's "base" memory (i.e.,
  559. * where the actual data is stored) gets changed due to resizing etc.
  560. * This is necessary to keep the security descriptor pointers valid.
  561. *
  562. * An example of why this is needed: We hand out the pointers to the
  563. * OS_DACL for instance, someone directly manipulates the OS_DACL (adds
  564. * an ACE which causes a reallocation which causes the ACL to move in
  565. * memory). The security descriptor in *this is now out of date, thus
  566. * the OS_DACL (and other security classes) has to call this method
  567. * to resync the two objects.
  568. */
  569. APIERR UpdateReferencedSecurityObject( OS_OBJECT_WITH_DATA * posobj ) ;
  570. public:
  571. OS_SECURITY_DESCRIPTOR( PSECURITY_DESCRIPTOR psecuritydesc = NULL,
  572. BOOL fCopy = FALSE ) ;
  573. ~OS_SECURITY_DESCRIPTOR() ;
  574. /* Queries the security descriptor control of this security descriptor.
  575. * The only way to change the security
  576. * control method is with the SetXXX methods below.
  577. */
  578. const OS_SECURITY_DESCRIPTOR_CONTROL * QueryControl( void ) const
  579. { return &_osSecDescControl ; }
  580. /* The following query methods determine if the specified component
  581. * is present and if it is, retrieves it. The first PBOOL parameter
  582. * will be set to TRUE if the component is present. If it is set to
  583. * FALSE, then the rest of the parameters should be ignored.
  584. *
  585. * For the QueryDACL/SACL methods, *ppOSACL may be set to NULL, which
  586. * means the ACL is empty.
  587. */
  588. APIERR QueryDACL( PBOOL pfDACLPresent,
  589. OS_ACL * * ppOSACL,
  590. PBOOL pfDACLDefaulted = NULL
  591. ) const ;
  592. APIERR QuerySACL( PBOOL pfSACLPresent,
  593. OS_ACL * * pOSACL,
  594. PBOOL pfSACLDefaulted = NULL
  595. ) const ;
  596. APIERR QueryGroup( PBOOL pfContainsGroup,
  597. OS_SID * * ppOSSID,
  598. PBOOL pfGroupDefaulted = NULL
  599. ) const ;
  600. APIERR QueryOwner( PBOOL pfContainsOwner,
  601. OS_SID * * ppOSSID,
  602. PBOOL pfGroupDefaulted = NULL
  603. ) const ;
  604. /* Returns the number of bytes this security descriptor uses. Asserts
  605. * out if the security descriptor is invalid.
  606. */
  607. ULONG QuerySize( void ) const ;
  608. /* Returns TRUE if the current security descriptor is valid
  609. */
  610. BOOL IsValid( void ) const ;
  611. BOOL IsOwnerPresent( void ) const
  612. { return _possidOwner != NULL ; }
  613. BOOL IsGroupPresent( void ) const
  614. { return _possidGroup != NULL ; }
  615. BOOL IsDACLPresent( void ) const
  616. { return QueryControl()->IsDACLPresent() ; }
  617. BOOL IsSACLPresent( void ) const
  618. { return QueryControl()->IsSACLPresent() ; }
  619. /* Sets the DACL, SACL, Owner and primary group on this security
  620. * descriptor. The primary item is copied, thus for items like
  621. * ACLs, it is recommended you avoid SetXXXs unless necessary because
  622. * of the hit for the memory copy. The SECURITY_INFORMATION and
  623. * SECURITY_DESCRIPTOR_CONTROL flags will be set accordingly after
  624. * each set.
  625. *
  626. * fD/SACLPresent - If set to TRUE indicates the ACL is present,
  627. * if set to FALSE, the D/SACL present flag is set to
  628. * FALSE and the rest of the parameters are ignored.
  629. * pOSACL - Pointer to D/SACL to set for this security descriptor.
  630. * fD/SACLDefaulted - If set to TRUE, indicates the ACL was chosen from
  631. * some default resource, should normally be FALSE.
  632. *
  633. */
  634. APIERR SetDACL( BOOL fDACLPresent,
  635. const OS_ACL * posacl,
  636. BOOL fDACLDefaulted = FALSE
  637. ) ;
  638. APIERR SetSACL( BOOL fSACLPresent,
  639. const OS_ACL * posacl,
  640. BOOL fSACLDefaulted = FALSE
  641. ) ;
  642. /* Note that setting the owner or group to be not present will make this
  643. * an "incomplete" security descriptor that AccessCheck will puke all over.
  644. */
  645. APIERR SetOwner( BOOL fOwnerPresent,
  646. const OS_SID * possid,
  647. BOOL fOwnerDefaulted = FALSE
  648. ) ;
  649. APIERR SetGroup( BOOL fGroupPresent,
  650. const OS_SID * possid,
  651. BOOL fGroupDefaulted = FALSE
  652. ) ;
  653. APIERR AccessCheck( ACCESS_MASK DesiredAccess,
  654. PGENERIC_MAPPING pGenericMapping,
  655. BOOL * pfAccessGranted,
  656. PACCESS_MASK pGrantedAccess = NULL ) ;
  657. /* Copies the passed security descriptor to *this.
  658. * This is equivalent to calling QueryXXX then SetXXX for each
  659. * of the components
  660. */
  661. APIERR Copy( const OS_SECURITY_DESCRIPTOR & ossecdescSrc ) ;
  662. //
  663. // Compares this and psecdesc for equality. Note that the security
  664. // descriptors must conform to the security editor's "canonical" form,
  665. // thus this isn't a general purpose compare method.
  666. //
  667. APIERR Compare( OS_SECURITY_DESCRIPTOR * possecdesc,
  668. BOOL * pfOwnerEqual,
  669. BOOL * pfGroupEqual,
  670. BOOL * pfDACLEqual,
  671. BOOL * pfSACLEqual,
  672. PGENERIC_MAPPING pGenericMapping,
  673. PGENERIC_MAPPING pGenericMappingNewObjects,
  674. BOOL fMapGenAllOnly,
  675. BOOL fIsContainer ) ;
  676. DECLARE_DBG_PRINT_SEC
  677. operator PSECURITY_DESCRIPTOR( void ) const
  678. { return _psecuritydesc ; }
  679. PSECURITY_DESCRIPTOR QueryDescriptor( void ) const
  680. { return _psecuritydesc ; }
  681. //
  682. // The following SetGroup and SetOwner are obsolete and have been
  683. // supplanted by the above SetOwner.
  684. //
  685. APIERR SetGroup( const OS_SID & ossid,
  686. BOOL fGroupDefaulted = FALSE
  687. ) ;
  688. APIERR SetOwner( const OS_SID & ossid,
  689. BOOL fOwnerDefaulted = FALSE
  690. ) ;
  691. } ; // OS_SECURITY_DESCRIPTOR
  692. /*************************************************************************
  693. NAME: OS_ACL_SUBJECT_ITER
  694. SYNOPSIS: Iterates through each subject contained in an OS_ACL
  695. Accumulating the Access masks as appropriate for
  696. each inheritance option.
  697. INTERFACE:
  698. PARENT: BASE
  699. USES: OS_ACL, OS_ACE
  700. CAVEATS: Not all DACLs can be recognized using this iterator.
  701. Specifically, denies interspersed with grants or partial
  702. denies cannot be represented with this class (and in fact,
  703. can only be accurately represented when contained in the
  704. ACL since order is important).
  705. NOTES: IERR_UNRECOGNIZED_ACL will be returned if this ACL doesn't
  706. support iterating subject by subject
  707. HISTORY:
  708. Johnl 22-Dec-1991 Created
  709. **************************************************************************/
  710. DLL_CLASS OS_ACL_SUBJECT_ITER : public BASE
  711. {
  712. private:
  713. const OS_ACL * _posacl ;
  714. PGENERIC_MAPPING _pGenericMapping ;
  715. PGENERIC_MAPPING _pGenericMappingNewObjects ;
  716. BOOL _fMapGenAllOnly ;
  717. /* If the associated object isn't a container, then we can ignore most
  718. * of the inherit bits
  719. */
  720. BOOL _fIsContainer ;
  721. OS_SID _ossidCurrentSubject ;
  722. /* Index of the first ACE that contains the current subject's SID.
  723. */
  724. ULONG _iCurrentAce ;
  725. ULONG _cTotalAces ;
  726. protected:
  727. ULONG QueryTotalAceCount( void ) const
  728. { return _cTotalAces ; }
  729. ULONG QueryCurrentACE( void ) const
  730. { return _iCurrentAce ; }
  731. const OS_ACL * QueryACL( void ) const
  732. { return _posacl ; }
  733. void SetCurrentACE( ULONG iNewAce )
  734. { _iCurrentAce = iNewAce ; }
  735. //
  736. // Used for special casing the Creator Owner SID
  737. //
  738. OS_SID _ossidCreator ;
  739. OS_SID _ossidCreatorGroup ;
  740. public:
  741. OS_ACL_SUBJECT_ITER( const OS_ACL * posacl,
  742. PGENERIC_MAPPING pGenericMapping,
  743. PGENERIC_MAPPING pGenericMappingNewObjects,
  744. BOOL fMapGenAllOnly,
  745. BOOL fIsContainer ) ;
  746. ~OS_ACL_SUBJECT_ITER() ;
  747. virtual BOOL Next( APIERR * perr ) = 0 ;
  748. virtual BOOL CompareCurrentSubject( OS_ACL_SUBJECT_ITER * psubjiter ) = 0 ;
  749. /* Finds the next new subject in the ACL starting from our
  750. * current position.
  751. *
  752. * pfFoundNewSubject - Set to TRUE if a new subject was found, FALSE
  753. * otherwise.
  754. * possidNewSubj - Pointer to OS_SID that will receive the new subject
  755. * posaceFirstAceWithSubj - pointer to ACE that will receive the first
  756. * ACE in this ACL that contains the new subject. The current
  757. * ACE index will be set to this ACE position also.
  758. */
  759. APIERR FindNextSubject( BOOL * pfFoundNewSubject,
  760. OS_SID * possidNewSubj,
  761. OS_ACE * posaceFirstAceWithSubj ) ;
  762. /* Using the generic mapping passed into the constructor, this method
  763. * will convert all specific access permissions to the corresponding
  764. * generic permission(s). If a match is found, then the matching
  765. * bits are zeroed. If any specific permissions are still on after
  766. * the mapping, then IERR_UNRECOGNIZED_ACL will be returned.
  767. *
  768. * If fMapGenAllOnly is TRUE, then only Generic All is mapped, the other
  769. * generic bits are not mapped.
  770. *
  771. * if fIsInherittedByNewObjects is TRUE, then the new object generic
  772. * mapping is used instead of the regular generic mapping.
  773. */
  774. APIERR MapSpecificToGeneric( ACCESS_MASK * pAccessMask,
  775. BOOL fIsInherittedByNewObjects ) ;
  776. //
  777. // Compares the passed subjiter with *this
  778. //
  779. APIERR Compare( BOOL * pfACLEqual,
  780. OS_ACL_SUBJECT_ITER * psubjiter ) ;
  781. void Reset( void )
  782. { _iCurrentAce = 0 ; }
  783. BOOL MapGenericAllOnly( void ) const
  784. { return _fMapGenAllOnly ; }
  785. BOOL IsContainer( void ) const
  786. { return _fIsContainer ; }
  787. const OS_SID * QuerySID( void ) const
  788. { return &_ossidCurrentSubject ; }
  789. } ;
  790. /*************************************************************************
  791. NAME: OS_DACL_SUBJECT_ITER
  792. SYNOPSIS: Iterates through each subject contained in an OS_ACL for
  793. a DACL, automatically gathering the access masks for each
  794. subject across multiple ACEs.
  795. INTERFACE:
  796. PARENT: BASE
  797. USES: OS_ACL, OS_ACE
  798. CAVEATS: We can gather access masks across multiple ACEs only if
  799. the ACL conforms to the all Deny Alls followed by all Grants
  800. form. Note that this iterator will effectively compact
  801. ACEs as necessary (and throw away ACEs that don't matter,
  802. like grant ACEs that follow a Deny All Ace).
  803. NOTES: IERR_UNRECOGNIZED_ACL will be returned if this ACL doesn't
  804. support iterating subject by subject
  805. The access mask is guaranteed to be zero if the Has*Ace
  806. flag is FALSE.
  807. HISTORY:
  808. Johnl 22-Dec-1991 Created
  809. **************************************************************************/
  810. DLL_CLASS OS_DACL_SUBJECT_ITER : public OS_ACL_SUBJECT_ITER
  811. {
  812. private:
  813. BOOL _fDenyAll ;
  814. BOOL _fDenyAllNewObj ;
  815. BOOL _fDenyAllNewCont ;
  816. BOOL _fDenyAllInheritOnly ;
  817. /* Contains the permissions for this SID. The permissions are
  818. * specific to the ACL we are examining and the types of ACEs it
  819. * contains.
  820. */
  821. ACCESS_MASK _accessmask ;
  822. BOOL _fHasAce ;
  823. ACCESS_MASK _accessmaskNewObj ;
  824. BOOL _fHasAceNewObj ;
  825. ACCESS_MASK _accessmaskNewCont ;
  826. BOOL _fHasAceNewCont ;
  827. ACCESS_MASK _accessmaskInheritOnly ;
  828. BOOL _fHasAceInheritOnly ;
  829. public:
  830. OS_DACL_SUBJECT_ITER( OS_ACL * posacl,
  831. PGENERIC_MAPPING pGenericMapping,
  832. PGENERIC_MAPPING pGenericMappingNewObjects,
  833. BOOL fMapGenAllOnly,
  834. BOOL fIsContainer ) ;
  835. ~OS_DACL_SUBJECT_ITER() ;
  836. virtual BOOL Next( APIERR * perr ) ;
  837. virtual BOOL CompareCurrentSubject( OS_ACL_SUBJECT_ITER * psubjiter ) ;
  838. BOOL IsDenyAll( void ) const
  839. { return _fDenyAll ; }
  840. BOOL IsNewObjectDenyAll( void ) const
  841. { return _fDenyAllNewObj ; }
  842. BOOL IsNewContainerDenyAll( void ) const
  843. { return _fDenyAllNewCont ; }
  844. BOOL IsInheritOnlyDenyAll( void ) const
  845. { return _fDenyAllInheritOnly ; }
  846. /* Returns TRUE if the data in QueryAccessMask and IsDenyAll came from
  847. * an ACE (thus is not the default value).
  848. */
  849. BOOL HasThisAce( void ) const
  850. { return _fHasAce ; }
  851. ACCESS_MASK QueryAccessMask( void ) const
  852. { return _accessmask ; }
  853. BOOL HasNewObjectAce( void ) const
  854. { return _fHasAceNewObj ; }
  855. ACCESS_MASK QueryNewObjectAccessMask( void ) const
  856. { return _accessmaskNewObj ; }
  857. BOOL HasNewContainerAce( void ) const
  858. { return _fHasAceNewCont ; }
  859. ACCESS_MASK QueryNewContainerAccessMask( void ) const
  860. { return _accessmaskNewCont ; }
  861. BOOL HasInheritOnlyAce( void ) const
  862. { return _fHasAceInheritOnly ; }
  863. ACCESS_MASK QueryInheritOnlyAccessMask( void ) const
  864. { return _accessmaskInheritOnly ; }
  865. } ;
  866. /*************************************************************************
  867. NAME: SACL_AUDIT_ALARM_DESCRIPTOR
  868. SYNOPSIS: Minor storage class for OS_SACL_SUBJECT_ITER
  869. NOTES:
  870. HISTORY:
  871. Johnl 31-Dec-1991 Created
  872. **************************************************************************/
  873. DLL_CLASS OS_SACL_SUBJECT_DESCRIPTOR
  874. {
  875. public:
  876. ACCESS_MASK _accessmask ;
  877. BOOL _fHasAce ;
  878. void InitToZero( void )
  879. {
  880. _accessmask = 0 ;
  881. _fHasAce = FALSE ;
  882. }
  883. } ;
  884. /* The following indexes into the array for the appropriate descriptor
  885. * The _S/_F suffix indicates whether this is a success or failure
  886. * descriptor.
  887. *
  888. * Do not intermix the alarm and audit values.
  889. */
  890. enum OS_SACL_DESCRIPTOR_TYPE
  891. {
  892. OS_SACL_DESC_THIS_OBJECT_S_AUDIT = 0,
  893. OS_SACL_DESC_THIS_OBJECT_F_AUDIT,
  894. OS_SACL_DESC_NEW_OBJECT_S_AUDIT,
  895. OS_SACL_DESC_NEW_OBJECT_F_AUDIT,
  896. OS_SACL_DESC_NEW_CONT_S_AUDIT,
  897. OS_SACL_DESC_NEW_CONT_F_AUDIT,
  898. OS_SACL_DESC_INHERIT_ONLY_S_AUDIT,
  899. OS_SACL_DESC_INHERIT_ONLY_F_AUDIT,
  900. /* This must be the first ALARM item in this enumeration
  901. */
  902. OS_SACL_DESC_THIS_OBJECT_S_ALARM,
  903. OS_SACL_DESC_THIS_OBJECT_F_ALARM,
  904. OS_SACL_DESC_NEW_OBJECT_S_ALARM,
  905. OS_SACL_DESC_NEW_OBJECT_F_ALARM,
  906. OS_SACL_DESC_NEW_CONT_S_ALARM,
  907. OS_SACL_DESC_NEW_CONT_F_ALARM,
  908. OS_SACL_DESC_INHERIT_ONLY_S_ALARM,
  909. OS_SACL_DESC_INHERIT_ONLY_F_ALARM,
  910. /* The size of the array that will be needed.
  911. */
  912. OS_SACL_DESC_LAST
  913. } ;
  914. /*************************************************************************
  915. NAME: OS_SACL_SUBJECT_ITER
  916. SYNOPSIS: Iterates through each subject contained in an OS_ACL,
  917. automatically gathering the access masks for each
  918. subject across multiple ACEs.
  919. INTERFACE:
  920. PARENT: BASE
  921. USES: OS_ACL, OS_ACE
  922. CAVEATS:
  923. NOTES: IERR_UNRECOGNIZED_ACL will be returned if this ACL doesn't
  924. support iterating subject by subject
  925. The access mask is guaranteed to be zero if the Has*Ace
  926. flag is FALSE.
  927. HISTORY:
  928. Johnl 22-Dec-1991 Created
  929. **************************************************************************/
  930. DLL_CLASS OS_SACL_SUBJECT_ITER : public OS_ACL_SUBJECT_ITER
  931. {
  932. private:
  933. OS_SACL_SUBJECT_DESCRIPTOR _asaclDesc[OS_SACL_DESC_LAST] ;
  934. void InitToZero( void ) ;
  935. public:
  936. OS_SACL_SUBJECT_ITER( OS_ACL * posacl,
  937. PGENERIC_MAPPING pGenericMapping,
  938. PGENERIC_MAPPING pGenericMappingNewObjects,
  939. BOOL fMapGenAllOnly,
  940. BOOL fIsContainer ) ;
  941. ~OS_SACL_SUBJECT_ITER() ;
  942. virtual BOOL Next( APIERR * perr ) ;
  943. virtual BOOL CompareCurrentSubject( OS_ACL_SUBJECT_ITER * psubjiter ) ;
  944. BOOL HasAuditAces( void ) const
  945. { return HasThisAuditAce_S() || HasThisAuditAce_F() ||
  946. HasNewObjectAuditAce_S() || HasNewObjectAuditAce_F() ||
  947. HasNewContainerAuditAce_S() || HasNewContainerAuditAce_F() ||
  948. HasInheritOnlyAuditAce_S() || HasInheritOnlyAuditAce_F() ;
  949. }
  950. /* A name with an _S appended is a Successful Access flag, an _F
  951. * appended is a Failed access flag.
  952. */
  953. BOOL HasThisAuditAce_S( void ) const
  954. { return _asaclDesc[OS_SACL_DESC_THIS_OBJECT_S_AUDIT]._fHasAce ; }
  955. ACCESS_MASK QueryAuditAccessMask_S( void ) const
  956. { return _asaclDesc[OS_SACL_DESC_THIS_OBJECT_S_AUDIT]._accessmask ; }
  957. BOOL HasThisAuditAce_F( void ) const
  958. { return _asaclDesc[OS_SACL_DESC_THIS_OBJECT_F_AUDIT]._fHasAce ; }
  959. ACCESS_MASK QueryAuditAccessMask_F( void ) const
  960. { return _asaclDesc[OS_SACL_DESC_THIS_OBJECT_F_AUDIT]._accessmask ; }
  961. /* New Object
  962. */
  963. BOOL HasNewObjectAuditAce_S( void ) const
  964. { return _asaclDesc[OS_SACL_DESC_NEW_OBJECT_S_AUDIT]._fHasAce ; }
  965. ACCESS_MASK QueryNewObjectAuditAccessMask_S( void ) const
  966. { return _asaclDesc[OS_SACL_DESC_NEW_OBJECT_S_AUDIT]._accessmask ; }
  967. BOOL HasNewObjectAuditAce_F( void ) const
  968. { return _asaclDesc[OS_SACL_DESC_NEW_OBJECT_F_AUDIT]._fHasAce ; }
  969. ACCESS_MASK QueryNewObjectAuditAccessMask_F( void ) const
  970. { return _asaclDesc[OS_SACL_DESC_NEW_OBJECT_F_AUDIT]._accessmask ; }
  971. /* New Container
  972. */
  973. BOOL HasNewContainerAuditAce_S( void ) const
  974. { return _asaclDesc[OS_SACL_DESC_NEW_CONT_S_AUDIT]._fHasAce ; }
  975. ACCESS_MASK QueryNewContainerAuditAccessMask_S( void ) const
  976. { return _asaclDesc[OS_SACL_DESC_NEW_CONT_S_AUDIT]._accessmask ; }
  977. BOOL HasNewContainerAuditAce_F( void ) const
  978. { return _asaclDesc[OS_SACL_DESC_NEW_CONT_F_AUDIT]._fHasAce ; }
  979. ACCESS_MASK QueryNewContainerAuditAccessMask_F( void ) const
  980. { return _asaclDesc[OS_SACL_DESC_NEW_CONT_F_AUDIT]._accessmask ; }
  981. /* Inherit only
  982. */
  983. BOOL HasInheritOnlyAuditAce_S( void ) const
  984. { return _asaclDesc[OS_SACL_DESC_INHERIT_ONLY_S_AUDIT]._fHasAce ; }
  985. ACCESS_MASK QueryInheritOnlyAuditAccessMask_S( void ) const
  986. { return _asaclDesc[OS_SACL_DESC_INHERIT_ONLY_S_AUDIT]._accessmask ; }
  987. BOOL HasInheritOnlyAuditAce_F( void ) const
  988. { return _asaclDesc[OS_SACL_DESC_INHERIT_ONLY_F_AUDIT]._fHasAce ; }
  989. ACCESS_MASK QueryInheritOnlyAuditAccessMask_F( void ) const
  990. { return _asaclDesc[OS_SACL_DESC_INHERIT_ONLY_F_AUDIT]._accessmask ; }
  991. BOOL HasThisAlarmAce_S( void ) const
  992. { return _asaclDesc[OS_SACL_DESC_THIS_OBJECT_S_ALARM]._fHasAce ; }
  993. ACCESS_MASK QueryAlarmAccessMask_S( void ) const
  994. { return _asaclDesc[OS_SACL_DESC_THIS_OBJECT_S_ALARM]._accessmask ; }
  995. BOOL HasThisAlarmAce_F( void ) const
  996. { return _asaclDesc[OS_SACL_DESC_THIS_OBJECT_F_ALARM]._fHasAce ; }
  997. ACCESS_MASK QueryAlarmAccessMask_F( void ) const
  998. { return _asaclDesc[OS_SACL_DESC_THIS_OBJECT_F_ALARM]._accessmask ; }
  999. /* New Object
  1000. */
  1001. BOOL HasNewObjectAlarmAce_S( void ) const
  1002. { return _asaclDesc[OS_SACL_DESC_NEW_OBJECT_S_ALARM]._fHasAce ; }
  1003. ACCESS_MASK QueryNewObjectAlarmAccessMask_S( void ) const
  1004. { return _asaclDesc[OS_SACL_DESC_NEW_OBJECT_S_ALARM]._accessmask ; }
  1005. BOOL HasNewObjectAlarmAce_F( void ) const
  1006. { return _asaclDesc[OS_SACL_DESC_NEW_OBJECT_F_ALARM]._fHasAce ; }
  1007. ACCESS_MASK QueryNewObjectAlarmAccessMask_F( void ) const
  1008. { return _asaclDesc[OS_SACL_DESC_NEW_OBJECT_F_ALARM]._accessmask ; }
  1009. /* New Container
  1010. */
  1011. BOOL HasNewContainerAlarmAce_S( void ) const
  1012. { return _asaclDesc[OS_SACL_DESC_NEW_CONT_S_ALARM]._fHasAce ; }
  1013. ACCESS_MASK QueryNewContainerAlarmAccessMask_S( void ) const
  1014. { return _asaclDesc[OS_SACL_DESC_NEW_CONT_S_ALARM]._accessmask ; }
  1015. BOOL HasNewContainerAlarmAce_F( void ) const
  1016. { return _asaclDesc[OS_SACL_DESC_NEW_CONT_F_ALARM]._fHasAce ; }
  1017. ACCESS_MASK QueryNewContainerAlarmAccessMask_F( void ) const
  1018. { return _asaclDesc[OS_SACL_DESC_NEW_CONT_F_ALARM]._accessmask ; }
  1019. /* Inherit only
  1020. */
  1021. BOOL HasInheritOnlyAlarmAce_S( void ) const
  1022. { return _asaclDesc[OS_SACL_DESC_INHERIT_ONLY_S_ALARM]._fHasAce ; }
  1023. ACCESS_MASK QueryInheritOnlyAlarmAccessMask_S( void ) const
  1024. { return _asaclDesc[OS_SACL_DESC_INHERIT_ONLY_S_ALARM]._accessmask ; }
  1025. BOOL HasInheritOnlyAlarmAce_F( void ) const
  1026. { return _asaclDesc[OS_SACL_DESC_INHERIT_ONLY_F_ALARM]._fHasAce ; }
  1027. ACCESS_MASK QueryInheritOnlyAlarmAccessMask_F( void ) const
  1028. { return _asaclDesc[OS_SACL_DESC_INHERIT_ONLY_F_ALARM]._accessmask ; }
  1029. } ;
  1030. #endif //_SECURITY_HXX_
  1031.