GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Commit 4154158d authored by Nick Mathewson's avatar Nick Mathewson 🐭

Make config/parse_tcp_proxy_line work in the presence of DNS hijacking

We can use our existing mocking functionality to do this: We have
been in this position before.

Fixes part of #40179; bugfix on 0.4.3.1-alpha.
parent 4876409c
o Minor bugfixes (testing):
- Fix the config/parse_tcp_proxy_line test so that it works correctly on
systems where the DNS provider hijacks invalid queries.
Fixes part of bug 40179; bugfix on 0.4.3.1-alpha.
...@@ -703,11 +703,13 @@ test_config_parse_tcp_proxy_line(void *arg) ...@@ -703,11 +703,13 @@ test_config_parse_tcp_proxy_line(void *arg)
tor_free(msg); tor_free(msg);
/* Bad TCPProxy line - unparsable address/port. */ /* Bad TCPProxy line - unparsable address/port. */
ret = parse_tcp_proxy_line("haproxy 95.216.163.36/443", options, &msg); MOCK(tor_addr_lookup, mock_tor_addr_lookup__fail_on_bad_addrs);
ret = parse_tcp_proxy_line("haproxy bogus_address!/300", options, &msg);
tt_int_op(ret, OP_EQ, -1); tt_int_op(ret, OP_EQ, -1);
tt_str_op(msg, OP_EQ, "TCPProxy address/port failed to parse or resolve. " tt_str_op(msg, OP_EQ, "TCPProxy address/port failed to parse or resolve. "
"Please fix."); "Please fix.");
tor_free(msg); tor_free(msg);
UNMOCK(tor_addr_lookup);
/* Good TCPProxy line - ipv4. */ /* Good TCPProxy line - ipv4. */
ret = parse_tcp_proxy_line("haproxy 95.216.163.36:443", options, &msg); ret = parse_tcp_proxy_line("haproxy 95.216.163.36:443", options, &msg);
...@@ -720,7 +722,7 @@ test_config_parse_tcp_proxy_line(void *arg) ...@@ -720,7 +722,7 @@ test_config_parse_tcp_proxy_line(void *arg)
tor_free(msg); tor_free(msg);
done: done:
; UNMOCK(tor_addr_lookup);
} }
/** /**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment