xrootd
XrdAccConfig.hh
Go to the documentation of this file.
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-AC02-76-SFO0515 with the Deprtment 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 <sys/types.h>
00034 
00035 #include "XrdOuc/XrdOuca2x.hh"
00036 #include "XrdSys/XrdSysError.hh"
00037 #include "XrdOuc/XrdOucHash.hh"
00038 #include "XrdSys/XrdSysPthread.hh"
00039 #include "XrdOuc/XrdOucStream.hh"
00040 #include "XrdAcc/XrdAccAccess.hh"
00041 #include "XrdAcc/XrdAccAuthDB.hh"
00042 #include "XrdAcc/XrdAccCapability.hh"
00043 #include "XrdAcc/XrdAccGroups.hh"
00044 
00045 /******************************************************************************/
00046 /*                           X r d A c c G l i s t                            */
00047 /******************************************************************************/
00048   
00049 struct XrdAccGlist 
00050 {
00051        struct XrdAccGlist *next;     /* Null if this is the last one */
00052        char               *name;     /* -> null terminated name */
00053 
00054        XrdAccGlist(const char *Name, struct XrdAccGlist *Next=0)
00055                   {name = strdup(Name); next = Next;}
00056       ~XrdAccGlist()
00057                   {if (name) free(name);}
00058 };
00059 
00060 /******************************************************************************/
00061 /*                          X r d A c c C o n f i g                           */
00062 /******************************************************************************/
00063   
00064 class XrdAccConfig
00065 {
00066 public:
00067 
00068 // Configure() is called during initialization.
00069 //
00070 int           Configure(XrdSysError &Eroute, const char *cfn);
00071 
00072 // ConfigDB() simply refreshes the in-core authorization database. When the 
00073 // Warm is true, a check is made whether the database actually changed and the
00074 // refresh is skipped if it has not changed.
00075 //
00076 int           ConfigDB(int Warm, XrdSysError &Eroute);
00077 
00078 XrdAccAccess *Authorization;
00079 XrdAccGroups  GroupMaster;
00080 
00081 int           AuthRT;
00082 
00083               XrdAccConfig();
00084              ~XrdAccConfig() {}    // Configuration is never destroyed!
00085 
00086 private:
00087 
00088 struct XrdAccGlist *addGlist(gid_t Gid, const char *Gname, 
00089                              struct XrdAccGlist *Gnext);
00090 int                 ConfigDBrec(XrdSysError &Eroute,
00091                                 struct XrdAccAccess_Tables &tabs);
00092 void                ConfigDefaults(void);
00093 int                 ConfigFile(XrdSysError &Eroute, const char *cfn);
00094 int                 ConfigXeq(char *, XrdOucStream &, XrdSysError &);
00095 int                 PrivsConvert(char *privs, XrdAccPrivCaps &ctab);
00096 int                 xaud(XrdOucStream &Config, XrdSysError &Eroute);
00097 int                 xart(XrdOucStream &Config, XrdSysError &Eroute);
00098 int                 xdbp(XrdOucStream &Config, XrdSysError &Eroute);
00099 int                 xglt(XrdOucStream &Config, XrdSysError &Eroute);
00100 int                 xgrt(XrdOucStream &Config, XrdSysError &Eroute);
00101 int                 xnis(XrdOucStream &Cofig, XrdSysError &Eroute);
00102 
00103 XrdAccAuthDB        *Database;
00104 char                *dbpath;
00105 
00106 XrdSysMutex          Config_Context;
00107 XrdSysThread         Config_Refresh;
00108 
00109 int                  options;
00110 };
00111 #endif