Commit Graph

57 Commits

Author SHA1 Message Date
fffe 1def5e8b36 Add log.print and enum.log_group methods 2026-07-22 11:08:32 +02:00
Jari Sundell 5d350f0bcc Use new encryption modes. 2026-07-14 17:34:14 +09:00
Xirvik Support a82bdf22ac Review fix: remove method.use_deprecated.set from untrusted whitelist 2026-03-23 15:11:07 +01:00
Xirvik d935e0ffe9 Address review feedback: explicit mark_safe whitelist and rpc trust flow 2026-03-23 15:11:07 +01:00
Xirvik f767053297 Mark safe commands with flag_untrusted_safe for whitelist enforcement
Annotate all commands that web UIs (ruTorrent) need for normal torrent
management with _U macro variants, which set flag_untrusted_safe.
Commands not marked are blocked by default for untrusted connections.

Safe commands include:
- d.* download getters, state, priorities, custom fields, start/stop
- f.* file getters, priority control
- p.* peer getters, disconnect, ban/snub
- t.* tracker getters, enable/disable
- throttle.* rate getters/setters, peer limits
- network.* read-only queries (getters safe, setters blocked)
- view.list, view.size, view.filter_all, ui.current_view
- load.*, download_list, d.multicall2, d.multicall.filtered
- convert.*, branch/if/and/or/not/cat/value/print
- system.* version/time/status queries (read-only)
- choke_group.* read-only queries
- method.has_key, method.const, method.list_keys, method.get, strings.*
- group.*.view, group.*.ratio.min/max/upload (dynamic, via flag propagation)

Blocked by default (not marked):
- execute*, method.insert/set/redirect, schedule*, import
- log.*, file.append, network.scgi.open_*, view.filter/sort/event_*
- system.shutdown, system.env, group.insert, choke_group.insert
- All user-defined commands (via method.insert)
2026-03-23 15:11:07 +01:00
Jari Sundell 48f82c17c2 Remove deprecated no-target flags for commands. 2025-09-20 17:27:26 +09:00
Rosen Penev 0948b5f86a clang-tidy: convert loops to range based
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2025-06-19 09:57:21 +02:00
Jari Sundell 9d5b769d78 Removed/replaced deprecated commands (execute/schedule/schedule_remove) and removed global lock in ExecFile. 2025-05-05 16:55:38 +09:00
Jari Sundell 85e74b5542 Removed priority_queue and rak/timer. 2025-05-02 18:03:51 +09:00
kannibalox 9f48226663 Add JSON-RPC capability
Inline nlohmann/json for the JSON parsing itself, and handle requests
with the same SCGI interface as XML-RPC.

Based off the work in https://github.com/jesec/rtorrent
2025-01-20 12:31:04 +01:00
kannibalox b789d83b70 Fix system.listMethods inclusion check 2024-11-25 18:44:28 +09:00
kannibalox 87c6422052 Allow using vendored tinyxml2 for XMLRPC
By default, builds will still not have XMLRPC enabled at all and the
configure flag `--with-xmlrpc-tinyxml2` must be specified. If both
xmlrpc-c and tinyxml2 are specified, xmlrpc-c takes precedence.

Basic benchmarks indicate tinyxml2 is 2x faster for small
requests/responses, and that only increases as response sizes get
larger.
2024-11-25 18:44:28 +09:00
rakshasa 6ab265ecd4 Fixed merge errors. 2024-11-14 00:33:03 +09:00
Jari Sundell c9fe2facfa Merge branch 'master' into feature/clang-format 2024-11-13 19:51:04 +09:00
kannibalox 5abcf52e55 Remove unused flag_delete_key 2024-11-13 19:22:34 +09:00
kannibalox 34de2b4ac9 Convert CommandMap to use std::string instead of char*
This allows it to own its keys and clean them up automatically on
destruction.
2024-11-13 19:22:34 +09:00
kannibalox 00fa4127e1 Respect existing line limits 2024-11-11 16:00:28 -05:00
kannibalox af23ca8032 Convert some representative files 2024-11-10 09:17:12 -05:00
stickz 6e9902c23b Fix critical memory leak
This commit fixes a critical memory leak with the inserting RPC commands. We must initialize the cmd_flags with the delete key, otherwise they hang around in memory forever; potentially leaking significant amounts of resources.
2024-09-06 11:16:47 -04:00
rakshasa eacf9798e2 commit 30addc1a5e
Author: kannibalox <kannibalox@gmail.com>
Date:   Mon Jun 10 13:09:29 2024 -0400

    Use regular iterators intead of bucket-local ones

    Trying to manually predict which bucket a hashed key will land in does not
    appear to be well-defined behavior.

    Fixes #1285
2024-08-20 17:56:03 +00:00
Jari Sundell 7659cd0ec0 Backport changes from feature-bind. 2019-08-23 23:25:24 +09:00
chros 1f418366d4 Fix 'list' type method (See #25) 2018-10-01 23:27:58 +01:00
rakshasa 3edeb364bc Fix a stray 'simple' method.insert check. 2016-03-10 08:47:14 +09:00
rakshasa dc8e786d58 Merge branch 'master' into c++11
Conflicts:
	src/command_dynamic.cc
	src/command_events.cc
	src/command_groups.cc
	src/command_ip.cc
	src/command_network.cc
2014-06-18 00:44:36 +09:00
rakshasa b8e24b78cd Added missing option strings commands. 2014-06-13 18:24:03 +09:00
rakshasa e4e73aeee9 Set deprecated commands to be off by default. If needed use the '-D' option, however note that they will be removed permanently in the future. 2014-05-16 01:14:47 +09:00
rakshasa 3b39f37f49 C++11 compatibility fixes. 2014-05-13 23:36:37 +09:00
rakshasa 48733c84ec Added 'catch' command to allow safely calling commands that might fail with input_error. Note that double-brackets are required as the method needs to be called by the 'catch' command, not the parser.
catch = ((foo.bar,"bad input"))
2012-05-21 16:08:49 +09:00
rakshasa 004862850d Allow command function lists for dynamically created functions. 2012-05-04 22:56:58 +09:00
rakshasa bb75f06c6d Replaced std::placeholders with tr1::placholders. 2012-03-21 01:24:35 +09:00
rakshasa 04acc8a0af Converted std::bind calls to tr1::bind. 2012-03-21 01:22:25 +09:00
Jari Sundell e58f3975f1 Fixed compiler issues with clang. 2011-12-29 18:58:12 +09:00
Jari Sundell 58727fe7fd Fixed compiler issues with gcc-4.6 c++0x. 2011-11-18 17:28:50 +09:00
rakshasa 4d313e6353 Updated copyright information.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1301 e378c898-3ddf-0310-93e7-cc216c733640
2011-10-09 06:30:14 +00:00
rakshasa d0d52cdda1 * Added 'method.const' and 'method.const.enable' for setting the const flag for objects in object_storage.
* Added '<foo_list>.push_back' to all list objects in object_storage.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1242 e378c898-3ddf-0310-93e7-cc216c733640
2011-06-22 06:13:43 +00:00
rakshasa 1e206cb1c4 * Cleanup of command handling.
* Added 'd.timestamp.finished' that is set when a downloading torrent completes. For torrents that only seed it remains '0'.

* Added 'elapsed.{less,greater}' for checking the time elapsed since a time is less/greater, and it also returns false in all cases where the time is '0'.

* Fixed a bug that would cause hash checking to block exessively in some cases.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1233 e378c898-3ddf-0310-93e7-cc216c733640
2011-06-05 07:11:59 +00:00
rakshasa d2f328cc8e * Added 'method.rlookup' and 'method.rlookup.clear' commands for looking up the event handlers holding a specified key.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1231 e378c898-3ddf-0310-93e7-cc216c733640
2011-05-26 03:38:45 +00:00
rakshasa 6f71a8c1b1 * Added 'p.is_unwanted' and 'p.is_preferred' commands.
* Removed std::tr1:: in favor of std:: using namespace.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1202 e378c898-3ddf-0310-93e7-cc216c733640
2011-04-07 08:41:16 +00:00
rakshasa 7b2fae35d5 * Allow inlining functions in commands with parantheses, e.g:
print = (convert.time,(system.time))
  schedule2 = test_print_2,2,2,((print,"current ",((convert.time,((system.time))))))

  Multiple parantheses need to be used in schedule to ensure the command doesn't get evaluated at the time of calling schedule.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1191 e378c898-3ddf-0310-93e7-cc216c733640
2011-02-12 12:20:09 +00:00
rakshasa 49f61eeda3 * Added separate '-I' and '-K' switches, the former is for testing rtorrent code, the latter for webui's.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1178 e378c898-3ddf-0310-93e7-cc216c733640
2010-10-05 23:49:06 +00:00
rakshasa 56e126d8a0 * Fixed more redirects to work properly with old webui's.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1175 e378c898-3ddf-0310-93e7-cc216c733640
2010-10-03 10:47:36 +00:00
rakshasa d9f409b223 * Changed command_base stored in CommandMap from a pointer to an instance.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1169 e378c898-3ddf-0310-93e7-cc216c733640
2010-04-30 12:16:45 +00:00
rakshasa c8fc6402bb * Finished the move over to object_storage, removing command_function.*.
* Added redirects for several commands.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1166 e378c898-3ddf-0310-93e7-cc216c733640
2010-04-29 10:59:41 +00:00
rakshasa b530d35d94 * More work on rpc::object_storage and moving simple functions over to it.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1165 e378c898-3ddf-0310-93e7-cc216c733640
2010-04-28 15:19:18 +00:00
rakshasa 74bae32243 * Fixed more redirected commands.
* Cleaned up the Command stack implementation.

* Added framework for object_storage class that will hold variables and user-defined command lists.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1162 e378c898-3ddf-0310-93e7-cc216c733640
2010-04-11 14:19:27 +00:00
rakshasa 90da65f8a1 * Cleanup of old command code.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1156 e378c898-3ddf-0310-93e7-cc216c733640
2010-04-04 04:44:45 +00:00
rakshasa 4e4540e60f * Removed old Command classes.
* Redirects can now be made efficiently using rpc::CommandMap::create_redirect or "methods.redirect=new_key,dest_key".


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1155 e378c898-3ddf-0310-93e7-cc216c733640
2010-03-28 18:09:09 +00:00
rakshasa bc96dbfa2d * Modified the fallocate configure check so it will fail if 'fallocate' can't be found.
* Changed more commands to the new format.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1153 e378c898-3ddf-0310-93e7-cc216c733640
2010-03-24 20:23:48 +00:00
rakshasa 44e77016a9 * Renamed 'system.method.*' to 'method.*'.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1139 e378c898-3ddf-0310-93e7-cc216c733640
2010-03-03 13:45:34 +00:00
rakshasa 3cae3d37be * Cleaning up command names. The deprecated commands will be redirected.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1131 e378c898-3ddf-0310-93e7-cc216c733640
2010-02-16 17:29:53 +00:00