Commit Graph

5036 Commits

Author SHA1 Message Date
Charles Kerr e51527203e
refactor: re-enable clang-tidy warnings (#2485) 2022-01-23 16:47:41 -06:00
Peter Bailey 96d9ab5abb
allow stopping torrents in verification states (#715) 2022-01-23 14:46:56 -06:00
Charles Kerr c5bc3091cc
fixup! NAT-PMP private/public port and lifetime fix (#1602) (#2482)
ensure the value passed to tr_timerAdd() is non-negative
2022-01-23 11:31:20 -06:00
Charles Kerr fa3cbc3e27
fix: memory leak in upnp (#2481)
Fixes #2480
2022-01-23 11:16:36 -06:00
Esa Varemo 032e01c9d8
Add the option of automatically picking up URLs from the clipboard on window focus (#1633) 2022-01-23 09:57:21 -06:00
Charles Kerr b45c831bcb
refactor: use C++ objects in announcer (#2474) 2022-01-22 23:41:01 -06:00
Charles Kerr e0c3a7f3e6
docs: add CONTRIBUTING.md (#2452) 2022-01-21 21:34:23 -06:00
mickaelifs 6c582469fa
NAT-PMP private/public port and lifetime fix (#1602) 2022-01-21 18:07:24 -06:00
Charles Kerr da4ad59290
fix: in check input before calling tr_sha1_from_string() (#2468)
Fixes #2467
2022-01-21 17:17:49 -06:00
Charles Kerr 4833723651
fixup! fix: don't follow symlinks when removing junk files (#1638) (#1638) (#2470)
code style
2022-01-21 12:39:01 -06:00
Vincent Vinel ddca909699
fix: don't follow symlinks when removing junk files (#1638) (#1638)
This prevents accidentally following a symlink that points outside of
the torrent's folder and crawling the rest of the drive for junk files
to remove.

This also prevents symlinks that point to a folder from being treated as
real directories, which would cause them to be removed even if the folder
they point to is not actually empty.
2022-01-21 11:53:00 -06:00
LaserEyess 9e5e27adb6
Add bind-address-ipv4 to upnp (#845)
Pass the bind-address-ipv4 to upnpDiscover to allow for upnp to only
use the interface specified. Prevents upnp packet leaks.

Authored-by: LaserEyess <lasereyess@lasereyess.net>
2022-01-21 09:44:45 -06:00
Charles Kerr 2d916ab9a8
fixup! Fixed wrong ipv6 addr used in announces. (#265) (#2464)
fix unused variable warning
2022-01-20 16:34:43 -06:00
vuori a89b98f9e5
Fixed wrong ipv6 addr used in announces. (#265) 2022-01-20 15:28:04 -06:00
Charles Kerr df1cca9b57
chore: update copyright years, make notices consistent (#2463) 2022-01-20 12:27:56 -06:00
Charles Kerr 0166b6e688
fix: explicitly use unsigned char when checking isprint() (#2444) 2022-01-18 15:20:49 -06:00
Charles Kerr 8189c68190
fix: remove assert() that shouldn't always be true (#2442)
Fixes #2441.
2022-01-18 12:35:08 -06:00
Charles Kerr 0e3a695af2
fix: string leak regression when udp announces fail (#2440) 2022-01-18 11:20:14 -06:00
Charles Kerr 8d75736ad1
fix: empty torrent filename (#2435)
fix torrents readded due to unremoved cfg files.
2022-01-17 23:14:00 -06:00
Charles Kerr aa2183c9c5
fix: torrents readded due to unremoved cfg files (#2433)
Fixes #2430.

When removing a torrent, try to remove config filenames under both old
and new filename formats. This prevents torrents from being incorrectly
re-added when old-format files aren't removed.
2022-01-17 20:36:41 -06:00
Charles Kerr bcf5e4636a
fix: calculate seed ratio by torrent size. (#2424)
Previously was calculated by number of bytes downloaded, which caused
edge cases when those two numbers were not the same, e.g. if the user
already had part of the torrent from another source and only downloaded
a small part. When this happened, the ratio could be very large and use
of seedratio would behave in a way that most people would not expect.

Note, the old behavior has been around for a VERY LONG TIME. Even though
this is a bugfix, it does change semantics. I don't think there is any
third-party code that depends on the old behavior but this is arguably
a breaking change.
2022-01-17 17:16:37 -06:00
Charles Kerr f415de0626
explicitly use unsigned chars (#2423)
Fixes #2106
2022-01-17 15:13:22 -06:00
Charles Kerr 3036a76beb
fix: sonarcloud code smells (#2421) 2022-01-17 12:39:50 -06:00
Charles Kerr 19ede2b8cd
fixup! refactor: replace tr_info with tr_torrent_metainfo (#2397) (#2415) 2022-01-17 11:44:53 -06:00
Charles Kerr d8d765c595
refactor: use libdeflate instead of zlib's deflate() (#2405)
Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
2022-01-17 10:20:12 -06:00
Charles Kerr 6b440af32f
fix: potential out-of-range error in io's readOrWritePiece() (#2413) 2022-01-16 12:02:47 -06:00
Charles Kerr 2c09e99515
fix: parse utorrent peer-id version components as hex (#2411) 2022-01-16 10:27:23 -06:00
Charles Kerr be1e46383d
fix: allow malformed magnet links to be added (#2410) 2022-01-16 09:28:18 -06:00
Charles Kerr db23ca4c6b
refactor: replace tr_info with tr_torrent_metainfo (#2397)
* refactor: replace tr_info with tr_torrent_metafo
2022-01-15 13:33:57 -06:00
Frank Aurich 41b2a802cf
Fix another integer overflow bug on 32-bit platforms with torrents > 4GB (#2391) 2022-01-12 22:52:36 -06:00
Charles Kerr b0ee4007ff
refactor: include cleanups (#2392)
* refactor: include <memory> when using shared_ptr or unique_ptr

* refactor: include <cstdio> iff we use it

* refactor: include <cstring> iff we use it

* refactor: include <cstdlib> iff we use it

* refactor: include <string_view> or <string> iff we use it

* refactor: include <array> iff we use it

* refactor: include <ctime> iff we use it

* refactor: include <cctype> iff we use it

* refactor: misc #include cleanups in libtransmission
2022-01-12 20:13:58 -06:00
Charles Kerr a9284c0a6b
fix: magnet link regression (#2390) 2022-01-11 08:28:14 -06:00
Charles Kerr 43b9d5c147
fix: potential infinite loop when parsing benc (#2389) 2022-01-10 14:27:05 -06:00
Charles Kerr d2e840c64c
refactor: unstack nested code in tr_torrentSetMetadataPiece() (#2387) 2022-01-09 13:17:53 -06:00
Charles Kerr dfc06fe918
refactor: use std::vector in tr_info (#2386) 2022-01-09 10:55:09 -06:00
Charles Kerr 7068eb66c1
refactor: migrate makeFilename() to tr_magnet_metainfo (#2385) 2022-01-08 21:03:21 -06:00
Charles Kerr 49f2823d6f
refactor: use std::string in tr_info (#2384) 2022-01-08 17:41:05 -06:00
Charles Kerr 79d244db82
refactor: rename tr_torrent.infoDictSize() (#2383) 2022-01-08 14:05:38 -06:00
Charles Kerr 8b65b660c8
refactor: use std::string in tr_file (#2382) 2022-01-08 12:53:35 -06:00
Charles Kerr 0c16c454ba
refactor: base64 utils (#2381)
base64 encode/decode now take std::string_views and return std::strings
2022-01-08 06:46:25 -06:00
Charles Kerr 385a119fb1
refactor: make tr_torrent aggregates tr_block_info instead of subclassing (#2376) 2022-01-07 13:13:37 -06:00
Frank Aurich 319312596a
fix: integer overflow when calculating `sizeWhenDone` (#2378)
While the function correctly returns a `uint64_t`, internally a `size_t` variable is used to calculate the accumulated size.
On 32-bit systems (e.g. Raspbian) `size_t` is only 32-bit wide, causing overflow for torrents > 4GB.
2022-01-07 10:48:08 -06:00
Charles Kerr a5c6168805
refactor: make tr_buildPath() private (#2374) 2022-01-02 11:51:59 -06:00
Charles Kerr eafbf59832
refactor: avoid referencing tr_file struct directly (#2373) 2022-01-01 19:25:25 -06:00
Mike Gelfand e56997185e
Fixup construction of temp dir path in `deleteLocalData` (#2370) 2022-01-01 11:27:03 +03:00
Mike Gelfand d8d361e491
Make some utility functions return std::string to simplify code (#2368)
* tr_formatter_speed_KBps returns std::string

* tr_formatter_mem_B returns std::string

* tr_formatter_size_B returns std::string

* tr_strpercent/tr_strratio returns std::string
2021-12-31 03:30:21 +03:00
Charles Kerr 26110d5c8e
fix: out-of-bound memory acess sonarcloud warning (#2364) 2021-12-29 21:48:50 -06:00
Charles Kerr 23b7f02100
fix: clear verify_thread before releasing verify mutex lock (#2360)
* fix: clear verify_thread before releasing verify mutex lock

* refactor: increase the verify buffer size

* fix: uniqueness comparison for verify torrents
2021-12-29 13:20:09 -06:00
Charles Kerr 46f9582e36
refactor: prefer std::from_chars over strtoul (#2359) 2021-12-29 02:28:12 -06:00
Charles Kerr 884135d853
fix: sonarcloud (#2356)
* refactor: replace #define with constexpr in some utils

* fix: use-std-string-instead-of-c-array sonarcloud warning

* fix: use init-statement sonarcloud warning

* fix: explain-empty-function sonarcloud warning

* fix: move #include directive to top sonarcloud warning

* fix: replace-void-ptr-arg-with-more-meaningful-type sonarcloud warning

* fix: replace-redundant-type-with-auto warning

* fix: use-init-statement sonarcloud warning

* fix: make type a pointer-to-const sonarcloud warning

* fix: cli tyop

* fix: replace-redundant-type-with-auto warning

* fix: use-init-statement sonarcloud warning

* fix: replace-redundant-type-with-auto warning

* fix: use-init-statement sonarcloud warning

* fix: replace-redundant-type-with-auto warning

* fix: make type a pointer-to-const sonarcloud warning

* fix: make type a pointer-to-const sonarcloud warning

* fix: replace-redundant-type-with-auto warning

* refactor: replace #define with constexpr in rpcimpl
2021-12-28 11:23:47 -06:00