#include <XrdOucGMap.hh>
Definition at line 48 of file XrdOucGMap.hh.
◆ XrdOucGMap()
Definition at line 103 of file XrdOucGMap.cc.
104 : valid(0), mf_mtime(-1), notafter(-1), timeout(600), elogger(
eDest), tracer(0), dbg(0)
113 if (pp.length() > 0) {
115 while ((from = pp.tokenize(p, from,
'|')) != -1) {
117 if (p ==
"debug" || p ==
"dbg") {
124 PRINT(tracer,
"OucGMap",
"timeout value badly formatted ("<<p<<
"); ignoring");
132 if (timeout > 0) notafter = time(0) + (time_t) timeout;
137 if (mf_name.
length() <= 0) {
138 mf_name = getenv(
"GRIDMAP");
139 if (mf_name.
length() <= 0)
140 mf_name =
"/etc/grid-security/grid-mapfile";
145 PRINT(tracer,
"OucGMap",
"cannot access grid map file '"<< mf_name
146 <<
"' in read mode; " <<
XrdSysE2T(errno));
152 if (load(mf_name.
c_str()) != 0) {
153 PRINT(tracer,
"OucGMap",
"unable to load file "<<mf_name<<
" - aborting");
static XrdSysError eDest(0,"crypto_")
int access(const char *path, int amode)
const char * XrdSysE2T(int errcode)
const char * c_str() const
int erasefromstart(int sz=0)
bool isdigit(int from=0, int to=-1)
long atoi(int from=0, int to=-1)
References access(), XrdOucString::atoi(), XrdOucString::beginswith(), XrdOucString::c_str(), eDest, XrdOucString::erasefromstart(), XrdOucString::isdigit(), XrdOucString::length(), PRINT, and XrdSysE2T().
◆ ~XrdOucGMap()
virtual XrdOucGMap::~XrdOucGMap |
( |
| ) |
|
|
inlinevirtual |
◆ dn2user()
int XrdOucGMap::dn2user |
( |
const char * |
dn, |
|
|
char * |
user, |
|
|
int |
ulen, |
|
|
time_t |
now = 0 |
|
) |
| |
|
virtual |
Map a distinguished name (dn) to a user name.
- Parameters
-
dn | -> Distinguished name. |
user | -> Buffer where the user name is to be placed. It must end with a null byte. |
ulen | -> The length of the 'user' buffer. |
now | -> Current time (result of time(0)) or 0 if not available. |
- Returns
- Success: Zero. Failure: An errno number describing the failure; typically -EFAULT - No valid matching found. -errno - If problems reloading the file
Definition at line 292 of file XrdOucGMap.cc.
298 if (user && ulen > 0) {
299 memset(user,
'\0', ulen);
301 PRINT(tracer,
"OucGMap::dn2user",
302 "buffer for the user name is undefined or has undefined length");
309 if (now <= 0) now = time(0);
310 if (notafter < now) {
312 if (load(mf_name.
c_str()) != 0) {
313 PRINT(tracer,
"OucGMap::dn2user",
314 "problems loading file "<<mf_name);
317 if (timeout > 0) notafter = now + (time_t) timeout;
329 if ((mc = mappings.
Find(dn))) {
340 if (mc->user.length() > 0) {
342 strncpy(user, mc->user.c_str(), ul);
349 DEBUG(dbg, tracer,
"XrdOucGMap::dn2user",
"mapping DN '"<<dn<<
"' to '"<<user<<
"'");
351 DEBUG(dbg, tracer,
"XrdOucGMap::dn2user",
"no valid match found for DN '"<<dn<<
"'");
#define DEBUG(d, t, n, y)
static int FindMatchingCondition(const char *, XrdSecGMapEntry_t *mc, void *xmp)
T * Apply(int(*func)(const char *, T *, void *), void *Arg)
T * Find(const char *KeyVal, time_t *KeyTime=0)
void Lock(const XrdSysXS_Type usage)
void UnLock(const XrdSysXS_Type usage=xs_None)
References XrdOucHash< T >::Apply(), XrdOucString::c_str(), DEBUG, XrdOucHash< T >::Find(), FindMatchingCondition(), kFull, XrdOucString::length(), XrdSysXSLock::Lock(), PRINT, XrdSysXSLock::UnLock(), XrdSecGMapEntry_t::user, and xs_Shared.
◆ isValid()
bool XrdOucGMap::isValid |
( |
| ) |
const |
|
inline |
The documentation for this class was generated from the following files: