aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_extorport.c
AgeCommit message (Collapse)Author
2021-03-12Update copyrights to 2021, using "make update-copyright"Nick Mathewson
2021-01-26Fix a subtle memory leak in test_exorport.cNick Mathewson
This is a _subtle_ bug introduced by d1494d14, which resolved connections that was allocated in the extorport/handshake test. So how did the connection get freed? Our test was set up so that every extorport connection would get the same ext_or_id. Two connections couldn't have the same ext_or_id, and if they did, one would get freed. This meant that the _next_ connection to be constructed in the test would cause the previous connection to become closeable, even if it hadn't been closeable before. But when we applied d149d14, we stopped making it so our code enforced this uniqueness, and thereby make it so we _weren't_ freeing this connection in the tests. Closes #40260; bug not in any released version of Tor.
2020-11-12Remove orconn_ext_or_id_map and related functionsNeel Chauhan
2020-01-08It's 2020. Update the copyright dates with "make update-copyright"Nick Mathewson
2019-06-11Rework orconn tracking to use pubsubTaylor Yu
Part of ticket 29976.
2019-04-30Replace all remaining tor_mem_is_zero() with fast_mem_is_zero()Nick Mathewson
2019-04-30Use prefilled PRNG replacement in test_extorportNick Mathewson
This is the last remaining place where our tests had mocked crypto_rand.
2019-03-25Split all controller events code into a new control_events.cNick Mathewson
Also, split the formatting code shared by control.c and control_events.c into controller_fmt.c.
2019-01-16Bump copyright date to 2019Nick Mathewson
2018-11-14Move buffers.c out of lib/containers to resolve a circularity.Nick Mathewson
2018-09-21Merge remote-tracking branch 'ahf-github/asn/bugs4700_2'Nick Mathewson
2018-09-21Split main.c into main.c and mainloop.cNick Mathewson
The main.c code is responsible for initialization and shutdown; the mainloop.c code is responsible for running the main loop of Tor. Splitting the "generic event loop" part of mainloop.c from the event-loop-specific part is not done as part of this patch.
2018-09-15Add unittest for HiddenServiceExportCircuitID.George Kadianakis
Had to move a function to test helpers.
2018-07-05Fix every include path changed in the previous commit (automated)Nick Mathewson
I am very glad to have written this script.
2018-07-01Remove system headers from or.hNick Mathewson
2018-06-28Fix paths for buffers.h; automated.Nick Mathewson
2018-06-21Rectify include paths (automated)Nick Mathewson
2018-06-20Run rectify_include_paths.pyNick Mathewson
2018-06-20Update copyrights to 2018.Nick Mathewson
2018-06-15Move or_connection_t to its own header.Nick Mathewson
2018-04-06crypto: Refactor (P)RNG functionality into new crypto_rand module.Isis Lovecruft
* ADD new /src/common/crypto_rand.[ch] module. * ADD new /src/common/crypto_util.[ch] module (contains the memwipe() function, since all crypto_* modules need this). * FIXES part of #24658: https://bugs.torproject.org/24658
2017-12-08Rename connection_free_ to connection_free_minimal.Nick Mathewson
2017-09-14Refactor control_event_bootstrap_problemTaylor Yu
Change the contract of control_event_bootstrap_problem() to be more general and to take a connection_t. New function control_event_bootstrap_prob_or() has the specific or_connection_t funcionality previously used.
2017-09-05Refactor buffer APIs to put a buf_t first.Nick Mathewson
By convention, a function that frobs a foo_t should be called foo_frob, and it should have a foo_t * as its first argument. But for many of the buf_t functions, the buf_t was the final argument, which is silly.
2017-09-05Repair buffer API so everything starts with buf_.Nick Mathewson
Our convention is that functions which manipulate a type T should be named T_foo. But the buffer functions were super old, and followed all kinds of conventions. Now they're uniform. Here's the perl I used to do this: \#!/usr/bin/perl -w -i -p s/read_to_buf\(/buf_read_from_socket\(/; s/flush_buf\(/buf_flush_to_socket\(/; s/read_to_buf_tls\(/buf_read_from_tls\(/; s/flush_buf_tls\(/buf_flush_to_tls\(/; s/write_to_buf\(/buf_add\(/; s/write_to_buf_compress\(/buf_add_compress\(/; s/move_buf_to_buf\(/buf_move_to_buf\(/; s/peek_from_buf\(/buf_peek\(/; s/fetch_from_buf\(/buf_get_bytes\(/; s/fetch_from_buf_line\(/buf_get_line\(/; s/fetch_from_buf_line\(/buf_get_line\(/; s/buf_remove_from_front\(/buf_drain\(/; s/peek_buf_startswith\(/buf_peek_startswith\(/; s/assert_buf_ok\(/buf_assert_ok\(/;
2017-04-27Clean up mentions of 'zlib' and rename the mentions to 'compressed'.Alexander Færøy
This patch cleans up in various places where 'zlib' is mentioned.
2017-03-15Run the copyright update script.Nick Mathewson
2016-02-27Update the copyright year.Nick Mathewson
2015-11-25Now that crypto_rand() cannot fail, it should return void.Nick Mathewson
2015-01-02Bump copyright dates to 2015, in case someday this matters.Nick Mathewson
2014-11-12Fix wide lines (from 13172)Nick Mathewson
2014-11-12Replace operators used as macro arguments with OP_XX macrosNick Mathewson
Part of fix for 13172
2014-10-28Add another year to our copyright dates.Nick Mathewson
Because in 95 years, we or our successors will surely care about enforcing the BSD license terms on this code. Right?
2014-09-15Replace remaining uses of deprecated test_mem* functionsNick Mathewson
2014-09-15Use coccinelle scripts to clean up our unit testsNick Mathewson
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-05-08Fix numerous 64->32 errors in the unit testsNick Mathewson
Before the 11825 fix, these were all silently ignored.
2014-05-08Fix numerous type errors in the unit testsNick Mathewson
Remove tinytest casts that were suppressing them. Fix for #11825.
2014-04-29Fix leaks in tests related to setting options->DataDirectoryNick Mathewson
We pre-populate that value in main(), and we weren't freeing it before overriding it.
2014-03-27Report only the first bootstrap failure from an orconnNick Mathewson
Otherwise, when we report "identity mismatch", we then later report DONE when the connection gets closed. Fixes bug 10431; bugfix on 0.2.1.1-alpha.
2014-03-10Throw control port warning if we failed to connect to all our bridges.George Kadianakis
2013-08-15Test ExtORPort cookie initialization when file writing is broken.George Kadianakis
2013-08-15Test some fail conditions of ext_orport.c USERADDR/TRANSPORT parsing.George Kadianakis
2013-08-15Fix some #5040 bugs found by Nick's tests.George Kadianakis
- Set conn->address when we receive a USERADDR command. - Set conn->state to a sane value when we transition from Extended ORPort to ORPort.
2013-08-15Implement and use a generic auth. cookie initialization function.George Kadianakis
Use the generic function for both the ControlPort cookie and the ExtORPort cookie. Also, place the global cookie variables in the heap so that we can pass them around more easily as pointers. Also also, fix the unit tests that broke by this change. Conflicts: src/or/config.h src/or/ext_orport.c
2013-08-15White-box tests for the succeeding case of ext_or_port handshake.Nick Mathewson
(Okay, white-box plus mocking enough other functions so they don't crash.)
2013-08-15Test for initializing ext_or_auth_cookie fileNick Mathewson
2013-08-15Unit test for the ext_orport safe_cookie handshakeNick Mathewson
2013-08-15More unit tests for handle_client_auth_nonceNick Mathewson
Incidentally, this business here where I make crypto_rand mockable: this is exactly the kind of thing that would make me never want to include test-support stuff in production builds.
2013-08-15Unit test for basic ext_or_cookie authentication backendNick Mathewson
2013-08-15Tests for connection_write_ext_or_command.Nick Mathewson