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
Definition: XrdDigAuth.hh:50
aType
Definition: XrdDigAuth.hh:53
const char * authFN
Definition: XrdDigAuth.hh:93
char * rec
Definition: XrdDigAuth.hh:47
XrdDigAuthEnt * next
Definition: XrdDigAuth.hh:46
Definition: XrdDigAuth.hh:50
Definition: XrdDigAuth.hh:50
Definition: XrdDigAuth.hh:50
Definition: XrdOucStream.hh:46
Definition: XrdDigAuth.hh:50
bool Failure(int lNum, const char *txt1, const char *txt2=0)
Definition: XrdDigAuth.hh:50
char * eChk[eNum]
Definition: XrdDigAuth.hh:51
char prot[XrdSecPROTOIDSIZE]
Definition: XrdDigAuth.hh:48
~XrdDigAuth()
Definition: XrdDigAuth.hh:80
Definition: XrdSysError.hh:89
Definition: XrdSysPthread.hh:165
#define XrdSecPROTOIDSIZE
Definition: XrdSecEntity.hh:47
bool accOK[XrdDigAuthEnt::aNum]
Definition: XrdDigAuth.hh:97
bool SetupAuth(bool isRefresh)
void Squash(char *bP)
XrdDigAuthEnt * authList
Definition: XrdDigAuth.hh:96
bool Refresh()
time_t authTOD
Definition: XrdDigAuth.hh:94
bool Configure(const char *aFN)
XrdDigAuth()
Definition: XrdDigAuth.hh:79
Definition: XrdDigAuth.hh:53
Definition: XrdDigAuth.hh:43
~XrdDigAuthEnt()
Definition: XrdDigAuth.hh:61
Definition: XrdDigAuth.hh:53
Definition: XrdDigAuth.hh:53
eType
Definition: XrdDigAuth.hh:50
bool Authorize(const XrdSecEntity *client, XrdDigAuthEnt::aType aType, bool aVec[XrdDigAuthEnt::aNum]=0)
Definition: XrdDigAuth.hh:68
bool OkGrp(const char *glist, const char *gname)
time_t authCHK
Definition: XrdDigAuth.hh:95
Definition: XrdDigAuth.hh:53
Definition: XrdSecEntity.hh:63
bool accOK[aNum]
Definition: XrdDigAuth.hh:54
XrdDigAuthEnt()
Definition: XrdDigAuth.hh:56
Definition: XrdDigAuth.hh:53
bool Parse(XrdOucStream &aFile, int lNum)
XrdSysMutex authMutex
Definition: XrdDigAuth.hh:92