Commit Graph

4682 Commits

Author SHA1 Message Date
Mike Gelfand 7a238e7c65 Rename `check_streq` to `check_str_eq` to be in line with other macros (libtest) 2017-05-30 17:44:42 +03:00
Mike Gelfand 432d573f2c Fixup 2321bc3fad (unintended logic change, spotted by cfpp2p in #297) 2017-05-29 08:50:40 +03:00
Mike Gelfand f27596238d Include stdbool.h unconditionally
All the compilers should provide the header file by now. Remove `tr_isBool`
sanity checks along the way as compiler should guarantee that bool (_Bool)
values are 0 or 1 and nothing else.
2017-05-24 22:53:06 +03:00
Mike Gelfand 295d3359b2 Little bastards keep popping up here and there :( 2017-05-23 22:17:17 +03:00
Mike Gelfand 501be27972 Reduce code duplication in logging macros 2017-05-22 23:20:28 +03:00
Dhiru Kholia dda33afbe0 Add Peer ID for PicoTorrent
Based on information from https://github.com/picotorrent/picotorrent and
http://www.picotorrent.org/.

PicoTorrent uses Azureus-style peer ID: -PI-. Example: -PI0091- (major:
0, minor: 09, patch: 1).
2017-05-21 12:30:47 +05:30
Mike Gelfand 82722476aa Fix some issues reported by Coverity 2017-05-20 23:31:56 +03:00
Mike Gelfand 8f3cb1c68d Wrap sizeof arguments in braces 2017-05-20 19:29:23 +03:00
Mike Gelfand 6303bb2247 Disable part of mmap test on OpenBSD that depends on UBC 2017-05-20 13:34:23 +03:00
Niklas Haas 4d7446e477
LibreSSL compatibility
This seems to be the idiomatic way to fix libressl compatibility issues,
judging by what most other open source projects seem to be doing.

I've confirmed that transmission builds with libressl for me after this
patch is applied.
2017-05-20 07:16:53 +02:00
Mike Gelfand 6b0229a546 Fix some issues reported by Coverity 2017-05-16 21:37:00 +03:00
Mike Gelfand 1e3d20422a Reduce for loop variables scope 2017-05-14 01:38:31 +03:00
Mike Gelfand 6d5e48f9e2 Fix some more off-by-one errors on last piece
See: TRAC-4037 and e2584b04ff
2017-05-09 14:23:25 +03:00
Piotr Drąg ccabc01900 lib: fix translator comment extraction
gettext won’t pick up a comment if it’s
not exactly one line above the string.
2017-05-02 21:22:15 +02:00
Mike Gelfand 87220d44a5 Fix FTBFS on Windows (oops!) 2017-05-01 19:08:30 +03:00
Mike Gelfand 14370e5353 Fix a number of other style inconsistencies met along the way (part 2) 2017-05-01 18:47:49 +03:00
Mike Gelfand e1d53855f4 Avoid declaring multiple variables on the same line 2017-05-01 18:46:41 +03:00
Mike Gelfand 1bc247c105 Merge pull request #161 from slokhorst/rpc-ipv6
Allow the RPC server to listen on an IPv6 address
2017-05-01 13:31:14 +03:00
Mike Gelfand 6a74bd438c Announce INT64_MAX as size left if the value is unknown
This helps with trakers like Amazon S3 where signed type is used but
negative values aren't accepted.

Fixes: #250
2017-05-01 12:33:55 +03:00
Mike Gelfand ac4fa04277 Announce -1 as size left if the value is unknown
Fixes: #250
2017-04-30 21:18:02 +03:00
Mike Gelfand efaa9d0ddc Compare system function return value to a specific value indicating the error 2017-04-30 19:47:18 +03:00
Mike Gelfand b342d134cb Merge pull request #256 from kholia/Xfplay
Add Peer ID for Xfplay torrent client
2017-04-30 19:43:49 +03:00
Mike Gelfand fbd8d4c79f Fix a number of other style inconsistencies met along the way 2017-04-30 19:33:55 +03:00
Mike Gelfand a762c770f2 Make conditional expressions explicitly boolean 2017-04-30 19:26:01 +03:00
Dhiru Kholia e970d7e546 Add Peer ID for Xfplay torrent client
This is based on the following resources,

http://www.xfplay.com/history.html
https://down.xfplay.com/xfplay9.994.exe
https://down.xfplay.com/xfplay9.992.exe
https://down.xfplay.com/xfplay9.991.exe
https://down.xfplay.com/xfplay9.99.exe
http://q.xfplay.com/
2017-04-29 12:40:55 +05:30
Sebastiaan Lokhorst ac661ff099 Allow the RPC server to listen on an IPv6 address 2017-04-26 17:46:36 +02:00
Mike Gelfand 6a15bc6742 Fix mount points enumeration (platform quota) on Solaris
Per documentation, `getmntent` returns 0 on success and -1 on error.
2017-04-22 21:42:44 +03:00
Mike Gelfand 4f9d9ad92b Code style change leftovers
For some reason, GTK client wasn't fully processed. All the rest of changes
are mostly in comments.
2017-04-21 10:40:57 +03:00
Mike Gelfand dadffa2c0f Align type qualifiers to the right (code style)
This way all the qualifiers (`const`, `volatile`, `mutable`) are grouped
together, e.g. `T const* const x` vs. `const T* const x`. Also helps reading
types right-to-left, e.g. "constant pointer to constant T" vs. "constant
pointer to T which is constant".
2017-04-20 19:53:20 +03:00
Mike Gelfand d7930984ef Adjust uncrustify config, reformat all but Mac client
There're places where manual intervention is still required as uncrustify
is not ideal (unfortunately), but at least one may rely on it to do the
right thing most of the time (e.g. when sending in a patch).

The style itself is quite different from what we had before but making it
uniform across all the codebase is the key. I also hope that it'll make the
code more readable (YMMV) and less sensitive to further changes.
2017-04-20 10:01:22 +03:00
Mike Gelfand 0f75e64d71 Detach the thread from within itself to avoid race condition
Fixes: #188
2017-02-23 00:07:39 +03:00
neheb 944382a62e Add TCP_FASTOPEN support
Should make transmission slightly faster.
2017-02-19 12:54:01 +03:00
Edward Betts 9e1c76a50f fix spelling mistake 2017-02-01 10:14:11 +00:00
Mike Gelfand 1cc67b31dd Use PRIdMAX instead of TR_PRI_SOCK to accomodate intltool 2017-01-27 04:50:14 +03:00
Mike Gelfand c1f08edf79 Fix memory leaks found by GCC's -address=sanitize (reported by milloni)
Fixes: #56
2017-01-17 23:55:34 +03:00
Mike Gelfand 67bda2dcb8 Handle two more cases where dirname/basename may have returned NULL (adds to 91f8ceb20d) 2017-01-17 02:22:31 +03:00
Mike Gelfand fd93316466 Improve version.h file generation
Store full revision hash in REVISION file. Write fixes 10 chars of revision
hash to version.h. Use `#pragma once` in version.h. Support getting revision
from TeamCity environment variable (similar to Jenkins).
2017-01-15 00:54:56 +03:00
Mike Gelfand 3375b22b23 Simplify `tr_ssha1_matches` logic
Gets rid of needless heap memory allocations and copying. Convert SHA1 hash
to hex in-place.

Fixes: #141
2017-01-09 14:15:07 +03:00
Mike Gelfand 15625de3c7 Extend SSHA1 test to check for predefined matches
Reduce number of test iterations to 4K along the way to shorten execution
time.
2017-01-09 14:12:17 +03:00
Mike Gelfand 4179a623d5 Interrupt verification ASAP if torrent is being removed 2016-12-31 14:23:06 +03:00
Mike Gelfand 0ac657c5f1 Fix up rename test to avoid random use-after-free failures 2016-12-25 19:44:38 +03:00
Mike Gelfand 3cda09ea81 Fix up rename test to avoid random duplicate torrent failures 2016-12-24 21:24:50 +03:00
Mike Gelfand 88505c345f Allow for different-cased "nan" value returned by tr_truncd 2016-12-24 20:20:55 +03:00
Mike Gelfand 448d8f39f6 CMake support for Solaris 2016-12-24 20:16:54 +03:00
Mike Gelfand 193d68cc5c Move tr_metainfoFree call higher per review comment 2016-12-09 22:01:58 +03:00
seiyap70 8541d74793 free the info resource if failed
free the info resource if failed
2016-11-07 14:07:56 +08:00
Mike Gelfand d8dd6f9c75 Merge pull request #60 from milloni/strncmp-instead-of-memcmp
Use strncmp instead of memcmp to avoid out-of-bounds reads
2016-11-02 23:13:25 +03:00
Markus Amalthea Magnuson 5b9ba3be0d HTTPS links for trac, forum, portcheck, and build subdomains. 2016-11-02 20:50:22 +01:00
Mike Gelfand 71af7be04f Improve support for wolfssl (formely cyassl) 2016-10-26 22:27:20 +03:00
Mike Gelfand 7f94c8df6c Add support for mbedtls (formely polarssl) 2016-10-26 22:27:20 +03:00
Maciej Wolny 69c33d0e18 Fix signedness related warnings 2016-10-20 20:27:55 +02:00
Maciej Wolny c6ad5bd36c Go back to using memcmp in libtransmission/net.c 2016-10-20 17:35:46 +02:00
Mike Gelfand 0390684bc4 Merge pull request #42 from wbx-github/master
uClibc-ng since 1.0.18 has sys/quota.h synced with GNU libc
2016-10-19 21:01:06 +03:00
Waldemar Brodkorb bae138ca22 uClibc-ng since 1.0.18 has sys/quota.h synced with GNU libc 2016-10-19 19:33:35 +02:00
Mike Gelfand eda26f7590 Make sure `tr_sha1` calls pass lengths as int
This fixes inability to authenticate with password-protected session, and
a few more issues it seems.
2016-10-18 00:05:03 +03:00
Maciej Wolny 3a1730495d Use strncmp instead of memcmp to avoid out-of-bounds reads 2016-10-05 16:19:31 +02:00
Mike Gelfand 17fb783c50 Add session-id.{c,h} to autoconf and Xcode builds 2016-09-27 21:36:01 +03:00
Mike Gelfand 661e2b513d Return session ID as part of "session-get" response 2016-09-27 21:18:36 +03:00
Mike Gelfand ff73e65069 Handle "fields" argument in "session-get" RPC request
If "fields" array is present in arguments, only return session fields
specified. Otherwise return all the fields as before.
2016-09-27 21:18:32 +03:00
Mike Gelfand b82f6009dd Maintain lock file(s) corresponding to session ID 2016-09-27 20:53:10 +03:00
Mike Gelfand 26b0a041cc Factor out session ID into a standalone entity 2016-09-21 22:29:56 +03:00
Mike Gelfand 4c00df9463 Abort handshake if establishing DH shared secret fails
Fixes #27
2016-09-18 14:01:00 +03:00
Mike Gelfand 8c8386a7f3 Fix coding style and building with !TR_LIGHTWEIGHT 2016-09-07 01:09:04 +03:00
Sebastian Andrzej Siewior f91cf5ad8c transmission: build against openssl 1.1.0
Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
2016-09-06 00:11:17 +02:00
Mike Gelfand 2248d3670f Get rid of $Id$ SVN keywords in source files 2016-09-02 23:10:15 +03:00
Mike Gelfand 1b81bb7682 Replace SVN and SCM with VCS everywhere 2016-09-02 22:21:00 +03:00
Mike Gelfand 076fd29098 #6071: Fix typo in comment 2016-04-23 16:21:39 +00:00
Jordan Lee 7cd2d10d00 crypto.h and crypto-utils.h can't use #pragma once, it breaks our name munging in crypto-test-ref.h 2016-03-29 19:02:26 +00:00
Jordan Lee c1abfe87c8 maybe fix double-include of crypto.h / crypto-utils.h in crypto-test 2016-03-29 17:18:50 +00:00
Jordan Lee 1af60ad6ad use '#pragma once' instead of #ifndef..#define..#endif guards 2016-03-29 16:37:21 +00:00
Jordan Lee 77b5105ea0 fix bad TR_DEPRECATED macro on clang :P 2016-03-29 16:01:41 +00:00
Jordan Lee 8d38442cc1 give a useful definition of TR_DEPRECATED on msvc as well 2016-03-29 15:47:29 +00:00
Jordan Lee 5fbd24fda5 fix a handful of minor compiler warnings, mostly in the unit tests, eg field width shortening or implicit signed/unsigned conversions 2016-03-29 03:04:54 +00:00
Mike Gelfand c955c04d8f Explicitly compare result of str(n)cmp/memcmp to signify that it's not boolean 2016-03-13 22:11:01 +00:00
Mike Gelfand 91f8ceb20d Handle potential dirname/basename errors where needed 2016-03-13 10:41:52 +00:00
Mike Gelfand 86f231184b Fix warning for when 2nd `iconv()` argument is const 2016-02-23 05:07:43 +00:00
Mike Gelfand 990dea4dd3 Only depend on iconv if found 2016-02-07 12:00:15 +00:00
Mike Gelfand 96ea2c82fd Check for `iconv()` instead of `iconv_open()`, adjust utils test 2016-02-07 11:54:01 +00:00
Mike Gelfand a447f0d628 #6064: Add test cases which exhibit the issue 2016-02-06 22:23:36 +00:00
Mike Gelfand 1eb0ae0a3a #6064: Merge ConvertUTF.c fixes from LLVM (?) 2016-02-06 22:05:22 +00:00
Mike Gelfand 9e7293b710 Add hidden "watch-dir-force-generic" setting handling to daemon 2016-01-25 22:09:49 +00:00
Mike Gelfand 39749f8e4b Make it possible to force generic watchdir implementation in runtime 2016-01-25 21:48:58 +00:00
Mike Gelfand 0e7a8eb7aa Add bitfield test for has all/none 2016-01-08 11:12:22 +00:00
Mike Gelfand 13a98a02b8 Use `TR_BAD_SIZE` instead of -1 in `tr_quark_new()` calls
Extend quark test to improve branch coverage.
2016-01-07 19:20:14 +00:00
Mike Gelfand bfbf81cea1 #6048: Improve error checking on metadata retrieval 2016-01-07 17:12:14 +00:00
Mike Gelfand eb49800fab #5737: Retry if RPC server fails to bind to specified address 2016-01-07 15:28:58 +00:00
Mike Gelfand 53c38c760d Add tests in such a way that target name is expanded (CMake) 2016-01-04 19:50:32 +00:00
Mike Gelfand 4a634ae026 #5663: Autotools fixes: proper kqueue check, macro definitions 2016-01-04 19:14:38 +00:00
Mike Gelfand 9ecd2ad319 Improve file test modification time checks 2016-01-04 05:04:55 +00:00
Mike Gelfand 6e00b1c543 Uncomment error prefixing tests 2016-01-03 21:03:54 +00:00
Mike Gelfand 52b2a7557f Fix line endings on last commit 2016-01-02 15:26:23 +00:00
Mike Gelfand 119d10f01e #5663: Emulate `GetOverlappedResultEx` on Windows Vista/7 2016-01-02 15:23:38 +00:00
Mike Gelfand ea48360212 #5663: Rework directory watching in daemon
Implement BSD/Darwin (kqueue) and Windows (ReadDirectoryChanges) mechanisms
for receiving directory change notifications. Use events instead of polling
for changes. Retry file parsing up to 3 times before giving up.

Huge thanks to missionsix for preparing first two versions of the patch.
2016-01-02 14:28:59 +00:00
Mike Gelfand de304e8a35 #5407: In `tr_peerMgrGetDesiredAvailable()`, check if swarm is running (suggested by x190) 2015-12-31 14:33:02 +00:00
Mike Gelfand 7d30ad3ff6 #5891: Move UDP shutdown timer setup to sessionCloseImplStart 2015-12-31 14:24:15 +00:00
Mike Gelfand d3f5b5d5ab #5891: Fix crash on session shutdown (evdns_getaddrinfo_cancel) 2015-12-31 14:17:37 +00:00
Mike Gelfand 40f3de0572 Loosen bitfield assertions to account for unknown bit counts 2015-12-31 05:22:42 +00:00
Mike Gelfand d4213f09d5 On second thought, bring back stdbool.h check back
Might be useful for uClibc (which still doesn't provide it) and others.
2015-12-29 19:44:50 +00:00
Mike Gelfand eb8fc35ac6 Remove useless checks and definitions (C99)
Now that MSVC support for C99 is quite good, remove previously needed but
now unused checks and definitions, like PRI* format macros (including
PRIdMAX and TR_PRIuSIZE, replaced with %jd and %zu) and inline macro.
Also, remove ssize_t typedef and replace few occurences with ev_ssize_t.
Also, remove check for stdbool.h availability (guaranteed by C99) and
include it unconditionally (except when in C++ mode).
2015-12-29 19:37:31 +00:00
Mike Gelfand eee92c82ac Always add all source files to targets
Mark files which shouldn't be compiled as header-only, but still add
them as sources so that they are visible in e.g. MSVS project tree.
2015-12-29 02:04:37 +00:00
Mike Gelfand db9d46bb91 Would you please die already, nasty chdir warning... 2015-12-29 00:48:55 +00:00
Mike Gelfand a6d4bd35fc Get rid of some more warnings 2015-12-29 00:42:40 +00:00
Mike Gelfand 15c9e5c126 Get rid of some more warnings 2015-12-28 23:53:55 +00:00
Mike Gelfand 4f266a5b15 Optimize URL-parsing functions a bit; rewrite `tr_urlParse()` 2015-12-28 23:52:26 +00:00
Mike Gelfand d0e157eceb Fix bitfield bit removal, add more asserts, extend unit test 2015-12-27 16:34:47 +00:00
Mike Gelfand e3c5ab74ed #5963: Fix two more places where int is used in boolean context 2015-12-27 15:19:03 +00:00
Mike Gelfand 3523277e7f Ongoing refactoring (use size_t instead of int) 2015-12-25 11:34:35 +00:00
Mike Gelfand 4a4badd4af Ongoing refactoring (use size_t instead of int) 2015-12-25 10:19:50 +00:00
Mike Gelfand 9853eb6715 Print log messages in one `OutputDebugString()` call (Windows) 2015-12-13 10:34:53 +00:00
Mike Gelfand ceb19b9711 Optionally return result length from `evbuffer_free_to_str()` 2015-12-13 10:23:22 +00:00
Mike Gelfand 073b05bb85 Reserve a few more bytes for base64 operations to prevent heap corruption 2015-12-13 01:29:39 +00:00
Jordan Lee 3ea43ba778 fix const warnings
In particular, in passing argv around as a "const char * const *"
instead of a "const char *".
2015-12-06 22:39:14 +00:00
Jordan Lee 3d76f23b2b fix unused label warning
some #ifdef code had a goto label 'non_sparse_out', so that goto label was
unused on platforms where all those #ifdef blocks were disabled.
2015-12-06 22:24:35 +00:00
Jordan Lee b559a20029 const correctness
silence some qual-cast warnings by sprinkling more consts throughout,
e.g. casting a const void* to a const struct foo * const *
2015-12-06 22:13:10 +00:00
Jordan Lee 39c48a162e (trivial) remove trailing enum comma 2015-12-06 21:41:18 +00:00
Jordan Lee 562f56459f remove unused macro 2015-12-06 16:39:38 +00:00
Mike Gelfand 505561c055 #5802: Require absolute paths in "session-set" and "free-space" requests as well 2015-11-05 21:48:00 +00:00
Mike Gelfand f6f15d6937 Use tr_realloc (BSD reallocf-alike) instead of plain realloc 2015-10-25 17:13:14 +00:00
Mike Gelfand 3d8c4c3960 Support absolute paths longer than ~260 chars on Windows 2015-10-23 05:29:47 +00:00
Mike Gelfand 88983c1ac1 Use tr_sys_path_remove instead of remove 2015-10-23 04:09:40 +00:00
Mike Gelfand abb572fe26 Better support for UNC paths in tr_sys_path_is_relative
Accept \\ and // and valid UNC path prefixes, but not \/ or /\.
2015-10-23 03:55:04 +00:00
Mike Gelfand 5f420cafda Rework Win32 basename and dirname implementation
Don't use _splitpath_s and _makepath_s as they don't support long paths
and UNC paths properly. Report error if path is not valid.
2015-10-23 03:42:11 +00:00
Mike Gelfand 650db1f46e #5802: Don't make assumptions of remote path validity in transmission-remote
Defer validity checks until path gets to the remote side, where they
actually make sense. Add simple checks for download directory path to
ensure it's not relative, since one cannot know what current working
directory of the remote process is.
2015-10-20 21:22:19 +00:00
Mike Gelfand ca21c1f230 Always invoke async RPC callback, even if operation failed to start 2015-10-20 21:06:01 +00:00
Mike Gelfand f89fab72f9 Remove unused session tag 2015-10-18 18:39:14 +00:00
Mike Gelfand 72f9dc6f92 #5992: Remove now obsolete check for 13th Baktun (already happened) 2015-10-16 19:49:07 +00:00
Mike Gelfand 7d972ed5e6 #6006: Don't use newlocale/uselocale with uClibc below 0.9.34
Incomplete locale internals initialization in uClibc leads to crash upon
`newlocale` call.

See also: http://git.uclibc.org/uClibc/commit/?id=3902d0c472
2015-10-15 20:19:27 +00:00
Mike Gelfand c059eea6b4 #6005: Style fix for previous commit (no functional changes) 2015-10-14 08:22:17 +00:00
Mike Gelfand 69687544d7 #6005: Bump minimum OpenSSL version to 0.9.7, fix build for versions less than 0.9.8b 2015-10-13 21:24:31 +00:00
Mike Gelfand 0420699ad6 Initialise networking in daemon before making libevent calls 2015-10-11 16:35:51 +00:00
Mike Gelfand 8beea92859 Improve error handling when formatting error messages on Windows 2015-10-11 16:15:19 +00:00
Mike Gelfand e745408f3b Fix parameters order in `tr_web_done_func` declaration 2015-10-08 19:47:59 +00:00
Mike Gelfand 1e6a3c2039 #5732: Change length argument type to uint32_t for LTEP messages 2015-10-05 23:10:52 +00:00
Mike Gelfand fcbc2915eb #5732: Fix possible overflow in messageLengthIsCorrect (partial patch by cfpp2p) 2015-10-05 01:21:47 +00:00
Mike Gelfand a90a473d48 #6003: Update to miniupnpc api 14 (slightly modified patch by infirit) 2015-10-04 04:53:18 +00:00
Mike Gelfand 18ea8c429a Improve RPC performance for local sessions
Don't unnecessarily de-/serialize JSON data if local session is used.
2015-07-13 00:32:48 +00:00
Mike Gelfand b9adf279ca #5912: Prevent completed pieces modification by webseeds (patch by cfpp2p)
This avoids blocks corruption in case webseed provides bad data.

As explained by cfpp2p, "The requirements to reproduce are at least one
webseed that sends corrupt block(s), and at least one other peer (webseed
or regular peer) that sends correct data for the same block. Then a peer
with correct block sends the block and transmission accepts and verifies
that block as good. But then the webseed thread comes around and the same
block is downloaded from the webseed that sends a bad block which is then
written even though the piece was previously deemed complete."
2015-07-05 07:54:46 +00:00
Mike Gelfand 6cbfcdc85e Fix `tr_net_strerror` on Windows (oops) 2015-07-01 00:58:00 +00:00
Mike Gelfand 79195614b2 Use `sockerrno` and `tr_net_strerror` for most of network-related errors
This ensures proper network errors formatting on Windows.

Also, disable IP_TOS socket option modification attempts on Windows
since it's not supported there and is considered deprecated: "Do not
use. Type of Service (TOS) settings should only be set using the
Quality of Service API" (c) MSDN. Using QoS API is a subject for
separate commit(s).
2015-07-01 00:54:41 +00:00
Mike Gelfand ba7ea94c7d Avoid assert on passing negative values to `isprint` (due to type promotion) 2015-06-26 21:22:27 +00:00
Mike Gelfand 2b5a03a88c #5964: Another follow-up commit for #5456 (encrypted communication with libevent 2.1.x)
Decrypt only what is asked for, not more. This fixes previous commit
which changed semantics by processing the buffer to the very end,
starting with correct offset though.

Refactor encryption/decryption to a single function which callback.
2015-06-24 21:24:41 +00:00
Mike Gelfand cdcc9e249f #5964: Follow-up fix for #5456 (encrypted communication with libevent 2.1.x)
I've misread libevent documentation and the check introduced was not
entirely correct. Changed `evbuffer_peek` call now to only request the
data which would fit into provided iovec.
2015-06-24 20:38:41 +00:00
Mike Gelfand 6101a69957 Avoid possible `_XOPEN_SOURCE` redefinition warning 2015-06-23 21:16:33 +00:00
Mike Gelfand 45b73a7866 #5456: Fix encrypted communication with libevent 2.1.x
Recent versions of libevent changed the semantics of `evbuffer_ptr_set`
function in a way that it succeeds if pointer is set right after the end
of the buffer. This caused `tr_cryptoEncrypt` and `tr_cryptoDecrypt` to
be called twice for last buffer chunk since no checks for `evbuffer_peek`
return value were made while it was returning 0 on last loop cycle,
leaving iovec unchanged.
2015-06-17 20:32:33 +00:00
Mike Gelfand 088c5c6ab9 Bump DHT version used in CMake scripts (includes latest Win32 fixes) 2015-06-08 19:54:51 +00:00
Mike Gelfand 2804335d05 Don't print trailing space char on each line when saving JSON 2015-06-01 20:50:25 +00:00
Mike Gelfand 5d48c2d3e9 #5851: Don't use _configthreadlocale if not provided by CRT (even if declaration is present) 2015-06-01 18:52:14 +00:00
Mike Gelfand ae5755dc1e #5851: Use per-thread locale setup if possible
This prevents crashes on concurrent tr_variantFromBuf, tr_variantToBuf
and tr_variantGetReal use.
2015-06-01 05:25:14 +00:00
Mike Gelfand 2e6d5c8bc9 Add more booleans to the picture 2015-05-31 22:13:31 +00:00
Mike Gelfand 6c04259c39 Remove useless ws2tcpip.h include in net.h
It's already included above, and QT_DLL condition is meaningless
since net.h is only being used inside libtransmission which doesn't
use Qt.
2015-05-30 15:44:17 +00:00
Mike Gelfand 8dd65cdfba Use CreateProcess instead of _spawnvpe to execute scripts on Windows 2015-05-30 11:15:57 +00:00
Mike Gelfand 7abe7c28a3 #4882: \u-encode all non-printable (as opposed to non-ascii) characters 2015-05-16 17:33:01 +00:00
Mike Gelfand e0dc1d6735 Fix some issues revealed by coverity 2015-05-09 14:10:55 +00:00
Mike Gelfand 4a23c94252 Fix some issues revealed by coverity 2015-05-09 14:09:05 +00:00
Mike Gelfand cdf3cf62f9 Fix some issues revealed by coverity 2015-05-09 11:56:35 +00:00
Mike Gelfand 2321bc3fad Fix some issues revealed by coverity 2015-05-09 08:37:55 +00:00
Mike Gelfand df98031294 #5946: Save "prefetch-enabled" setting as boolean (spotted by cfpp2p) 2015-05-07 06:45:35 +00:00
Mike Gelfand 5de8bbe6d8 Cut internal macro names to have equal number of underscores on each side (take two) 2015-05-04 20:06:05 +00:00
Mike Gelfand 7879100c01 Cut internal macro names to have equal number of underscores on each side 2015-05-04 19:58:34 +00:00
Mike Gelfand 0c01e6e19d #5937: Don't send TR_RPC_TORRENT_ADDED notification if torrent wasn't actually added (patch by xzcvczx) 2015-04-29 19:42:05 +00:00
Mike Gelfand b89b90ee15 Avoid GCC `'static' is not at beginning of declaration` warning 2015-04-21 11:40:15 +00:00
Mike Gelfand c1b10abe0f Use UTF-8 for console I/O on Windows 2015-04-21 10:07:57 +00:00
Mike Gelfand 829cbffaf7 Add version info to executables (on Windows). Group projects into folders (CMake). 2015-04-14 22:46:40 +00:00
Mike Gelfand 53a0fc2a19 Allow files (and their parent directories) to be renamed even when in use (on Windows). 2015-04-13 18:31:32 +00:00
Mike Gelfand 7bf402bb7d Forward-declare `tr_error` structure in headers 2015-04-11 14:54:01 +00:00
Mike Gelfand b58621c683 Add ERROR_DIRECTORY_NOT_SUPPORTED define missing in MinGW 2015-04-11 10:58:08 +00:00
Mike Gelfand 3b129a72d8 #5908: Check for `tr_loadFile` return value instead of `errno` in `tr_variantFromFile`
Seems like there could be a defect in uClibc making errno not
thread-local. Don't rely on errno value but check function return value
instead which is a better failure indicator.

Return errors from `tr_loadFile` and `tr_variantFromFile` via tr_error.
Fix `tr_sessionLoadSettings` to not fail on Windows if settings.json
does not exist.
2015-04-11 10:51:59 +00:00
Mike Gelfand 99e0f5bd63 Tune directory paths on Windows
Use %USERPROFILE% instead of %USERPROFILE%\Documents as home directory.
Don't roam configuration directory (I don't think we want that).
Use known Downloads folder (instead of %HOME%\Downloads) if set.
When searching for web interface files, let local user application data
directory override roaming one, and roaming one override common one.
Use Vista+ API (SHGetKnownFolderPath) to get known folder paths.
2015-04-10 22:15:41 +00:00
Mike Gelfand 7bfcbe55e1 #5920: Fix memory leak and access to freed memory in tr_getDefaultConfigDir (patch by jyelloz) 2015-04-05 06:39:06 +00:00
Mike Gelfand c768af3865 #5407: Fix crash on Mac when pausing torrents (patch by x190) 2015-03-26 18:32:33 +00:00
Mike Gelfand 12095175a1 Do not return `-EINVAL` as socket value (obviously not a good idea).
Also, fix socket descriptor leak in `tr_netBindTCPImpl` if `IPV6_V6ONLY` is defined.
2015-03-26 18:29:11 +00:00
Mike Gelfand cefc477918 Fix a couple more MinGW/MSVC warnings. 2015-03-19 19:13:23 +00:00
Mike Gelfand 45983e66e6 Fix a couple of MinGW warnings. 2015-03-19 06:08:06 +00:00
Mike Gelfand 949e02b933 Define and use tr_socket_t and TR_BAD_SOCKET instead of int and -1.
Test socket validity by comparing to TR_BAD_SOCKET instead of various
(and sometimes wrong) other tests like `x >= 0`, `x != -1`, `x > 0`,
`x > -1`, `x` (valid), and `x < 0`, `x == -1` (invalid).
2015-03-18 07:34:26 +00:00
Mike Gelfand 3f9575fcc8 Minor type adjustments (incomplete, it takes way too much time) 2015-03-15 11:43:32 +00:00
Mike Gelfand 2331cee776 #5505: Temporarily comment assert out so that nightly builds are usable again 2015-03-11 06:22:11 +00:00
Mike Gelfand a2037bdbbd Define one of LFS macros instead of using xxx64 functions directly.
There're too many functions and types to consider, and benefits of not
using LFS macros aren't that big (I was thinking of using fts(3) but
that may not happen soon or at all).
2015-03-10 22:31:09 +00:00
Mike Gelfand 8c511dc590 Use lseek64 instead of lseek, if available (large files on 32-bit systems) 2015-03-08 19:14:24 +00:00
Mike Gelfand 806f81c05c #5881: Explicitly state all possible crypto backend source files so that they are included into archive by `make dist` 2015-01-21 22:32:27 +00:00
Mike Gelfand 5ab451242d Do not write timezone to log, not a good idea after all (no standardized format) 2015-01-13 21:09:21 +00:00
Mike Gelfand fe47350656 Further adjustments to support PolarSSL 1.2 2015-01-07 14:05:58 +00:00
Mike Gelfand 30690fcf99 Lower minimum PolarSSL version required down to 1.2 2015-01-07 13:41:22 +00:00
Mike Gelfand c3afe215d5 Fix copyright years and SVN attributes on new files 2015-01-07 13:20:56 +00:00
Mike Gelfand d877fb9cde Add PolarSSL support 2015-01-07 13:19:00 +00:00
Mike Gelfand 035589f8af #4400: Access CyaSSL RNG in thread-safe manner 2015-01-07 13:13:19 +00:00
Mike Gelfand 097b1dc50f #4400: Actually use CyaSSL (or some other) backend in libtransmission 2015-01-07 03:00:06 +00:00
Mike Gelfand c7d2a7f959 #4400: Add CyaSSL support 2015-01-07 02:04:08 +00:00
Mike Gelfand 295eade2a6 Don't use ssize_t in bitfield.c (cleaner w/o it anyway) 2015-01-04 15:31:47 +00:00
Mike Gelfand 1d58af5082 Increase BASE64 encoding size when using system libb64
Remove BASE64 reference testing as it's only libb64 now.
Improve the test to ignore \r and \n when comparing BASE-encoded
strings to not fail on system (unpatched) libb64.
2015-01-03 21:35:20 +00:00
Mike Gelfand 440f482d01 Replace tabs with spaces; remove trailing spaces 2015-01-02 11:15:31 +00:00
Mike Gelfand 9a3b965ce4 Kill some warnings when compiling on Windows 2015-01-02 04:02:13 +00:00
Mike Gelfand b928ae1ba8 Use libb64 instead of OpenSSL to encode/decode BASE64
Some crypto libraries (like CyaSSL, MatrixSSL and CommonCrypto) either
don't have or expose this functionality at all, expose only part of it,
or (like OpenSSL) have heavyweight API for it. Also, for the task as
easy as BASE64 encoding and decoding it's much better to use small and
simple specialized library.
2015-01-01 21:16:36 +00:00
Mike Gelfand 8b849a0910 #4400, #5462: Fix autotools configuration 2015-01-01 14:33:02 +00:00
Mike Gelfand 45f8bb8c40 #4400, #5462: Add possibility to test one crypto backend against another (reference) backend 2015-01-01 14:23:47 +00:00
Mike Gelfand 342f38bbc5 Factor RPC logic out from session (Qt client) 2014-12-27 20:03:10 +00:00
Mike Gelfand eee49af2b4 Improve cross-compilation support when using CMake 2014-12-20 22:28:43 +00:00
Mike Gelfand c845e35ce1 Fix format specifier warning introduced couple commits earlier 2014-12-13 17:04:14 +00:00
Mike Gelfand 74a5bdb9e6 Don't mess with MinGW printf support for now (tricky) 2014-12-13 16:00:14 +00:00
Mike Gelfand 52a9d774e4 Fix compilation on Windows
This should not affect non-Win32 platforms in any way.
As for Win32 (both MinGW and MSVC), this should hopefully allow for
unpatched compilation. Correct functioning is not yet guaranteed though.
2014-12-13 15:22:39 +00:00
Mike Gelfand aedfc35393 #5692: Fix build under Cygwin (patch by rb07) 2014-12-11 20:06:07 +00:00