mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-22 17:16:17 +00:00
Correctly handle commands that are flagged as not using targets
Fixes #1346
This commit is contained in:
@@ -59,6 +59,9 @@ private:
|
|||||||
|
|
||||||
void
|
void
|
||||||
XmlRpc::object_to_target(const torrent::Object& obj, int callFlags, rpc::target_type* target) {
|
XmlRpc::object_to_target(const torrent::Object& obj, int callFlags, rpc::target_type* target) {
|
||||||
|
if (callFlags & CommandMap::flag_no_target)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!obj.is_string()) {
|
if (!obj.is_string()) {
|
||||||
throw torrent::input_error("invalid parameters: target must be a string");
|
throw torrent::input_error("invalid parameters: target must be a string");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -214,8 +214,10 @@ execute_command(std::string method_name, const tinyxml2::XMLElement* params_elem
|
|||||||
// Parse out the target if available
|
// Parse out the target if available
|
||||||
const auto* child = params_element->FirstChildElement("param");
|
const auto* child = params_element->FirstChildElement("param");
|
||||||
if (child != nullptr) {
|
if (child != nullptr) {
|
||||||
XmlRpc::object_to_target(xml_value_to_object(child->FirstChildElement("value")), cmd_itr->second.m_flags, &target);
|
if (!(cmd_itr->second.m_flags & CommandMap::flag_no_target)) {
|
||||||
child = child->NextSiblingElement("param");
|
XmlRpc::object_to_target(xml_value_to_object(child->FirstChildElement("value")), cmd_itr->second.m_flags, &target);
|
||||||
|
child = child->NextSiblingElement("param");
|
||||||
|
}
|
||||||
// Parse out any other params
|
// Parse out any other params
|
||||||
while (child != nullptr) {
|
while (child != nullptr) {
|
||||||
params.push_back(xml_value_to_object(child->FirstChildElement("value")));
|
params.push_back(xml_value_to_object(child->FirstChildElement("value")));
|
||||||
@@ -226,8 +228,10 @@ execute_command(std::string method_name, const tinyxml2::XMLElement* params_elem
|
|||||||
// If it's not a <params>, it's probably a <array> passed in via system.multicall
|
// If it's not a <params>, it's probably a <array> passed in via system.multicall
|
||||||
const auto* child = params_element->FirstChildElement("data")->FirstChildElement("value");
|
const auto* child = params_element->FirstChildElement("data")->FirstChildElement("value");
|
||||||
if (child != nullptr) {
|
if (child != nullptr) {
|
||||||
XmlRpc::object_to_target(xml_value_to_object(child), cmd_itr->second.m_flags, &target);
|
if (!(cmd_itr->second.m_flags & CommandMap::flag_no_target)) {
|
||||||
child = child->NextSiblingElement("value");
|
XmlRpc::object_to_target(xml_value_to_object(child), cmd_itr->second.m_flags, &target);
|
||||||
|
child = child->NextSiblingElement("value");
|
||||||
|
}
|
||||||
while (child != nullptr) {
|
while (child != nullptr) {
|
||||||
params.push_back(xml_value_to_object(child));
|
params.push_back(xml_value_to_object(child));
|
||||||
child = child->NextSiblingElement("value");
|
child = child->NextSiblingElement("value");
|
||||||
|
|||||||
Reference in New Issue
Block a user