Commit Graph

3550 Commits

Author SHA1 Message Date
Nick Mathewson
a7bd20ebaf Merge branch 'maint-0.3.3' into maint-0.3.4 2018-07-18 15:08:57 -04:00
Nick Mathewson
c31700d664 Merge branch 'maint-0.3.2' into maint-0.3.3 2018-07-18 15:04:14 -04:00
Nick Mathewson
559f79fd79 Merge branch 'maint-0.2.9' into maint-0.3.2 2018-07-18 15:03:27 -04:00
Nick Mathewson
a321d72401 Merge branch 'bug26485_029_squashed' into maint-0.2.9 2018-07-18 15:01:03 -04:00
Nick Mathewson
fd5dce0a1b Add a test for format_recommended_version_list. 2018-07-18 15:00:53 -04:00
Nick Mathewson
ef5c3c8216 Merge branch 'ulimit_when_crashing' 2018-07-18 09:38:04 -04:00
teor
449d190e2e
SKIP test_key_expiration.sh on Windows until the underlying issue is resolved
Skip an unreliable key expiration test on Windows, until the underlying
issue in bug 26076 is resolved.

Fixes bug 26853; bugfix on 0.3.2.1-alpha.
2018-07-18 12:37:12 +10:00
Nick Mathewson
ee12c11dd4 Increase line coverage in libtor-string to 100%
(On linux.)
2018-07-17 16:47:32 -04:00
Nick Mathewson
e2b744ce38 Merge branch 'bug25552_ope_squashed' 2018-07-17 16:19:32 -04:00
George Kadianakis
9e6235d290 Fix time source bug in sr_state_get_start_time_of_current_protocol_run().
The following bug was causing many issues for this branch in chutney:

In sr_state_get_start_time_of_current_protocol_run() we were using the
consensus valid-after to calculate beginning_of_current_round, but we were
using time(NULL) to calculate the current_round slot. This was causing time
sync issues when the consensus valid-after and time(NULL) were disagreeing on
what the current round is. Our fix is to use the consensus valid-after in both
places.

This also means that we are not using 'now' (aka time(NULL)) anymore in that
function, and hence we can remove that argument from the function (and its
callers). I'll do this in the next commit so that we keep things separated.

Furthermore, we fix a unittest that broke.
2018-07-17 15:57:46 -04:00
George Kadianakis
1d2333405e Remove now useless rev counter state file code.
We are not using the state file for rev counters anymore, we just generate them
on the fly!
2018-07-17 15:57:46 -04:00
George Kadianakis
2e8d4139a7 Fix up some unittests by being more careful with the local time.
Now that the rev counter depends on the local time, we need to be more careful
in the unittests. Some unittests were breaking because they were using
consensus values from 1985, but they were not updating the local time
appropriately. That was causing the OPE module to complain that it was trying
to encrypt insanely large values.
2018-07-17 15:57:46 -04:00
Nick Mathewson
3a45f6ffe9 Implementation for a simple order-preserving encryption scheme.
This is meant for use when encrypting the current time within the
period in order to get a monotonically increasing revision counter
without actually revealing our view of the time.

This scheme is far from the most state-of-the-art: don't use it for
anything else without careful analysis by somebody much smarter than
I am.

See ticket #25552 for some rationale for this logic.
2018-07-17 15:57:46 -04:00
Nick Mathewson
304ee896d1 Merge branch 'maint-0.3.3' into maint-0.3.4 2018-07-17 14:56:52 -04:00
Nick Mathewson
28d1057d56 Merge branch 'maint-0.3.2' into maint-0.3.3 2018-07-17 14:56:52 -04:00
Nick Mathewson
61a2762e35 Merge branch 'maint-0.2.9' into maint-0.3.2 2018-07-17 14:56:52 -04:00
Nick Mathewson
12afdcc15a Merge branch 'maint-0.3.4' 2018-07-17 14:56:52 -04:00
teor
6dafddd05d SKIP test_keygen.sh on Windows until the underlying issue is resolved
Skip an unreliable key generation test on Windows, until the underlying
issue in bug 26076 is resolved.

Fixes bug 26830; bugfix on 0.2.7.3-rc.
2018-07-17 14:56:18 -04:00
Nick Mathewson
4833717d69 Merge branch 'maint-0.3.4' 2018-07-17 14:46:16 -04:00
rl1987
8645647250 Fix build to work with --disable-unittests again 2018-07-17 12:09:34 +00:00
juga0
c6aee94d19 Add tests for max length bw file headers 2018-07-16 14:43:49 +00:00
juga0
317d930f08 Add test with NULL bw_file_header
and complete v1.0.0 bandwidth file
2018-07-16 14:43:49 +00:00
juga0
e87793bae5 Move bandwidth file tests to same function
also add tests for bw_file_headers.
Headers are all that is found before a correct relay line or
the terminator.
Tests include:
* a empty bandwidth file
* a bandwidth file with only timestamp
* a bandwidth file with v1.0.0 headers
* a bandwidth file with v1.0.0 headers and relay lines
* a bandwidth file with v1.1.0 headers and v1.0.0 relay lines
* a bandwidth file with v1.0.0 headers, malformed relay lines and
  relay lines
* a bandwidth file with v1.0.0 headers, malformed relay lines,
  relay lines and malformed relay lines
* a bandwidth file with v1.1.0 headers without terminator
* a bandwidth file with v1.1.0 headers with terminator
* a bandwidth file with v1.1.0 headers without terminator and
  relay lines
* a bandwidth file with v1.1.0 headers with terminator and relay
  lines
* a bandwidth file with v1.1.0 headers without terminator, bad
  relay lines and relay lines
* a bandwidth file with v1.1.0 headers with terminator, bad relay
  lines and relay lines
2018-07-16 14:43:49 +00:00
juga0
e5dd46beab Add the Bandwidth List file headers to votes
* add bwlist_headers argument to dirserv_read_measured_bandwidth
  in order to store all the headers found when parsing the file
* add bwlist_headers to networkstatus_t in order to store the
  the headers found by the previous function
* include the bandwidth headers as string in vote documents
* add test to check that dirserv_read_measured_bandwidth generates
  the bwlist_headers
2018-07-16 14:43:48 +00:00
Nick Mathewson
f8e9c4a894 Try putting ulimit -c 0 in test_bt.sh to see if it fixes bug 26787 2018-07-16 07:53:43 -04:00
Nick Mathewson
27dd2b1f1f Make nss get initialized before we fuzz anything. 2018-07-13 12:35:22 -04:00
Nick Mathewson
d811ce2421 Add postfork support for nss
We need this in our unit tests, since otherwise NSS will notice
we've forked and start cussing us out.

I suspect we'll need a different hack for daemonizing, but this
should be enough for tinytest to work.
2018-07-13 12:35:22 -04:00
Nick Mathewson
2d0e1cef20 Add fuzzing wrapper for fetch_from_buf_socks() 2018-07-12 14:20:46 -04:00
Nick Mathewson
7556933537 Merge branch 'socks_trunnel4_squashed' into socks_trunnel4_squashed_merged 2018-07-12 11:47:25 -04:00
rl1987
58cb2ed243 Fix buf_t advancement in fetch_buf_from_socks
We pullup 512 bytes of input to make sure that at least one SOCKS
message ends up in head of linked list
2018-07-12 11:41:44 -04:00
rl1987
bcbd3fb71e Second phase of SOCKS5 2018-07-12 11:41:05 -04:00
rl1987
9155e08450 Parsing SOCKS4/4a request using trunnel impl 2018-07-12 11:40:49 -04:00
Nick Mathewson
a7ec493d88 Merge remote-tracking branch 'imnotbad/bug26663' 2018-07-12 08:59:23 -04:00
Nick Mathewson
f45107e7de Rename crypto.c to crypto_cipher.c (since that's all it still has.) 2018-07-11 14:12:36 -04:00
Nick Mathewson
12a1ada158 Move the initialization and cleanup parts of crypto.c
These are now part of crypto_init.c.  The openssl-only parts now
live in crypto_openssl_mgt.c.

I recommend reviewing this patch with -b and --color-moved.
2018-07-11 13:45:49 -04:00
Nick Mathewson
92db96d80f Make our crypto library symbolic in the makefiles. 2018-07-11 12:51:36 -04:00
Nick Mathewson
e7f5f48d68 Rename torlog.[ch] to log.[ch]
Fun fact: these files used to be called log.[ch] until we ran into
conflicts with systems having a log.h file.  But now that we always
include "lib/log/log.h", we should be fine.
2018-07-10 15:20:30 -04:00
Nick Mathewson
41640b6573 Rename util_malloc to malloc. 2018-07-10 15:16:57 -04:00
Nick Mathewson
a2c44a7a7e Isolate resolve.h usage in the modules that really need it.
(Almost none of Tor should actually need to touch the platform resolver.)
2018-07-10 13:36:45 -04:00
Nick Mathewson
2f657a1416 Remove all users of addr_port_lookup outside of address.c
This function has a nasty API, since whether or not it invokes the
resolver depends on whether one of its arguments is NULL.  That's a
good way for accidents to happen.

This patch incidentally makes tor-resolve support socks hosts on
IPv6.
2018-07-10 13:23:37 -04:00
Nick Mathewson
19f2057d49 Fix some lingering windows compilation issues from Jenkins.
These were caused by the recent refactoring.
2018-07-09 12:54:40 -04:00
Nick Mathewson
98dff5df3f Merge branch 'maint-0.3.3' into maint-0.3.4 2018-07-09 10:17:20 -04:00
Nick Mathewson
250e0fc1c4 Merge branch 'maint-0.3.2' into maint-0.3.3 2018-07-09 10:17:20 -04:00
Nick Mathewson
1b81c4b5f3 Merge branch 'maint-0.3.4' 2018-07-09 10:17:20 -04:00
Nick Mathewson
6ad2c2b92f Merge remote-tracking branch 'github/bug26269_031' into maint-0.3.2 2018-07-09 10:17:17 -04:00
Nick Mathewson
a1a55a33c2 Merge branch 'bug26488' 2018-07-09 09:37:14 -04:00
rl1987
46998fc8fd Validate that DirAuthority address is IPv4 2018-07-09 09:37:09 -04:00
Nick Mathewson
8e3a52e5c3 Merge branch 'maint-0.3.4' 2018-07-09 09:14:41 -04:00
Nick Mathewson
75d9db9e5b Merge branch 'maint-0.3.3' into maint-0.3.4 2018-07-09 09:14:37 -04:00
Nick Mathewson
f721a08220 Merge remote-tracking branch 'catalyst-github/bug26455_033' into maint-0.3.3 2018-07-09 09:13:58 -04:00
Kaidan
abeb07a1bf Made 'auto' keyword in torrc case insensitive 2018-07-08 00:15:16 +10:00
Nick Mathewson
667a6e8fe9 Whoops. Protover.[ch] belong in src/core/or 2018-07-05 17:15:50 -04:00
Nick Mathewson
f720a5a439 Fix everything that previously referred to src/or 2018-07-05 17:15:50 -04:00
Nick Mathewson
5f51c2de8b Fix our build system to know the new locations of the src/or stuff 2018-07-05 17:15:50 -04:00
Nick Mathewson
ef486e3c02 Fix every include path changed in the previous commit (automated)
I am very glad to have written this script.
2018-07-05 17:15:50 -04:00
Nick Mathewson
81cb0afb2b Start splitting src/or
This is a very gentle commit that just lays the groundwork in the
build system: it puts the include files to build libtor-app.a into
src/core, and to build the tor executable into src/app.  The
executable is now "src/app/tor".
2018-07-05 17:15:50 -04:00
Nick Mathewson
1dd5b5f441 Add a missing include. 2018-07-05 15:44:33 -04:00
Nick Mathewson
2d69c32bb6 Clean up include paths for libtor-evloop (automated) 2018-07-05 15:22:17 -04:00
Nick Mathewson
1e417b7275 All remaining files in src/common belong to the event loop. 2018-07-05 15:22:17 -04:00
Nick Mathewson
4593829861 Remove util.h
Inline its contents (which were all includes) into or.h, and some of
its contents into other places that didn't include or.h at all.
2018-07-05 15:04:18 -04:00
Nick Mathewson
0adcfbc7c8 Move address_set to src/or
This is temporary, until src/or is split.

Putting this in containers would be another logical alternative,
except that addresses depend on containers, and we don't like
cycles.
2018-07-05 14:51:07 -04:00
Nick Mathewson
24c0f83185 Move socks5_status.h to src/lib/net
There might be a better place for it in the long run, but this is
the best I can think of for now.
2018-07-05 14:48:29 -04:00
Nick Mathewson
0e4b1781f4 Move handles.h to src/lib/container
There might be a better place for it in the long run, but this is
the best we can think of for now.
2018-07-05 14:45:34 -04:00
Nick Mathewson
df98582851 Merge remote-tracking branch 'github/ticket26626' 2018-07-03 12:52:43 -04:00
Nick Mathewson
77e678c20d Merge remote-tracking branch 'github/shrink_or_h_more' 2018-07-03 11:09:54 -04:00
Nick Mathewson
02a4442524 Fix up some windows compilation issues.
These were mostly cases where our previous macros had been casting,
and the values that we were trying to printf were not in fact
uint64_t.
2018-07-03 11:00:18 -04:00
Nick Mathewson
d5a3bb960d Retire U64_TO_DBL and DBL_TO_U64
These were necessary long ago to work around a bug in VC6.
2018-07-03 10:45:43 -04:00
Nick Mathewson
9568c0ce3d Return U64_PRINTF_ARG and U64_FORMAT
The standard is printf("%"PRIu64, x);
2018-07-03 10:40:59 -04:00
Nick Mathewson
52884f56d4 Replace U64_LITERAL with the standard UINT64_C 2018-07-03 10:33:50 -04:00
Nick Mathewson
c75215c23a Clean up various things that broke with our stdint.h changes
Casting before printf was necessary; now it's not so smart.

We don't have SIZEOF_UINT8_T any more.
2018-07-03 10:26:06 -04:00
Nick Mathewson
a4e8f94507 Merge branch 'maint-0.2.9' into maint-0.3.2 2018-07-03 09:48:03 -04:00
Nick Mathewson
4c094436c5 Merge branch 'maint-0.3.2' into maint-0.3.3 2018-07-03 09:48:03 -04:00
Nick Mathewson
d38e474950 Merge branch 'maint-0.3.3' into maint-0.3.4 2018-07-03 09:48:03 -04:00
Nick Mathewson
228d25ddf6 Merge branch 'maint-0.3.4' 2018-07-03 09:48:03 -04:00
Nick Mathewson
3baf3d01cb hs_ntor_ref.py: pass only strings to subprocess.Popen
Recent Python3 versions seem to require this on Windows.

Fixes bug 26535; bug copied from ntor_ref.py on 0.3.1.1-alpha.
2018-07-02 14:23:26 -04:00
Nick Mathewson
fc5f8b6931 ntor_ref.py: pass only strings to subprocess.Popen
Recent Python3 versions seem to require this on Windows.

Fixes bug 26535; bug introduced in f4be34f70d, which
was apparently intended itself as a Python3 workaround.
2018-07-02 14:18:41 -04:00
Nick Mathewson
bfcfeaed07 Merge branch 'mikeperry_bug26214-rebased_squashed' into maint-0.3.4 2018-07-02 13:22:07 -04:00
Nick Mathewson
6c440da926 Remove system headers from or.h 2018-07-01 15:20:37 -04:00
Nick Mathewson
986d761510 Extract or_state_t to its own header.
Fewer modules needed this than I had expected.
2018-07-01 15:20:37 -04:00
Nick Mathewson
49f88e77e5 Extract more constants from or.h 2018-07-01 15:20:37 -04:00
Nick Mathewson
f54a5cbfb6 Extract addr_policy_t into a new header. 2018-07-01 15:20:37 -04:00
Nick Mathewson
6da0311d2c Extract various enums and tiny structs from or.h
These all have a logical header to go in.
2018-07-01 15:20:37 -04:00
Nick Mathewson
1743dac078 Minimize headers that include crypto_formats and x25519 stuff 2018-07-01 15:20:37 -04:00
Nick Mathewson
500826479a Remove other needless includes include from or/*.h 2018-07-01 15:20:37 -04:00
Nick Mathewson
471104eaa5 Remove needless includes from or.h
or.h should really include only the minimum of stuff from or/*,
common/*, and lib/*.
2018-07-01 15:20:37 -04:00
Nick Mathewson
7a61a92870 Combine DH_BYTES and DH_KEY_LEN; put them in a lib/defs header. 2018-07-01 11:25:29 -04:00
Nick Mathewson
43dc92441d Tabify all of the .am files. 2018-07-01 09:37:28 -04:00
Nick Mathewson
ed84dab8b4 Merge branch 'maint-0.3.1' into maint-0.3.2 2018-06-29 13:49:43 -04:00
Nick Mathewson
36c372581f Merge branch 'maint-0.3.2' into maint-0.3.3 2018-06-29 13:49:43 -04:00
Nick Mathewson
75a6e7e256 Merge branch 'maint-0.3.3' into maint-0.3.4 2018-06-29 13:49:43 -04:00
Nick Mathewson
cd3f957219 Merge branch 'maint-0.3.4' 2018-06-29 13:49:43 -04:00
Nick Mathewson
a3ec89a4f8 Merge branch 'maint-0.2.9' into maint-0.3.1 2018-06-29 13:49:43 -04:00
Nick Mathewson
3c0a63c40f Fix a memory error in test_shared_random
Bug not in any released Tor.
2018-06-29 13:49:02 -04:00
Nick Mathewson
d583459d58 Fix some memory errors in the recent coverity fixes.
Found by asan on travis :/
2018-06-29 13:48:36 -04:00
Nick Mathewson
92b4996b23 Merge branch 'maint-0.3.2' into maint-0.3.3 2018-06-29 13:07:13 -04:00
Nick Mathewson
d3ecb3a8d6 Merge branch 'maint-0.3.3' into maint-0.3.4 2018-06-29 13:07:13 -04:00
Nick Mathewson
1f389dadd0 Merge branch 'maint-0.3.4' 2018-06-29 13:07:13 -04:00
Nick Mathewson
6e9d5fc4ec Merge remote-tracking branch 'ahf-github/maint-0.3.2' into maint-0.3.2 2018-06-29 13:07:07 -04:00
Nick Mathewson
7a47379f25 Merge branch 'maint-0.3.4' 2018-06-29 13:06:16 -04:00
Nick Mathewson
f82f8179e6 Merge branch 'maint-0.3.2' into maint-0.3.3 2018-06-29 13:06:15 -04:00
Nick Mathewson
f6b30a97a9 Merge branch 'maint-0.3.3' into maint-0.3.4 2018-06-29 13:06:15 -04:00
Nick Mathewson
68dfbd5ef4 Merge branch 'maint-0.3.1' into maint-0.3.2 2018-06-29 13:06:15 -04:00
Nick Mathewson
b89a66e997 Merge remote-tracking branch 'ahf-github/maint-0.3.0' into maint-0.3.1 2018-06-29 13:06:11 -04:00
Nick Mathewson
419077c26d Merge remote-tracking branch 'ahf-github/maint-0.3.1' into maint-0.3.1 2018-06-29 13:06:08 -04:00
Nick Mathewson
1a5be3c5e7 Merge branch 'maint-0.3.4' 2018-06-29 13:03:00 -04:00
Nick Mathewson
5ab23e03fa Merge branch 'maint-0.3.3' into maint-0.3.4 2018-06-29 13:02:56 -04:00
Nick Mathewson
df896ed632 Merge branch 'maint-0.3.2' into maint-0.3.3 2018-06-29 13:00:56 -04:00
Nick Mathewson
fe2588a5a8 Merge branch 'maint-0.3.1' into maint-0.3.2 2018-06-29 13:00:56 -04:00
Nick Mathewson
1385a5118d Merge branch 'maint-0.2.9' into maint-0.3.1 2018-06-29 13:00:56 -04:00
Nick Mathewson
6ac64e16ed Eliminate compat.h 2018-06-29 12:21:52 -04:00
Nick Mathewson
71e56c70e9 Remove windows libraries from util.h and compat.h 2018-06-29 12:21:52 -04:00
Nick Mathewson
31897a256c Extract socks5_status_t
I'm not sure of the best place to put this header long-term, since
both or/*.c and tools/tor-resolve.c use it.
2018-06-29 12:21:52 -04:00
Nick Mathewson
e0957022bd Extract get_uname to lib/osinfo. 2018-06-29 12:21:52 -04:00
Nick Mathewson
40199b180e Remove read_all and write_all
These had become wrappers around their fd and socket variants; there
were only a few users of the original functions still remaining.
2018-06-29 12:21:52 -04:00
Nick Mathewson
0362cdc169 Move fd and memory-info functions. 2018-06-29 12:21:52 -04:00
Nick Mathewson
935ba02565 Fix paths for buffers.h; automated. 2018-06-28 16:29:35 -04:00
Nick Mathewson
a742a826f6 Remove all include common/ uses in crypto_ops and tls. 2018-06-28 14:40:25 -04:00
Nick Mathewson
57f4b83852 Fix up the include path of compat_time.h (automated) 2018-06-28 13:01:54 -04:00
Nick Mathewson
a097ddb4f5 Extract time functionality into lib/wallclock and lib/time 2018-06-28 13:01:54 -04:00
Nick Mathewson
bdea94a665 Move floating-point math functions into a new lib/math 2018-06-28 12:24:45 -04:00
Nick Mathewson
6178a9f758 Move compute_num_cpus to lib/thread 2018-06-28 12:08:18 -04:00
Nick Mathewson
db1a420c4e Move tor_gethostname to lib/net 2018-06-28 11:57:01 -04:00
Nick Mathewson
8c6ff9fec2 Move tor_escape_str_for_pt_args into or/transports.c 2018-06-28 11:49:27 -04:00
Nick Mathewson
30166261bb Move string_is_key_value to lib/encoding 2018-06-28 11:46:32 -04:00
Nick Mathewson
48ebd9bf76 Move weakrng into lib/intmath 2018-06-28 11:39:49 -04:00
Nick Mathewson
315e6b59dd Extract process-management functionality into a new lib/process
Note that procmon does *not* go here, since procmon needs to
integrate with the event loop.
2018-06-28 11:18:13 -04:00
Nick Mathewson
ec4eee6356 Fix the include paths for storagedir,conffile (automated) 2018-06-28 09:42:33 -04:00
Nick Mathewson
38fd3e0df0 Fix up the modules that include memarea.h (automated) 2018-06-28 09:25:58 -04:00
Nick Mathewson
9cf335c9a5 Extract threading code into a new library.
Note that the workqueue code does *not* go here: it is logically at
a higher level, since it needs to use libevent and the networking
stack.
2018-06-28 09:14:42 -04:00
Nick Mathewson
544ab27a94 Extract the alert-socket code into lib/net.
This code was in compat_threads, since it was _used_ for efficiently
notifying the main libevent thread from another thread.  But in
spite of its usage, it's fundamentally a part of the network code.
2018-06-28 08:49:07 -04:00
Nick Mathewson
696f6f1569 Split confline into confline and conffile.
The "conffile" module knows about includes and filesystem access,
whereas confline doesn't.  This will make it possible to put these
functions into libraries without introducing a cycle.
2018-06-27 16:59:56 -04:00
Nick Mathewson
235ddb15a0 Move util_format into a new libtor-encoding library
libtor-encoding is about various ways to transform data to and from
character sequences.
2018-06-27 16:18:42 -04:00
Nick Mathewson
2113603718 Merge branch 'sandbox_refactor' 2018-06-27 14:45:14 -04:00
Nick Mathewson
b9b05e437d Merge branch 'net_refactor' 2018-06-27 12:52:31 -04:00
Nick Mathewson
55b7939367 Fix up include paths for sandbox.h (automated) 2018-06-27 10:04:41 -04:00
Nick Mathewson
0742b38725 Revert "Use the "commands" argument of AC_CONFIG_FILES to make scripts +x"
This reverts commit 56c1fbf33f.
2018-06-27 09:53:46 -04:00
Nick Mathewson
d893be190f rectify include paths (automatic) for address.h 2018-06-27 09:13:04 -04:00
Nick Mathewson
3930416dec Link GetAdaptersAddresses, rather than loading it on-demand.
This function has been present since Windows XP.
2018-06-27 09:12:57 -04:00
Nick Mathewson
42b3caa6ad Move network code to libtor-net.
There are some additional changes to come: those points are marked
by XXXX.
2018-06-27 09:08:35 -04:00
Nick Mathewson
80730c45e0 Move tor_parse_long and friends into parse_int.h in libtor-string 2018-06-26 21:02:29 -04:00
Nick Mathewson
5f41bc91c6 Merge branch 'ticket26439' 2018-06-26 17:02:06 -04:00
Nick Mathewson
ebbb0348dc Finish renaming digestset_contains to digestset_probably_contains
Since bloom filters are probabilistic, it's nice to make it clear
that the "contains" operation can have false positives.
2018-06-26 13:27:50 -04:00
Nick Mathewson
bf89278c79 Refactor bloom filter logic not to be digest-specific.
Now the address-set code and the digest-set code share the same
backend.

Closes ticket 26510
2018-06-26 13:27:23 -04:00
Nick Mathewson
92d8284a97 Merge branch 'log_dependencies' 2018-06-26 11:27:33 -04:00
Nick Mathewson
b059c38d8a Merge branch 'maint-0.3.4' 2018-06-25 13:50:37 -04:00
Nick Mathewson
d85fbc9a58 Add some casts to get test_dir.c compiling on windows.
Fixed bug 26479.  Bug introduced by 0a6f4627a4292e4; bug not in any
released version.
2018-06-24 14:06:39 -04:00
Nick Mathewson
3cc0a145bd Fix test_geoip failures on windows by writing file in binary mode.
Fixes bug 26480; bug appeared when we re-enabled the geoip tests on
windows.  Bug originally introduced by our fix to 25787; bug not in
any released Tor.
2018-06-24 14:06:05 -04:00
Alexander Færøy
8ec6b36dca Fix memory leak in test_sr_setup_commits().
This patch fixes a memory leak in test_sr_setup_commits() where the
place_holder is allocated, but never freed again.

See: Coverity CID 1437440.
2018-06-23 13:11:03 +02:00
Alexander Færøy
a2e623f631 Fix memory leak in helper_add_hsdir_to_networkstatus().
This patch fixes a memory leak in helper_add_hsdir_to_networkstatus()
where the rs object might not get properly freed.

See: Coverity CID 1437427.
2018-06-23 13:07:56 +02:00
Alexander Færøy
8e805bf0f6 Fix memory leak in new_establish_intro_cell().
This patch fixes a memory leak in new_establish_intro_cell() that could
happen if a test assertion fails and the *cell_out value isn't properly
free'd.

See: Coverity CID 1437445
2018-06-23 13:07:56 +02:00
Alexander Færøy
8550016e6f Fix memory leak in test_channelpadding_consensus().
The relay variable is always allocated, but might not be freed before we
return from this function.

See: Coverity CID 1437431
2018-06-23 12:52:04 +02:00
Alexander Færøy
c997d49ad6 Fix memory link in test_link_specifier().
This patch fixes a memory leak in test_link_specifier() where ls might
not get freed in case one of the test macros fails.

See: Coverity CID 1437434.
2018-06-23 12:39:20 +02:00
Alexander Færøy
dc2384da30 Fix potential memory leak in hs_helper_build_hs_desc_impl().
This patch fixes a memory leak in hs_helper_build_hs_desc_impl() where
if a test assertion would fail we would leak the storage that `desc`
points to.

See: Coverity CID 1437448
2018-06-23 10:27:10 +02:00
Alexander Færøy
1724f995c7 Fix potential memory leak in test_hs_auth_cookies().
This patch fixes a potential memory leak in test_hs_auth_cookies() if a
test-case fails and we goto the done label where no memory clean up is
done.

See: Coverity CID 1437453
2018-06-23 03:17:09 +02:00
Alexander Færøy
8c8941eb29 Fix potential memory leak in hs_helper_build_intro_point().
This patch fixes a potential memory leak in
hs_helper_build_intro_point() where a `goto done` is called before the
`intro_point` variable have been assigned to the value of the `ip`
variable.

See: Coverity CID 1437460
See: Coverity CID 1437456
2018-06-23 02:29:54 +02:00
Nick Mathewson
79f73ab330 Finally extract the log library and make it build.
This patch:
  - introduces an fdio module for low-level fd functions that don't
    need to log.
  - moves the responsibility for opening files outside of torlog.c,
    so it won't need to call tor_open_cloexec.
2018-06-22 11:40:20 -04:00
Nick Mathewson
da4ae8a6b6 Automated fixup of include paths after torlog.h movement. 2018-06-22 10:32:10 -04:00
Nick Mathewson
c2a558a346 Expunge container.h 2018-06-22 09:49:13 -04:00
Nick Mathewson
50a5954003 Remove bloom filters, order statistics, and bitarrays from container.h 2018-06-22 09:49:13 -04:00
Nick Mathewson
b8be8265b6 Rectify include paths after container split (automatic) 2018-06-22 09:49:13 -04:00
Taylor Yu
d935aceb2b Use correct CARGO_HOME in test_rust.sh
Out-of-tree builds could fail to run the rust tests if built in
offline mode.  cargo expects CARGO_HOME to point to the .cargo
directory, not the directory containing .cargo.

Fixes bug 26455; bug not in any released tor.
2018-06-21 18:20:03 -05:00
Nick Mathewson
e066966bf4 Extract tor_malloc and friends to a new module. 2018-06-21 15:20:01 -04:00
Nick Mathewson
56c1fbf33f Use the "commands" argument of AC_CONFIG_FILES to make scripts +x
Closes ticket 26439.
2018-06-21 14:26:47 -04:00
Nick Mathewson
3305ae5044 Rectify include paths (automated).
You have no idea how glad I am that this is automated.
2018-06-21 13:20:07 -04:00
Nick Mathewson
accf239fa3 Rectify include paths (automated) 2018-06-21 13:19:00 -04:00
Nick Mathewson
d2f4a716e8 Remove unused pubsub module. 2018-06-21 13:14:14 -04:00
Nick Mathewson
b420da4cf8 Rectify include paths (automated) 2018-06-21 13:14:14 -04:00
Nick Mathewson
275aff6917 Rectify include paths (automated) 2018-06-21 10:47:11 -04:00
Nick Mathewson
b2346b1201 Refactor makefiles to keep list of internal libraries in one place.
This change makes it possible for us to change the list of libraries
more easily, without changing every single linker line.
2018-06-21 10:35:30 -04:00
Nick Mathewson
2ad062ee60 Merge branch 'mikeperry_bug26214-rebased_squashed' 2018-06-21 09:20:03 -04:00
Mike Perry
46b06cd699 Bug 26214: Test updates. 2018-06-21 09:18:51 -04:00
Nick Mathewson
c42071f750 Merge branch 'maint-0.3.4' 2018-06-21 08:59:58 -04:00
Nick Mathewson
e845bd17f8 Merge branch 'bug25787_squashed' into maint-0.3.4 2018-06-21 08:56:27 -04:00
Nick Mathewson
cacf326e78 Revise geoip tests to not require paths of actual geoip config
When I wrote the first one of these, it needed the path of the geoip
file.  But that doesn't translate well in at least two cases:

   - Mingw, where the compile-time path is /c/foo/bar and the
     run-time path is c:\foo\bar.

   - Various CI weirdnesses, where we cross-compile a test binary,
     then copy it into limbo and expect it to work.

Together, these problems precluded these tests running on windows.

So, instead let's just generate some minimal files ourselves, and
test against them.

Fixes bug 25787
2018-06-21 08:56:20 -04:00
Nick Mathewson
27e456cd72 Merge remote-tracking branch 'rl1987/ticket19979_2' 2018-06-21 08:53:48 -04:00
Nick Mathewson
72a5ae8c66 Merge branch 'maint-0.3.4' 2018-06-21 08:38:21 -04:00
Nick Mathewson
d110f9c9a6 Add a leak suppression for backtrace_alloc
This appears to be an internal rust thing: I don't know why it's
leaking.  We should investigate further.
2018-06-20 18:02:49 -04:00
Nick Mathewson
e99ecf9399 Merge branch 'rust_build_script_v3' into additional_rust_test_fixes 2018-06-20 17:07:47 -04:00
Nick Mathewson
398f15bdf1 Merge branch 'maint-0.3.4' 2018-06-20 16:37:39 -04:00
Isis Lovecruft
7589fd6d40 rust: Remove --all-features flag from cargo test call in test_rust.sh.
We'd like to feature gate code that calls C from Rust, as a workaround
to several linker issues when running `cargo test` (#25386), and we
can't feature gate anything out of test code if `cargo test` is called
with `--all-features`.

 * FIXES #26400: https://bugs.torproject.org/26400
2018-06-20 16:37:33 -04:00
Nick Mathewson
5ecd1fec15 Move horrible-emergency handling into torerr.[ch]
Previously we had code like this for bad things happening from
signal handlers, but it makes sense to use the same logic to handle
cases when something is happening at a level too low for log.c to be
involved.

My raw_assert*() stuff now uses this code.
2018-06-20 15:08:06 -04:00
Nick Mathewson
9fa73003fc Remove dmalloc support; closes #26426
Dmalloc hasn't seen a release in over a decade, and there are much
better tools to use these days.
2018-06-20 10:21:34 -04:00
Nick Mathewson
0dab29ce10 Run rectify_include_paths.py 2018-06-20 09:35:05 -04:00
Nick Mathewson
257b280776 Simplify AM_CPPFLAGS include setup
We had accumulated a bunch of cruft here.  Now let's only include
src and src/ext.  (exception: src/trunnel is autogenerated code, and
need to include src/trunnel.)

This commit will break the build hard.  The next commit will fix it.
2018-06-20 09:27:04 -04:00
Nick Mathewson
e9c93a3415 Merge branch 'maint-0.3.4' 2018-06-20 08:29:52 -04:00
Nick Mathewson
0a6f4627a4 eol@eof in test-dir.c 2018-06-20 08:29:38 -04:00
Nick Mathewson
fb0019daf9 Update copyrights to 2018. 2018-06-20 08:13:28 -04:00
Nick Mathewson
5acbcf150e Merge branch 'maint-0.3.4' 2018-06-20 07:53:22 -04:00
rl1987
9054ccb36b Enable DEBUG_SMARTLIST in unit tests 2018-06-20 07:49:41 -04:00
rl1987
7bb3777dfb Refrain from accessing empty smartlist in test_bridges_clear_bridge_list
Just check that smartlist length is zero instead
2018-06-20 07:49:41 -04:00
rl1987
5af29fbb63 When possible, use RFC5869 HKDF implementation from OpenSSL
Also, stop supporting empty HKDF input key material
2018-06-19 19:26:31 +03:00
Nick Mathewson
bd9ebb3763 Use a rust build script to set linker options correctly for tests.
We need this trick because some of our Rust tests depend on our C
code, which in turn depend on other native libraries, which thereby
pulls a whole mess of our build system into "cargo test".

To solve this, we add a build script (build.rs) to set most of the
options that we want based on the contents of config.rust.  Some
options can't be set, and need to go to the linker directly: we use
a linker replacement (link_rust.sh) for these.  Both config.rust and
link_rust.sh are generated by autoconf for us.

This patch on its own should enough to make the crypto test build,
but not necessarily enough to make it pass.
2018-06-19 12:01:13 -04:00
Nick Mathewson
5879909826 Revert "Remove duplicate MODULE_DIRAUTH_SOURCES from libtor_testing.a"
This reverts commit 70d91bd059.
2018-06-18 17:06:18 -04:00
Nick Mathewson
70d91bd059 Remove duplicate MODULE_DIRAUTH_SOURCES from libtor_testing.a
This was already added to LIBTOR_A_SOURCES; it doesn't need to get
added again.

Fixes bug 26402. Bugfix on 0.3.4.1-alpha.
2018-06-18 17:03:52 -04:00
David Goulet
a8e76f3824 test: Add missing headers in test_controller.c
After the big or.h refactoring, one single unit test file was missing two
headers for node_t and microdesc_t.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-06-18 15:07:30 -04:00
Nick Mathewson
104c2e9e7e Merge branch 'split_or_h' 2018-06-18 14:18:34 -04:00
Nick Mathewson
5746e210b8 Merge remote-tracking branch 'rl1987/feature8323_squashed2' 2018-06-17 20:20:15 -04:00
Nick Mathewson
987174cc6f Merge remote-tracking branch 'github/bug26152_035' 2018-06-17 19:28:59 -04:00
Nick Mathewson
8184f45ad9 Merge branch 'maint-0.3.3' into maint-0.3.4 2018-06-16 13:10:19 -04:00
Nick Mathewson
ccf1eb3164 Fix a bug in my fix for #26258
The fix here is use a different bourne shell subsitution for
CARGO_ONLINE, so that an empty string counts as set.
2018-06-16 13:08:40 -04:00
Nick Mathewson
3191ba389d Move extend_info_t into its own header. 2018-06-15 15:37:05 -04:00
Nick Mathewson
fde868ffe3 Extract cell type and their queues into new headers
Since packed_cell and destroy_cell exist only to be queued, they go
in the same headers as the queues.
2018-06-15 15:27:46 -04:00
Nick Mathewson
f85d731e3a Extract download_status_t into its own header. 2018-06-15 14:58:43 -04:00
Nick Mathewson
ed0731c7de Extract routerinfo_t into its own header.
I was expecting this to be much worse.
2018-06-15 14:49:46 -04:00
Nick Mathewson
9d6276bca8 Extract microdesc_t into its own header. 2018-06-15 14:38:30 -04:00
Nick Mathewson
def1f20e1f Extract routerstatus_t into its own header. 2018-06-15 14:33:03 -04:00
Nick Mathewson
00f1d1653e Extract extrainfo_t into its own header 2018-06-15 14:21:25 -04:00
Nick Mathewson
1e4e9db815 Extract authority_cert_t into its own header 2018-06-15 14:14:11 -04:00
Nick Mathewson
b8ae4111e3 Extract desc_store_t and routerlist_t into their own headers. 2018-06-15 14:07:17 -04:00
Nick Mathewson
62315dab84 Extract ns_detached_signatures_st into its own header. 2018-06-15 13:49:30 -04:00
Nick Mathewson
50369f8981 Extract networkstatus_t and ..sr_info_t into their own headers 2018-06-15 13:45:15 -04:00
Nick Mathewson
89aefb0319 Extract networkstatus_vote_info_t into its own header. 2018-06-15 13:31:47 -04:00
Nick Mathewson
80c9e1e585 Move document_signature_t into its own header. 2018-06-15 13:27:11 -04:00
Nick Mathewson
72d2fd83d8 Split vote_{microdesc_hash,routerstatus}_t into their own headers 2018-06-15 13:23:02 -04:00
Nick Mathewson
d2942d127d Extract node_t into its own header. 2018-06-15 13:13:33 -04:00
Nick Mathewson
8b7df72359 Split socks_request_t into its own header. 2018-06-15 13:01:50 -04:00
Nick Mathewson
c9e4ebf96a Move fp_pair_t declaration to fp_pair.h. 2018-06-15 12:52:22 -04:00
Nick Mathewson
5cdc234330 Split rend_authorized_client_t and encoded_.._t into their own headers 2018-06-15 12:36:59 -04:00
Nick Mathewson
990184da49 Extract rend_intro_point_t into its own header. 2018-06-15 12:23:06 -04:00
Nick Mathewson
22e9c64738 Extract rend_service_descriptor_t into its own header. 2018-06-15 12:18:17 -04:00
Nick Mathewson
7d2d131afa Extract tor_version_t into its own header. 2018-06-15 12:12:15 -04:00
Nick Mathewson
d51de77311 Extract cpath_build_state into its own header.
More modules use this than I had expected!
2018-06-15 12:07:20 -04:00
Nick Mathewson
b3f2c682b7 Extract crypt_path_t and relay_crypto_t into their own headers 2018-06-15 11:52:32 -04:00
Nick Mathewson
a0bc164af5 Extract {or,origin}_circuit_t into their own headers 2018-06-15 11:34:33 -04:00
Nick Mathewson
bba998af65 Extract connection_t into its own header.
Now the entire connection_t hierarchy is extracted from or.h
2018-06-15 11:05:56 -04:00
Nick Mathewson
bcc283bcc9 Split or_handshake_{certs,state}_t into their own headers. 2018-06-15 10:56:15 -04:00
Nick Mathewson
19c34b4658 Move or_connection_t to its own header. 2018-06-15 10:48:50 -04:00
Nick Mathewson
1416f54d1e Split dir_connection_t into its own header 2018-06-15 10:31:21 -04:00
Nick Mathewson
3b917b2408 Split control_connection_t into its own header.
This one was actually fairly simple.
2018-06-15 10:17:27 -04:00
Nick Mathewson
5d5c442e6a Split entry and edge_connection_t into their own headers. 2018-06-15 10:10:24 -04:00
Nick Mathewson
2a574d11ac Move dir_server_t into its own header. 2018-06-14 16:58:01 -04:00
Nick Mathewson
df9a3fe86f Make server_port_cfg_t and port_cfg_t into separate headers. 2018-06-14 16:48:15 -04:00
Nick Mathewson
945d871da5 Merge branch 'maint-0.3.3' 2018-06-14 12:50:26 -04:00
Nick Mathewson
ee860b8f37 squash! Make sure that the test_rust.sh script fails when a test fails
Also make sure that we're actually running the test from within the right
cwd, like we do when we're building.  This seems necessary to avoid
an error when running offline.

Amusingly, it appears that we had this bug before: we just weren't
noticing it, because of bug 26258.
2018-06-13 12:21:25 -04:00
Nick Mathewson
ce692332b8 test_entrynodes: fix a GCC warning
Some versions of GCC complain that the bfn_mock_node_get_by_id
function might return NULL, but we're assuming that it won't.
(We're assuming it won't return NULL because we know in the tests
that we're passing it valid IDs.)

To make GCC happy, tt_assert() that each node_t is set before using
it.

Fixes a second case of bug26269; bugfix on 0.3.0.1-alpha.
2018-06-13 10:45:15 -04:00
Nick Mathewson
ed7b135812 Merge remote-tracking branch 'asn-github/bug26358' 2018-06-13 10:00:37 -04:00
Nick Mathewson
8c8ed91aae Merge remote-tracking branch 'rl1987/bug24891' 2018-06-13 09:46:50 -04:00
George Kadianakis
99974d4c1e Silence warning of relaycell/circbw tst.
Shouldn't send RELAY_COMMAND_DATA cell with 0 stream id.
2018-06-13 14:14:17 +03:00
rl1987
25341245ae Implement GETINFO md/all 2018-06-08 13:25:25 +03:00
rl1987
b7fae0f48c Heed --disable-unittests properly 2018-06-02 12:53:04 +03:00
Mike Perry
93ee227e18 Bug 26259: Don't count 0-length RELAY_COMMAND_DATA in CIRC_BW OVERHEAD
This cell should be treated as invalid for purposes of CIRC_BW.
2018-06-01 00:23:08 +00:00
Nick Mathewson
9d06c41c6e Make sure that the test_rust.sh script fails when a test fails
Exit codes from find(1) seem not to be so reliable as we had hoped.

Closes ticket 26258; bugfix on 0.3.3.4-alpha when we fixed #25560
2018-05-31 17:15:57 -07:00
Nick Mathewson
d7bbfd0f62 Fix various typos 2018-05-30 07:57:22 -07:00
Nick Mathewson
fa1890e97f Merge remote-tracking branch 'public/bug25691_033_again_squashed' into maint-0.3.3 2018-05-27 10:03:11 -04:00
Nick Mathewson
3f3739c6e0 Merge branch 'maint-0.3.1' into maint-0.3.2 2018-05-24 09:40:06 -04:00
Nick Mathewson
f48fb8a720 Merge branch 'maint-0.2.9' into maint-0.3.1 2018-05-24 09:40:06 -04:00
Nick Mathewson
f42739e746 Merge branch 'maint-0.3.3' 2018-05-24 09:40:06 -04:00
Nick Mathewson
0ef432d457 Merge branch 'maint-0.3.2' into maint-0.3.3 2018-05-24 09:40:06 -04:00
Nick Mathewson
aeb4be1d5a Add a unit test for PEM-encrypted documents. 2018-05-24 09:36:33 -04:00
Nick Mathewson
cde5c9d0c3 Merge branch 'maint-0.3.3' 2018-05-22 13:35:33 -04:00