xrootd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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;
47  };
48 
49 /******************************************************************************/
50 /* X r d A c c E n t i t y */
51 /******************************************************************************/
52 
53 class XrdOucTokenizer;
54 class XrdSecEntity;
55 class XrdSysError;
56 
58 {
59 public:
60 
61 static
62 XrdAccEntity *GetEntity(const XrdSecEntity *secP);
63 
64 bool Next(int &seq, XrdAccEntityInfo &info)
65  {if (int(attrVec.size()) <= seq) return false;
66  EntityAttr *aP = &attrVec[seq++];
67  info.vorg = aP->vorg;
68  info.role = aP->role;
69  info.grup = aP->grup;
70  return true;
71  }
72 
73 void PutEntity();
74 
75 static
76 void setError(XrdSysError *errP);
77 
78 private:
79 
80  XrdAccEntity(const XrdSecEntity *secP, bool &aOK);
81 
83  if (roleInfo) free(roleInfo);
84  if (grpsInfo) free(grpsInfo);
85  }
86 
87 bool OneOrZero(char *src, const char *&dest);
88 bool setAttr(XrdOucTokenizer &tkl, const char *&dest);
89 
90 struct EntityAttr
91  {const char *vorg;
92  const char *role;
93  const char *grup;
96  };
97 
98 
99 std::vector<EntityAttr> attrVec;
100 
101 char *vorgInfo;
102 char *roleInfo;
103 char *grpsInfo;
104 int ueid;
105 };
106 
107 /******************************************************************************/
108 /* X r d A c c E n t i t y I n i t */
109 /******************************************************************************/
110 
112 {
113 public:
114 
116  {aeR = aeP = XrdAccEntity::GetEntity(secP);}
117 
119 
120 private:
121 
123 };
124 #endif
char * vorgInfo
Definition: XrdAccEntity.hh:101
const char * grup
Definition: XrdAccEntity.hh:93
bool OneOrZero(char *src, const char *&dest)
~XrdAccEntityInfo()
Definition: XrdAccEntity.hh:46
const char * host
Definition: XrdAccEntity.hh:41
XrdAccEntity(const XrdSecEntity *secP, bool &aOK)
const char * grup
Definition: XrdAccEntity.hh:44
const char * name
Definition: XrdAccEntity.hh:40
void PutEntity()
bool Next(int &seq, XrdAccEntityInfo &info)
Definition: XrdAccEntity.hh:64
~XrdAccEntity()
Definition: XrdAccEntity.hh:82
Definition: XrdSysError.hh:89
std::vector< EntityAttr > attrVec
Definition: XrdAccEntity.hh:99
char * grpsInfo
Definition: XrdAccEntity.hh:103
const char * role
Definition: XrdAccEntity.hh:92
const char * vorg
Definition: XrdAccEntity.hh:91
XrdAccEntityInfo()
Definition: XrdAccEntity.hh:45
static void setError(XrdSysError *errP)
const char * vorg
Definition: XrdAccEntity.hh:42
~EntityAttr()
Definition: XrdAccEntity.hh:95
bool setAttr(XrdOucTokenizer &tkl, const char *&dest)
Definition: XrdAccEntity.hh:39
XrdAccEntity * aeP
Definition: XrdAccEntity.hh:122
~XrdAccEntityInit()
Definition: XrdAccEntity.hh:118
Definition: XrdAccEntity.hh:111
const char * role
Definition: XrdAccEntity.hh:43
Definition: XrdOucTokenizer.hh:32
Definition: XrdAccEntity.hh:90
Definition: XrdAccEntity.hh:57
Definition: XrdSecEntity.hh:51
EntityAttr()
Definition: XrdAccEntity.hh:94
int ueid
Definition: XrdAccEntity.hh:104
XrdAccEntityInit(const XrdSecEntity *secP, XrdAccEntity *&aeR)
Definition: XrdAccEntity.hh:115
char * roleInfo
Definition: XrdAccEntity.hh:102
static XrdAccEntity * GetEntity(const XrdSecEntity *secP)