#include <XrdVomsMapfile.hh>
Definition at line 37 of file XrdVomsMapfile.hh.
◆ ~XrdVomsMapfile()
XrdVomsMapfile::~XrdVomsMapfile |
( |
| ) |
|
|
virtual |
◆ Apply()
Definition at line 257 of file XrdVomsMapfile.cc.
264 std::string gridmap_name;
265 auto gridmap_success = entity.
eaAPI->
Get(
"gridmap.name", gridmap_name);
266 if (gridmap_success && gridmap_name ==
"1") {
270 int from_vorg = 0, from_role = 0, from_grps = 0;
274 if (m_edest) m_edest->
Log(
LogMask::Debug,
"VOMSMapfile",
"Applying VOMS mapfile to incoming credential");
275 while (((from_vorg = vorg.
tokenize(entry_vorg, from_vorg,
' ')) != -1) &&
276 ((role ==
"") || (from_role = role.
tokenize(entry_role, from_role,
' ')) != -1) &&
277 ((from_grps = grps.
tokenize(entry_grps, from_grps,
' ')) != -1))
279 auto fqan = MakePath(entry_grps);
280 if (fqan.empty()) {
continue;}
284 if (strcmp(fqan[0].c_str(), entry_vorg.c_str())) {
continue;}
286 fqan.emplace_back(std::string(
"Role=") + entry_role.c_str());
287 fqan.emplace_back(
"Capability=NULL");
288 std::string username;
289 if (!(username = Map(fqan)).empty()) {
290 if (entity.
name) {free(entity.
name);}
291 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 Macaroons::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 308 of file XrdVomsMapfile.cc.
310 if (tried_configure) {
311 auto result = mapper.get();
313 result->SetErrorStream(erp);
318 tried_configure =
true;
323 char *config_filename =
nullptr;
328 XrdOucStream stream(erp, getenv(
"XRDINSTANCE"), &myEnv,
"=====> ");
331 if ((cfg_fd =
open(config_filename, O_RDONLY, 0)) < 0) {
332 if (erp) erp->
Emsg(
"Config", errno,
"open config file", config_filename);
335 stream.Attach(cfg_fd);
337 std::string map_filename;
338 while ((var = stream.GetMyFirstWord())) {
339 if (!strcmp(var,
"voms.mapfile")) {
340 auto val = stream.GetWord();
341 if (!val || !val[0]) {
342 if (erp) erp->
Emsg(
"Config",
"VOMS mapfile not specified");
346 }
else if (!strcmp(var,
"voms.trace")) {
347 auto val = stream.GetWord();
348 if (!val || !val[0]) {
349 if (erp) erp->
Emsg(
"Config",
"VOMS logging level not specified");
359 else if (!strcmp(val,
"none")) {erp->
setMsgMask(0);}
360 else {erp->
Emsg(
"Config",
"voms.trace encountered an unknown directive:", val);}
361 val = stream.GetWord();
366 if (!map_filename.empty()) {
367 if (erp) erp->
Emsg(
"Config",
"Will initialize VOMS mapfile", map_filename.c_str());
369 if (!mapper->IsValid()) {
370 mapper.reset(
nullptr);
int open(const char *path, int oflag,...)
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 Macaroons::All, XrdOucStream::Attach(), Macaroons::Debug, XrdSysError::Emsg(), Macaroons::Error, XrdSysError::getMsgMask(), XrdOucStream::GetMyFirstWord(), XrdOucStream::GetWord(), XrdOucEnv::Import(), Info, open(), XrdSysError::setMsgMask(), VOMS_MAP_FAILED, and Warning.
Referenced by XrdVomsFun::VOMSInit().
◆ Get()
◆ IsValid()
bool XrdVomsMapfile::IsValid |
( |
| ) |
const |
|
inline |
The documentation for this class was generated from the following files: