1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-02-21 21:57:01 +00:00
Commit graph

4683 commits

Author SHA1 Message Date
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
Mike Gelfand
74c6719bb2 #5407: Fix crash on Mac when pausing torrents (patch by x190) 2014-12-11 19:57:52 +00:00
Mike Gelfand
7de6a52e14 Fix utils test; move -Winline to C-only flags (it only harms C++) 2014-12-11 05:25:26 +00:00
Mike Gelfand
fed15dc29d Fix a couple of ordinary and pedantic warnings
Add previously missing -Wall to warning flags in CMake. Remove -Wformat
and -Wvariadic-macros (enabled by default; latter is not meaningful in
C99 mode we use), -Wdeclaration-after-statement (again, not needed as
we use C99). Move -Wmissing-declarations to C-only flags (GCC man says
so).

Add copyrights year to crypto-utils-fallback.c.
2014-12-11 05:11:02 +00:00
Mike Gelfand
bb09ad5a50 Add missing svn:keywords property to recently (and not so recently) added files 2014-12-10 18:58:12 +00:00
Mike Gelfand
4fe156a255 Fix tr_moveFile error reporting
Remove unused `renamed` argument.
Use tr_error instead of errno to report errors to support Win32 file
wrappers which do not map Windows error codes to POSIX ones.
Return bool instead of int (0/-1).

Uncomment tr_error_prefix and tr_error_propagate_prefixed functions.
2014-12-10 18:37:58 +00:00
Mike Gelfand
a3fdd5f029 #5369: Improve file allocation error checking (initial patch by g.proskurin)
Additionally,
* always close file descriptor on error in cached_file_open (FD leak),
* only store file descriptor to tr_cached_file on success,
* call ftruncate after xfsctl-based preallocation so that correct size
  is reported by the system.
2014-12-10 18:23:11 +00:00
Mike Gelfand
1560ebd3ff Fix small memory leaks in crypto (base64) and rename (multi-file torrent) unit tests 2014-12-07 10:42:12 +00:00
Mike Gelfand
b9d844b166 Increase move test timeouts from 5 sec to 5 min 2014-12-07 10:10:16 +00:00
Mike Gelfand
42de056a4b #4400, #5462: Move SHA1/HEX helpers to crypto-utils
On a way to factoring out OpenSSL support to a standalone file to ease
addition of other crypto libraries support in the future, move helpers
providing SHA1/HEX conversion to crypto-utils.{c,h}.

Rename functions:
* tr_sha1_to_hex -> tr_binary_to_hex (add length argument),
* tr_hex_to_sha1 -> tr_hex_to_binary (add length argument).

Make tr_sha1_to_hex and tr_hex_to_sha1 wrappers around above functions.
2014-12-04 20:53:56 +00:00
Mike Gelfand
748f8a75d2 #4400, #5462: Move SSHA1 helpers to crypto-utils
On a way to factoring out OpenSSL support to a standalone file to ease
addition of other crypto libraries support in the future, move helpers
providing SSHA1 password generation and checking to crypto-utils.{c,h}.
2014-12-04 20:45:18 +00:00
Mike Gelfand
5c43b5c23c #4400, #5462: Move BASE64 helpers to crypto-utils
On a way to factoring out OpenSSL support to a standalone file to ease
addition of other crypto libraries support in the future, move helpers
providing BASE64 encoding and decoding to crypto-utils.{c,h}. OpenSSL-
related functionality is moved to crypto-utils-openssl.c.

Add new functions to be implemented by crypto backends:
* tr_base64_encode_impl - encode from binary to BASE64,
* tr_base64_decode_impl - decode from BASE64 to binary.

Change `tr_base64_encode` and `tr_base64_decode` functions to expect
non-negative input data length which is considered real and never adjusted.
To process null-terminated strings (which was achieved before by passing 0
or -1 as input data length), add new `tr_base64_encode_str` and
`tr_base64_decode_str` functions which do not accept input data length as
an argument but calculate it on their own.
2014-12-04 19:58:34 +00:00
Mike Gelfand
117ab3e8d2 #4400, #5462: Move DH helpers to crypto-utils
On a way to factoring out OpenSSL support to a standalone file to ease
addition of other crypto libraries support in the future, move helpers
providing DH key exchange to crypto-utils.{c,h}. OpenSSL-related
functionality (DH context management) is moved to crypto-utils-openssl.c.
Since we know in advance that DH secret key management code will be the
same for most of backends, implement common functionality in separate
crypto-utils-fallback.c.

Add new tr_dh_ctx_t and tr_dh_secret_t types and functions to be
implemented by crypto backends:
* tr_dh_new - allocate DH context,
* tr_dh_free - free the context,
* tr_dh_make_key - generate private/public keypair,
* tr_dh_agree - perform DH key exchange and generate secret key,
* tr_dh_secret_derive - calculate secret key hash,
* tr_dh_secret_free - free the secret key,
* tr_dh_align_key - align some DH key in the buffer allocated for it.

Make DH secret key not accessible in plain form outside the crypto
backend. This allows for implementations where the key is managed by
the underlying library and is not even exposed to our backend.
2014-12-04 19:18:08 +00:00
Mike Gelfand
7e23390fa2 #4400, #5462: Do not assert on input to SHA1 or RC4 if input length is 0. 2014-12-04 18:20:46 +00:00
Mike Gelfand
d424ed143e #4400, #5462: Move RC4 helpers to crypto-utils
On a way to factoring out OpenSSL support to a standalone file to ease
addition of other crypto libraries support in the future, move helpers
providing RC4 ciphering to crypto-utils.{c,h}. OpenSSL-related
functionality (RC4 context management) is moved to crypto-utils-openssl.c.

Add new tr_rc4_ctx_t type and functions to be implemented by crypto
backends:
* tr_rc4_new - allocate RC4 context,
* tr_rc4_free - free the context,
* tr_rc4_set_key - set cipher key,
* tr_rc4_process - cipher memory block.
2014-12-04 12:37:08 +00:00
Mike Gelfand
4cfe7e7ddb #4400, #5462: Move SHA1 helpers to crypto-utils
On a way to factoring out OpenSSL support to a standalone file to ease
addition of other crypto libraries support in the future, move helpers
providing SHA1 calculation to crypto-utils.{c,h}. OpenSSL-related
functionality (SHA1 context management) is moved to crypto-utils-openssl.c.

Add new tr_sha1_ctx_t type and functions to be implemented by crypto
backends:
* tr_sha1_init - allocate SHA1 context and and initialize it,
* tr_sha1_update - hash some [more] data,
* tr_sha1_final - finish hash calculation and free the context.

Add new files to CMakeLists.txt (leftover from previous commit) to fix
CMake-based configuration.
2014-12-04 12:13:59 +00:00
Mike Gelfand
f6f7bf8227 #4400, #5462: Move random helpers to crypto-utils
On a way to factoring out OpenSSL support to a standalone file to ease
addition of other crypto libraries support in the future, move helpers
providing random numbers/data generation to crypto-utils.{c,h}. OpenSSL-
related functionality (generation of cryptographically strong random
data) is moved to crypto-utils-openssl.c.

Rename functions to follow currently accepted style:
* tr_cryptoRandBuf -> tr_rand_buffer
* tr_cryptoRandInt -> tr_rand_int
* tr_cryptoWeakRandInt -> tr_rand_int_weak

Fix rare case of invalid value being returned from tr_rand_int. Return
value for abs(INT_MIN) may be undefined and thus negative, and so
tr_rand_int will return negative value which is incorrect (out of
requested and expected range).
2014-12-04 11:27:38 +00:00
Mike Gelfand
83c4edb008 #5828: Initial CMake build system support 2014-12-01 19:55:22 +00:00
Mike Gelfand
13cad2fb55 #5722: Rename remaining WIN32 uses to _WIN32 2014-11-30 20:08:20 +00:00
Mike Gelfand
e30728367f #5771: Use true and false instead of 1 and 0 for bool variables (patch by ticamkq + additional fixes) 2014-11-30 19:38:47 +00:00
Jordan Lee
ed12ddb090 fix infinite loop in deleteLocalData(). 2014-11-10 01:39:14 +00:00
Jordan Lee
c54f220fe8 add libtransmission/file.c 2014-09-21 18:08:56 +00:00
Jordan Lee
870041d92d (trunk) #4160: mike.dld patch: 4160-08-args.patch 2014-09-21 18:06:28 +00:00
Jordan Lee
be290162c2 (trunk) #4160: mike.dld patch: 4160-07-env.patch 2014-09-21 18:05:14 +00:00
Jordan Lee
3e4ceecf03 #4160: mike.dld patch: 4160-06-misc.patch 2014-09-21 18:03:13 +00:00
Jordan Lee
01196c8c4f mikedld patch: 4160-05b-file-fmt.patch 2014-09-21 18:01:36 +00:00
Jordan Lee
90bbbaefc3 (trunk, libT) #4160: apply mike.dld's patch: 4160-05a-file-fmt.patch 2014-09-21 17:57:45 +00:00
Jordan Lee
d9d66e3e42 (trunk, libt) #4160 - the slow slog to catch trunk up to mike.dld's 4160 diff continues. This step applies 4160-04b-dir.patch, which replaces native file operations with the tr_sys_dir_*() portability wrappers added in the previous commit. 2014-09-21 17:55:39 +00:00
Jordan Lee
51a90d0da0 (trunk, libt) #4160 - the slow slog to catch trunk up to mike.dld's 4160 diff continues. This step applies 4160-04a-dir.patch, which adds tr_sys_dir_*() portability wrappers. 2014-09-21 17:52:36 +00:00
Jordan Lee
b325bc0a16 (trunk) #5759 compilation error, undefined reference to sqrt 2014-08-20 17:14:17 +00:00
Jordan Lee
b33a7d4dc1 (trunk, libt) #4160 - the slow slog to catch trunk up to mike.dld's 4160 diff continues. This step applies 4160-03b-file.patch, which replaces native file operations with the tr_sys_file_*() portability wrappers added in r14321. 2014-07-28 04:13:38 +00:00
Jordan Lee
ab24ef9fcb use pkg-config to get the zlib cflags/libs; remove obsolete zlib.m4 macro 2014-07-13 21:54:56 +00:00
Jordan Lee
2e3ffdc6ec since libz's been required in rpcimpl.c for ages and nobody's complained, remove the HAVE_ZLIB cruft for conditional-compiling with and without zlib. 2014-07-13 21:50:56 +00:00
Jordan Lee
c1beabfea6 (trunk, libT) #4160 'foreign character support' -- merge mike.dld's 4160-03a-file.platch, which introduces tr_sys_file_*() portability wrappers 2014-07-08 00:15:12 +00:00
Jordan Lee
0323639e57 (trunk, libT) #4160 'foreign character support' -- merge mike.dld's 4160-02b-path.patch, which updates the codebase to use the new tr_sys_path_*() portability wrappers introduced in 4160-02a 2014-07-08 00:08:43 +00:00
Jordan Lee
d7f4478679 (trunk, libT) #5735 'segfault iside node_alloc' -- fixed with patch by benjarobin 2014-07-06 20:06:45 +00:00
Jordan Lee
a2898f2ee9 (trunk, libT) #5656 'Problems renaming files' -- fixed, patch by rb07 2014-07-04 03:23:27 +00:00
Mitchell Livingston
0e01879974 Use built-in _WIN32 macro instead of WIN32 2014-07-04 00:00:07 +00:00
Jordan Lee
60a5c793d9 (trunk, libT) mike.dld's 4160-02a-path.patch: portability wrapper around file paths. 2014-07-03 21:58:39 +00:00
Jordan Lee
b939f98ec7 (trunk, libT) #5709 'Fix an instance of time_t printing' -- fixed, patch by naddy 2014-07-03 19:28:21 +00:00
Mitchell Livingston
084273c106 Use built-in __APPLE__ macro instead of SYS_DARWIN and MACOSX 2014-07-03 19:20:12 +00:00
Jordan Lee
821aa2aaff fix tr_bencParseStr() bug reported by Ben Hawkes 2014-06-29 01:44:22 +00:00
Jordan Lee
b224148ed9 Fix peer communication vulnerability (no known exploits) reported by Ben Hawkes 2014-06-29 01:43:27 +00:00
Jordan Lee
92daae473e mike.dld's portability improvements to libtransmission, pt 1 2014-06-23 02:38:53 +00:00
Jordan Lee
ef9370783a (trunk, utils) in transmission-create, return an error if a user tries to manually set a piece size that isn't a power of two. 2014-06-10 00:43:21 +00:00
Jordan Lee
f433f2ee17 (trunk, libT) #5517 when parsing a torrent's metainfo's path list, allow empty components because some .torrent files innocently have them. Update unit tests. 2014-06-09 02:53:04 +00:00
Jordan Lee
4a61241406 (trunk, libT) #5714: ensure we don't add empty path components when creating an info dict in tr_makeMetaInfo(). 2014-06-09 01:14:14 +00:00
Jordan Lee
99eda37b5e in makemeta-tests, add tests to generate a .torrent file from a folder of randomly-generated files. 2014-06-08 22:21:27 +00:00
Jordan Lee
e40a7d5359 (trunk) replace the tr_metainfo_builder.isSingleFile and tr_info.isMultifile fields an 'isFolder' bool in both structs.
This makes the variable naming more uniform. It also clarifies the information we're really trying to convey -- previously, isSingleFile was false whenever the torrent held a directory tree, even if there was only a single file in the tree.

Sync the Mac OS X client's use to match the libtransmission variable names.
2014-06-08 22:16:01 +00:00
Jordan Lee
db8a589ec4 add tr_makeMetaInfo() unit test for creating a single-file torrent 2014-06-08 20:01:10 +00:00
Jordan Lee
f17d152e2b separate out the sandbox code so that test sandboxes can be created without a tr_session 2014-06-08 19:09:41 +00:00
Jordan Lee
755b47b498 builder.isSingleFile should be a bool, not an int. 2014-06-08 19:07:59 +00:00
Jordan Lee
a0fff80248 (trunk, libT) #5711: add support for BitTorrent client peer-id 2014-06-07 15:07:51 +00:00
Jordan Lee
4bb7f61e31 fix tr_cryptoGetTorrentHash() behavior for crypto-test.c 2014-05-18 20:47:58 +00:00
Jordan Lee
6ee973aaac (trunk) #5671 'dht-0.22': update third-party/dht.c to Juliusz Chroboczek's upstream v0.22 2014-05-05 20:45:14 +00:00
Jordan Lee
b00b90c48c (trunk, libT) #5650: 'make log timestamp format configurable' -- timestamp expanded to include full date/time/tz info, patch by mike.dld 2014-04-28 15:31:46 +00:00
Jordan Lee
5a2268289e (trunk, libT) #5651 'int to bool patch' -- fixed, patch by rajmannugetr 2014-04-27 23:10:01 +00:00
Jordan Lee
8f5c7809e7 (trunk, libT) #5517 'Don't create or add torrents with "../" at the beginning of the path or "/../" anywhere in the path' -- fixed. 2014-04-27 20:17:16 +00:00
Jordan Lee
a7137b7bb9 upgrade miniupnp version to 1.9. update autoconf script to detect the API version; update upnp.c's #ifdefs to use the API version. 2014-04-27 19:31:10 +00:00
Jordan Lee
fef15a7ab2 (trunk, libT) #5643 'quota support for NetBSD >= 6' -- patch by wiz 2014-04-27 00:02:00 +00:00
Jordan Lee
02cff80c2d Copyedit the license's revised text: (1) remove unnecessary repitition use of the word 'license' from the top of the header and source files (2) add the standard 'we hope it's useful, but no warranty' clause to COPYING (3) make explicit that linking OpenSSL is allowed (see https://people.gnome.org/~markmc/openssl-and-the-gpl.html for background) (4) sync the Qt and GTK+ clients' license popups with COPYING's revised text 2014-01-21 03:10:30 +00:00
Jordan Lee
d49b8b6650 (trunk, libT) #5467: 'transmission-daemon SEGFAULTs on startup without error message if ~/.config does not exist and ~ is not writeable' -- nice quick fix by mike.dld 2014-01-21 02:27:46 +00:00
Jordan Lee
1637da5c1d when we free the UDP trackers on shutdown, make sure to cancel any DNS requests that are pending for them. 2014-01-20 23:18:52 +00:00
Jordan Lee
b342c2c180 (trunk, libT) #4089: 'magnet download not verified for existing data' -- patch by cfpp2p 2014-01-19 05:03:27 +00:00
Jordan Lee
2ec84b2e32 (trunk, libT) #5573 'crypto unit test' -- written by mike.dld 2014-01-19 04:41:20 +00:00
Jordan Lee
fa23e1e60a (trunk, libT) #5517 'fix error adding torrents whose names with an ellipsis' -- fix by e5g6s. 2014-01-19 04:19:14 +00:00
Jordan Lee
f470ab3210 (trunk, libT) #5583 'blockfile.tmp file descriptor is leaked when importing blocklist' -- fix by rb07. 2014-01-19 02:03:41 +00:00
Jordan Lee
9fc4260295 (trunk, libT) #5570 'regression: peers no longer load from .resume files' -- fix submitted by Nonal 2014-01-19 01:55:54 +00:00
Jordan Lee
15d11de5f4 add svn:keywords on source files that were missing them 2014-01-19 01:29:38 +00:00
Jordan Lee
4b9626bb83 Licensing changes:
1. add the option the code to be used under GPLv2 or GPLv3; previously only GPLv2 was allowed

2. add the "proxy option" as described in GPLv3 so we can add future licenses without having to bulk-edit everything again :)

3. remove the awkward "exception for MIT code in Mac client" clause; it was unnecessary and confusing.
2014-01-19 01:09:44 +00:00
Jordan Lee
4904b923fb (trunk) restore copyright year as suggested in email by rms 2014-01-18 20:56:57 +00:00
Jordan Lee
2002253802 (trunk, libT) allocate in jsonsl, allocate jpr_root using the correct integral type. upstream xref: https://github.com/mnunberg/jsonsl/issues/6 2013-12-16 16:32:55 +00:00
Mitchell Livingston
4ecbb29137 #5304 daemon fails to build on mac 2013-10-27 19:31:36 +00:00
Jordan Lee
cd00ad4f55 (trunk, libT) #5450: when starting torrents via RPC with torrent-start or torrent-start-now requests, work through the rpc-supplied torrent list in queue order 2013-10-20 17:24:57 +00:00
Jordan Lee
451d398aa6 (trunk, libT) #5427 'torrents start in pause' -- fix resume issue with que_restart_v2 patch by cfpp2p 2013-10-20 17:15:19 +00:00
Jordan Lee
d9a6539e19 fix pedantic compiler warnings 2013-09-09 01:32:09 +00:00
Jordan Lee
80a5815c0c (trunk, libT) tr-getopt-test fixes similar to r14192 2013-09-09 00:40:20 +00:00
Jordan Lee
eff3b75586 blocklist cleanup: use bool instead of int where appropriate, use tr_fileExists() instead of stat() 2013-09-08 21:25:13 +00:00
Jordan Lee
36cc115c7b have the peer-id test follow the other unit test files' naming conventions 2013-09-08 19:30:16 +00:00
Jordan Lee
0e453bb873 (trunk, libT) improved/new MSVC portability wrappers dirname, basename, gettimeofday(). patch by mikedld, breakage by charles 2013-09-08 18:27:27 +00:00
Jordan Lee
0ba7c5f3cf fix a handful of CL warnings & errors in libtransmission. mikedld 2013-09-08 17:58:14 +00:00
Jordan Lee
677769a462 remove a few straggling uses of %zu to follow up on the previous TR_PRIuSIZE commit 2013-09-08 17:36:11 +00:00
Jordan Lee
ea7d2482dd introduce TR_PRIuSIZE macro for portable printf()ing of size_t. mikedld 2013-09-08 17:32:09 +00:00
Jordan Lee
98dd141449 correct function pointer type correctness. mikedld 2013-09-08 17:29:25 +00:00
Jordan Lee
4c8bda8805 function pointer type correctness. mikedld 2013-09-08 17:08:18 +00:00
Jordan Lee
605e2e89ad use evutil_socket_t instead of int to define socket types. Patch my mikedLd :) 2013-09-08 17:03:11 +00:00
Jordan Lee
4aa5c5c08d (trunk, libT) #5476: also, define __USE_MINGW_ANSI_STDIO and __STDC_FORMAT_MACROS on win32 systems so these new macros will work on mingw-w64 and mingw. (rb07) 2013-08-26 17:15:12 +00:00
Jordan Lee
9fe48d7a08 (trunk, libT) #5476: correct the definitions of PRIu64 and PRIu32 on win32 systems; thanks to rb07 for this correction 2013-08-26 17:12:16 +00:00
Jordan Lee
d112a813e9 make accessing tr_list's recycle nodes threadsafe. patch by mike.did, fixes #5352 2013-08-25 16:27:19 +00:00
Jordan Lee
5661aaad5e add windows-friendly definitions for PRIu64, PRId64, PRIu32 2013-08-24 20:49:27 +00:00
Jordan Lee
65f15a4ba9 more treating-bools-as-bools 2013-08-24 18:18:38 +00:00
Jordan Lee
f762c2ce6a treat bool args as booleans rather than ints; no need to compare them a la 'if (boolVal != 0)' 2013-08-24 18:08:38 +00:00
Jordan Lee
28fe36f1f8 #include limits.h where we use it, and don't where we don't 2013-08-24 17:53:45 +00:00
Jordan Lee
35638e210e add inline wrapper functions to tr_torrent to decouple the rest of the code from tr_completion 2013-08-18 13:06:39 +00:00
Jordan Lee
0f1f84898b silence a small handful of minor gcc compiler warnings in libtransmission 2013-08-17 17:20:31 +00:00
Jordan Lee
765879ddba silence a small handful of minor gcc compiler warnings in libtransmission 2013-08-17 17:03:15 +00:00
Jordan Lee
ba688e2811 silence a small handful of minor gcc compiler warnings in libtransmission 2013-08-17 16:31:03 +00:00
Jordan Lee
9182c34711 #5298 'Transmission not holding queue order' -- fixed with patch by gabrielrcp 2013-08-17 16:20:32 +00:00
Jordan Lee
6fc8481524 (trunk, libT) #5452 'preventing zombies from child scripts' -- fixed. 2013-08-05 13:07:23 +00:00
Jordan Lee
76528d8e14 (trunk, libT) #5451: 'crash in tr_torrentGetPeerId() during incoming encrypted handshake' -- fixed. 2013-08-05 04:39:43 +00:00