MGM: fix bugs in new recycle bin

parent 0f4451c7
Pipeline #469179 passed with stages
in 40 minutes 49 seconds
Subproject commit bcbccfa667693ed0420c2eb69017a75f71fccbba
Subproject commit 223c2e127c6b7530e839c52665e35c45dfd4fb7f
......@@ -605,7 +605,7 @@ Recycle::Print(XrdOucString& stdOut, XrdOucString& stdErr,
}
if (sdname.substr(0, 4) == "uid:") {
uid_t uid = std::stoull(sdname.substr(5));
uid_t uid = std::stoull(sdname.substr(4));
printmap[uid] = true;
}
}
......@@ -1089,10 +1089,16 @@ Recycle::Restore(XrdOucString& stdOut, XrdOucString& stdErr,
rprefix += (int) vid.gid;
rprefix += "/";
rprefix += (int) vid.uid;
XrdOucString newrprefix = Recycle::gRecyclingPrefix.c_str();
newrprefix += "/uid:";
newrprefix += (int) vid.uid;
while (rprefix.replace("//", "/")) {
}
while (newrprefix.replace("//", "/")) {
}
{
// TODO(gbitzes): This could be more precise...
eos::Prefetcher::prefetchFileMDWithParentsAndWait(gOFS->eosView, fid);
......@@ -1105,7 +1111,8 @@ Recycle::Restore(XrdOucString& stdOut, XrdOucString& stdErr,
recyclepath = gOFS->eosView->getUri(fmd.get());
repath = recyclepath.c_str();
if (!repath.beginswith(rprefix.c_str())) {
if (!repath.beginswith(rprefix.c_str()) &&
!repath.beginswith(newrprefix.c_str())) {
stdErr = "error: this is not a file in your recycle bin - try to prefix the key with pxid:<key>\n";
return EPERM;
}
......@@ -1119,7 +1126,8 @@ Recycle::Restore(XrdOucString& stdOut, XrdOucString& stdErr,
recyclepath = gOFS->eosView->getUri(cmd.get());
repath = recyclepath.c_str();
if (!repath.beginswith(rprefix.c_str())) {
if (!repath.beginswith(rprefix.c_str()) &&
!repath.beginswith(newrprefix.c_str())) {
stdErr = "error: this is not a directory in your recycle bin\n";
return EPERM;
}
......
Markdown is supported
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