309{
310 if (tried_configure) {
311 auto result = mapper.get();
312 if (result) {
313 result->SetErrorStream(erp);
314 }
315 return result;
316 }
317
318 tried_configure = true;
319
320
321 if (erp) erp->
setMsgMask(LogMask::Error | LogMask::Warning);
322
323 char *config_filename = nullptr;
326 }
327 XrdOucEnv myEnv;
328 XrdOucStream stream(erp, getenv("XRDINSTANCE"), &myEnv, "=====> ");
329
330 int cfg_fd;
331 if ((cfg_fd =
open(config_filename, O_RDONLY, 0)) < 0) {
332 if (erp) erp->
Emsg(
"Config", errno,
"open config file", config_filename);
334 }
335 stream.Attach(cfg_fd);
336 char *var;
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");
344 }
345 map_filename = val;
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");
351 }
353 if (erp) do {
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();
362 } while (val);
363 }
364 }
365
366 if (!map_filename.empty()) {
367 if (erp) erp->
Emsg(
"Config",
"Will initialize VOMS mapfile", map_filename.c_str());
368 mapper.reset(new XrdVomsMapfile(erp, map_filename));
369 if (!mapper->IsValid()) {
370 mapper.reset(nullptr);
372 }
373 }
374
375 return mapper.get();
376}
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)