|
xrootd
|
00001 #ifndef __ACC_ACCESS__ 00002 #define __ACC_ACCESS__ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d A c c A c c e s s . h h */ 00006 /* */ 00007 /* (c) 2003 by the Board of Trustees of the Leland Stanford, Jr., University */ 00008 /* All Rights Reserved */ 00009 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 00010 /* DE-AC02-76-SFO0515 with the Department of Energy */ 00011 /* */ 00012 /* This file is part of the XRootD software suite. */ 00013 /* */ 00014 /* XRootD is free software: you can redistribute it and/or modify it under */ 00015 /* the terms of the GNU Lesser General Public License as published by the */ 00016 /* Free Software Foundation, either version 3 of the License, or (at your */ 00017 /* option) any later version. */ 00018 /* */ 00019 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */ 00020 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ 00021 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ 00022 /* License for more details. */ 00023 /* */ 00024 /* You should have received a copy of the GNU Lesser General Public License */ 00025 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ 00026 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */ 00027 /* */ 00028 /* The copyright holder's institutional names and contributor's names may not */ 00029 /* be used to endorse or promote products derived from this software without */ 00030 /* specific prior written permission of the institution or contributor. */ 00031 /******************************************************************************/ 00032 00033 #include "XrdAcc/XrdAccAudit.hh" 00034 #include "XrdAcc/XrdAccAuthorize.hh" 00035 #include "XrdAcc/XrdAccCapability.hh" 00036 #include "XrdSec/XrdSecEntity.hh" 00037 #include "XrdOuc/XrdOucHash.hh" 00038 #include "XrdSys/XrdSysXSLock.hh" 00039 #include "XrdSys/XrdSysPlatform.hh" 00040 00041 /******************************************************************************/ 00042 /* A c c e s s _ I D _ T y p e */ 00043 /******************************************************************************/ 00044 00045 // The following are supported id types for access() checking 00046 // 00047 enum Access_ID_Type {AID_Group, 00048 AID_Host, 00049 AID_Netgroup, 00050 AID_Set, 00051 AID_Template, 00052 AID_User 00053 }; 00054 00055 /******************************************************************************/ 00056 /* S e t T a b s P a r a m e t e r */ 00057 /******************************************************************************/ 00058 00059 struct XrdAccAccess_Tables 00060 {XrdOucHash<XrdAccCapability> *G_Hash; // Groups 00061 XrdOucHash<XrdAccCapability> *H_Hash; // Hosts 00062 XrdOucHash<XrdAccCapability> *N_Hash; // Netgroups 00063 XrdOucHash<XrdAccCapability> *S_Hash; // Sets 00064 XrdOucHash<XrdAccCapability> *T_Hash; // Templates 00065 XrdOucHash<XrdAccCapability> *U_Hash; // Users 00066 XrdAccCapName *D_List; // Domains 00067 XrdAccCapName *E_List; // Domains (end of list) 00068 XrdAccCapability *X_List; // Fungable capbailities 00069 XrdAccCapability *Z_List; // Default capbailities 00070 00071 XrdAccAccess_Tables() {G_Hash = 0; H_Hash = 0; N_Hash = 0; 00072 S_Hash = 0; T_Hash = 0; U_Hash = 0; 00073 D_List = 0; E_List = 0; 00074 X_List = 0; Z_List = 0; 00075 } 00076 ~XrdAccAccess_Tables() {if (G_Hash) delete G_Hash; 00077 if (H_Hash) delete H_Hash; 00078 if (N_Hash) delete N_Hash; 00079 if (S_Hash) delete S_Hash; 00080 if (T_Hash) delete T_Hash; 00081 if (U_Hash) delete U_Hash; 00082 if (X_List) delete X_List; 00083 if (Z_List) delete Z_List; 00084 } 00085 }; 00086 00087 /******************************************************************************/ 00088 /* X r d A c c A c c e s s */ 00089 /******************************************************************************/ 00090 00091 class xrdOucError; 00092 00093 class XrdAccAccess : public XrdAccAuthorize 00094 { 00095 public: 00096 00097 friend class XrdAccConfig; 00098 00099 XrdAccPrivs Access(const XrdSecEntity *Entity, 00100 const char *path, 00101 const Access_Operation oper, 00102 XrdOucEnv *Env=0); 00103 00104 int Audit(const int accok, 00105 const XrdSecEntity *Entity, 00106 const char *path, 00107 const Access_Operation oper, 00108 XrdOucEnv *Env=0); 00109 00110 // SwapTabs() is used by the configuration object to establish new access 00111 // control tables. It may be called whenever the tables change. 00112 // 00113 void SwapTabs(struct XrdAccAccess_Tables &newtab); 00114 00115 int Test(const XrdAccPrivs priv, const Access_Operation oper); 00116 00117 XrdAccAccess(XrdSysError *erp); 00118 00119 ~XrdAccAccess() {} // The access object is never deleted 00120 00121 private: 00122 00123 XrdAccPrivs Access(const char *id, const Access_ID_Type idtype, 00124 const char *path, const Access_Operation oper); 00125 00126 struct XrdAccAccess_Tables Atab; 00127 00128 XrdSysXSLock Access_Context; 00129 00130 XrdAccAudit *Auditor; 00131 }; 00132 #endif
1.7.6.1