xrootd
XrdAccEntity.hh
Go to the documentation of this file.
1#ifndef __ACC_ENTITY_H__
2#define __ACC_ENTITY_H__
3/******************************************************************************/
4/* */
5/* X r d A c c E n t i t y . h h */
6/* */
7/* (c) 2019 by the Board of Trustees of the Leland Stanford, Jr., University */
8/* Produced by Andrew Hanushevsky for Stanford University under contract */
9/* DE-AC02-76-SFO0515 with the Department of Energy */
10/* */
11/* This file is part of the XRootD software suite. */
12/* */
13/* XRootD is free software: you can redistribute it and/or modify it under */
14/* the terms of the GNU Lesser General Public License as published by the */
15/* Free Software Foundation, either version 3 of the License, or (at your */
16/* option) any later version. */
17/* */
18/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
19/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
20/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
21/* License for more details. */
22/* */
23/* You should have received a copy of the GNU Lesser General Public License */
24/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
25/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
26/* */
27/* The copyright holder's institutional names and contributor's names may not */
28/* be used to endorse or promote products derived from this software without */
29/* specific prior written permission of the institution or contributor. */
30/******************************************************************************/
31
32#include <stdlib.h>
33#include <vector>
34
35/******************************************************************************/
36/* X r d A c c E n t i t y I n f o */
37/******************************************************************************/
38
40 {const char *name; // Filled in by caller
41 const char *host; // Filled in by caller
42 const char *vorg;
43 const char *role;
44 const char *grup;
46 name(NULL),
47 host(NULL),
48 vorg(NULL),
49 role(NULL),
50 grup(NULL) {}
52 };
53
54/******************************************************************************/
55/* X r d A c c E n t i t y */
56/******************************************************************************/
57
58class XrdOucTokenizer;
59class XrdSecEntity;
60class XrdSysError;
61
63{
64public:
65
66static
68
69bool Next(int &seq, XrdAccEntityInfo &info)
70 {if (int(attrVec.size()) <= seq) return false;
71 EntityAttr *aP = &attrVec[seq++];
72 info.vorg = aP->vorg;
73 info.role = aP->role;
74 info.grup = aP->grup;
75 return true;
76 }
77
78void PutEntity();
79
80static
82
83private:
84
85 XrdAccEntity(const XrdSecEntity *secP, bool &aOK);
86
88 if (roleInfo) free(roleInfo);
89 if (grpsInfo) free(grpsInfo);
90 }
91
92bool OneOrZero(char *src, const char *&dest);
93bool setAttr(XrdOucTokenizer &tkl, const char *&dest);
94
96 {const char *vorg;
97 const char *role;
98 const char *grup;
99 EntityAttr() : vorg(NULL), role(NULL), grup(NULL) {}
101 };
102
103
104std::vector<EntityAttr> attrVec;
105
110};
111
112/******************************************************************************/
113/* X r d A c c E n t i t y I n i t */
114/******************************************************************************/
115
117{
118public:
119
121 {aeR = aeP = XrdAccEntity::GetEntity(secP);}
122
124
125private:
126
128};
129#endif
Definition: XrdAccEntity.hh:117
XrdAccEntity * aeP
Definition: XrdAccEntity.hh:127
~XrdAccEntityInit()
Definition: XrdAccEntity.hh:123
XrdAccEntityInit(const XrdSecEntity *secP, XrdAccEntity *&aeR)
Definition: XrdAccEntity.hh:120
Definition: XrdAccEntity.hh:63
static void setError(XrdSysError *errP)
std::vector< EntityAttr > attrVec
Definition: XrdAccEntity.hh:104
char * vorgInfo
Definition: XrdAccEntity.hh:106
char * roleInfo
Definition: XrdAccEntity.hh:107
void PutEntity()
int ueid
Definition: XrdAccEntity.hh:109
char * grpsInfo
Definition: XrdAccEntity.hh:108
bool OneOrZero(char *src, const char *&dest)
XrdAccEntity(const XrdSecEntity *secP, bool &aOK)
static XrdAccEntity * GetEntity(const XrdSecEntity *secP)
~XrdAccEntity()
Definition: XrdAccEntity.hh:87
bool setAttr(XrdOucTokenizer &tkl, const char *&dest)
bool Next(int &seq, XrdAccEntityInfo &info)
Definition: XrdAccEntity.hh:69
Definition: XrdOucTokenizer.hh:33
Definition: XrdSecEntity.hh:52
Definition: XrdSysError.hh:90
Definition: XrdAccEntity.hh:40
const char * vorg
Definition: XrdAccEntity.hh:42
~XrdAccEntityInfo()
Definition: XrdAccEntity.hh:51
const char * role
Definition: XrdAccEntity.hh:43
const char * name
Definition: XrdAccEntity.hh:40
XrdAccEntityInfo()
Definition: XrdAccEntity.hh:45
const char * host
Definition: XrdAccEntity.hh:41
const char * grup
Definition: XrdAccEntity.hh:44
Definition: XrdAccEntity.hh:96
const char * vorg
Definition: XrdAccEntity.hh:96
EntityAttr()
Definition: XrdAccEntity.hh:99
~EntityAttr()
Definition: XrdAccEntity.hh:100
const char * grup
Definition: XrdAccEntity.hh:98
const char * role
Definition: XrdAccEntity.hh:97