xrootd
Loading...
Searching...
No Matches
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 <cstdlib>
33#include <vector>
34
35#include "XrdSec/XrdSecAttr.hh"
36
37/******************************************************************************/
38/* X r d A c c E n t i t y I n f o */
39/******************************************************************************/
40
42 {const char *name; // Filled in by caller
43 const char *host; // Filled in by caller
44 const char *vorg;
45 const char *role;
46 const char *grup;
48 name(NULL),
49 host(NULL),
50 vorg(NULL),
51 role(NULL),
52 grup(NULL) {}
54 };
55
56/******************************************************************************/
57/* X r d A c c E n t i t y */
58/******************************************************************************/
59
60class XrdOucTokenizer;
61class XrdSecEntity;
62class XrdSysError;
63
65{
66public:
67
68static
69XrdAccEntity *GetEntity(const XrdSecEntity *secP, bool &isNew);
70
71bool Next(int &seq, XrdAccEntityInfo &info)
72 {if (int(attrVec.size()) <= seq) return false;
73 EntityAttr *aP = &attrVec[seq++];
74 info.vorg = aP->vorg;
75 info.role = aP->role;
76 info.grup = aP->grup;
77 return true;
78 }
79
80void PutEntity(const XrdSecEntity *secP);
81
82static
84
85private:
86
87 XrdAccEntity(const XrdSecEntity *secP, bool &aOK);
88
90 if (roleInfo) free(roleInfo);
91 if (grpsInfo) free(grpsInfo);
92 }
93
94bool OneOrZero(char *src, const char *&dest);
95bool setAttr(XrdOucTokenizer &tkl, const char *&dest);
96
98 {const char *vorg;
99 const char *role;
100 const char *grup;
101 EntityAttr() : vorg(NULL), role(NULL), grup(NULL) {}
103 };
104
105
106std::vector<EntityAttr> attrVec;
107
111static int accSig; // Attribute Object Signture
112};
113
114/******************************************************************************/
115/* X r d A c c E n t i t y I n i t */
116/******************************************************************************/
117
119{
120public:
121
122 XrdAccEntityInit(const XrdSecEntity *secP, XrdAccEntity *&aeR) : seP(secP)
123 {bool isNew;
124 aeR = XrdAccEntity::GetEntity(secP, isNew);
125 aeP = (isNew ? aeR : 0);
126 }
127
129
130private:
131
134};
135#endif
Definition XrdAccEntity.hh:119
XrdAccEntity * aeP
Definition XrdAccEntity.hh:133
~XrdAccEntityInit()
Definition XrdAccEntity.hh:128
XrdAccEntityInit(const XrdSecEntity *secP, XrdAccEntity *&aeR)
Definition XrdAccEntity.hh:122
const XrdSecEntity * seP
Definition XrdAccEntity.hh:132
Definition XrdAccEntity.hh:65
static void setError(XrdSysError *errP)
std::vector< EntityAttr > attrVec
Definition XrdAccEntity.hh:106
char * vorgInfo
Definition XrdAccEntity.hh:108
char * roleInfo
Definition XrdAccEntity.hh:109
char * grpsInfo
Definition XrdAccEntity.hh:110
bool OneOrZero(char *src, const char *&dest)
XrdAccEntity(const XrdSecEntity *secP, bool &aOK)
void PutEntity(const XrdSecEntity *secP)
static int accSig
Definition XrdAccEntity.hh:111
static XrdAccEntity * GetEntity(const XrdSecEntity *secP, bool &isNew)
~XrdAccEntity()
Definition XrdAccEntity.hh:89
bool setAttr(XrdOucTokenizer &tkl, const char *&dest)
bool Next(int &seq, XrdAccEntityInfo &info)
Definition XrdAccEntity.hh:71
Definition XrdOucTokenizer.hh:33
Definition XrdSecAttr.hh:61
Definition XrdSecEntity.hh:65
Definition XrdSysError.hh:90
Definition XrdAccEntity.hh:42
const char * vorg
Definition XrdAccEntity.hh:44
~XrdAccEntityInfo()
Definition XrdAccEntity.hh:53
const char * role
Definition XrdAccEntity.hh:45
const char * name
Definition XrdAccEntity.hh:42
XrdAccEntityInfo()
Definition XrdAccEntity.hh:47
const char * host
Definition XrdAccEntity.hh:43
const char * grup
Definition XrdAccEntity.hh:46
Definition XrdAccEntity.hh:98
const char * vorg
Definition XrdAccEntity.hh:98
EntityAttr()
Definition XrdAccEntity.hh:101
~EntityAttr()
Definition XrdAccEntity.hh:102
const char * grup
Definition XrdAccEntity.hh:100
const char * role
Definition XrdAccEntity.hh:99