Nick Mathewson
ef9a0d2048
Add script to detect and remove unCish malloc-then-cast pattern
...
Also, apply it.
2014-09-16 10:57:00 -04:00
Nick Mathewson
ea72b4f60a
clean up eol whitespace from coccinelle-generated patches
2014-09-16 09:40:38 -04:00
Nick Mathewson
a6627fdb80
Remove the legacy_test_helper and legacy_setup wrappers
...
These wrappers went into place when the default type for our unit
test functions changed from "void fn(void)" to "void fn(void *arg)".
To generate this patch, I did the same hokey-pokey as before with
replacing all operators used as macro arguments, then I ran a
coccinelle script, then I ran perl script to fix up everything that
used legacy_test_helper, then I manually removed the
legacy_test_helper functions, then I ran a final perl script to put
the operators back how they were.
==============================
#!/usr/bin/perl -w -i -p
s/==,/_X_EQ_,/g;
s/!=,/_X_NE_,/g;
s/<,/_X_LT_,/g;
s/>,/_X_GT_,/g;
s/>=,/_X_GEQ_,/g;
s/<=,/_X_LEQ_,/g;
--------------------
@@
identifier func =~ "test_.*$";
statement S, S2;
@@
static void func (
-void
+void *arg
)
{
... when != S2
+(void) arg;
S
...
}
--------------------
#!/usr/bin/perl -w -i -p
s/, *legacy_test_helper, *([^,]+), *\&legacy_setup, *([^\}]+) *}/, $2, $1, NULL, NULL }/g;
--------------------
#!/usr/bin/perl -w -i -p
s/_X_NEQ_/!=/g;
s/_X_NE_/!=/g;
s/_X_EQ_/==/g;
s/_X_GT_/>/g;
s/_X_LT_/</g;
s/_X_GEQ_/>=/g;
s/_X_LEQ_/<=/g;
--------------------
2014-09-16 09:30:22 -04:00
Nick Mathewson
d684657548
Replace all uses of test_{str,}eq
2014-09-15 21:36:23 -04:00
Nick Mathewson
34bf9b3690
Replace the remaining test_assert instances
2014-09-15 21:29:48 -04:00
Nick Mathewson
0e0cef1d60
remove two unused test_* macros
2014-09-15 21:28:26 -04:00
Nick Mathewson
0d654d2355
Replace remaining uses of deprecated test_mem* functions
2014-09-15 21:27:23 -04:00
Nick Mathewson
1146a6a1c5
Replace the remaining test_n?eq_ptr calls
2014-09-15 21:25:27 -04:00
Nick Mathewson
5253ba3184
Make not even macros use test_fail_msg.
2014-09-15 21:22:36 -04:00
Nick Mathewson
0243895792
Use coccinelle scripts to clean up our unit tests
...
This should get rid of most of the users of the old test_*
functions. Some are in macros and will need manual cleanup, though.
This patch is for 13119, and was automatically generated with these
scripts. The perl scripts are there because coccinelle hates
operators as macro arguments.
------------------------------
s/==,/_X_EQ_,/g;
s/!=,/_X_NE_,/g;
s/<,/_X_LT_,/g;
s/>,/_X_GT_,/g;
s/>=,/_X_GEQ_,/g;
s/<=,/_X_LEQ_,/g;
------------------------------
@@
expression a;
identifier func;
@@
func (...) {
<...
-test_fail_msg
+TT_DIE
(
+(
a
+)
)
...>
}
@@
identifier func;
@@
func (...) {
<...
-test_fail()
+TT_DIE(("Assertion failed."))
...>
}
@@
expression a;
identifier func;
@@
func (...) {
<...
-test_assert
+tt_assert
(a)
...>
}
@@
expression a, b;
identifier func;
@@
func (...) {
<...
-test_eq
+tt_int_op
(a,
+_X_EQ_,
b)
...>
}
@@
expression a, b;
identifier func;
@@
func (...) {
<...
-test_neq
+tt_int_op
(a,
+_X_NEQ_,
b)
...>
}
@@
expression a, b;
identifier func;
@@
func (...) {
<...
-test_streq
+tt_str_op
(a,
+_X_EQ_,
b)
...>
}
@@
expression a, b;
identifier func;
@@
func (...) {
<...
-test_strneq
+tt_str_op
(a,
+_X_NEQ_,
b)
...>
}
@@
expression a, b;
identifier func;
@@
func (...) {
<...
-test_eq_ptr
+tt_ptr_op
(a,
+_X_EQ_,
b)
...>
}
@@
expression a, b;
identifier func;
@@
func() {
<...
-test_neq_ptr
+tt_ptr_op
(a,
+_X_NEQ_,
b)
...>
}
@@
expression a, b, len;
identifier func;
@@
func (...) {
<...
-test_memeq
+tt_mem_op
(a,
+_X_EQ_,
b, len)
...>
}
@@
expression a, b, len;
identifier func;
@@
func (...) {
<...
-test_memneq
+tt_mem_op
(a,
+_X_NEQ_,
b, len)
...>
}
------------------------------
@@
char a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a == b
+a, _X_EQ_, b
)
...>
}
@@
int a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a == b
+a, _X_EQ_, b
)
...>
}
@@
long a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a == b
+a, _X_EQ_, b
)
...>
}
@@
unsigned int a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_uint_op
(
-a == b
+a, _X_EQ_, b
)
...>
}
@@
unsigned long a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_uint_op
(
-a == b
+a, _X_EQ_, b
)
...>
}
@@
char a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a != b
+a, _X_NEQ_, b
)
...>
}
@@
int a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a != b
+a, _X_NEQ_, b
)
...>
}
@@
long a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a != b
+a, _X_NEQ_, b
)
...>
}
@@
unsigned int a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_uint_op
(
-a != b
+a, _X_NEQ_, b
)
...>
}
@@
unsigned long a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_uint_op
(
-a != b
+a, _X_NEQ_, b
)
...>
}
@@
char a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a >= b
+a, _X_GEQ_, b
)
...>
}
@@
int a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a >= b
+a, _X_GEQ_, b
)
...>
}
@@
long a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a >= b
+a, _X_GEQ_, b
)
...>
}
@@
unsigned int a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_uint_op
(
-a >= b
+a, _X_GEQ_, b
)
...>
}
@@
unsigned long a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_uint_op
(
-a >= b
+a, _X_GEQ_, b
)
...>
}
@@
char a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a <= b
+a, _X_LEQ_, b
)
...>
}
@@
int a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a <= b
+a, _X_LEQ_, b
)
...>
}
@@
long a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a <= b
+a, _X_LEQ_, b
)
...>
}
@@
unsigned int a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_uint_op
(
-a <= b
+a, _X_LEQ_, b
)
...>
}
@@
unsigned long a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_uint_op
(
-a <= b
+a, _X_LEQ_, b
)
...>
}
@@
char a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a > b
+a, _X_GT_, b
)
...>
}
@@
int a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a > b
+a, _X_GT_, b
)
...>
}
@@
long a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a > b
+a, _X_GT_, b
)
...>
}
@@
unsigned int a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_uint_op
(
-a > b
+a, _X_GT_, b
)
...>
}
@@
unsigned long a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_uint_op
(
-a > b
+a, _X_GT_, b
)
...>
}
@@
char a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a < b
+a, _X_LT_, b
)
...>
}
@@
int a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a < b
+a, _X_LT_, b
)
...>
}
@@
long a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_int_op
(
-a < b
+a, _X_LT_, b
)
...>
}
@@
unsigned int a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_uint_op
(
-a < b
+a, _X_LT_, b
)
...>
}
@@
unsigned long a, b;
identifier func;
@@
func (...) {
<...
-tt_assert
+tt_uint_op
(
-a < b
+a, _X_LT_, b
)
...>
}
------------------------------
s/_X_NEQ_/!=/g;
s/_X_NE_/!=/g;
s/_X_EQ_/==/g;
s/_X_GT_/>/g;
s/_X_LT_/</g;
s/_X_GEQ_/>=/g;
s/_X_LEQ_/<=/g;
s/test_mem_op\(/tt_mem_op\(/g;
2014-09-15 21:18:21 -04:00
Nick Mathewson
0bd220adcb
Don't pass invalid memory regions to digestmap_set/get in test_routerlist
...
Fixes bug in c887e20e6a5a2c17c65; bug in no released Tor version.
2014-09-15 14:04:19 -04:00
Nick Mathewson
1dc0d26b50
Clean up a clangalyzer warning in directory_remove_invalid
...
"At this point in the code, msg has been set to a string
constant. But the tor code checks that msg is not NULL, and the
redundant NULL check confuses the analyser[...] To avoid this
spurious warning, the patch initialises msg to NULL."
Patch from teor. another part of 13157.
2014-09-15 13:52:56 -04:00
Nick Mathewson
53a94c4b4b
Clear up another clangalyzer issue
...
"The NULL pointer warnings on the return value of
tor_addr_to_in6_addr32() are incorrect. But clang can't work this
out itself due to limited analysis depth. To teach the analyser that
the return value is safe to dereference, I applied tor_assert to the
return value."
Patch from teor. Part of 13157.
2014-09-15 13:52:13 -04:00
Roger Dingledine
d6b2a1709d
fix typo in comment
2014-09-13 17:10:04 -04:00
Nick Mathewson
550c03336c
Bump maint-0.2.5 to 0.2.5.7-rc-dev
2014-09-11 21:38:32 -04:00
Nick Mathewson
89e32c7c08
One more whitespace fix
2014-09-11 14:40:24 -04:00
Nick Mathewson
32f75c870e
Whitespace cleanups in test_util
2014-09-11 14:37:12 -04:00
Nick Mathewson
6d66e9068b
Whitespace cleanups in transports/test_pt
2014-09-11 14:36:51 -04:00
Nick Mathewson
43a47ae726
Use tor_malloc_zero() in pt tests
...
Fixes for PT tests merged with 8402; patch from Yawning.
2014-09-11 09:17:13 -04:00
Nick Mathewson
2914d56ea4
Merge remote-tracking branch 'origin/maint-0.2.5'
2014-09-11 08:59:24 -04:00
Nick Mathewson
121f4a9ca4
Merge remote-tracking branch 'public/bug13104_025'
2014-09-11 08:30:41 -04:00
Nick Mathewson
d02937a203
Fix "comparison is always false" warnings in new test_util_di_ops
...
Having a constant zero means that unsigned < 0 is always false.
2014-09-11 08:28:46 -04:00
Roger Dingledine
6215ebb266
Reduce log severity for unused ClientTransportPlugin lines
...
Tor Browser includes several ClientTransportPlugin lines in its
torrc-defaults file, leading every Tor Browser user who looks at her
logs to see these notices and wonder if they're dangerous.
Resolves bug 13124; bugfix on 0.2.5.3-alpha.
2014-09-11 08:02:37 -04:00
Nick Mathewson
48558ed1aa
Merge remote-tracking branch 'public/bug13104_025'
2014-09-11 00:11:26 -04:00
Nick Mathewson
2491eadf00
C90 compliance for #13104 fixes
2014-09-11 00:10:53 -04:00
Nick Mathewson
284cc9a224
Avoid an overflow on negation in format_helper_exit_status
...
Part of 13104; patch from teor.
2014-09-11 00:00:13 -04:00
Nick Mathewson
59f9a5c786
Avoid divide by zero and NaNs in scale_array_elements_to_u64
...
Patch from teor; part of 13104
2014-09-10 23:59:21 -04:00
Nick Mathewson
5126bc2ebd
Extra tests for tor_memeq and memcmp
...
(Patch from teor; part of 13104)
2014-09-10 23:58:02 -04:00
Nick Mathewson
d2463c0cfe
Avoid overflows and underflows in sscanf and friends
...
(Patch from teor on 13104)
2014-09-10 23:57:31 -04:00
Nick Mathewson
73ee161d8a
Merge remote-tracking branch 'origin/maint-0.2.5'
2014-09-10 23:48:59 -04:00
Nick Mathewson
3c2c6a6116
In routerlist_assert_ok(), check r2 before taking &(r2->cache_info)
...
Technically, we're not allowed to take the address of a member can't
exist relative to the null pointer. That makes me wonder how any sane
compliant system implements the offsetof macro, but let's let sleeping
balrogs lie.
Fixes 13096; patch on 0.1.1.9-alpha; patch from "teor", who was using
clang -fsanitize=undefined-trap -fsanitize-undefined-trap-on-error -ftrapv
2014-09-10 23:48:11 -04:00
Nick Mathewson
e07206afea
Merge remote-tracking branch 'yawning/bug_8402'
2014-09-10 23:41:55 -04:00
Nick Mathewson
5474d8ae05
Merge remote-tracking branch 'public/torrc_minimal'
2014-09-10 23:36:27 -04:00
Nick Mathewson
a9b2e5eac6
Merge remote-tracking branch 'public/bug12908_025' into maint-0.2.5
2014-09-10 22:12:47 -04:00
Nick Mathewson
916d53d6ce
Mark StrictE{ntry,xit}Nodes as obsolete.
2014-09-10 07:10:10 -04:00
Yawning Angel
cae44838fe
Fix issues brought up in nickm's review.
...
* Update pt_get_proxy_uri() documentation.
* proxy_supported is now unsigned.
* Added a changes file.
2014-09-09 18:21:19 +00:00
George Kadianakis
01800ea1e4
Add unittests for finding the third quartile of a set.
2014-09-09 12:28:15 -04:00
Nick Mathewson
8e39395199
Merge remote-tracking branch 'asn/bug13064'
2014-09-09 12:26:16 -04:00
Nick Mathewson
40b7dfaed2
Remove now-pointless SIZE_MAX stanza from OpenBSD_malloc_linux
2014-09-09 12:09:18 -04:00
Nick Mathewson
1eea7a68ed
Use S?SIZE_MAX, not S?SIZE_T_MAX
...
This fixes bug 13102 (not on any released Tor) where using the
standard SSIZE_MAX name broke mingw64, and we didn't realize.
I did this with
perl -i -pe 's/SIZE_T_MAX/SIZE_MAX/' src/*/*.[ch] src/*/*/*.[ch]
2014-09-09 12:08:03 -04:00
Sebastian Hahn
409a56281e
Remove client-side bad directory logic
...
Implements the second half of #13060 .
2014-09-09 11:54:20 -04:00
Sebastian Hahn
8099dee992
Remove dirauth support for the BadDirectory flag
...
Implements the first half of #13060 . The second half will be to remove
client support, too.
2014-09-09 11:54:15 -04:00
Nick Mathewson
59f3cce0dc
Merge branch 'bug12899_squashed'
2014-09-09 11:51:18 -04:00
Sebastian Hahn
607724c696
Remove support for naming directory authorities
...
This implements the meat of #12899 . This commit should simply remove the
parts of Tor dirauths used to check whether a relay was supposed to be
named or not, it doesn't yet convert to a new mechanism for
reject/invalid/baddir/badexiting relays.
2014-09-09 11:50:21 -04:00
Nick Mathewson
4af88d68b4
Merge remote-tracking branch 'origin/maint-0.2.5'
2014-09-09 11:05:28 -04:00
Nick Mathewson
8eed82b3d4
Merge remote-tracking branch 'andrea/bug12160_025' into maint-0.2.5
2014-09-09 11:04:54 -04:00
Nick Mathewson
dd22ab519a
Merge remote-tracking branch 'public/bug12700_024' into maint-0.2.5
2014-09-09 10:51:39 -04:00
Nick Mathewson
2997908228
Merge remote-tracking branch 'origin/maint-0.2.5'
2014-09-09 10:27:41 -04:00
Nick Mathewson
8391c96091
Clean up the MVSC nmake files so they work again.
...
Fixes bug 13081; bugfix on 0.2.5.1-alpha. Patch from "NewEraCracker."
2014-09-09 10:27:05 -04:00
Nick Mathewson
ad0ae89b3c
Merge remote-tracking branch 'origin/maint-0.2.5'
2014-09-09 10:22:42 -04:00
Nick Mathewson
a3c49ca79a
Add more escaped() calls in directory.c
...
Patch from teor to fix 13071.
2014-09-09 10:22:01 -04:00
Nick Mathewson
2ecaa59bd7
Merge remote-tracking branch 'origin/maint-0.2.5'
2014-09-08 15:16:45 -04:00
Nick Mathewson
d229025fef
Expand the event_mask field in controller conns to 64 bits
...
Back in 078d6bcd
, we added an event number 0x20, but we didn't make
the event_mask field big enough to compensate.
Patch by "teor". Fixes 13085; bugfix on 0.2.5.1-alpha.
2014-09-08 15:16:02 -04:00
George Kadianakis
0f50f5f373
Evaluate TestingDirAuthVoteGuard only after filling all rs elements.
2014-09-06 14:37:41 +03:00
Andrea Shepard
39a017809b
Correctly update channel local mark when address of incoming connection changes after handshake; fixes bug #12160
2014-09-05 11:12:08 -07:00
Sebastian Hahn
8356721662
Fix add_fingerprint_to_dir() doc and signature
...
This function never returns non-null, but its usage doesn't reflect
that. Let's make it explicit. This will be mostly overridden by later
commits, so no changes file here.
2014-09-04 22:22:56 +02:00
Sebastian Hahn
10fe5bad9a
Remove the AuthDirRejectUnlisted config option
...
This is in preparation for a big patch series removing the entire Naming
system from Tor. In its wake, the approved-routers file is being
deprecated, and a replacement option to allow only pre-approved routers
is not being implemented.
2014-09-04 06:25:38 +02:00
Nick Mathewson
ed8f020e20
Fix a couple of small memory leaks on failure cases.
...
[CID 1234702, 1234703]
2014-09-03 10:59:39 -04:00
Nick Mathewson
c4d0d30bf3
Fix some 'dereference-before-null-check' warnings in test_circuitlist.c
...
Found by Coverity Scan.
[CID 1234704, 1234705, 1234706]
2014-09-03 10:59:10 -04:00
Nick Mathewson
0e66edb254
Fix the leaks that valgrind found in the new routerset tests.
...
(We have a tests-shouldn't-leak policy so that we won't accidentally
ignore true-positives.)
2014-09-03 09:51:14 -04:00
Nick Mathewson
9ab35b0a2e
Use 'Bytes', not 'B', in torrc.sample.
...
Also put this change into torrc.minimal.in-staging
Closes ticket 10343
2014-09-02 19:18:21 -04:00
Magnus Nord
d0113a0c2a
Fix: typo in torrc.sample.in
2014-09-02 19:16:16 -04:00
Nick Mathewson
8a79b56ac6
Divide torrc.sample into torrc.sample and torrc.minimal
...
torrc.minimal is now the one that should change as infrequently as
possible. To schedule an change to go into it eventually, make your
change to torrc.minimal.in-sample.
torrc.sample is now the volatile one: we can change it to our hearts'
content.
Closes ticket #11144
2014-09-02 19:14:30 -04:00
Sebastian Hahn
962765a35d
Don't list relays w/ bw estimate of 0 in the consensus
...
This implements a feature from bug 13000. Instead of starting a bwauth
run with this wrong idea about their bw, relays should do the self-test
and then get measured.
2014-09-02 18:55:01 -04:00
Sebastian Hahn
14abf1c3f1
Don't delay uploading a new desc if bw estimate was 0
...
When a tor relay starts up and has no historical information about its
bandwidth capability, it uploads a descriptor with a bw estimate of 0.
It then starts its bw selftest, but has to wait 20 minutes to upload the
next descriptor due to the MAX_BANDWIDTH_CHANGE_FREQ delay. This change
should mean that on average, relays start seeing meaningful traffic a
little quicker, since they will have a higher chance to appear in the
consensus with a nonzero bw.
Patch by Roger, changes file and comment by Sebastian.
2014-09-02 18:54:56 -04:00
Nick Mathewson
bce32e0a35
Fix more (void*)11 warnings in the tests
2014-09-02 15:40:47 -04:00
Nick Mathewson
a14c6cb70f
Make iter for DECLARE_TYPED_DIGESTMAP_FNS be a pointer.
...
This fixes a clangalyzer warning, and makes our C slightly better C.
2014-09-02 15:40:04 -04:00
Nick Mathewson
44f0dfa53b
Use real pointers in unit tests, not (void*)101 etc
...
The clangalyzer hates (void*)101 etc
2014-09-02 13:56:54 -04:00
Nick Mathewson
32b88d2565
Don't include a backtrace test for dereferencing 0 under analyzers
...
They hate this.
2014-09-02 13:56:31 -04:00
Nick Mathewson
9b850f9200
Add more assertions to esc_for_log to please the clangalyzer.
2014-09-02 13:29:45 -04:00
Nick Mathewson
07a16b3372
Add an assertion to read_file_to_str_until_eof
...
The clangalyzer doesn't believe our math here. I'm pretty sure our
math is right. Also, add some unit tests.
2014-09-02 13:29:11 -04:00
Nick Mathewson
1a2f2c163f
Explicitly initialize addresses in tor_ersatz_socketpair
...
This should stop a false positive from the clangalyzer.
2014-09-02 12:58:32 -04:00
Nick Mathewson
57c48bf734
Apply the MALLOC_ZERO_WORKS fixup to tor_realloc as well.
...
Also, make MALLOC_ZERO_WORKS never get applied when clang analyzer is
running. This should make the clangalyzer a little happier.
2014-09-02 12:55:20 -04:00
Nick Mathewson
00ffccd9a6
Another clang analyzer complaint wrt HT_GENERATE
...
We're calling mallocfn() and reallocfn() in the HT_GENERATE macro
with the result of a product. But that makes any sane analyzer
worry about overflow.
This patch keeps HT_GENERATE having its old semantics, since we
aren't the only project using ht.h. Instead, define a HT_GENERATE2
that takes a reallocarrayfn.
2014-09-02 12:48:34 -04:00
Nick Mathewson
e3c143f521
Merge remote-tracking branch 'origin/maint-0.2.5'
2014-09-02 11:58:08 -04:00
Nick Mathewson
efcab43956
Fix a number of clang analyzer false-positives
...
Most of these are in somewhat non-obvious code where it is probably
a good idea to initialize variables and add extra assertions anyway.
Closes 13036. Patches from "teor".
2014-09-02 11:56:56 -04:00
Nick Mathewson
87f9c51f64
Avoid unsigned/sign compare warning from last patch.
2014-09-01 15:42:17 -04:00
Philip Van Hoof
60a3897ed9
Bounds check while looping over a fixed size table or array
...
(Edited to use existing ARRAY_LENGTH macro --nickm)
2014-09-01 15:40:47 -04:00
Nick Mathewson
f113a263de
Merge remote-tracking branch 'origin/maint-0.2.5'
2014-08-29 16:45:56 -04:00
Nick Mathewson
41058dce95
Merge remote-tracking branch 'arma/bug12996b' into maint-0.2.5
2014-08-29 16:44:50 -04:00
Roger Dingledine
7a878c192f
Downgrade "Unexpected onionskin length after decryption" warning
...
It's now a protocol-warn, since there's nothing relay operators can
do about a client that sends them a malformed create cell.
Resolves bug 12996; bugfix on 0.0.6rc1.
2014-08-29 16:38:54 -04:00
Nick Mathewson
d6fa8239c8
Merge remote-tracking branch 'origin/maint-0.2.5'
2014-08-29 16:13:04 -04:00
Nick Mathewson
4a6f5bb2dd
Improve "Tried to establish rendezvous on non-OR or non-edge circuit"
...
Instead of putting it all in one warning message, log what exactly
was wrong with the circuit.
Resolves ticket 12997.
2014-08-29 16:05:58 -04:00
Nick Mathewson
573d62748a
Fix some coverity warnings in new routerset tests
2014-08-29 15:09:27 -04:00
dana koch
c887e20e6a
Introduce full coverage tests for module routerset.c.
...
This is using the paradigm introduced for test_status.c.
2014-08-29 12:55:28 -04:00
Nick Mathewson
cc3b04a8c1
Merge remote-tracking branch 'origin/maint-0.2.5'
2014-08-28 08:36:00 -04:00
Roger Dingledine
37a76d75dd
Resume expanding abbreviations for command-line options
...
The fix for bug 4647 accidentally removed our hack from bug 586 that
rewrote HashedControlPassword to __HashedControlSessionPassword when
it appears on the commandline (which allowed the user to set her own
HashedControlPassword in the torrc file while the controller generates
a fresh session password for each run).
Fixes bug 12948; bugfix on 0.2.5.1-alpha.
2014-08-28 08:33:43 -04:00
Nick Mathewson
9f9b19ed7b
Initialize crash handler in unit tests
...
This way, we don't get locking failures when we hit an assertion in
the unit tests. Also, we might find out about unit test bugs from
folks who can't do gdb.
2014-08-27 20:03:00 -04:00
Nick Mathewson
fdb7fc70d0
Merge remote-tracking branch 'public/bug10163'
2014-08-26 09:44:16 -04:00
Nick Mathewson
051dd9c409
Remove the assigned-but-unused chosen_named_idx local variable
...
It had been used in consensus method 1. But now that 13 is the
minimum (see #10163 ), we don't need it around.
Found by sysrqb.
2014-08-25 11:26:08 -04:00
Nick Mathewson
72ba1739e2
Fix another memory leak case in sandbox.c:prot_strings()
...
This is related to the rest of 523587a5cf
2014-08-25 11:14:31 -04:00
Nick Mathewson
9222707e5c
Use the ARRAY_LENGTH macro more consistently.
2014-08-24 13:35:48 -04:00
Nick Mathewson
15be51b41d
Remove the non-implemented versions of the sandbox _array() functions
2014-08-24 13:35:30 -04:00
Nick Mathewson
991545acf1
Whitespace fixes
2014-08-24 13:32:39 -04:00
Nick Mathewson
7c1143e11f
Terser ways to sandbox-allow related filenames
...
Using the *_array() functions here confused coverity, and was actually
a bit longer than we needed. Now we just use macros for the repeated
bits, so that we can mention a file and a suffix-appended version in
one line.
2014-08-24 13:30:55 -04:00
Nick Mathewson
59e114832e
Merge branch 'bug11792_1_squashed'
...
Conflicts:
src/or/circuitlist.c
2014-08-24 13:09:08 -04:00
Nick Mathewson
d6033843a4
When looking for conns to close, count the age of linked queued data
...
Specifically, count the age of the data queued in a linked directory
connection's buffers when counting a stream's age.
2014-08-24 13:04:45 -04:00
Nick Mathewson
68e430a6fb
Kill non-tunneled directory connections when handling OOM.
...
Another part of 11792.
2014-08-24 13:04:38 -04:00
Nick Mathewson
8e55cafd67
Count zlib buffer memory towards OOM totals.
...
Part of 11792.
(Uses the zlib-endorsed formula for memory needs for inflate/deflate
from "zconf.h".)
2014-08-24 13:04:27 -04:00
Nick Mathewson
d31bcc4b23
Tidy status handling in rendservice.c
...
We had some code to fix up the 'status' return value to -1 on error
if it wasn't set, but it was unreachable because our code was
correct. Tweak this by initializing status to -1, and then only
setting it to 0 on success. Also add a goto which was missing: its
absence was harmless.
[CID 718614, 718616]
2014-08-22 12:23:01 -04:00
Nick Mathewson
523587a5cf
fix memory leak on failure in sandbox.c:prot_strings()
...
[CID 1205014]
2014-08-21 11:40:48 -04:00
Nick Mathewson
35b2e11755
Store sandbox params as char *, since that's what they are.
...
This allows coverity to infer that we aren't leaking them.
[Fixes a lot of CIDs]
2014-08-21 11:22:42 -04:00
Nick Mathewson
446e481c90
Check for duplicate arguments to tor-gencert
...
Found by coverity, which noticed that if you said
tor-gencert -i identity1 -i identity2
we would leak "identity1".
[CID 1198201, 1198202, 1198203]
2014-08-21 11:22:42 -04:00
Nick Mathewson
a66fff6381
Mark one use of networkstatus_check_document_signature as (void)
...
Also explain why we aren't checking its return value.
[CID 1198197]
2014-08-21 11:22:42 -04:00
Nick Mathewson
059e33de59
remove meaningless checks for chunks==NULL in dirserv stuff
...
Also, make it clearer that chunks cannot be NULL
[CID 1031750, 1031751]
2014-08-21 11:22:42 -04:00
Nick Mathewson
917e1042f7
Suppress coverity warning about overflowing in safe_mem_is_zero
...
The unsigned underflow here is defined and intentional.
CID 202482
2014-08-21 11:22:42 -04:00
Nick Mathewson
7bc25b5a78
Avoid performing an assert on an always-true value
...
This was freaking out coverity.
[CID 743379]
2014-08-21 11:22:42 -04:00
Nick Mathewson
c43e45d0ea
Suppress coverity warning about overflowing in tor_memeq.
...
The unsigned underflow here is defined and intentional.
CID 202482
2014-08-21 10:44:13 -04:00
Nick Mathewson
0de7565dfd
Check return values for fcntl in tor_spawn_background.
...
[CID 718609]
2014-08-21 10:38:19 -04:00
Nick Mathewson
377b5c0510
Allow rend_service_intro_free to get called with NULL
...
(We allowed it previously, but produced an LD_BUG message when it
happened, which is not consistent
Also, remove inconsistent NULL checks before calling
rend_service_intro_free.
(Removing the check is for CID 718613)
2014-08-21 10:34:29 -04:00
Nick Mathewson
c9cac69ac6
Remove a dead check for errmsg in handle_control_authenticate
...
Coverity doesn't like doing NULL checks on things that can't be
NULL; I like checking things where the logic for their not being
NULL is nontrivial. Let's compromise, and make it obvious that this
field can't be NULL.
[Coverity CID 202004]
2014-08-21 10:27:43 -04:00
Nick Mathewson
e6a05c1c54
Add a missing goto to an unusable branch and make the branch LD_BUG.
...
(It's LD_BUG to reach this point because the hashed password values
were tested earlier from options_validate)
[Coverity CID 1232091]
2014-08-21 10:21:17 -04:00
Nick Mathewson
2a0a5fe612
Explicitly cast when dividing ints then implicitly casting to double.
...
Coverity thinks that when we do "double x = int1/int2;", we probably
meant "double x = ((double)int1) / int2;". In these cases, we
didn't.
[Coverity CID 1232089 and 1232090]
2014-08-21 10:19:26 -04:00
Nick Mathewson
b6a725c67e
Fix memory leaks in test_entrynodes.c
...
[Coverity CID 1232087 and 1232088]
2014-08-21 10:18:17 -04:00
Nick Mathewson
2cf229ab60
Make the two branches of tor_tls_used_v1_handshake into one.
...
(Coverity thinks that "if (a) X; else X;" is probably a bug.)
[Coverity CID 1232086]
2014-08-21 10:12:54 -04:00
Nick Mathewson
916fba2243
Merge branch 'bug12205_take2_squashed'
2014-08-20 15:32:48 -04:00
Nick Mathewson
2994f00199
Whitespace fixes
2014-08-20 15:32:35 -04:00
Nick Mathewson
a5fe84b5a6
Small cleanups to test_entry_is_time_to_retry
2014-08-20 15:31:25 -04:00
rl1987
8b539cc276
Unit testing entry_is_time_to_retry().
2014-08-20 15:29:56 -04:00
rl1987
c731a1c68f
Write comments for members of periods array.
2014-08-20 15:29:56 -04:00
rl1987
197d855009
Rewriting entry_is_time_to_retry() using table approach.
2014-08-20 15:29:55 -04:00
Nick Mathewson
01a0ab02a3
Merge branch 'bug10116_squashed'
2014-08-20 14:52:24 -04:00
Nick Mathewson
7f5a440421
Don't allocate an extra smartlist in the OOM handler
...
Fixes issue 10116
2014-08-20 14:50:38 -04:00
Nick Mathewson
82d4b60b91
fix remaining compilation problems
2014-08-20 14:50:37 -04:00
Nick Mathewson
7c61d10c6c
Fix return value of tor_fd_seekend.
...
Previously, we had documented it to return -1 or 0, when in fact
lseek returns -1 or the new position in the file.
This is harmless, since we were only checking for negative values
when we used tor_fd_seekend.
2014-08-20 13:49:25 -04:00
Nick Mathewson
a32913d5aa
Allow named pipes for our log files.
...
Closes ticket 12061. Based on a patch from "carlo von lynX" on tor-dev at
https://lists.torproject.org/pipermail/tor-dev/2014-April/006705.html
2014-08-20 13:45:16 -04:00
Nick Mathewson
fb762f6db0
Merge remote-tracking branch 'public/bug11787'
2014-08-20 13:34:02 -04:00
Nick Mathewson
c57e8da4ea
Merge remote-tracking branch 'public/bug12908_025'
2014-08-20 12:58:26 -04:00
Sathyanarayanan Gunasekaran
a3fe8b1166
Warn if Tor is a relay and a HS
...
Closes 12908; see #8742
2014-08-20 12:56:57 -04:00
Nick Mathewson
d0009cb8e8
Merge remote-tracking branch 'public/bug12728_024'
2014-08-20 12:44:15 -04:00
George Kadianakis
d28670c94f
Fix entrynodes test fails because of outdated test vectors.
2014-08-20 10:25:27 -04:00
Nick Mathewson
764cebb4d9
Merge remote-tracking branch 'public/bug12700_024'
2014-08-20 09:00:41 -04:00
Nick Mathewson
ec59167cae
When counting memory from closing a connection, count the dir conn too
...
Fix part of bug 11972
2014-08-18 15:21:50 -04:00
Nick Mathewson
1196ed7cc4
Fix relay_command_to_string(); solve 12700.
...
Two bugs here:
1) We didn't add EXTEND2/EXTENDED2 to relay_command_to_string().
2) relay_command_to_string() didn't log the value of unrecognized
commands.
Both fixed here.
2014-08-18 13:21:40 -04:00
Nick Mathewson
2937de2180
Merge remote-tracking branch 'origin/maint-0.2.5'
2014-08-18 10:20:37 -04:00
Nick Mathewson
b159ffb675
Fix windows warning introduced by 0808ed83f9
...
This will fix the warning
"/src/or/config.c:6854:48: error: unused parameter 'group_readable'"
that I introduced while fixing 12864.
Bug not in any released version of Tor.
2014-08-18 10:19:05 -04:00
Nick Mathewson
d38aa5545f
Remove implementation code for all pre-13 consensus methods.
...
Also remove a test for the way that we generated parameter votes
before consensus method 12.
2014-08-15 18:11:26 -04:00
Nick Mathewson
908bd4cee3
Remove support for generating consensuses with methods <= 9.
...
The last patch disabled these; this one removes the code to implement
them.
2014-08-15 18:05:53 -04:00
Nick Mathewson
df99ce2395
No longer advertise or negotiate any consensus method before 13.
...
Implements proposal 215; closes ticket 10163.
Why? From proposal 215:
Consensus method 1 is no longer viable for the Tor network. It
doesn't result in a microdescriptor consensus, and omits other
fields that clients need in order to work well. Consensus methods
under 12 have security issues, since they let a single authority
set a consensus parameter.
...
For example, while Tor 0.2.4.x is under development, authorities
should really not be running anything before Tor 0.2.3.x. Tor
0.2.3.x has supported consensus method 13 since 0.2.3.21-rc, so
it's okay for 0.2.4.x to require 13 as the minimum method. We even
might go back to method 12, since the worst outcome of not using 13
would be some warnings in client logs. Consensus method 12 was a
security improvement, so we don't want to roll back before that.
2014-08-15 17:57:37 -04:00
Nick Mathewson
1f35fd0017
Merge remote-tracking branch 'origin/maint-0.2.5'
2014-08-15 17:41:13 -04:00
Nick Mathewson
967b4e7c54
Merge remote-tracking branch 'asn/nickm-bug12864_025' into maint-0.2.5
2014-08-15 17:40:13 -04:00
Nick Mathewson
664b2645fb
Hand-fix a few global_circuit_list cases
2014-08-15 16:32:32 -04:00
Nick Mathewson
6969bd9a02
Autoconvert most circuit-list iterations to smartlist iterations
...
Breaks compilation.
Used this coccinelle script:
@@
identifier c;
typedef circuit_t;
iterator name TOR_LIST_FOREACH;
iterator name SMARTLIST_FOREACH_BEGIN;
statement S;
@@
- circuit_t *c;
...
- TOR_LIST_FOREACH(c, \(&global_circuitlist\|circuit_get_global_list()\), head)
+ SMARTLIST_FOREACH_BEGIN(circuit_get_global_list(), circuit_t *, c)
S
+ SMARTLIST_FOREACH_END(c);
2014-08-15 16:23:22 -04:00
George Kadianakis
112c984f92
Some documentation fixes for #12864 .
2014-08-15 23:12:06 +03:00
Nick Mathewson
db2af2abb0
Start converting circuitlist to smartlist.
2014-08-15 15:58:00 -04:00
Nick Mathewson
33fab2846a
Merge remote-tracking branch 'origin/maint-0.2.5'
2014-08-15 10:07:04 -04:00
Nick Mathewson
0cb028b7c0
Remove stale printfs from buffer/zlib_fin_at_chunk_end test
...
These got committed by mistake.
2014-08-15 09:34:10 -04:00
Nick Mathewson
0fc2d0edce
Documentation fix for policy_summarize().
...
Spotted by "epilys"
2014-08-15 08:53:29 -04:00
Nick Mathewson
0808ed83f9
Restore functionality for CookieAuthFileGroupReadable.
...
When we merged the cookieauthfile creation logic in 33c3e60a37
, we
accidentally took out this feature. Fixes bug 12864, bugfix on
0.2.5.1-alpha.
Also adds an ExtORPortCookieAuthFileGroupReadable, since there's no
reason not to.
2014-08-15 08:30:44 -04:00
Nick Mathewson
c69e96680a
Merge remote-tracking branch 'origin/maint-0.2.5'
2014-08-13 23:15:44 -04:00