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
43
class
XrdDigAuthEnt
44
{
45
public
:
46
XrdDigAuthEnt
*
next
;
47
char
*
rec
;
48
char
prot
[
XrdSecPROTOIDSIZE
];
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
68
class
XrdDigAuth
69
{
70
public
:
71
72
bool
Authorize
(
const
XrdSecEntity
*client,
73
XrdDigAuthEnt::aType
aType,
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) {}
80
~XrdDigAuth
() {}
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
XrdSecEntity.hh
XrdSecPROTOIDSIZE
#define XrdSecPROTOIDSIZE
Definition:
XrdSecEntity.hh:47
XrdSysPthread.hh
XrdDigAuthEnt
Definition:
XrdDigAuth.hh:44
XrdDigAuthEnt::rec
char * rec
Definition:
XrdDigAuth.hh:47
XrdDigAuthEnt::prot
char prot[XrdSecPROTOIDSIZE]
Definition:
XrdDigAuth.hh:48
XrdDigAuthEnt::aType
aType
Definition:
XrdDigAuth.hh:53
XrdDigAuthEnt::aProc
@ aProc
Definition:
XrdDigAuth.hh:53
XrdDigAuthEnt::aLogs
@ aLogs
Definition:
XrdDigAuth.hh:53
XrdDigAuthEnt::aNum
@ aNum
Definition:
XrdDigAuth.hh:53
XrdDigAuthEnt::aCore
@ aCore
Definition:
XrdDigAuth.hh:53
XrdDigAuthEnt::aConf
@ aConf
Definition:
XrdDigAuth.hh:53
XrdDigAuthEnt::eType
eType
Definition:
XrdDigAuth.hh:50
XrdDigAuthEnt::eHost
@ eHost
Definition:
XrdDigAuth.hh:50
XrdDigAuthEnt::eGrp
@ eGrp
Definition:
XrdDigAuth.hh:50
XrdDigAuthEnt::eNum
@ eNum
Definition:
XrdDigAuth.hh:50
XrdDigAuthEnt::eRole
@ eRole
Definition:
XrdDigAuth.hh:50
XrdDigAuthEnt::eVorg
@ eVorg
Definition:
XrdDigAuth.hh:50
XrdDigAuthEnt::eName
@ eName
Definition:
XrdDigAuth.hh:50
XrdDigAuthEnt::~XrdDigAuthEnt
~XrdDigAuthEnt()
Definition:
XrdDigAuth.hh:61
XrdDigAuthEnt::eChk
char * eChk[eNum]
Definition:
XrdDigAuth.hh:51
XrdDigAuthEnt::next
XrdDigAuthEnt * next
Definition:
XrdDigAuth.hh:46
XrdDigAuthEnt::XrdDigAuthEnt
XrdDigAuthEnt()
Definition:
XrdDigAuth.hh:56
XrdDigAuthEnt::accOK
bool accOK[aNum]
Definition:
XrdDigAuth.hh:54
XrdDigAuth
Definition:
XrdDigAuth.hh:69
XrdDigAuth::~XrdDigAuth
~XrdDigAuth()
Definition:
XrdDigAuth.hh:80
XrdDigAuth::Authorize
bool Authorize(const XrdSecEntity *client, XrdDigAuthEnt::aType aType, bool aVec[XrdDigAuthEnt::aNum]=0)
Definition:
XrdDigAuth.cc:89
XrdDigAuth::XrdDigAuth
XrdDigAuth()
Definition:
XrdDigAuth.hh:79
XrdDigAuth::Configure
bool Configure(const char *aFN)
Definition:
XrdDigAuth.cc:163
XrdOucStream
Definition:
XrdOucStream.hh:47
XrdSecEntity
Definition:
XrdSecEntity.hh:65
XrdSysError
Definition:
XrdSysError.hh:90
XrdSysMutex
Definition:
XrdSysPthread.hh:165
XrdDig
XrdDigAuth.hh
Generated by
1.9.1