00001 #ifndef __XRDOUCGMAP_H__ 00002 #define __XRDOUCGMAP_H__ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d O u c G M a p . h h */ 00006 /* */ 00007 /* (c) 2006 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 "XrdOuc/XrdOucHash.hh" 00034 #include "XrdOuc/XrdOucString.hh" 00035 #include "XrdSys/XrdSysXSLock.hh" 00036 00037 class XrdOucTrace; 00038 class XrdSysError; 00039 class XrdSecGMapEntry_t 00040 { 00041 public: 00042 XrdSecGMapEntry_t(const char *v, const char *u, int t) : val(v), user(u), type(t) { } 00043 XrdOucString val; 00044 XrdOucString user; 00045 int type; 00046 }; 00047 00048 class XrdOucGMap 00049 { 00050 public: 00051 00052 //------------------------------------------------------------------------------ 00065 //------------------------------------------------------------------------------ 00066 00067 virtual int dn2user(const char *dn, char *user, int ulen, time_t now = 0); 00068 00069 00070 //------------------------------------------------------------------------------ 00088 //------------------------------------------------------------------------------ 00089 #define XrdOucGMapArgs XrdSysError *eDest, \ 00090 const char *mapfn, \ 00091 const char *parms 00092 XrdOucGMap(XrdOucGMapArgs); 00093 00094 //------------------------------------------------------------------------------ 00096 //------------------------------------------------------------------------------ 00097 00098 virtual ~XrdOucGMap() {} 00099 00100 //------------------------------------------------------------------------------ 00102 //------------------------------------------------------------------------------ 00103 00104 bool isValid() const { return valid; } 00105 00106 private: 00107 //------------------------------------------------------------------------------ 00109 //------------------------------------------------------------------------------ 00110 00111 bool valid; 00112 XrdOucHash<XrdSecGMapEntry_t> mappings; 00113 XrdOucString mf_name; 00114 time_t mf_mtime; 00115 time_t notafter; 00116 long timeout; 00117 00118 XrdSysError *elogger; 00119 XrdOucTrace *tracer; 00120 bool dbg; 00121 00122 XrdSysXSLock xsl; 00123 00124 //------------------------------------------------------------------------------ 00126 //------------------------------------------------------------------------------ 00127 00128 int load(const char *mf, bool force = 0); 00129 }; 00130 00131 /******************************************************************************/ 00132 /* X r d O u c g e t G M a p */ 00133 /******************************************************************************/ 00134 00135 //------------------------------------------------------------------------------ 00156 //------------------------------------------------------------------------------ 00157 00158 extern "C" XrdOucGMap *XrdOucgetGMap(XrdOucGMapArgs); 00159 00160 //------------------------------------------------------------------------------ 00166 //------------------------------------------------------------------------------ 00167 00173 #endif