rtorrent: fix xmlrpc bugs
This commit is contained in:
parent
747c34bfa2
commit
9b0a78321f
3 changed files with 111 additions and 1 deletions
76
srcpkgs/rtorrent/patches/fix-xml-rpc-overflow.patch
Normal file
76
srcpkgs/rtorrent/patches/fix-xml-rpc-overflow.patch
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
From 1f418366d4e56d96420459ea868a3c23f7c297e8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: chros <chros@chrosGX620>
|
||||||
|
Date: Mon, 1 Oct 2018 23:27:58 +0100
|
||||||
|
Subject: [PATCH] Fix 'list' type method (See #25)
|
||||||
|
|
||||||
|
---
|
||||||
|
src/command_dynamic.cc | 28 +++++++++++++++++++++++-----
|
||||||
|
1 file changed, 23 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git src/command_dynamic.cc src/command_dynamic.cc
|
||||||
|
index 91eb3c46..a8d0ff02 100644
|
||||||
|
--- src/command_dynamic.cc
|
||||||
|
+++ src/command_dynamic.cc
|
||||||
|
@@ -139,6 +139,8 @@ system_method_insert_object(const torrent::Object::list_type& args, int flags) {
|
||||||
|
case rpc::object_storage::flag_function_type:
|
||||||
|
system_method_generate_command2(&value, itrArgs, args.end());
|
||||||
|
break;
|
||||||
|
+ case rpc::object_storage::flag_list_type:
|
||||||
|
+ break;
|
||||||
|
case rpc::object_storage::flag_multi_type:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
@@ -152,7 +154,17 @@ system_method_insert_object(const torrent::Object::list_type& args, int flags) {
|
||||||
|
if (!(flags & rpc::object_storage::flag_private))
|
||||||
|
cmd_flags |= rpc::CommandMap::flag_public_xmlrpc;
|
||||||
|
|
||||||
|
- control->object_storage()->insert_str(rawKey, value, flags);
|
||||||
|
+ if ((flags & rpc::object_storage::mask_type) == rpc::object_storage::flag_list_type) {
|
||||||
|
+ torrent::Object valueList = torrent::Object::create_list();
|
||||||
|
+ torrent::Object::list_type& valueListType = valueList.as_list();
|
||||||
|
+
|
||||||
|
+ if ((itrArgs)->is_list())
|
||||||
|
+ valueListType = (itrArgs)->as_list();
|
||||||
|
+
|
||||||
|
+ control->object_storage()->insert_str(rawKey, valueList, flags);
|
||||||
|
+ } else {
|
||||||
|
+ control->object_storage()->insert_str(rawKey, value, flags);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if ((flags & rpc::object_storage::mask_type) == rpc::object_storage::flag_function_type ||
|
||||||
|
(flags & rpc::object_storage::mask_type) == rpc::object_storage::flag_multi_type) {
|
||||||
|
@@ -208,6 +220,13 @@ system_method_insert_object(const torrent::Object::list_type& args, int flags) {
|
||||||
|
&rpc::command_base_call_string<rpc::target_type>,
|
||||||
|
cmd_flags, NULL, NULL);
|
||||||
|
break;
|
||||||
|
+ case rpc::object_storage::flag_list_type:
|
||||||
|
+ rpc::commands.insert_slot<rpc::command_base_is_type<rpc::command_base_call_list<rpc::target_type> >::type>
|
||||||
|
+ (create_new_key<5>(rawKey, ".set"),
|
||||||
|
+ std::bind(&rpc::object_storage::set_str_list, control->object_storage(), rawKey, std::placeholders::_2),
|
||||||
|
+ &rpc::command_base_call_list<rpc::target_type>,
|
||||||
|
+ cmd_flags, NULL, NULL);
|
||||||
|
+ break;
|
||||||
|
case rpc::object_storage::flag_function_type:
|
||||||
|
case rpc::object_storage::flag_multi_type:
|
||||||
|
default: break;
|
||||||
|
@@ -310,10 +329,6 @@ system_method_insert(const torrent::Object::list_type& args) {
|
||||||
|
new_flags = rpc::object_storage::flag_string_type;
|
||||||
|
else if (options.find("list") != std::string::npos)
|
||||||
|
new_flags = rpc::object_storage::flag_list_type;
|
||||||
|
- else if (options.find("simple") != std::string::npos)
|
||||||
|
- new_flags = rpc::object_storage::flag_function_type;
|
||||||
|
- else
|
||||||
|
- throw torrent::input_error("No support for 'list' variable type.");
|
||||||
|
|
||||||
|
if (options.find("static") != std::string::npos)
|
||||||
|
new_flags |= rpc::object_storage::flag_static;
|
||||||
|
@@ -447,6 +462,9 @@ initialize_command_dynamic() {
|
||||||
|
|
||||||
|
CMD2_ANY_LIST ("method.insert", std::bind(&system_method_insert, std::placeholders::_2));
|
||||||
|
CMD2_ANY_LIST ("method.insert.value", std::bind(&system_method_insert_object, std::placeholders::_2, rpc::object_storage::flag_value_type));
|
||||||
|
+ CMD2_ANY_LIST ("method.insert.bool", std::bind(&system_method_insert_object, std::placeholders::_2, rpc::object_storage::flag_bool_type));
|
||||||
|
+ CMD2_ANY_LIST ("method.insert.string", std::bind(&system_method_insert_object, std::placeholders::_2, rpc::object_storage::flag_string_type));
|
||||||
|
+ CMD2_ANY_LIST ("method.insert.list", std::bind(&system_method_insert_object, std::placeholders::_2, rpc::object_storage::flag_list_type));
|
||||||
|
|
||||||
|
CMD2_METHOD_INSERT("method.insert.simple", rpc::object_storage::flag_function_type);
|
||||||
|
CMD2_METHOD_INSERT("method.insert.c_simple", rpc::object_storage::flag_constant | rpc::object_storage::flag_function_type);
|
34
srcpkgs/rtorrent/patches/properly-close-xmlrpc-log.patch
Normal file
34
srcpkgs/rtorrent/patches/properly-close-xmlrpc-log.patch
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
From 3d88ac2cc89ad203eb9ea75e4933d36bbda4d04d Mon Sep 17 00:00:00 2001
|
||||||
|
From: pyroscope <pyroscope.project@gmail.com>
|
||||||
|
Date: Fri, 15 Jun 2018 19:37:57 +0200
|
||||||
|
Subject: [PATCH] fix: properly close the XMLRPC log, resetting the handle
|
||||||
|
after close
|
||||||
|
|
||||||
|
---
|
||||||
|
src/thread_worker.cc | 9 +++++----
|
||||||
|
1 file changed, 5 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git src/thread_worker.cc src/thread_worker.cc
|
||||||
|
index d6fa2f61..939d7026 100644
|
||||||
|
--- src/thread_worker.cc
|
||||||
|
+++ src/thread_worker.cc
|
||||||
|
@@ -113,14 +113,15 @@ ThreadWorker::change_xmlrpc_log() {
|
||||||
|
if (scgi() == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
- if (scgi()->log_fd() != -1)
|
||||||
|
+ if (scgi()->log_fd() != -1) {
|
||||||
|
::close(scgi()->log_fd());
|
||||||
|
-
|
||||||
|
- if (m_xmlrpcLog.empty()) {
|
||||||
|
+ scgi()->set_log_fd(-1);
|
||||||
|
control->core()->push_log("Closed XMLRPC log.");
|
||||||
|
- return;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (m_xmlrpcLog.empty())
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
scgi()->set_log_fd(open(rak::path_expand(m_xmlrpcLog).c_str(), O_WRONLY | O_APPEND | O_CREAT, 0644));
|
||||||
|
|
||||||
|
if (scgi()->log_fd() == -1) {
|
|
@ -1,7 +1,7 @@
|
||||||
# Template file for 'rtorrent'
|
# Template file for 'rtorrent'
|
||||||
pkgname=rtorrent
|
pkgname=rtorrent
|
||||||
version=0.9.7
|
version=0.9.7
|
||||||
revision=3
|
revision=4
|
||||||
build_style=gnu-configure
|
build_style=gnu-configure
|
||||||
configure_args="--with-xmlrpc-c"
|
configure_args="--with-xmlrpc-c"
|
||||||
hostmakedepends="automake libtool pkg-config"
|
hostmakedepends="automake libtool pkg-config"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue