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 
92 XrdSysMutex authMutex;
93 const char *authFN;
94 time_t authTOD;
95 time_t authCHK;
96 XrdDigAuthEnt *authList;
97 bool accOK[XrdDigAuthEnt::aNum];
98 };
99 #endif
#define XrdSecPROTOIDSIZE
Definition: XrdSecEntity.hh:47
char prot[XrdSecPROTOIDSIZE]
Definition: XrdDigAuth.hh:48
char * eChk[eNum]
Definition: XrdDigAuth.hh:51
XrdDigAuthEnt * next
Definition: XrdDigAuth.hh:46
bool accOK[aNum]
Definition: XrdDigAuth.hh:54
bool Authorize(const XrdSecEntity *client, XrdDigAuthEnt::aType aType, bool aVec[XrdDigAuthEnt::aNum]=0)
Definition: XrdDigAuth.cc:89
bool Configure(const char *aFN)
Definition: XrdDigAuth.cc:163