#include <XrdVomsMapfile.hh>
Definition at line 37 of file XrdVomsMapfile.hh.
◆ ~XrdVomsMapfile()
| XrdVomsMapfile::~XrdVomsMapfile |
( |
| ) |
|
|
virtual |
◆ Apply()
Definition at line 261 of file XrdVomsMapfile.cc.
268 std::string gridmap_name;
269 auto gridmap_success = entity.
eaAPI->
Get(
"gridmap.name", gridmap_name);
270 if (gridmap_success && gridmap_name ==
"1") {
274 int from_vorg = 0, from_role = 0, from_grps = 0;
278 if (m_edest) m_edest->
Log(
LogMask::Debug,
"VOMSMapfile",
"Applying VOMS mapfile to incoming credential");
279 while (((from_vorg = vorg.
tokenize(entry_vorg, from_vorg,
' ')) != -1) &&
280 ((role ==
"") || (from_role = role.
tokenize(entry_role, from_role,
' ')) != -1) &&
281 ((from_grps = grps.
tokenize(entry_grps, from_grps,
' ')) != -1))
283 auto fqan = MakePath(entry_grps);
284 if (fqan.empty()) {
continue;}
288 if (strcmp(fqan[0].c_str(), entry_vorg.c_str())) {
continue;}
290 fqan.emplace_back(std::string(
"Role=") + entry_role.c_str());
291 fqan.emplace_back(
"Capability=NULL");
292 std::string username;
293 if (!(username = Map(fqan)).empty()) {
294 if (entity.
name) {free(entity.
name);}
295 entity.
name = strdup(username.c_str());
int tokenize(XrdOucString &tok, int from, char del=':')
XrdSecAttr * Get(const void *sigkey)
char * vorg
Entity's virtual organization(s)
XrdSecEntityAttr * eaAPI
non-const API to attributes
char * grps
Entity's group name(s)
char * name
Entity's name.
char * role
Entity's role(s)
void Log(int mask, const char *esfx, const char *text1, const char *text2=0, const char *text3=0)
References Debug, XrdSecEntity::eaAPI, XrdSecEntityAttr::Get(), XrdSecEntity::grps, XrdSysError::Log(), XrdSecEntity::name, XrdSecEntity::role, XrdOucString::tokenize(), and XrdSecEntity::vorg.
Referenced by XrdVomsFun::VOMSFun().
◆ Configure()
Definition at line 312 of file XrdVomsMapfile.cc.
314 if (tried_configure) {
315 auto result = mapper.get();
317 result->SetErrorStream(erp);
322 tried_configure =
true;
327 char *config_filename =
nullptr;
332 XrdOucStream stream(erp, getenv(
"XRDINSTANCE"), &myEnv,
"=====> ");
335 if ((cfg_fd =
open(config_filename, O_RDONLY, 0)) < 0) {
336 if (erp) erp->
Emsg(
"Config", errno,
"open config file", config_filename);
339 stream.Attach(cfg_fd);
341 std::string map_filename;
342 while ((var = stream.GetMyFirstWord())) {
343 if (!strcmp(var,
"voms.mapfile")) {
344 auto val = stream.GetWord();
345 if (!val || !val[0]) {
346 if (erp) erp->
Emsg(
"Config",
"VOMS mapfile not specified");
350 }
else if (!strcmp(var,
"voms.trace")) {
351 auto val = stream.GetWord();
352 if (!val || !val[0]) {
353 if (erp) erp->
Emsg(
"Config",
"VOMS logging level not specified");
363 else if (!strcmp(val,
"none")) {erp->
setMsgMask(0);}
364 else {erp->
Emsg(
"Config",
"voms.trace encountered an unknown directive:", val);}
365 val = stream.GetWord();
370 if (!map_filename.empty()) {
371 if (erp) erp->
Emsg(
"Config",
"Will initialize VOMS mapfile", map_filename.c_str());
373 if (!mapper->IsValid()) {
374 mapper.reset(
nullptr);
static bool Import(const char *var, char *&val)
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
void setMsgMask(int mask)
References TPC::All, XrdOucStream::Attach(), Debug, XrdSysError::Emsg(), Error, XrdSysError::getMsgMask(), XrdOucStream::GetMyFirstWord(), XrdOucStream::GetWord(), XrdOucEnv::Import(), TPC::Info, open, XrdSysError::setMsgMask(), VOMS_MAP_FAILED, and TPC::Warning.
Referenced by XrdVomsFun::VOMSInit().
◆ Get()
◆ IsValid()
| bool XrdVomsMapfile::IsValid |
( |
| ) |
const |
|
inline |
The documentation for this class was generated from the following files: