mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-13 21:52:30 +00:00
Address review: tighten untrusted safelist and remove set_trusted
This commit is contained in:
+4
-10
@@ -21,13 +21,6 @@ ExecFile execFile;
|
||||
// CommandMap::call_command(), which catches all command execution
|
||||
// including nested calls through argument expansion.
|
||||
|
||||
bool
|
||||
RpcManager::set_trusted(bool trusted) {
|
||||
bool prev = m_trusted;
|
||||
m_trusted = trusted;
|
||||
return prev;
|
||||
}
|
||||
|
||||
bool
|
||||
RpcManager::is_trusted() const {
|
||||
return m_trusted;
|
||||
@@ -146,14 +139,15 @@ RpcManager::process(RPCType type, const char* in_buffer, uint32_t length, slot_r
|
||||
|
||||
bool
|
||||
RpcManager::process_untrusted(RPCType type, const char* in_buffer, uint32_t length, slot_response_callback callback) {
|
||||
bool previous = set_trusted(false);
|
||||
bool previous = m_trusted;
|
||||
m_trusted = false;
|
||||
|
||||
try {
|
||||
bool result = process(type, in_buffer, length, callback);
|
||||
set_trusted(previous);
|
||||
m_trusted = previous;
|
||||
return result;
|
||||
} catch (...) {
|
||||
set_trusted(previous);
|
||||
m_trusted = previous;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +83,6 @@ public:
|
||||
// Trusted/untrusted XMLRPC connection model.
|
||||
// When an SCGI request includes the UNTRUSTED_CONNECTION header,
|
||||
// commands without flag_untrusted_safe are blocked.
|
||||
bool set_trusted(bool trusted);
|
||||
bool is_trusted() const;
|
||||
|
||||
static void object_to_target(const torrent::Object& obj, int callFlags, rpc::target_type* target, std::function<void()>* deleter);
|
||||
|
||||
Reference in New Issue
Block a user