Loading...
Searching...
No Matches
XrdOucGMap.cc File Reference
`#include <cerrno>`
`#include <fcntl.h>`
`#include <sys/stat.h>`
`#include <cstdio>`
`#include <cstdlib>`
`#include <cstring>`
`#include "XrdOuc/XrdOucEnv.hh"`
`#include "XrdOuc/XrdOucGMap.hh"`
`#include "XrdOuc/XrdOucTrace.hh"`
`#include "XrdOuc/XrdOucStream.hh"`
`#include "XrdSys/XrdSysE2T.hh"`
Include dependency graph for XrdOucGMap.cc:

Go to the source code of this file.

## Macros

#define | DEBUG(d, t, n, y)
#define | PRINT(t, n, y)

## Enumerations

enum | XrdOucGMap_Match { kFull = 0 , kBegins = 1 , kEnds = 2 , kContains = 4 }

## Functions

static int | FindMatchingCondition (const char *, XrdSecGMapEntry_t *mc, void *xmp)
XrdOucGMap * | XrdOucgetGMap (XrdOucGMapArgs)

## Macro Definition Documentation

## DEBUG

#define DEBUG | ( |  | d,
|  |  | t,
|  |  | n,
|  |  | y )

Value:
{if (d && t) {t->Beg(n); std::cerr <<y; t->End();}}

Definition at line 61 of file XrdOucGMap.cc.

## PRINT

#define PRINT | ( |  | t,
|  |  | n,
|  |  | y )

Value:
{if (t) {t->Beg(n); std::cerr <<y; t->End();}}

Definition at line 60 of file XrdOucGMap.cc.

## Enumeration Type Documentation

## XrdOucGMap_Match

enum XrdOucGMap_Match

Enumerator
kFull |
kBegins |
kEnds |
kContains |

Definition at line 54 of file XrdOucGMap.cc.

{kFull = 0,
kBegins = 1,
kEnds = 2,
kContains = 4
};
kBegins
@ kBegins
Definition XrdOucGMap.cc:55
kEnds
@ kEnds
Definition XrdOucGMap.cc:56
kContains
@ kContains
Definition XrdOucGMap.cc:57
kFull
@ kFull
Definition XrdOucGMap.cc:54

## Function Documentation

## FindMatchingCondition()

int FindMatchingCondition | ( | const char * | ,
|  | XrdSecGMapEntry_t * | mc,
|  | void * | xmp )

static

Definition at line 64 of file XrdOucGMap.cc.

{
// Print content of entry 'ui' and go to next
XrdSecGMapEntry_t *mpe = (XrdSecGMapEntry_t *)xmp;
bool match = 0;
if (mc && mpe) {
if (mc->type == kContains) {
if (mpe->val.find(mc->val) != STR_NPOS) match = 1;
} else if (mc->type == kBegins) {
if (mpe->val.beginswith(mc->val)) match = 1;
} else if (mc->type == kEnds) {
if (mpe->val.endswith(mc->val)) match = 1;
} else {
if (mpe->val.matches(mc->val.c_str())) match = 1;
}
if (match) mpe->user = mc->user;
}
// We stop if matched, otherwise we continue
return (match) ? 1 : 0;
}
STR_NPOS
#define STR_NPOS
Definition XrdOucString.hh:250
XrdOucString::endswith
bool endswith(char c)
Definition XrdOucString.cc:406
XrdOucString::beginswith
bool beginswith(char c)
Definition XrdOucString.hh:289
XrdOucString::matches
int matches(const char *s, char wch=' *')
Definition XrdOucString.cc:426
XrdOucString::find
int find(const char c, int start=0, bool forward=1)
Definition XrdOucString.cc:260
XrdOucString::c_str
const char * c_str() const
Definition XrdOucString.hh:278
XrdSecGMapEntry_t
Definition XrdOucGMap.hh:40
XrdSecGMapEntry_t::user
XrdOucString user
Definition XrdOucGMap.hh:44
XrdSecGMapEntry_t::type
int type
Definition XrdOucGMap.hh:45
XrdSecGMapEntry_t::val
XrdOucString val
Definition XrdOucGMap.hh:43

References XrdOucString::beginswith(), XrdOucString::c_str(), XrdOucString::endswith(), XrdOucString::find(), kBegins, kContains, kEnds, XrdOucString::matches(), STR_NPOS, XrdSecGMapEntry_t::type, XrdSecGMapEntry_t::user, and XrdSecGMapEntry_t::val.

Referenced by XrdOucGMap::dn2user(), and XrdSecgsiGMAPFun().

Here is the call graph for this function:
Here is the caller graph for this function:

## XrdOucgetGMap()

XrdOucGMap * XrdOucgetGMap | ( | XrdOucGMapArgs |  | ) |

Obtain an instance of the XrdOucGMap object.

This extern "C" function is called when a shared library plug-in containing implementation of this class is loaded. It must exist in the shared library and must be thread-safe.

Parameters

  eDest | -> The error object that must be used to print any errors or other messages (see XrdSysError.hh).
  mapfn | -> Path to the grid map file to be used. This pointer may be null; the default path will be tested then.
  parms | -> Argument string specified on the gridmap directive. It may be null or point to a null string if no parms exist.

Returns
  Success: A pointer to an instance of the XrdOucGMap object. Failure: A null pointer which causes initialization to fail.

The GMap object is used frequently in the course of creating new physical connections. The algorithms used by this object must be efficient and speedy; otherwise system performance will be severely degraded.

Declare compilation version.

Additionally, you should declare the xrootd version you used to compile your plug-in. While not currently required, it is highly recommended to avoid execution issues should the class definition change. Declare it as:

    #include "XrdVersion.hh"
    XrdVERSIONINFO(XrdOucgetGMap,<name>);

where <name> is a 1- to 15-character unquoted name identifying your plugin.

Definition at line 92 of file XrdOucGMap.cc.

{
// Create a XrdOucGMap object and return it if valid
XrdOucGMap *gm = new XrdOucGMap(eDest, mapfn, parms);
if (gm && gm->isValid()) return gm;
if (gm) delete gm;
return (XrdOucGMap *)0;
}}
eDest
static XrdSysError eDest(0,"crypto_")
XrdOucGMap
Definition XrdOucGMap.hh:49
XrdOucGMap::isValid
bool isValid() const
Validity checker.
Definition XrdOucGMap.hh:104

References eDest, XrdOucGMap::isValid(), and XrdOucGMapArgs.

Referenced by XrdSecProtocolgsi::Init().

Here is the call graph for this function:
Here is the caller graph for this function: