diff options
author | Damien Miller <djm@mindrot.org> | 2015-06-30 16:05:40 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2015-06-30 16:05:40 +1000 |
commit | 52fb6b9b034fcfd24bf88cc7be313e9c31de9889 (patch) | |
tree | b10596cd645ccc658b081781a50fe2aa02fc434b | |
parent | 512caddf590857af6aa12218461b5c0441028cf5 (diff) |
skip IPv6-related portions on hosts without IPv6
with Tim Rice
-rw-r--r-- | regress/cfgparse.sh | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/regress/cfgparse.sh b/regress/cfgparse.sh index 7f377d887..736f38976 100644 --- a/regress/cfgparse.sh +++ b/regress/cfgparse.sh | |||
@@ -3,6 +3,11 @@ | |||
3 | 3 | ||
4 | tid="config parse" | 4 | tid="config parse" |
5 | 5 | ||
6 | # This is a reasonable proxy for IPv6 support. | ||
7 | if ! config_defined HAVE_STRUCT_IN6_ADDR ; then | ||
8 | SKIP_IPV6=yes | ||
9 | fi | ||
10 | |||
6 | # We need to use the keys generated for the regression test because sshd -T | 11 | # We need to use the keys generated for the regression test because sshd -T |
7 | # will fail if we're not running with SUDO (no permissions for real keys) or | 12 | # will fail if we're not running with SUDO (no permissions for real keys) or |
8 | # if we are # running tests on a system that has never had sshd installed | 13 | # if we are # running tests on a system that has never had sshd installed |
@@ -26,9 +31,12 @@ verbose "listenaddress order" | |||
26 | cat > $OBJ/sshd_config.0 <<EOD | 31 | cat > $OBJ/sshd_config.0 <<EOD |
27 | listenaddress 1.2.3.4:1234 | 32 | listenaddress 1.2.3.4:1234 |
28 | listenaddress 1.2.3.4:5678 | 33 | listenaddress 1.2.3.4:5678 |
34 | EOD | ||
35 | [ X${SKIP_IPV6} = Xyes ] || cat >> $OBJ/sshd_config.0 <<EOD | ||
29 | listenaddress [::1]:1234 | 36 | listenaddress [::1]:1234 |
30 | listenaddress [::1]:5678 | 37 | listenaddress [::1]:5678 |
31 | EOD | 38 | EOD |
39 | |||
32 | # test input sets. should all result in the output above. | 40 | # test input sets. should all result in the output above. |
33 | # test 1: addressfamily and port first | 41 | # test 1: addressfamily and port first |
34 | cat > $OBJ/sshd_config.1 <<EOD | 42 | cat > $OBJ/sshd_config.1 <<EOD |
@@ -37,8 +45,11 @@ addressfamily any | |||
37 | port 1234 | 45 | port 1234 |
38 | port 5678 | 46 | port 5678 |
39 | listenaddress 1.2.3.4 | 47 | listenaddress 1.2.3.4 |
48 | EOD | ||
49 | [ X${SKIP_IPV6} = Xyes ] || cat >> $OBJ/sshd_config.1 <<EOD | ||
40 | listenaddress ::1 | 50 | listenaddress ::1 |
41 | EOD | 51 | EOD |
52 | |||
42 | ($SUDO ${SSHD} -T -f $OBJ/sshd_config.1 | \ | 53 | ($SUDO ${SSHD} -T -f $OBJ/sshd_config.1 | \ |
43 | grep 'listenaddress ' >$OBJ/sshd_config.2 && | 54 | grep 'listenaddress ' >$OBJ/sshd_config.2 && |
44 | diff $OBJ/sshd_config.0 $OBJ/sshd_config.2) || \ | 55 | diff $OBJ/sshd_config.0 $OBJ/sshd_config.2) || \ |
@@ -47,11 +58,14 @@ EOD | |||
47 | cat > $OBJ/sshd_config.1 <<EOD | 58 | cat > $OBJ/sshd_config.1 <<EOD |
48 | ${SSHD_KEYS} | 59 | ${SSHD_KEYS} |
49 | listenaddress 1.2.3.4 | 60 | listenaddress 1.2.3.4 |
50 | listenaddress ::1 | ||
51 | port 1234 | 61 | port 1234 |
52 | port 5678 | 62 | port 5678 |
53 | addressfamily any | 63 | addressfamily any |
54 | EOD | 64 | EOD |
65 | [ X${SKIP_IPV6} = Xyes ] || cat >> $OBJ/sshd_config.1 <<EOD | ||
66 | listenaddress ::1 | ||
67 | EOD | ||
68 | |||
55 | ($SUDO ${SSHD} -T -f $OBJ/sshd_config.1 | \ | 69 | ($SUDO ${SSHD} -T -f $OBJ/sshd_config.1 | \ |
56 | grep 'listenaddress ' >$OBJ/sshd_config.2 && | 70 | grep 'listenaddress ' >$OBJ/sshd_config.2 && |
57 | diff $OBJ/sshd_config.0 $OBJ/sshd_config.2) || \ | 71 | diff $OBJ/sshd_config.0 $OBJ/sshd_config.2) || \ |