Main Page   Namespace List   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

ace.h

Go to the documentation of this file.
00001 // ace.h: DO NOT include this file. #include fksec.h instead!
00002 
00003 
00004 
00005 #if ! defined( AFX_ACE_H__C2404C08_2791_41F1_A45E_A62EF7364105__INCLUDED_ )
00006 #define AFX_ACE_H__C2404C08_2791_41F1_A45E_A62EF7364105__INCLUDED_
00007 #pragma once
00008 
00009 
00012 
00013 
00190 
00191 namespace fksec {
00192 
00193     class ace
00194     {
00195     public:
00196         // --- ctors/dtor ---
00198         ace();
00200         ace( const ace &a );
00202         ace( const void *a );
00204         ace( byte type, byte flags, byte inheritance, ACCESS_MASK mask, const sid &newSid,
00205             const GUID &ObjectType = GUID_NULL, const GUID &InheritedObjectType = GUID_NULL );
00206 
00208         virtual ~ace();
00209 
00210         // --- assignment ---
00212         const ace &operator=( const ace &s );
00214         const ace &operator=( const void *s );
00215 
00216         // --- conversions ---
00218         operator const void *() const;
00219 
00220         // --- comparisons ---
00222         bool operator==( const ace &r );
00224         bool operator!=( const ace &r );
00226         bool operator<( const ace &r );
00227 
00228         // --- accessors ---
00229 
00231 
00233         byte GetType() const { return aceType; }
00235 
00238         byte GetFlags() const { return aceFlags; }
00240 
00242         ACCESS_MASK GetMask() const { return aceMask; }
00244 
00246         DWORD GetSize() const { return GetLength(); }
00248 
00251         byte GetInheritance() const { return aceInheritance; }
00253 
00255         const sid &GetSid() const { return aceSid; }
00256 
00258 
00260         DWORD GetObjectFlags() const { return aceObjectFlags ; }
00262 
00264         bool  HasObjectType() const { return ( aceObjectFlags & ACE_OBJECT_TYPE_PRESENT ) ? true : false ; }
00266 
00268         bool  HasInheritedObjectType() const { return (aceObjectFlags & ACE_INHERITED_OBJECT_TYPE_PRESENT) ? true : false ; }
00270 
00272         const GUID &GetObjectType() const { return aceObjectTypeGUID ; }
00274 
00276         const GUID &GetInheritedObjectType() const { return aceInheritedObjectTypeGUID ; }
00277 
00279         void SetType( byte newType );
00281         void SetFlags( byte newFlags );
00283         void SetMask( ACCESS_MASK newMask );
00285         void SetInheritance( byte newInheritance );
00287         void SetSid( const sid &newSid );
00289         void SetSid( const TCHAR *stringSid );
00290 
00292 
00294         void SetObjectType(const GUID &ObjectType ) ;
00296         void RemoveObjectType() ;
00298 
00300         void SetInheritedObjectType(const GUID &InheritedObjectType ) ;
00302         void RemoveInheritedObjectType() ;
00303 
00304         // --- utilities ---
00306         DWORD GetLength() const;
00308         void StoreAce( void *p, DWORD sz ) const;
00310         bool IsValid() const;
00311 
00313         bool IsObjectACE() const ;
00314 
00315         // --- inserters ---
00317         friend fkostream &operator<<( fkostream &o, const ace &a );
00318 
00321         enum AceSortOrder {
00323             asoDefault,
00325             asoNT4,
00327             asoNT5
00328         };
00329 
00331         static AceSortOrder GetAceSortOrder();
00332 
00334         static void SetAceSortOrder( AceSortOrder aso );
00335 
00336     private:
00338         void ClearPACE() const;
00340         void ReleasePACE() const;
00342         void *MakePACE() const;
00344         void InitFromPACE( const void *a );
00345 
00347         static AceSortOrder currentAceSortOrder;
00348 
00349         // keep track of components we have
00351         bool haveAceType;
00353         bool haveAceFlags;
00355         bool haveAceMask;
00357         bool haveAceInheritance;
00358         // no "haveAceSid" -- aceSid.IsValid() serves here
00359 
00360         // ACE components
00362         byte aceType;
00364         byte aceFlags;
00366         byte aceInheritance;
00368         ACCESS_MASK aceMask;
00370         fksec::sid aceSid;
00371 
00373         DWORD aceObjectFlags ;
00375         GUID aceObjectTypeGUID ;
00377         GUID aceInheritedObjectTypeGUID ; 
00378 
00380         mutable bool havePACE;
00382         mutable ACCESS_ALLOWED_ACE *pace;
00383     };
00384 
00386     fkostream &operator<<( fkostream &o, const ace &a );
00387 
00388 } // namespace fksec
00389 
00390 #endif // ! defined( AFX_ACE_H__C2404C08_2791_41F1_A45E_A62EF7364105__INCLUDED_ )

Generated at Mon Oct 16 06:14:07 2000 for fksec by doxygen1.2.2 written by Dimitri van Heesch, © 1997-2000