#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <unistd.h>
#include "XrdVersion.hh"
#include "XrdSys/XrdSysHeaders.hh"
#include "XrdSys/XrdSysPthread.hh"
#include "XrdSec/XrdSecEntity.hh"
#include "XrdOuc/XrdOucEnv.hh"
#include "XrdOuc/XrdOucLock.hh"
Go to the source code of this file.
|
#define | PRINT(y) if (g_debug) {std::cerr << y << "\n";} |
|
#define | PROUT(_x_) std::cerr <<inf_pfx <<"entity." #_x_ "='" <<(entity._x_ ? entity._x_ : "") <<"'.\n" |
|
◆ PRINT
#define PRINT |
( |
|
y | ) |
if (g_debug) {std::cerr << y << "\n";} |
◆ PROUT
#define PROUT |
( |
|
_x_ | ) |
std::cerr <<inf_pfx <<"entity." #_x_ "='" <<(entity._x_ ? entity._x_ : "") <<"'.\n" |
◆ XrdSecgsiAuthzFun()
Definition at line 140 of file XrdSecgsiAuthzFunVO.cc.
142 static const char* inf_pfx =
"INFO in AuthzFun: ";
144 const char *vtxt =
"", *etxt = 0;
145 char vbuff[(g_maxvolen+1)*2];
151 if (!entity.
vorg) etxt =
"missing";
152 else if ((n = strlen(entity.
vorg)) > g_maxvolen) etxt =
"too long";
155 strcpy(vbuff+1, entity.
vorg);
156 if (!strstr(g_valido, vbuff))
157 {vtxt = entity.
vorg; etxt =
" not allowed";}
163 {std::cerr <<
"AuthzVO: Invalid cert; vo " <<vtxt <<etxt <<std::endl;
170 {snprintf(vbuff,
sizeof(vbuff), g_vo2grp, entity.
vorg);
172 entity.
grps = strdup(vbuff);
178 {snprintf(vbuff,
sizeof(vbuff), g_vo2usr, entity.
vorg);
180 entity.
name = strdup(vbuff);
181 }
else if (g_cn2usr && entity.
name && (vtxt=strstr(entity.
name,
"/CN=")))
183 strncpy(vbuff, vtxt+4, g_maxvolen); vbuff[n] = 0;
184 while(*cP) {
if (*cP ==
' ') *cP =
'_'; cP++;}
185 for (i = n-1; i >= 0; i--) {
if (*cP ==
'_') *cP = 0;}
187 {
if (entity.
name) free(entity.
name);
188 entity.
name = strdup(vbuff);
char * vorg
Entity's virtual organization(s)
char * grps
Entity's group name(s)
char * name
Entity's name.
References XrdSecEntity::grps, XrdSecEntity::name, PROUT, and XrdSecEntity::vorg.
◆ XrdSecgsiAuthzInit()
int XrdSecgsiAuthzInit |
( |
const char * |
cfg | ) |
|
Definition at line 237 of file XrdSecgsiAuthzFunVO.cc.
244 static const char* inf_pfx =
"INFO in AuthzInit: ";
246 char cfgbuff[2048], *sP;
254 if (i >= (
int)
sizeof(cfgbuff)) i =
sizeof(cfgbuff)-1;
255 memcpy(cfgbuff, cfg, i);
257 if ((sP = index(cfgbuff,
' '))) *sP = 0;
259 if (!cfg || !(*cfg))
return g_certificate_format;
267 if ((sP =
envP->
Get(
"debug")) && *sP ==
'1') g_debug = 1;
271 if ((g_vo2grp =
envP->
Get(
"vo2grp"))) g_vo2grp = strdup(g_vo2grp);
272 if ((g_vo2usr =
envP->
Get(
"vo2usr")))
274 g_vo2usr = (!strcmp(g_vo2usr,
"*") ? 0 : strdup(g_vo2usr));
279 if ((sP =
envP->
Get(
"valido")))
281 g_valido = (
char *)malloc(i+2);
283 strcpy(g_valido+1, sP);
292 PRINT(inf_pfx <<
"cfg='"<< (cfg ? cfg :
"null") <<
"'.");
293 return g_certificate_format;
char * Get(const char *varname)
References XrdProxy::envP, XrdOucEnv::Get(), and PRINT.
◆ XrdSecgsiAuthzKey()
int XrdSecgsiAuthzKey |
( |
XrdSecEntity & |
entity, |
|
|
char ** |
key |
|
) |
| |
Definition at line 209 of file XrdSecgsiAuthzFunVO.cc.
215 static const char* err_pfx =
"ERR in AuthzKey: ";
216 static const char* inf_pfx =
"INFO in AuthzKey: ";
220 PRINT(err_pfx <<
"'key' is not defined!");
224 PRINT(inf_pfx <<
"Returning creds of len " << entity.
credslen <<
" as key.");
227 *key =
new char[entity.
credslen + 1];
228 strcpy(*key, entity.
creds);
int credslen
Length of the 'creds' data.
char * creds
Raw entity credentials or cert.
References XrdSecEntity::creds, XrdSecEntity::credslen, and PRINT.
◆ XrdVERSIONINFO() [1/3]
◆ XrdVERSIONINFO() [2/3]
◆ XrdVERSIONINFO() [3/3]