xrootd
|
00001 #ifndef _ACC_CONFIG_H 00002 #define _ACC_CONFIG_H 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d A c c C o n f i g . 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-AC03-76-SFO0515 with the Deprtment of Energy */ 00011 /******************************************************************************/ 00012 00013 // $Id$ 00014 00015 #include <sys/types.h> 00016 00017 #include "XrdOuc/XrdOuca2x.hh" 00018 #include "XrdSys/XrdSysError.hh" 00019 #include "XrdOuc/XrdOucHash.hh" 00020 #include "XrdSys/XrdSysPthread.hh" 00021 #include "XrdOuc/XrdOucStream.hh" 00022 #include "XrdAcc/XrdAccAccess.hh" 00023 #include "XrdAcc/XrdAccAuthDB.hh" 00024 #include "XrdAcc/XrdAccCapability.hh" 00025 #include "XrdAcc/XrdAccGroups.hh" 00026 00027 /******************************************************************************/ 00028 /* X r d A c c G l i s t */ 00029 /******************************************************************************/ 00030 00031 struct XrdAccGlist 00032 { 00033 struct XrdAccGlist *next; /* Null if this is the last one */ 00034 char *name; /* -> null terminated name */ 00035 00036 XrdAccGlist(const char *Name, struct XrdAccGlist *Next=0) 00037 {name = strdup(Name); next = Next;} 00038 ~XrdAccGlist() 00039 {if (name) free(name);} 00040 }; 00041 00042 /******************************************************************************/ 00043 /* X r d A c c C o n f i g */ 00044 /******************************************************************************/ 00045 00046 class XrdAccConfig 00047 { 00048 public: 00049 00050 // Configure() is called during initialization. 00051 // 00052 int Configure(XrdSysError &Eroute, const char *cfn); 00053 00054 // ConfigDB() simply refreshes the in-core authorization database. When the 00055 // Warm is true, a check is made whether the database actually changed and the 00056 // refresh is skipped if it has not changed. 00057 // 00058 int ConfigDB(int Warm, XrdSysError &Eroute); 00059 00060 XrdAccAccess *Authorization; 00061 XrdAccGroups GroupMaster; 00062 00063 int AuthRT; 00064 00065 XrdAccConfig(); 00066 ~XrdAccConfig() {} // Configuration is never destroyed! 00067 00068 private: 00069 00070 struct XrdAccGlist *addGlist(gid_t Gid, const char *Gname, 00071 struct XrdAccGlist *Gnext); 00072 int ConfigDBrec(XrdSysError &Eroute, 00073 struct XrdAccAccess_Tables &tabs); 00074 void ConfigDefaults(void); 00075 int ConfigFile(XrdSysError &Eroute, const char *cfn); 00076 int ConfigXeq(char *, XrdOucStream &, XrdSysError &); 00077 int PrivsConvert(char *privs, XrdAccPrivCaps &ctab); 00078 int xaud(XrdOucStream &Config, XrdSysError &Eroute); 00079 int xart(XrdOucStream &Config, XrdSysError &Eroute); 00080 int xdbp(XrdOucStream &Config, XrdSysError &Eroute); 00081 int xglt(XrdOucStream &Config, XrdSysError &Eroute); 00082 int xgrt(XrdOucStream &Config, XrdSysError &Eroute); 00083 int xnis(XrdOucStream &Cofig, XrdSysError &Eroute); 00084 00085 XrdAccAuthDB *Database; 00086 char *dbpath; 00087 00088 XrdSysMutex Config_Context; 00089 XrdSysThread Config_Refresh; 00090 00091 int options; 00092 }; 00093 #endif