summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2017-01-01 15:21:10 +0000
committerColin Watson <cjwatson@debian.org>2017-01-16 15:02:54 +0000
commit7ce93c802065cd926e7cbfd10e629f3a2d352301 (patch)
treef6a402fa3f0cca09e5fca7adafeb1e3cd22a1056 /regress
parent2b53482aec037f0747198f19e449f51d921acd30 (diff)
Make integrity tests more robust against timeouts
If the first test in a series for a given MAC happens to modify the low bytes of a packet length, then ssh will time out and this will be interpreted as a test failure. Handle this failure mode. Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=2658 Patch-Name: regress-integrity-robust.patch Last-Update: 2017-01-01
Diffstat (limited to 'regress')
-rw-r--r--regress/integrity.sh9
1 files changed, 5 insertions, 4 deletions
diff --git a/regress/integrity.sh b/regress/integrity.sh
index 39d310deb..fd7d58bcb 100644
--- a/regress/integrity.sh
+++ b/regress/integrity.sh
@@ -5,8 +5,6 @@ tid="integrity"
5cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak 5cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak
6 6
7# start at byte 2900 (i.e. after kex) and corrupt at different offsets 7# start at byte 2900 (i.e. after kex) and corrupt at different offsets
8# XXX the test hangs if we modify the low bytes of the packet length
9# XXX and ssh tries to read...
10tries=10 8tries=10
11startoffset=2900 9startoffset=2900
12macs=`${SSH} -Q mac` 10macs=`${SSH} -Q mac`
@@ -27,6 +25,7 @@ for m in $macs; do
27 elen=0 25 elen=0
28 epad=0 26 epad=0
29 emac=0 27 emac=0
28 etmo=0
30 ecnt=0 29 ecnt=0
31 skip=0 30 skip=0
32 for off in `jot $tries $startoffset`; do 31 for off in `jot $tries $startoffset`; do
@@ -61,14 +60,16 @@ for m in $macs; do
61 Corrupted?MAC* | *message?authentication?code?incorrect*) 60 Corrupted?MAC* | *message?authentication?code?incorrect*)
62 emac=`expr $emac + 1`; skip=0;; 61 emac=`expr $emac + 1`; skip=0;;
63 padding*) epad=`expr $epad + 1`; skip=0;; 62 padding*) epad=`expr $epad + 1`; skip=0;;
63 *Timeout,?server*)
64 etmo=`expr $etmo + 1`; skip=0;;
64 *) fail "unexpected error mac $m at $off: $out";; 65 *) fail "unexpected error mac $m at $off: $out";;
65 esac 66 esac
66 done 67 done
67 verbose "test $tid: $ecnt errors: mac $emac padding $epad length $elen" 68 verbose "test $tid: $ecnt errors: mac $emac padding $epad length $elen timeout $etmo"
68 if [ $emac -eq 0 ]; then 69 if [ $emac -eq 0 ]; then
69 fail "$m: no mac errors" 70 fail "$m: no mac errors"
70 fi 71 fi
71 expect=`expr $ecnt - $epad - $elen` 72 expect=`expr $ecnt - $epad - $elen - $etmo`
72 if [ $emac -ne $expect ]; then 73 if [ $emac -ne $expect ]; then
73 fail "$m: expected $expect mac errors, got $emac" 74 fail "$m: expected $expect mac errors, got $emac"
74 fi 75 fi