MGM/CONSOLE: encode '&' characters for attr commands

parent 292c5f50
Pipeline #469849 passed with stages
in 28 minutes 26 seconds
......@@ -78,6 +78,9 @@ com_attr(char* arg1)
}
path = abspath(path.c_str());
while (path.replace("&", "#AND#")) {}
in += "&mgm.subcmd=ls";
in += "&mgm.path=";
in += path;
......@@ -139,6 +142,9 @@ com_attr(char* arg1)
}
path = abspath(path.c_str());
while (path.replace("&", "#AND#")) {}
in += "&mgm.subcmd=set&mgm.attr.key=";
in += key;
in += "&mgm.attr.value=";
......@@ -280,6 +286,9 @@ com_attr(char* arg1)
}
path = abspath(path.c_str());
while (path.replace("&", "#AND#")) {}
in += "&mgm.subcmd=get&mgm.attr.key=";
in += key;
in += "&mgm.path=";
......@@ -294,6 +303,9 @@ com_attr(char* arg1)
}
path = abspath(path.c_str());
while (path.replace("&", "#AND#")) {}
in += "&mgm.subcmd=fold";
in += "&mgm.path=";
in += path;
......@@ -313,6 +325,9 @@ com_attr(char* arg1)
}
path = abspath(path.c_str());
while (path.replace("&", "#AND#")) {}
in += "&mgm.subcmd=rm&mgm.attr.key=";
in += key;
in += "&mgm.path=";
......
......@@ -42,6 +42,8 @@ ProcCommand::Attr()
eos::common::Path cPath(path);
spath = cPath.GetPath();
while (spath.replace("#AND#", "&")) {}
if ((!spath.length()) ||
((mSubCmd != "set") && (mSubCmd != "get") && (mSubCmd != "ls") &&
(mSubCmd != "rm") && (mSubCmd != "fold"))) {
......@@ -109,15 +111,17 @@ ProcCommand::Attr()
for (it = map.begin(); it != map.end(); ++it) {
partialStdOut += (it->first).c_str();
if (it->first != "sys.file.buffer") {
partialStdOut += "=";
partialStdOut += "\"";
partialStdOut += (it->second).c_str();
} else {
partialStdOut += "=\"[";
partialStdOut += (std::to_string(it->second.size()).c_str());
partialStdOut += "] bytes";
}
if (it->first != "sys.file.buffer") {
partialStdOut += "=";
partialStdOut += "\"";
partialStdOut += (it->second).c_str();
} else {
partialStdOut += "=\"[";
partialStdOut += (std::to_string(it->second.size()).c_str());
partialStdOut += "] bytes";
}
partialStdOut += "\"";
partialStdOut += "\n";
}
......
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