]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Add checks for expected log messages in test_hs_intropoint.
authorAlexander Færøy <ahf@torproject.org>
Wed, 1 Feb 2017 18:58:06 +0000 (18:58 +0000)
committerAlexander Færøy <ahf@torproject.org>
Wed, 1 Feb 2017 19:01:07 +0000 (19:01 +0000)
This patch adds checks for expected log messages for failure cases of
different ill-formed ESTABLISH_INTRO cell's.

See: https://bugs.torproject.org/21266

src/test/test_hs_intropoint.c

index 770fff42d2106c6d7810febbec2247b67dd20382..ea12aeb2da789fc70fa09e5b9c918ed2896e64ce 100644 (file)
@@ -146,8 +146,11 @@ test_establish_intro_wrong_purpose(void *arg)
                                          establish_intro_cell);
   tt_int_op(cell_len, >, 0);
 
-  /* Receive the cell */
+  /* Receive the cell. Should fail. */
+  setup_full_capture_of_logs(LOG_INFO);
   retval = hs_intro_received_establish_intro(intro_circ, cell_body, cell_len);
+  expect_log_msg_containing("Rejecting ESTABLISH_INTRO on non-OR circuit.");
+  teardown_capture_of_logs();
   tt_int_op(retval, ==, -1);
 
  done:
@@ -180,7 +183,10 @@ test_establish_intro_wrong_keytype(void *arg)
   helper_prepare_circ_for_intro(intro_circ, circuit_key_material);
 
   /* Receive the cell. Should fail. */
+  setup_full_capture_of_logs(LOG_INFO);
   retval = hs_intro_received_establish_intro(intro_circ, (uint8_t*)"", 0);
+  expect_log_msg_containing("Empty ESTABLISH_INTRO cell.");
+  teardown_capture_of_logs();
   tt_int_op(retval, ==, -1);
 
  done:
@@ -217,7 +223,10 @@ test_establish_intro_wrong_keytype2(void *arg)
   cell_body[0] = 42;
 
   /* Receive the cell. Should fail. */
+  setup_full_capture_of_logs(LOG_INFO);
   retval = hs_intro_received_establish_intro(intro_circ, cell_body, cell_len);
+  expect_log_msg_containing("Unrecognized AUTH_KEY_TYPE 42.");
+  teardown_capture_of_logs();
   tt_int_op(retval, ==, -1);
 
  done:
@@ -413,7 +422,10 @@ test_establish_intro_wrong_sig(void *arg)
   cell_body[cell_len-1]++;
 
   /* Receive the cell. Should fail. */
+  setup_full_capture_of_logs(LOG_INFO);
   retval = hs_intro_received_establish_intro(intro_circ, cell_body, cell_len);
+  expect_log_msg_containing("Failed to verify ESTABLISH_INTRO cell.");
+  teardown_capture_of_logs();
   tt_int_op(retval, ==, -1);
 
  done: