57{
59
60 if (parms && parms[0]) {
64 int from = parms_str.tokenize(chained_lib, 0, ' ');
65 const char *chained_parms = NULL;
66 err->
Emsg(
"Config",
"Will chain library", chained_lib.
c_str());
67 if (from > 0)
68 {
69 parms_str.erasefromstart(from);
70 if (parms_str.length())
71 {
72 err->
Emsg(
"Config",
"Will chain parameters", parms_str.c_str());
73 chained_parms = parms_str.c_str();
74 }
75 }
76 char resolvePath[2048];
77 bool usedAltPath{true};
79 err->
Emsg(
"Config",
"Failed to locate appropriately versioned chained auth library:", parms);
80 delete err;
81 return NULL;
82 }
83 void *handle_base = dlopen(resolvePath, RTLD_LOCAL|RTLD_NOW);
84 if (handle_base == NULL) {
85 err->
Emsg(
"Config",
"Failed to base plugin ", resolvePath, dlerror());
86 delete err;
87 return NULL;
88 }
89
92 (dlsym(handle_base, "XrdAccAuthorizeObject"));
93 if (!ep)
94 {
95 err->
Emsg(
"Config",
"Unable to chain second authlib after macaroons", parms);
96 delete err;
97 return NULL;
98 }
99
100 chain_authz = (*ep)(log, config, chained_parms);
101
102 if (chain_authz == NULL) {
103 err->
Emsg(
"Config",
"Unable to chain second authlib after macaroons "
104 "which returned NULL");
105 delete err;
106 return NULL;
107 }
108 }
109 else
110 {
112 }
113 try
114 {
117 return new_authz;
118 }
119 catch (const std::runtime_error &e)
120 {
122 err.
Emsg(
"Config",
"Configuration of Macaroon authorization handler failed", e.what());
123 return NULL;
124 }
125}
XrdAccAuthorize * XrdAccDefaultAuthorizeObject(XrdSysLogger *lp, const char *cfn, const char *parm, XrdVersionInfo &myVer)
int XrdOucPinPath(const char *piPath, bool &noAltP, char *buff, int blen)
const char * c_str() const
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)