40 #include "XrdVersion.hh"
52 #define TRACE_Authen 0x0002
53 #define EPNAME(x) static const char *epname = x;
54 #define PRINT(y) {if (dnTrace) {dnTrace->Beg(epname); std::cerr <<y; dnTrace->End();}}
55 #define DEBUG(y) if (dnTrace && (dnTrace->What & TRACE_Authen)) PRINT(y)
112 return (match) ? 1 : 0;
149 if (mc->user.length() > 0) {
150 name =
new char[mc->user.length() + 1];
151 strcpy(name, mc->user.c_str());
155 DEBUG(
"mapping DN '"<<dn<<
"' to '"<<name<<
"'");
157 DEBUG(
"no valid match found for DN '"<<dn<<
"'");
179 while ((from = pps.tokenize(p, from,
'|')) != -1) {
181 if (p ==
"d" || p ==
"dbg" || p ==
"debug") {
193 if (cfg.
length() <= 0) cfg = getenv(
"XRDGSIGMAPDNCF");
195 PRINT(
"ERROR: undefined config file path");
201 char l[4096], val[4096], usr[256];
202 while (fgets(l,
sizeof(l), fcf)) {
204 if (len < 2)
continue;
205 if (l[0] ==
'#')
continue;
206 if (l[len-1] ==
'\n') l[len-1] =
'\0';
207 if (sscanf(l,
"%4095s %255s", val, usr) >= 2) {
215 stype =
"beginning with";
217 int vlen = strlen(val);
218 if (val[vlen-1] ==
'$') {
222 stype =
"ending with";
223 }
else if (val[vlen-1] ==
'+') {
227 stype =
"containing";
233 DEBUG(
"mapping DNs "<<stype<<
" '"<<p<<
"' to '"<<usr<<
"'");
238 PRINT(
"ERROR: config file '"<<cfg<<
"' could not be open (errno: "<<errno<<
")");
static XrdSysError dnDest(0, "gmapdn_")
char * XrdSecgsiGMAPFun(const char *dn, int now)
static int FindMatchingCondition(const char *, XrdSecgsiMapEntry_t *mc, void *xmp)
XrdVERSIONINFO(XrdSecgsiGMAPFun, secgsigmap)
int XrdSecgsiGMAPInit(const char *cfg)
static XrdOucHash< XrdSecgsiMapEntry_t > gMappings
static XrdSysLogger dnLogger
static XrdOucTrace * dnTrace
const char * c_str() const
int matches(const char *s, char wch=' *')
int find(const char c, int start=0, bool forward=1)
XrdSecgsiMapEntry_t(const char *v, const char *u, int t)
XrdSysLogger * logger(XrdSysLogger *lp=0)