xrootd
XrdDigAuth.hh
Go to the documentation of this file.
1 #ifndef __XRDDIGAUTH_HH__
2 #define __XRDDIGAUTH_HH__
3 /******************************************************************************/
4 /* */
5 /* X r d D i g A u t h . h h */
6 /* */
7 /* (C) 2013 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* All Rights Reserved */
9 /* Produced by Andrew Hanushevsky for Stanford University under contract */
10 /* DE-AC02-76-SFO0515 with the Deprtment of Energy */
11 /* */
12 /* This file is part of the XRootD software suite. */
13 /* */
14 /* XRootD is free software: you can redistribute it and/or modify it under */
15 /* the terms of the GNU Lesser General Public License as published by the */
16 /* Free Software Foundation, either version 3 of the License, or (at your */
17 /* option) any later version. */
18 /* */
19 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22 /* License for more details. */
23 /* */
24 /* You should have received a copy of the GNU Lesser General Public License */
25 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27 /* */
28 /* The copyright holder's institutional names and contributor's names may not */
29 /* be used to endorse or promote products derived from this software without */
30 /* specific prior written permission of the institution or contributor. */
31 /******************************************************************************/
32 
33 #include "XrdSec/XrdSecEntity.hh"
34 #include "XrdSys/XrdSysPthread.hh"
35 
36 class XrdOucStream;
37 class XrdSysError;
38 
39 /******************************************************************************/
40 /* X r d D i g A u t h E n t */
41 /******************************************************************************/
42 
44 {
45 public:
47 char *rec;
49 
50 enum eType {eName=0, eHost=1, eVorg=2, eRole=3, eGrp=4, eNum=5};
51 char *eChk[eNum];
52 
53 enum aType {aConf = 0, aCore = 1, aLogs = 2, aProc = 3, aNum = 4};
54 bool accOK[aNum];
55 
56  XrdDigAuthEnt() : next(0), rec(0)
57  {memset(prot, 0, sizeof(prot));
58  memset(eChk, 0, sizeof(eChk));
59  memset(accOK, 0, sizeof(accOK));
60  }
61  ~XrdDigAuthEnt() {if (rec) free(rec);}
62 };
63 
64 /******************************************************************************/
65 /* X r d D i g A u t h */
66 /******************************************************************************/
67 
69 {
70 public:
71 
72 bool Authorize(const XrdSecEntity *client,
74  bool aVec[XrdDigAuthEnt::aNum]=0
75  );
76 
77 bool Configure(const char *aFN);
78 
79  XrdDigAuth() : authFN(0), authTOD(0), authCHK(0), authList(0) {}
81 
82 private:
83 
84 bool Failure(int lNum, const char *txt1, const char *txt2=0);
85 bool OkGrp(const char *glist, const char *gname);
86 bool Parse(XrdOucStream &aFile, int lNum);
87 bool Refresh();
88 bool SetupAuth(bool isRefresh);
89 bool SetupAuth(bool isRefresh, bool aOK);
90 void Squash(char *bP);
91 
93 const char *authFN;
94 time_t authTOD;
95 time_t authCHK;
98 };
99 #endif
XrdDigAuth::SetupAuth
bool SetupAuth(bool isRefresh, bool aOK)
XrdDigAuthEnt::XrdDigAuthEnt
XrdDigAuthEnt()
Definition: XrdDigAuth.hh:56
XrdDigAuth::Configure
bool Configure(const char *aFN)
XrdDigAuth::XrdDigAuth
XrdDigAuth()
Definition: XrdDigAuth.hh:79
XrdDigAuth::authCHK
time_t authCHK
Definition: XrdDigAuth.hh:95
XrdDigAuthEnt::aConf
@ aConf
Definition: XrdDigAuth.hh:53
XrdSysMutex
Definition: XrdSysPthread.hh:165
XrdSysPthread.hh
XrdDigAuthEnt::rec
char * rec
Definition: XrdDigAuth.hh:47
XrdDigAuthEnt::accOK
bool accOK[aNum]
Definition: XrdDigAuth.hh:54
XrdDigAuthEnt
Definition: XrdDigAuth.hh:44
XrdDigAuthEnt::aLogs
@ aLogs
Definition: XrdDigAuth.hh:53
XrdDigAuth::SetupAuth
bool SetupAuth(bool isRefresh)
XrdDigAuthEnt::aCore
@ aCore
Definition: XrdDigAuth.hh:53
XrdDigAuth::Authorize
bool Authorize(const XrdSecEntity *client, XrdDigAuthEnt::aType aType, bool aVec[XrdDigAuthEnt::aNum]=0)
XrdDigAuth::OkGrp
bool OkGrp(const char *glist, const char *gname)
XrdDigAuth::accOK
bool accOK[XrdDigAuthEnt::aNum]
Definition: XrdDigAuth.hh:97
XrdOucStream
Definition: XrdOucStream.hh:47
XrdDigAuthEnt::aProc
@ aProc
Definition: XrdDigAuth.hh:53
XrdDigAuthEnt::eChk
char * eChk[eNum]
Definition: XrdDigAuth.hh:51
XrdDigAuthEnt::eNum
@ eNum
Definition: XrdDigAuth.hh:50
XrdDigAuthEnt::prot
char prot[XrdSecPROTOIDSIZE]
Definition: XrdDigAuth.hh:48
XrdDigAuth::Failure
bool Failure(int lNum, const char *txt1, const char *txt2=0)
XrdSecPROTOIDSIZE
#define XrdSecPROTOIDSIZE
Definition: XrdSecEntity.hh:47
XrdDigAuthEnt::aNum
@ aNum
Definition: XrdDigAuth.hh:53
XrdDigAuth::authFN
const char * authFN
Definition: XrdDigAuth.hh:93
XrdDigAuthEnt::aType
aType
Definition: XrdDigAuth.hh:53
XrdDigAuthEnt::eGrp
@ eGrp
Definition: XrdDigAuth.hh:50
XrdDigAuthEnt::eVorg
@ eVorg
Definition: XrdDigAuth.hh:50
XrdDigAuth::authMutex
XrdSysMutex authMutex
Definition: XrdDigAuth.hh:92
XrdDigAuthEnt::eName
@ eName
Definition: XrdDigAuth.hh:50
XrdDigAuthEnt::~XrdDigAuthEnt
~XrdDigAuthEnt()
Definition: XrdDigAuth.hh:61
XrdDigAuth::authTOD
time_t authTOD
Definition: XrdDigAuth.hh:94
XrdDigAuthEnt::eRole
@ eRole
Definition: XrdDigAuth.hh:50
XrdDigAuth::~XrdDigAuth
~XrdDigAuth()
Definition: XrdDigAuth.hh:80
XrdDigAuth::Parse
bool Parse(XrdOucStream &aFile, int lNum)
XrdSecEntity
Definition: XrdSecEntity.hh:64
XrdDigAuthEnt::eHost
@ eHost
Definition: XrdDigAuth.hh:50
XrdDigAuth::Squash
void Squash(char *bP)
XrdDigAuthEnt::eType
eType
Definition: XrdDigAuth.hh:50
XrdSysError
Definition: XrdSysError.hh:90
XrdDigAuthEnt::next
XrdDigAuthEnt * next
Definition: XrdDigAuth.hh:46
XrdDigAuth
Definition: XrdDigAuth.hh:69
XrdDigAuth::authList
XrdDigAuthEnt * authList
Definition: XrdDigAuth.hh:96
XrdDigAuth::Refresh
bool Refresh()
XrdSecEntity.hh