XRootD
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)   {if (d && t) {t->Beg(n); std::cerr <<y; t->End();}}
 
#define PRINT(t, n, y)   {if (t) {t->Beg(n); std::cerr <<y; t->End();}}
 

Enumerations

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

Functions

static int FindMatchingCondition (const char *, XrdSecGMapEntry_t *mc, void *xmp)
 
XrdOucGMapXrdOucgetGMap (XrdOucGMapArgs)
 

Macro Definition Documentation

◆ DEBUG

#define DEBUG (   d,
  t,
  n,
 
)    {if (d && t) {t->Beg(n); std::cerr <<y; t->End();}}

Definition at line 61 of file XrdOucGMap.cc.

◆ PRINT

#define PRINT (   t,
  n,
 
)    {if (t) {t->Beg(n); std::cerr <<y; t->End();}}

Definition at line 60 of file XrdOucGMap.cc.

Enumeration Type Documentation

◆ XrdOucGMap_Match

Enumerator
kFull 
kBegins 
kEnds 
kContains 

Definition at line 54 of file XrdOucGMap.cc.

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

Function Documentation

◆ FindMatchingCondition()

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

Definition at line 64 of file XrdOucGMap.cc.

65 {
66  // Print content of entry 'ui' and go to next
67 
69 
70  bool match = 0;
71  if (mc && mpe) {
72  if (mc->type == kContains) {
73  if (mpe->val.find(mc->val) != STR_NPOS) match = 1;
74  } else if (mc->type == kBegins) {
75  if (mpe->val.beginswith(mc->val)) match = 1;
76  } else if (mc->type == kEnds) {
77  if (mpe->val.endswith(mc->val)) match = 1;
78  } else {
79  if (mpe->val.matches(mc->val.c_str())) match = 1;
80  }
81  if (match) mpe->user = mc->user;
82  }
83 
84  // We stop if matched, otherwise we continue
85  return (match) ? 1 : 0;
86 }
#define STR_NPOS
const char * c_str() const
bool endswith(char c)
bool beginswith(char c)
int matches(const char *s, char wch=' *')
int find(const char c, int start=0, bool forward=1)
XrdOucString user
Definition: XrdOucGMap.hh:44
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().

+ 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.

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

References eDest, and XrdOucGMap::isValid().

Referenced by XrdSecProtocolgsi::Init().

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