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
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
01196c8c4f
mikedld patch: 4160-05b-file-fmt.patch
2014-09-21 18:01:36 +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
b224148ed9
Fix peer communication vulnerability (no known exploits) reported by Ben Hawkes
2014-06-29 01:43:27 +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
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
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
d9a6539e19
fix pedantic compiler warnings
2013-09-09 01:32:09 +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
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
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
de248c94fb
in peer-msgs.c's tr_peerMsgsCalculateActive(), adjust some of those new tracer assertions to work better with magnet links.
2013-07-09 17:05:32 +00:00
Jordan Lee
e0e4849abd
in peer-msgs.c's my_funcs struct, remove an unnecessary trailing comma in the designated initializers.
2013-07-08 16:44:19 +00:00
Jordan Lee
058e430251
fix bug #5372 , 'wrong peer states displayed'.
2013-07-08 16:41:12 +00:00
Jordan Lee
3fb74c4e00
(trunk, libT) fix tr_torrentStat() regression in the nightlies reported in #5294 by mw3demo
2013-05-27 21:04:48 +00:00
Jordan Lee
094af58f29
undo previous commit's accidental inclusion of changes to peer-msgs.* and peer-mgr.c
2013-05-22 19:06:54 +00:00
Jordan Lee
d81f956daa
(trunk, libT) #5356 'only set CURLOPT_COOKIEFILE if cookies.txt exists on startup' -- fixed.
2013-05-22 19:02:07 +00:00
Jordan Lee
96691dd019
(libT) make the class hierarchy between tr_peer, tr_peerMsgs, and tr_webseed a little less ad-hoc
2013-02-04 16:23:33 +00:00
Jordan Lee
5475e1507e
(libT) reduce the scope of REQUEST_BUF_SECS from peer-common.h to peer-msgs.c
2013-02-03 23:29:34 +00:00
Jordan Lee
f370a76c57
move tr_peer.encryptionPreference to tr_peermsgs.encryptionPreference
2013-02-03 22:45:32 +00:00
Jordan Lee
3cb7595b85
(libT) move the tr_peer declaration from peer-mgr.h to peer-common.h
2013-02-03 22:40:00 +00:00
Jordan Lee
553bd58681
(libT) peer-mgr doesn't care about non-piece data being transferred, so don't notify it when it happens
2013-01-30 18:00:03 +00:00
Jordan Lee
f75027d5e9
make all the log functions/structs/enums use a single 'tr_log' namespace, such as tr_logGetQueue, tr_logAddInfo, tr_logIsLevelActive
2013-01-25 23:34:20 +00:00
Jordan Lee
569b895cef
increase the per-peer prefetch count from 12 to 18. Add a symbolic constant for it.
2013-01-09 00:33:00 +00:00
Jordan Lee
c1559f3cc4
(trunk, libT) first drop of the tr_quark patch.
2012-12-22 20:35:19 +00:00
Jordan Lee
e96ed247fe
refactor libtransmission's tr_benc class as tr_variant.
2012-12-14 04:34:42 +00:00
Jordan Lee
079c78981c
(trunk) #5168 'make libtransmission's public funcs nonblocking when possible' -- first attempt.
2012-12-12 20:22:57 +00:00
Jordan Lee
a2d2a10226
(trunk, libT) #5165 : fix r13625 oops
2012-12-07 01:53:31 +00:00
Jordan Lee
3d38723ad9
Follow more common whitespace style conventions in the C code (libtransmission, daemon, utils, cli, gtk).
2012-12-05 17:29:46 +00:00
Jordan Lee
624c8ff1cc
(trunk, libt) #4932 'crash on magnet links' -- fixed.
2012-09-19 05:11:19 +00:00
Jordan Lee
357b160cde
remove trailing spaces
2012-09-07 04:25:04 +00:00
Jordan Lee
3398a48e57
(trunk libT) #4402 "Transmission Bandwidth allocation getting overflows" -- use gvdl's patch '4402-uint-bpsoverflow.patch'
2012-07-01 02:17:35 +00:00
Jordan Lee
6948852013
(trunk libT) #4894 -- don't use evbuffer_add_printf() and evbuffer_pullup() together.
2012-05-17 17:40:31 +00:00
Jordan Lee
57d273cd61
(trunk libT) #4700 "compilation fails on FreeBSD because it can't find alloca.h" -- fixed.
2012-01-10 19:18:18 +00:00
Jordan Lee
18b90f60bc
(trunk libt) in tr_bitfieldSetRaw(), add a `bounded' argument for cases where we know how large the final bitfield will be. This can be used ensure that the excess bits at the end of the array are zeroed out and safe for bitfield.c's countArray() function.
2011-09-26 22:50:42 +00:00
Jordan Lee
b14c44a3a6
(trunk libT) during the extended handshake, don't send the "m" dict if it doesn't have any entries.
2011-07-25 22:33:07 +00:00
Jordan Lee
bd6aaf9a12
(trunk libT) remove trailing spaces from a couple of lines of code
2011-07-17 18:11:34 +00:00
Jordan Lee
2317f08d38
(trunk libT) #4338 "improved webseed support" -- patch by alexat
2011-07-10 15:24:51 +00:00
Jordan Lee
a4ab013568
(trunk libT) fix magnet link crash in peer-msgs.c's updateDesiredRequestCount() reported by quinx in the forums.
...
In some odd cases (such as if unchoked without having shown interest), the code could dividing a number by the torrent's block size without checking to see if the torrent had its metadata yet. This caused a division by zero because a magnet torrent's blocksize is unset until the metadata is downloaded.
2011-05-12 06:43:40 +00:00
Jordan Lee
f5a0276332
(trunk libT) the functions tr_peerMsgsSetChoke() and tr_peerMsgsSetInterested() have bool arguments whose types never got switched from "int" to "bool" when "bool" was adopted.
2011-05-01 19:10:34 +00:00
Jordan Lee
2ecca714f1
(trunk libT) heap pruning: use tr_bencToBuf() instead of tr_bencToStr() when building LTEP messages. This saves us from a handful of unnecessary malloc+memcpy+free calls in each instance where the change is made.
2011-04-27 21:38:45 +00:00
Jordan Lee
ab698d2fa4
(trunk libT) more heap pruning: don't allocate peer-msgs' incoming block buffer until it's needed. If we're seeding, we won't need it.
2011-04-17 06:13:22 +00:00
Jordan Lee
294c2d7113
(trunk libT) heap and event pruning: don't create evtimers for periodic pex messages if the torrent doesn't allow pex (such as, if it's on a private tracker).
...
Previously, we unconditionally created the evtimer, and then checked each time to see if pex was allowed.
2011-04-17 05:55:46 +00:00
Jordan Lee
ac3ec2db39
(trunk libT) use alloca() for allocating the block array in updateBlockRequests()
2011-04-05 00:53:57 +00:00
Jordan Lee
40b2ad63d9
(trunk libT) avoid an unnecessary malloc() + free() call when we finish downloading a block.
...
Pre-libevent2, this free() was useful in helping keep the peer's incoming piece data buffer from growing too large because that could be a significant amount of wasted space given enough peers. However now that we're using the libevent2 code, that piece data buffer gets handed off to the block cache, so most of the time we're freeing an evbuffer that doesn't have any inernal chains allocated anyway.
2011-04-04 05:15:54 +00:00
Jordan Lee
525d854016
(trunk libT) when reading piece data in from a socket, avoid two unnecessary calls to memcpy()
2011-04-04 04:45:41 +00:00
Jordan Lee
0c2dce9da7
(trunk libT) remove dead logic branch detected by clang static analyzer
2011-03-31 04:33:49 +00:00