Commit 4d276d02 authored by Elvin Sindrilaru's avatar Elvin Sindrilaru
Browse files

XROOTD: Process the opaque information in a more robust way by removing any '?' that certain

        applications (e.g. ROOT) can add to the user opaque information.
        Reword some log messages.
parent ced0cdd2
......@@ -735,7 +735,7 @@ XrdxCastor2Acc::Access(const XrdSecEntity* Entity,
}
int envlen = 0;
char* opaque = Env->Env(envlen);
const char* opaque = Env->Env(envlen);
if (!opaque)
{
......@@ -748,11 +748,10 @@ XrdxCastor2Acc::Access(const XrdSecEntity* Entity,
// This is not nice, but ROOT puts a ? into the opaque string,
// if there is a user opaque info
for (unsigned int i = 0; i < strlen(opaque); i++)
{
if (opaque[i] == '?')
opaque[i] = '&';
}
XrdOucString tmp_opaque = opaque;
while (tmp_opaque.replace("?", "&")) { };
while (tmp_opaque.replace("&&", "&")) { };
opaque = tmp_opaque.c_str();
XrdSysMutexHelper lock_decode(mDecodeMutex);
......
......@@ -592,7 +592,6 @@ XrdxCastor2Fs::stageprepare(const char* path,
{
EPNAME("stageprepare");
XrdOucString sinfo = (ininfo ? ininfo : "");
const char* info = 0;
int qpos = 0;
// Get client identity
uid_t client_uid;
......@@ -602,7 +601,7 @@ XrdxCastor2Fs::stageprepare(const char* path,
if ((qpos = sinfo.find("?")) != STR_NPOS)
sinfo.erase(qpos);
info = (ininfo ? sinfo.c_str() : ininfo);
const char* info = (ininfo ? sinfo.c_str() : ininfo);
xcastor_debug("path=%s, info=%s", path, (info ? info : ""));
XrdOucEnv Open_Env(info);
xcastor::Timing preparetiming("stageprepare");
......@@ -628,22 +627,21 @@ XrdxCastor2Fs::stageprepare(const char* path,
std::string allowed_svc = GetAllowedSvc(map_path.c_str(), desired_svc);
if (allowed_svc.empty())
return Emsg(epname, error, EINVAL, "stageprepare - cannot find any"
" valid service class mapping for fn = ", map_path.c_str());
return Emsg(epname, error, EINVAL, "stageprepare - cannot find any "
"valid service class mapping for fn = ", map_path.c_str());
// Get the allowed service class, preference for the default one
TIMING("STAGERQUERY", &preparetiming);
struct XrdxCastor2Stager::RespInfo resp_info;
int retc = (XrdxCastor2Stager::Prepare2Get(error, (uid_t) client_uid,
(gid_t) client_gid, map_path.c_str(),
allowed_svc.c_str(), resp_info)
? SFS_OK : SFS_ERROR);
bool done = XrdxCastor2Stager::Prepare2Get(error, client_uid, client_gid,
map_path.c_str(), allowed_svc.c_str(),
resp_info);
TIMING("END", &preparetiming);
if (gMgr->mLogLevel == LOG_DEBUG)
preparetiming.Print();
return retc;
return (done ? SFS_OK : SFS_ERROR);
}
......
......@@ -295,8 +295,8 @@ XrdxCastor2OfsFile::open(const char* path,
XrdOucString newopaque = opaque;
// If there is explicit user opaque information we find two ?,
// so we just replace it with a seperator.
newopaque.replace("?", "&");
newopaque.replace("&&", "&");
while (newopaque.replace("?", "&")) { };
while (newopaque.replace("&&", "&")) { };
// Check if there are several redirection tokens
int firstpos = 0;
......
......@@ -109,7 +109,7 @@ XrdxCastor2Stager::Prepare2Get(XrdOucErrInfo& error,
const char* serviceclass,
struct RespInfo& respInfo)
{
xcastor_static_debug("uid=%i, gid=%i, path=%s, sericeclass=%s",
xcastor_static_debug("uid=%i, gid=%i, path=%s, svcClass=%s",
uid, gid, path, serviceclass);
// Construct the request and subrequest objects
struct stage_options Opts;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment