aboutsummaryrefslogtreecommitdiff
path: root/src/test
AgeCommit message (Collapse)Author
2020-08-12Fix allocation counting in clean_v2_descs_as_dir test.Nick Mathewson
Without this fix, running this test on its own would fail. Fixes bug 40099. Bugfix on ade5005853c17b3 in 0.2.8.1-alpha.
2020-07-30Fix a bug in buf_move_all() when the input buffer is empty.Nick Mathewson
We found this in #40076, after we started using buf_move_all() in more places. Fixes bug #40076; bugfix on 0.3.3.1-alpha. As far as I know, the crash only affects master, but I think this warrants a backport, "just in case".
2020-07-30Add unit test for buf_move_all(), including a failing caseNick Mathewson
The failing case is #if'd out for now, but will be fixed in the next commit. Testing for a fix for #40076.
2020-07-06Run `tor_tls_cert_matches_key()` Test Suite with both OpenSSL and NSS.Alexander Færøy
This patch lifts the `tor_tls_cert_matches_key()` tests out of the OpenSSL specific TLS test suite and moves it into the generic TLS test suite that is executed for both OpenSSL and NSS. This patch is largely a code movement, but we had to rewrite parts of the test to avoid using OpenSSL specific data-types (such as `X509 *`) and replace it with the generic Tor abstraction type (`tor_x509_cert_impl_t *`). This patch is part of the fix for TROVE-2020-001. See: https://bugs.torproject.org/33119
2020-06-30Merge branch 'tor-github/pr/1793' into maint-0.3.5Alexander Færøy
2020-06-30Merge branch 'tor-github/pr/1785' into maint-0.3.5Alexander Færøy
2020-05-06Use __attribute__((fallthrough)) rather than magic GCC comments.Nick Mathewson
GCC added an implicit-fallthrough warning a while back, where it would complain if you had a nontrivial "case:" block that didn't end with break, return, or something like that. Clang recently added the same thing. GCC, however, would let you annotate a fall-through as intended by any of various magic "/* fall through */" comments. Clang, however, only seems to like "__attribute__((fallthrough))". Fortunately, GCC accepts that too. A previous commit in this branch defined a FALLTHROUGH macro to do the right thing if GNUC is defined; here we replace all of our "fall through" comments with uses of that macro. This is an automated commit, made with the following perl one-liner: #!/usr/bin/perl -i -p s#/\* *falls? ?thr.*?\*/#FALLTHROUGH;#i;
2020-04-09Merge remote-tracking branch 'tor-github/pr/1784' into maint-0.3.5teor
2020-03-19Add a TOR_SKIP_TESTCASES environment variable for suppressing tests.Nick Mathewson
For example, "TOR_SKIP_TESTCASES=crypto/.. ./src/test/test" will run the tests and suppress all the "crypto/" tests. You could get the same effect by running "./src/test/test :crypto/..", but that can be harder to arrange from CI. Part of a fix/workaround for 33643.
2020-03-17Merge branch 'trove_2020_002_035' into maint-0.3.5Nick Mathewson
2020-03-17Add off-by-one checks for key length.Nick Mathewson
2020-03-14Add a test for crypto_pk_asn1_decode_private maxbits.Nick Mathewson
2020-03-12Fix unit tests that look at contactinfo logs.Nick Mathewson
2020-03-11pem_decode(): Tolerate CRLF line endingsNick Mathewson
Fixes bug 33032; bugfix on 0.3.5.1-alpha when we introduced our own PEM decoder.
2020-03-10dos: Pass transport name on new client connectionDavid Goulet
For a bridge configured with a pluggable transport, the transport name is used, with the IP address, for the GeoIP client cache entry. However, the DoS subsystem was not aware of it and always passing NULL when doing a lookup into the GeoIP cache. This resulted in bridges with a PT are never able to apply DoS defenses for newly created connections. Fixes #33491 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-02-12Lowercase the BridgeDistribution value from torrc in descriptors.Alexander Færøy
This patch ensures that we always lowercase the BridgeDistribution from torrc in descriptors before submitting it. See: https://bugs.torproject.org/32753
2019-11-06Merge remote-tracking branch 'tor-github/pr/1354' into maint-0.3.5teor
2019-10-20test/rebind: Make control formatting and log parsing more robustteor
* actually sleep when tor has not logged anything * log at debug level when waiting for tor to log something * backslash-replace bad UTF-8 characters in logs * format control messages as ASCII: tor does not accept UTF-8 control commands Fixes bug 31837; bugfix on 0.3.5.1-alpha.
2019-09-23Fix bug when %including folder with comment only files. #31408Daniel Pinto
When processing a %included folder, a bug caused the pointer to the last element of the options list to be set to NULL when processing a file with only comments or whitepace. This could cause options from other files on the same folder to be discarded depending on the lines after the affected %include.
2019-09-06entrynodes: Make routine descriptor expiry notice logs less alarmingteor
When tor is missing descriptors for some primary entry guards, make the log message less alarming. It's normal for descriptors to expire, as long as tor fetches new ones soon after. Fixes bug 31657; bugfix on 0.3.3.1-alpha.
2019-08-30Merge remote-tracking branch 'tor-github/pr/1117' into maint-0.3.5teor
2019-08-12Merge remote-tracking branch 'tor-github/pr/1065' into maint-0.3.5teor
2019-08-12Merge remote-tracking branch 'tor-github/pr/1039' into maint-0.3.5teor
2019-08-09Merge remote-tracking branch 'tor-github/pr/763' into maint-0.3.5teor
2019-06-19guard: Ignore marked for close circuit when changing state to openDavid Goulet
When we consider all circuits in "waiting for guard" state to be promoted to an "open" state, we were considering all circuits, even the one marked for close. This ultiamtely triggers a "circuit_has_opened()" called on the circuit that is marked for close which then leads to possible undesirable behaviors within a subsystem. For instance, the HS subsystem would be unable to find the authentication key of the introduction point circuit leading to a BUG() warning and a duplicate mark for close on the circuit. This commit also adds a unit test to make sure we never select marked for close circuits when upgrading its guard state from waiting for guard to open. Fixes #30871 Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-06-11Merge remote-tracking branch 'tor-github/pr/1091' into maint-0.3.5teor
2019-06-11Merge remote-tracking branch 'tor-github/pr/924' into maint-0.3.5teor
2019-06-10Travis: Skip test_rebind on macOS buildsteor
Skip test_rebind when the TOR_SKIP_TEST_REBIND environmental variable is set. Skip test_rebind on macOS in Travis builds, because it is unreliable on macOS on Travis. Fixes bug 30713; bugfix on 0.3.5.1-alpha.
2019-05-31Fix some tests for CL_PORT_NO_STREAM_OPTIONSNick Mathewson
The comment in the tests was correct: this option _was_ inverted wrt SessionGroup=.
2019-05-22Merge remote-tracking branch 'nickm/ticket30454_034_01_squashed' into ↵David Goulet
ticket30454_035_01
2019-05-20hs: Remove hs_intro_auth_key_type_t enumDavid Goulet
Like the previous commit about the INTRODUCE_ACK status code, change all auth key type to use the one defined in the trunnel file. Standardize the use of these auth type to a common ABI. Part of #30454 Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-04-10test: Also avoid reading the system default torrc in integration teststeor
Part of 29702.
2019-04-10Use empty torrc file when launching tor in test_rebind.pyrl1987
2019-04-09Actually I believe this should be an EINVAL.Nick Mathewson
2019-04-08Detect and suppress an additional gmtime() warning in test_util.cNick Mathewson
Fixes bug 29922; bugfix on 0.2.9.3-alpha when we tried to capture all these warnings. No need to backport any farther than 0.3.5, though -- these warnings don't cause test failures before then. This one was tricky to find because apparently it only happened on _some_ windows builds.
2019-03-27Merge remote-tracking branch 'tor-github/pr/820' into maint-0.3.4teor
2019-03-21test/dir: add an extra argument to dirserv_read_measured_bandwidths()teor
Part of 29806.
2019-03-21Merge branch 'ticket29806_034_squashed' into ticket29806_035_squashed_mergedteor
Copy and paste the vote=0 code from the old src/or/dirserv.c to the new src/feature/dirauth/bwauth.c.
2019-03-21bwauth: Ignore bandwidth file lines with "vote=0"juga0
so that the relays that would be "excluded" from the bandwidth file because of something failed can be included to diagnose what failed, without still including these relays in the bandwidth authorities vote. Closes #29806.
2019-03-20Merge branch 'maint-0.3.4' into maint-0.3.5teor
2019-03-19Merge remote-tracking branch 'tor-github/pr/727' into maint-0.3.5teor
2019-03-18test/sr: update sr_state_free() to sr_state_free_all() in a commentteor
2019-03-18Merge branch 'bug29706_029_minimal' into bug29706_034_minimal_mergeteor
2019-03-18test/sr: Clear SRVs after init, and before setupteor
Already merged to 0.4.0 and later in tor-github/pr/776. Backported to 0.2.9 and later with minor comment changes. Part of 29706.
2019-03-14Merge remote-tracking branch 'tor-github/pr/794' into maint-0.3.4teor
2019-03-14Merge remote-tracking branch 'nickm/bug27073_029' into bug27073_034teor
Replace == with OP_EQ in test macros.
2019-03-14Merge remote-tracking branch 'tor-github/pr/771' into maint-0.3.4teor
2019-03-09test/sr: Free SRVs before replacing them in test_sr_setup_srv()teor
Stop leaking parts of the shared random state in the shared-random unit tests. The previous fix in 29599 was incomplete. Fixes bug 29706; bugfix on 0.2.9.1-alpha.
2019-03-08Merge branch 'bug23512-v4-029-fixes-keep-typedef' into bug23512-v4-034-fixesteor
2019-03-08Merge remote-tracking branch 'bug28525_029' into maint-0.3.5teor