commit 6d52b5ce910c31962e16b654426b923a43f38201 Author: teor teor@torproject.org Date: Thu Oct 31 17:21:10 2019 +1000
test/parseconf: Add conf_examples for PTs
Tests relay/transport_config.c.
Part of 32213. --- src/test/conf_examples/pt_01/error_no_dirauth_relay | 1 + src/test/conf_examples/pt_01/expected | 0 src/test/conf_examples/pt_01/torrc | 7 +++++++ src/test/conf_examples/pt_02/error_no_dirauth_relay | 1 + src/test/conf_examples/pt_02/expected | 0 src/test/conf_examples/pt_02/torrc | 11 +++++++++++ src/test/conf_examples/pt_03/error_no_dirauth_relay | 1 + src/test/conf_examples/pt_03/expected | 1 + src/test/conf_examples/pt_03/torrc | 4 ++++ src/test/conf_examples/pt_04/error_no_dirauth_relay | 1 + src/test/conf_examples/pt_04/expected | 3 +++ src/test/conf_examples/pt_04/torrc | 6 ++++++ src/test/conf_examples/pt_05/error_no_dirauth_relay | 1 + src/test/conf_examples/pt_05/expected | 4 ++++ src/test/conf_examples/pt_05/torrc | 6 ++++++ src/test/conf_examples/pt_06/error_no_dirauth_relay | 1 + src/test/conf_examples/pt_06/expected | 6 ++++++ src/test/conf_examples/pt_06/torrc | 9 +++++++++ src/test/conf_examples/pt_07/error_no_dirauth_relay | 1 + src/test/conf_examples/pt_07/expected | 4 ++++ src/test/conf_examples/pt_07/torrc | 6 ++++++ src/test/conf_examples/pt_08/error | 1 + src/test/conf_examples/pt_08/error_no_dirauth_relay | 1 + src/test/conf_examples/pt_08/torrc | 5 +++++ src/test/conf_examples/pt_09/error_no_dirauth_relay | 1 + src/test/conf_examples/pt_09/expected | 0 src/test/conf_examples/pt_09/torrc | 7 +++++++ 27 files changed, 89 insertions(+)
diff --git a/src/test/conf_examples/pt_01/error_no_dirauth_relay b/src/test/conf_examples/pt_01/error_no_dirauth_relay new file mode 100644 index 000000000..9f9c0fd8f --- /dev/null +++ b/src/test/conf_examples/pt_01/error_no_dirauth_relay @@ -0,0 +1 @@ +This tor was built with relay mode disabled. diff --git a/src/test/conf_examples/pt_01/expected b/src/test/conf_examples/pt_01/expected new file mode 100644 index 000000000..e69de29bb diff --git a/src/test/conf_examples/pt_01/torrc b/src/test/conf_examples/pt_01/torrc new file mode 100644 index 000000000..574bb32a0 --- /dev/null +++ b/src/test/conf_examples/pt_01/torrc @@ -0,0 +1,7 @@ +# Relay PT tests +# Options from relay/transport_config.c +# Empty linelist values are ignored with a warning +ExtORPort +ServerTransportPlugin +ServerTransportListenAddr +ServerTransportOptions diff --git a/src/test/conf_examples/pt_02/error_no_dirauth_relay b/src/test/conf_examples/pt_02/error_no_dirauth_relay new file mode 100644 index 000000000..9f9c0fd8f --- /dev/null +++ b/src/test/conf_examples/pt_02/error_no_dirauth_relay @@ -0,0 +1 @@ +This tor was built with relay mode disabled. diff --git a/src/test/conf_examples/pt_02/expected b/src/test/conf_examples/pt_02/expected new file mode 100644 index 000000000..e69de29bb diff --git a/src/test/conf_examples/pt_02/torrc b/src/test/conf_examples/pt_02/torrc new file mode 100644 index 000000000..d047d615f --- /dev/null +++ b/src/test/conf_examples/pt_02/torrc @@ -0,0 +1,11 @@ +# Relay PT tests +# Options from relay/transport_config.c +# Bad options are also ignored +ExtORPort illegal_hostname_chars$()^*%(%#%)#(%* +ServerTransportPlugin bad +ServerTransportPlugin bad2 exec +ServerTransportPlugin bad3 exec / +ServerTransportListenAddr bad +ServerTransportListenAddr bad2 illegal_hostname_chars$()^*%(%#%)#(%* +ServerTransportOptions bad +ServerTransportOptions bad2 not_kv diff --git a/src/test/conf_examples/pt_03/error_no_dirauth_relay b/src/test/conf_examples/pt_03/error_no_dirauth_relay new file mode 100644 index 000000000..9f9c0fd8f --- /dev/null +++ b/src/test/conf_examples/pt_03/error_no_dirauth_relay @@ -0,0 +1 @@ +This tor was built with relay mode disabled. diff --git a/src/test/conf_examples/pt_03/expected b/src/test/conf_examples/pt_03/expected new file mode 100644 index 000000000..f849f2a78 --- /dev/null +++ b/src/test/conf_examples/pt_03/expected @@ -0,0 +1 @@ +ServerTransportPlugin bad3 exec / diff --git a/src/test/conf_examples/pt_03/torrc b/src/test/conf_examples/pt_03/torrc new file mode 100644 index 000000000..9868c39b2 --- /dev/null +++ b/src/test/conf_examples/pt_03/torrc @@ -0,0 +1,4 @@ +# Relay PT tests +# Options from relay/transport_config.c +# Plugin, but no ExtORPort +ServerTransportPlugin bad3 exec / diff --git a/src/test/conf_examples/pt_04/error_no_dirauth_relay b/src/test/conf_examples/pt_04/error_no_dirauth_relay new file mode 100644 index 000000000..9f9c0fd8f --- /dev/null +++ b/src/test/conf_examples/pt_04/error_no_dirauth_relay @@ -0,0 +1 @@ +This tor was built with relay mode disabled. diff --git a/src/test/conf_examples/pt_04/expected b/src/test/conf_examples/pt_04/expected new file mode 100644 index 000000000..9087f600e --- /dev/null +++ b/src/test/conf_examples/pt_04/expected @@ -0,0 +1,3 @@ +ExtORPortCookieAuthFile / +ExtORPort 1 +ServerTransportPlugin bad3 exec / diff --git a/src/test/conf_examples/pt_04/torrc b/src/test/conf_examples/pt_04/torrc new file mode 100644 index 000000000..18bb28f9c --- /dev/null +++ b/src/test/conf_examples/pt_04/torrc @@ -0,0 +1,6 @@ +# Relay PT tests +# Options from relay/transport_config.c +# Try a bad cookie auth file +ExtORPort 1 +ExtORPortCookieAuthFile / +ServerTransportPlugin bad3 exec / diff --git a/src/test/conf_examples/pt_05/error_no_dirauth_relay b/src/test/conf_examples/pt_05/error_no_dirauth_relay new file mode 100644 index 000000000..9f9c0fd8f --- /dev/null +++ b/src/test/conf_examples/pt_05/error_no_dirauth_relay @@ -0,0 +1 @@ +This tor was built with relay mode disabled. diff --git a/src/test/conf_examples/pt_05/expected b/src/test/conf_examples/pt_05/expected new file mode 100644 index 000000000..61568bb9a --- /dev/null +++ b/src/test/conf_examples/pt_05/expected @@ -0,0 +1,4 @@ +ExtORPort 1 +Nickname Unnamed +ORPort 2 +ServerTransportPlugin bad3 exec / diff --git a/src/test/conf_examples/pt_05/torrc b/src/test/conf_examples/pt_05/torrc new file mode 100644 index 000000000..55c569bb1 --- /dev/null +++ b/src/test/conf_examples/pt_05/torrc @@ -0,0 +1,6 @@ +# Relay PT tests +# Options from relay/transport_config.c +# Try a valid minimal config +ORPort 2 +ExtORPort 1 +ServerTransportPlugin bad3 exec / diff --git a/src/test/conf_examples/pt_06/error_no_dirauth_relay b/src/test/conf_examples/pt_06/error_no_dirauth_relay new file mode 100644 index 000000000..9f9c0fd8f --- /dev/null +++ b/src/test/conf_examples/pt_06/error_no_dirauth_relay @@ -0,0 +1 @@ +This tor was built with relay mode disabled. diff --git a/src/test/conf_examples/pt_06/expected b/src/test/conf_examples/pt_06/expected new file mode 100644 index 000000000..d5788b92c --- /dev/null +++ b/src/test/conf_examples/pt_06/expected @@ -0,0 +1,6 @@ +ExtORPortCookieAuthFile / +ExtORPortCookieAuthFileGroupReadable 1 +ExtORPort 1 +ServerTransportListenAddr bad3 127.0.0.1:2 +ServerTransportOptions bad3 a=b +ServerTransportPlugin bad3 exec / diff --git a/src/test/conf_examples/pt_06/torrc b/src/test/conf_examples/pt_06/torrc new file mode 100644 index 000000000..20cfc329a --- /dev/null +++ b/src/test/conf_examples/pt_06/torrc @@ -0,0 +1,9 @@ +# Relay PT tests +# Options from relay/transport_config.c +# Try a config with all the options +ExtORPort 1 +ExtORPortCookieAuthFile / +ExtORPortCookieAuthFileGroupReadable 1 +ServerTransportPlugin bad3 exec / +ServerTransportListenAddr bad3 127.0.0.1:2 +ServerTransportOptions bad3 a=b diff --git a/src/test/conf_examples/pt_07/error_no_dirauth_relay b/src/test/conf_examples/pt_07/error_no_dirauth_relay new file mode 100644 index 000000000..9f9c0fd8f --- /dev/null +++ b/src/test/conf_examples/pt_07/error_no_dirauth_relay @@ -0,0 +1 @@ +This tor was built with relay mode disabled. diff --git a/src/test/conf_examples/pt_07/expected b/src/test/conf_examples/pt_07/expected new file mode 100644 index 000000000..c3a75dc40 --- /dev/null +++ b/src/test/conf_examples/pt_07/expected @@ -0,0 +1,4 @@ +ExtORPort 2.2.2.2:1 +Nickname Unnamed +ORPort 2 +ServerTransportPlugin bad3 exec / diff --git a/src/test/conf_examples/pt_07/torrc b/src/test/conf_examples/pt_07/torrc new file mode 100644 index 000000000..40eaf50e6 --- /dev/null +++ b/src/test/conf_examples/pt_07/torrc @@ -0,0 +1,6 @@ +# Relay PT tests +# Options from relay/transport_config.c +# Try a valid config with a risky ExtORPort address +ORPort 2 +ExtORPort 2.2.2.2:1 +ServerTransportPlugin bad3 exec / diff --git a/src/test/conf_examples/pt_08/error b/src/test/conf_examples/pt_08/error new file mode 100644 index 000000000..7931bbb4b --- /dev/null +++ b/src/test/conf_examples/pt_08/error @@ -0,0 +1 @@ +ExtORPort does not support unix sockets \ No newline at end of file diff --git a/src/test/conf_examples/pt_08/error_no_dirauth_relay b/src/test/conf_examples/pt_08/error_no_dirauth_relay new file mode 100644 index 000000000..9f9c0fd8f --- /dev/null +++ b/src/test/conf_examples/pt_08/error_no_dirauth_relay @@ -0,0 +1 @@ +This tor was built with relay mode disabled. diff --git a/src/test/conf_examples/pt_08/torrc b/src/test/conf_examples/pt_08/torrc new file mode 100644 index 000000000..bf36a185a --- /dev/null +++ b/src/test/conf_examples/pt_08/torrc @@ -0,0 +1,5 @@ +# Relay PT tests +# Options from relay/transport_config.c +# Try an invalid config with a unix socket for ExtORPort +ExtORPort unix:/ +ServerTransportPlugin bad3 exec / diff --git a/src/test/conf_examples/pt_09/error_no_dirauth_relay b/src/test/conf_examples/pt_09/error_no_dirauth_relay new file mode 100644 index 000000000..9f9c0fd8f --- /dev/null +++ b/src/test/conf_examples/pt_09/error_no_dirauth_relay @@ -0,0 +1 @@ +This tor was built with relay mode disabled. diff --git a/src/test/conf_examples/pt_09/expected b/src/test/conf_examples/pt_09/expected new file mode 100644 index 000000000..e69de29bb diff --git a/src/test/conf_examples/pt_09/torrc b/src/test/conf_examples/pt_09/torrc new file mode 100644 index 000000000..50a8e95b9 --- /dev/null +++ b/src/test/conf_examples/pt_09/torrc @@ -0,0 +1,7 @@ +# Relay PT tests +# Options from relay/transport_config.c +# Try a valid minimal config, with a bad ServerTransportListenAddr +ORPort 2 +ExtORPort 1 +ServerTransportPlugin bad3 exec / +ServerTransportListenAddr bad3 [aaaa::bbbb:ccccc]
tor-commits@lists.torproject.org