summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2017-03-29 01:35:00 +0100
committerColin Watson <cjwatson@debian.org>2017-03-29 01:35:00 +0100
commit6fabaf6fd9b07cc8bc6a17c9c4a5b76849cfc874 (patch)
treeb4377d09196e24e2c6f2c2128f66f92cf7891105 /regress
parent971a7653746a6972b907dfe0ce139c06e4a6f482 (diff)
parentd38f05dbdd291212bc95ea80648b72b7177e9f4e (diff)
Import openssh_7.5p1.orig.tar.gz
Diffstat (limited to 'regress')
-rw-r--r--regress/Makefile1
-rw-r--r--regress/agent-getpeereid.sh8
-rw-r--r--regress/allow-deny-users.sh2
-rw-r--r--regress/cert-file.sh53
-rw-r--r--regress/forwarding.sh44
-rw-r--r--regress/integrity.sh5
-rw-r--r--regress/test-exec.sh4
-rw-r--r--regress/unittests/Makefile7
-rw-r--r--regress/unittests/conversion/Makefile10
-rw-r--r--regress/unittests/conversion/tests.c51
-rw-r--r--regress/unittests/match/tests.c21
-rw-r--r--regress/unittests/test_helper/test_helper.c13
-rw-r--r--regress/unittests/test_helper/test_helper.h17
-rw-r--r--regress/unittests/utf8/tests.c65
14 files changed, 231 insertions, 70 deletions
diff --git a/regress/Makefile b/regress/Makefile
index c2dba4fdf..b23496b98 100644
--- a/regress/Makefile
+++ b/regress/Makefile
@@ -222,6 +222,7 @@ unit:
222 $$V ${.OBJDIR}/unittests/sshkey/test_sshkey \ 222 $$V ${.OBJDIR}/unittests/sshkey/test_sshkey \
223 -d ${.CURDIR}/unittests/sshkey/testdata ; \ 223 -d ${.CURDIR}/unittests/sshkey/testdata ; \
224 $$V ${.OBJDIR}/unittests/bitmap/test_bitmap ; \ 224 $$V ${.OBJDIR}/unittests/bitmap/test_bitmap ; \
225 $$V ${.OBJDIR}/unittests/conversion/test_conversion ; \
225 $$V ${.OBJDIR}/unittests/kex/test_kex ; \ 226 $$V ${.OBJDIR}/unittests/kex/test_kex ; \
226 $$V ${.OBJDIR}/unittests/hostkeys/test_hostkeys \ 227 $$V ${.OBJDIR}/unittests/hostkeys/test_hostkeys \
227 -d ${.CURDIR}/unittests/hostkeys/testdata ; \ 228 -d ${.CURDIR}/unittests/hostkeys/testdata ; \
diff --git a/regress/agent-getpeereid.sh b/regress/agent-getpeereid.sh
index 91621a59c..34bced154 100644
--- a/regress/agent-getpeereid.sh
+++ b/regress/agent-getpeereid.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: agent-getpeereid.sh,v 1.7 2016/09/26 21:34:38 bluhm Exp $ 1# $OpenBSD: agent-getpeereid.sh,v 1.8 2017/01/06 02:51:16 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="disallow agent attach from other uid" 4tid="disallow agent attach from other uid"
@@ -32,17 +32,17 @@ if [ $r -ne 0 ]; then
32else 32else
33 chmod 644 ${SSH_AUTH_SOCK} 33 chmod 644 ${SSH_AUTH_SOCK}
34 34
35 ssh-add -l > /dev/null 2>&1 35 ${SSHADD} -l > /dev/null 2>&1
36 r=$? 36 r=$?
37 if [ $r -ne 1 ]; then 37 if [ $r -ne 1 ]; then
38 fail "ssh-add failed with $r != 1" 38 fail "ssh-add failed with $r != 1"
39 fi 39 fi
40 if test -z "$sudo" ; then 40 if test -z "$sudo" ; then
41 # doas 41 # doas
42 ${SUDO} -n -u ${UNPRIV} ssh-add -l 2>/dev/null 42 ${SUDO} -n -u ${UNPRIV} ${SSHADD} -l 2>/dev/null
43 else 43 else
44 # sudo 44 # sudo
45 < /dev/null ${SUDO} -S -u ${UNPRIV} ssh-add -l 2>/dev/null 45 < /dev/null ${SUDO} -S -u ${UNPRIV} ${SSHADD} -l 2>/dev/null
46 fi 46 fi
47 r=$? 47 r=$?
48 if [ $r -lt 2 ]; then 48 if [ $r -lt 2 ]; then
diff --git a/regress/allow-deny-users.sh b/regress/allow-deny-users.sh
index 32a269afa..86805e193 100644
--- a/regress/allow-deny-users.sh
+++ b/regress/allow-deny-users.sh
@@ -4,7 +4,7 @@
4tid="AllowUsers/DenyUsers" 4tid="AllowUsers/DenyUsers"
5 5
6me="$LOGNAME" 6me="$LOGNAME"
7if [ "x$me" == "x" ]; then 7if [ "x$me" = "x" ]; then
8 me=`whoami` 8 me=`whoami`
9fi 9fi
10other="nobody" 10other="nobody"
diff --git a/regress/cert-file.sh b/regress/cert-file.sh
index b184e7fea..43b8e0201 100644
--- a/regress/cert-file.sh
+++ b/regress/cert-file.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: cert-file.sh,v 1.4 2016/12/16 02:48:55 djm Exp $ 1# $OpenBSD: cert-file.sh,v 1.5 2017/03/11 23:44:16 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="ssh with certificates" 4tid="ssh with certificates"
@@ -17,24 +17,59 @@ ${SSHKEYGEN} -q -N '' -t ed25519 -f $OBJ/user_key1 || \
17 fatal "ssh-keygen failed" 17 fatal "ssh-keygen failed"
18${SSHKEYGEN} -q -N '' -t ed25519 -f $OBJ/user_key2 || \ 18${SSHKEYGEN} -q -N '' -t ed25519 -f $OBJ/user_key2 || \
19 fatal "ssh-keygen failed" 19 fatal "ssh-keygen failed"
20${SSHKEYGEN} -q -N '' -t ed25519 -f $OBJ/user_key3 || \
21 fatal "ssh-keygen failed"
22${SSHKEYGEN} -q -N '' -t ed25519 -f $OBJ/user_key4 || \
23 fatal "ssh-keygen failed"
24${SSHKEYGEN} -q -N '' -t ed25519 -f $OBJ/user_key5 || \
25 fatal "ssh-keygen failed"
26
20# Move the certificate to a different address to better control 27# Move the certificate to a different address to better control
21# when it is offered. 28# when it is offered.
22${SSHKEYGEN} -q -s $OBJ/user_ca_key1 -I "regress user key for $USER" \ 29${SSHKEYGEN} -q -s $OBJ/user_ca_key1 -I "regress user key for $USER" \
23 -z $$ -n ${USER} $OBJ/user_key1 || 30 -z $$ -n ${USER} $OBJ/user_key1 ||
24 fail "couldn't sign user_key1 with user_ca_key1" 31 fatal "couldn't sign user_key1 with user_ca_key1"
25mv $OBJ/user_key1-cert.pub $OBJ/cert_user_key1_1.pub 32mv $OBJ/user_key1-cert.pub $OBJ/cert_user_key1_1.pub
26${SSHKEYGEN} -q -s $OBJ/user_ca_key2 -I "regress user key for $USER" \ 33${SSHKEYGEN} -q -s $OBJ/user_ca_key2 -I "regress user key for $USER" \
27 -z $$ -n ${USER} $OBJ/user_key1 || 34 -z $$ -n ${USER} $OBJ/user_key1 ||
28 fail "couldn't sign user_key1 with user_ca_key2" 35 fatal "couldn't sign user_key1 with user_ca_key2"
29mv $OBJ/user_key1-cert.pub $OBJ/cert_user_key1_2.pub 36mv $OBJ/user_key1-cert.pub $OBJ/cert_user_key1_2.pub
37${SSHKEYGEN} -q -s $OBJ/user_ca_key1 -I "regress user key for $USER" \
38 -z $$ -n ${USER} $OBJ/user_key3 ||
39 fatal "couldn't sign user_key3 with user_ca_key1"
40rm $OBJ/user_key3.pub # to test use of private key w/o public half.
41${SSHKEYGEN} -q -s $OBJ/user_ca_key1 -I "regress user key for $USER" \
42 -z $$ -n ${USER} $OBJ/user_key4 ||
43 fatal "couldn't sign user_key4 with user_ca_key1"
44rm $OBJ/user_key4 $OBJ/user_key4.pub # to test no matching pub/private key case.
30 45
31trace 'try with identity files' 46trace 'try with identity files'
32opts="-F $OBJ/ssh_proxy -oIdentitiesOnly=yes" 47opts="-F $OBJ/ssh_proxy -oIdentitiesOnly=yes"
33opts2="$opts -i $OBJ/user_key1 -i $OBJ/user_key2" 48opts2="$opts -i $OBJ/user_key1 -i $OBJ/user_key2"
34echo "cert-authority $(cat $OBJ/user_ca_key1.pub)" > $OBJ/authorized_keys_$USER 49echo "cert-authority $(cat $OBJ/user_ca_key1.pub)" > $OBJ/authorized_keys_$USER
35 50
51# Make a clean config that doesn't have any pre-added identities.
52cat $OBJ/ssh_proxy | grep -v IdentityFile > $OBJ/no_identity_config
53
54# XXX: verify that certificate used was what we expect. Needs exposure of
55# keys via enviornment variable or similar.
56
36for p in ${SSH_PROTOCOLS}; do 57for p in ${SSH_PROTOCOLS}; do
58 # Key with no .pub should work - finding the equivalent *-cert.pub.
59 verbose "protocol $p: identity cert with no plain public file"
60 ${SSH} -F $OBJ/no_identity_config -oIdentitiesOnly=yes \
61 -i $OBJ/user_key3 somehost exit 5$p
62 [ $? -ne 5$p ] && fail "ssh failed"
63
64 # CertificateFile matching private key with no .pub file should work.
65 verbose "protocol $p: CertificateFile with no plain public file"
66 ${SSH} -F $OBJ/no_identity_config -oIdentitiesOnly=yes \
67 -oCertificateFile=$OBJ/user_key3-cert.pub \
68 -i $OBJ/user_key3 somehost exit 5$p
69 [ $? -ne 5$p ] && fail "ssh failed"
70
37 # Just keys should fail 71 # Just keys should fail
72 verbose "protocol $p: plain keys"
38 ${SSH} $opts2 somehost exit 5$p 73 ${SSH} $opts2 somehost exit 5$p
39 r=$? 74 r=$?
40 if [ $r -eq 5$p ]; then 75 if [ $r -eq 5$p ]; then
@@ -42,6 +77,7 @@ for p in ${SSH_PROTOCOLS}; do
42 fi 77 fi
43 78
44 # Keys with untrusted cert should fail. 79 # Keys with untrusted cert should fail.
80 verbose "protocol $p: untrusted cert"
45 opts3="$opts2 -oCertificateFile=$OBJ/cert_user_key1_2.pub" 81 opts3="$opts2 -oCertificateFile=$OBJ/cert_user_key1_2.pub"
46 ${SSH} $opts3 somehost exit 5$p 82 ${SSH} $opts3 somehost exit 5$p
47 r=$? 83 r=$?
@@ -50,6 +86,7 @@ for p in ${SSH_PROTOCOLS}; do
50 fi 86 fi
51 87
52 # Good cert with bad key should fail. 88 # Good cert with bad key should fail.
89 verbose "protocol $p: good cert, bad key"
53 opts3="$opts -i $OBJ/user_key2" 90 opts3="$opts -i $OBJ/user_key2"
54 opts3="$opts3 -oCertificateFile=$OBJ/cert_user_key1_1.pub" 91 opts3="$opts3 -oCertificateFile=$OBJ/cert_user_key1_1.pub"
55 ${SSH} $opts3 somehost exit 5$p 92 ${SSH} $opts3 somehost exit 5$p
@@ -59,6 +96,7 @@ for p in ${SSH_PROTOCOLS}; do
59 fi 96 fi
60 97
61 # Keys with one trusted cert, should succeed. 98 # Keys with one trusted cert, should succeed.
99 verbose "protocol $p: single trusted"
62 opts3="$opts2 -oCertificateFile=$OBJ/cert_user_key1_1.pub" 100 opts3="$opts2 -oCertificateFile=$OBJ/cert_user_key1_1.pub"
63 ${SSH} $opts3 somehost exit 5$p 101 ${SSH} $opts3 somehost exit 5$p
64 r=$? 102 r=$?
@@ -67,6 +105,7 @@ for p in ${SSH_PROTOCOLS}; do
67 fi 105 fi
68 106
69 # Multiple certs and keys, with one trusted cert, should succeed. 107 # Multiple certs and keys, with one trusted cert, should succeed.
108 verbose "protocol $p: multiple trusted"
70 opts3="$opts2 -oCertificateFile=$OBJ/cert_user_key1_2.pub" 109 opts3="$opts2 -oCertificateFile=$OBJ/cert_user_key1_2.pub"
71 opts3="$opts3 -oCertificateFile=$OBJ/cert_user_key1_1.pub" 110 opts3="$opts3 -oCertificateFile=$OBJ/cert_user_key1_1.pub"
72 ${SSH} $opts3 somehost exit 5$p 111 ${SSH} $opts3 somehost exit 5$p
@@ -74,14 +113,6 @@ for p in ${SSH_PROTOCOLS}; do
74 if [ $r -ne 5$p ]; then 113 if [ $r -ne 5$p ]; then
75 fail "ssh failed with multiple certs in protocol $p" 114 fail "ssh failed with multiple certs in protocol $p"
76 fi 115 fi
77
78 #Keys with trusted certificate specified in config options, should succeed.
79 opts3="$opts2 -oCertificateFile=$OBJ/cert_user_key1_1.pub"
80 ${SSH} $opts3 somehost exit 5$p
81 r=$?
82 if [ $r -ne 5$p ]; then
83 fail "ssh failed with trusted cert in config in protocol $p"
84 fi
85done 116done
86 117
87#next, using an agent in combination with the keys 118#next, using an agent in combination with the keys
diff --git a/regress/forwarding.sh b/regress/forwarding.sh
index 2539db9b7..45c596d7d 100644
--- a/regress/forwarding.sh
+++ b/regress/forwarding.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: forwarding.sh,v 1.16 2016/04/14 23:57:17 djm Exp $ 1# $OpenBSD: forwarding.sh,v 1.19 2017/01/30 05:22:14 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="local and remote forwarding" 4tid="local and remote forwarding"
@@ -10,8 +10,7 @@ start_sshd
10base=33 10base=33
11last=$PORT 11last=$PORT
12fwd="" 12fwd=""
13CTL=$OBJ/ctl-sock 13CTL=/tmp/openssh.regress.ctl-sock.$$
14rm -f $CTL
15 14
16for j in 0 1 2; do 15for j in 0 1 2; do
17 for i in 0 1 2; do 16 for i in 0 1 2; do
@@ -29,7 +28,8 @@ for p in ${SSH_PROTOCOLS}; do
29 q=$p 28 q=$p
30 fi 29 fi
31 trace "start forwarding, fork to background" 30 trace "start forwarding, fork to background"
32 ${SSH} -$p -F $OBJ/ssh_config -f $fwd somehost sleep 10 31 rm -f $CTL
32 ${SSH} -S $CTL -M -$p -F $OBJ/ssh_config -f $fwd somehost sleep 10
33 33
34 trace "transfer over forwarded channels and check result" 34 trace "transfer over forwarded channels and check result"
35 ${SSH} -$q -F $OBJ/ssh_config -p$last -o 'ConnectionAttempts=4' \ 35 ${SSH} -$q -F $OBJ/ssh_config -p$last -o 'ConnectionAttempts=4' \
@@ -37,7 +37,7 @@ for p in ${SSH_PROTOCOLS}; do
37 test -s ${COPY} || fail "failed copy of ${DATA}" 37 test -s ${COPY} || fail "failed copy of ${DATA}"
38 cmp ${DATA} ${COPY} || fail "corrupted copy of ${DATA}" 38 cmp ${DATA} ${COPY} || fail "corrupted copy of ${DATA}"
39 39
40 sleep 10 40 ${SSH} -F $OBJ/ssh_config -S $CTL -O exit somehost
41done 41done
42 42
43for p in ${SSH_PROTOCOLS}; do 43for p in ${SSH_PROTOCOLS}; do
@@ -52,7 +52,7 @@ for d in L R; do
52 -$d ${base}04:127.0.0.1:$PORT \ 52 -$d ${base}04:127.0.0.1:$PORT \
53 -oExitOnForwardFailure=yes somehost true 53 -oExitOnForwardFailure=yes somehost true
54 if [ $? != 0 ]; then 54 if [ $? != 0 ]; then
55 fail "connection failed, should not" 55 fatal "connection failed, should not"
56 else 56 else
57 # this one should fail 57 # this one should fail
58 ${SSH} -q -$p -F $OBJ/ssh_config \ 58 ${SSH} -q -$p -F $OBJ/ssh_config \
@@ -75,30 +75,32 @@ for p in ${SSH_PROTOCOLS}; do
75 ${SSH} -$p -F $OBJ/ssh_config -oClearAllForwardings=yes somehost true 75 ${SSH} -$p -F $OBJ/ssh_config -oClearAllForwardings=yes somehost true
76 76
77 trace "clear local forward proto $p" 77 trace "clear local forward proto $p"
78 ${SSH} -$p -f -F $OBJ/ssh_config -L ${base}01:127.0.0.1:$PORT \ 78 rm -f $CTL
79 ${SSH} -S $CTL -M -$p -f -F $OBJ/ssh_config -L ${base}01:127.0.0.1:$PORT \
79 -oClearAllForwardings=yes somehost sleep 10 80 -oClearAllForwardings=yes somehost sleep 10
80 if [ $? != 0 ]; then 81 if [ $? != 0 ]; then
81 fail "connection failed with cleared local forwarding" 82 fail "connection failed with cleared local forwarding"
82 else 83 else
83 # this one should fail 84 # this one should fail
84 ${SSH} -$p -F $OBJ/ssh_config -p ${base}01 true \ 85 ${SSH} -$p -F $OBJ/ssh_config -p ${base}01 somehost true \
85 >>$TEST_REGRESS_LOGFILE 2>&1 && \ 86 >>$TEST_REGRESS_LOGFILE 2>&1 && \
86 fail "local forwarding not cleared" 87 fail "local forwarding not cleared"
87 fi 88 fi
88 sleep 10 89 ${SSH} -F $OBJ/ssh_config -S $CTL -O exit somehost
89 90
90 trace "clear remote forward proto $p" 91 trace "clear remote forward proto $p"
91 ${SSH} -$p -f -F $OBJ/ssh_config -R ${base}01:127.0.0.1:$PORT \ 92 rm -f $CTL
93 ${SSH} -S $CTL -M -$p -f -F $OBJ/ssh_config -R ${base}01:127.0.0.1:$PORT \
92 -oClearAllForwardings=yes somehost sleep 10 94 -oClearAllForwardings=yes somehost sleep 10
93 if [ $? != 0 ]; then 95 if [ $? != 0 ]; then
94 fail "connection failed with cleared remote forwarding" 96 fail "connection failed with cleared remote forwarding"
95 else 97 else
96 # this one should fail 98 # this one should fail
97 ${SSH} -$p -F $OBJ/ssh_config -p ${base}01 true \ 99 ${SSH} -$p -F $OBJ/ssh_config -p ${base}01 somehost true \
98 >>$TEST_REGRESS_LOGFILE 2>&1 && \ 100 >>$TEST_REGRESS_LOGFILE 2>&1 && \
99 fail "remote forwarding not cleared" 101 fail "remote forwarding not cleared"
100 fi 102 fi
101 sleep 10 103 ${SSH} -F $OBJ/ssh_config -S $CTL -O exit somehost
102done 104done
103 105
104for p in 2; do 106for p in 2; do
@@ -115,6 +117,7 @@ echo "LocalForward ${base}01 127.0.0.1:$PORT" >> $OBJ/ssh_config
115echo "RemoteForward ${base}02 127.0.0.1:${base}01" >> $OBJ/ssh_config 117echo "RemoteForward ${base}02 127.0.0.1:${base}01" >> $OBJ/ssh_config
116for p in ${SSH_PROTOCOLS}; do 118for p in ${SSH_PROTOCOLS}; do
117 trace "config file: start forwarding, fork to background" 119 trace "config file: start forwarding, fork to background"
120 rm -f $CTL
118 ${SSH} -S $CTL -M -$p -F $OBJ/ssh_config -f somehost sleep 10 121 ${SSH} -S $CTL -M -$p -F $OBJ/ssh_config -f somehost sleep 10
119 122
120 trace "config file: transfer over forwarded channels and check result" 123 trace "config file: transfer over forwarded channels and check result"
@@ -123,21 +126,24 @@ for p in ${SSH_PROTOCOLS}; do
123 test -s ${COPY} || fail "failed copy of ${DATA}" 126 test -s ${COPY} || fail "failed copy of ${DATA}"
124 cmp ${DATA} ${COPY} || fail "corrupted copy of ${DATA}" 127 cmp ${DATA} ${COPY} || fail "corrupted copy of ${DATA}"
125 128
126 ${SSH} -S $CTL -O exit somehost 129 ${SSH} -F $OBJ/ssh_config -S $CTL -O exit somehost
127done 130done
128 131
129for p in 2; do 132for p in 2; do
130 trace "transfer over chained unix domain socket forwards and check result" 133 trace "transfer over chained unix domain socket forwards and check result"
131 rm -f $OBJ/unix-[123].fwd 134 rm -f $OBJ/unix-[123].fwd
132 ${SSH} -f -F $OBJ/ssh_config -R${base}01:[$OBJ/unix-1.fwd] somehost sleep 10 135 rm -f $CTL $CTL.[123]
133 ${SSH} -f -F $OBJ/ssh_config -L[$OBJ/unix-1.fwd]:[$OBJ/unix-2.fwd] somehost sleep 10 136 ${SSH} -S $CTL -M -f -F $OBJ/ssh_config -R${base}01:[$OBJ/unix-1.fwd] somehost sleep 10
134 ${SSH} -f -F $OBJ/ssh_config -R[$OBJ/unix-2.fwd]:[$OBJ/unix-3.fwd] somehost sleep 10 137 ${SSH} -S $CTL.1 -M -f -F $OBJ/ssh_config -L[$OBJ/unix-1.fwd]:[$OBJ/unix-2.fwd] somehost sleep 10
135 ${SSH} -f -F $OBJ/ssh_config -L[$OBJ/unix-3.fwd]:127.0.0.1:$PORT somehost sleep 10 138 ${SSH} -S $CTL.2 -M -f -F $OBJ/ssh_config -R[$OBJ/unix-2.fwd]:[$OBJ/unix-3.fwd] somehost sleep 10
139 ${SSH} -S $CTL.3 -M -f -F $OBJ/ssh_config -L[$OBJ/unix-3.fwd]:127.0.0.1:$PORT somehost sleep 10
136 ${SSH} -F $OBJ/ssh_config -p${base}01 -o 'ConnectionAttempts=4' \ 140 ${SSH} -F $OBJ/ssh_config -p${base}01 -o 'ConnectionAttempts=4' \
137 somehost cat ${DATA} > ${COPY} 141 somehost cat ${DATA} > ${COPY}
138 test -s ${COPY} || fail "failed copy ${DATA}" 142 test -s ${COPY} || fail "failed copy ${DATA}"
139 cmp ${DATA} ${COPY} || fail "corrupted copy of ${DATA}" 143 cmp ${DATA} ${COPY} || fail "corrupted copy of ${DATA}"
140 144
141 #wait 145 ${SSH} -F $OBJ/ssh_config -S $CTL -O exit somehost
142 sleep 10 146 ${SSH} -F $OBJ/ssh_config -S $CTL.1 -O exit somehost
147 ${SSH} -F $OBJ/ssh_config -S $CTL.2 -O exit somehost
148 ${SSH} -F $OBJ/ssh_config -S $CTL.3 -O exit somehost
143done 149done
diff --git a/regress/integrity.sh b/regress/integrity.sh
index 39d310deb..1df2924f5 100644
--- a/regress/integrity.sh
+++ b/regress/integrity.sh
@@ -1,12 +1,10 @@
1# $OpenBSD: integrity.sh,v 1.19 2016/11/25 02:56:49 dtucker Exp $ 1# $OpenBSD: integrity.sh,v 1.20 2017/01/06 02:26:10 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="integrity" 4tid="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
diff --git a/regress/test-exec.sh b/regress/test-exec.sh
index bfa48803b..dc033cd96 100644
--- a/regress/test-exec.sh
+++ b/regress/test-exec.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: test-exec.sh,v 1.58 2016/12/16 01:06:27 dtucker Exp $ 1# $OpenBSD: test-exec.sh,v 1.59 2017/02/07 23:03:11 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4#SUDO=sudo 4#SUDO=sudo
@@ -444,12 +444,10 @@ Host *
444 User $USER 444 User $USER
445 GlobalKnownHostsFile $OBJ/known_hosts 445 GlobalKnownHostsFile $OBJ/known_hosts
446 UserKnownHostsFile $OBJ/known_hosts 446 UserKnownHostsFile $OBJ/known_hosts
447 RSAAuthentication yes
448 PubkeyAuthentication yes 447 PubkeyAuthentication yes
449 ChallengeResponseAuthentication no 448 ChallengeResponseAuthentication no
450 HostbasedAuthentication no 449 HostbasedAuthentication no
451 PasswordAuthentication no 450 PasswordAuthentication no
452 RhostsRSAAuthentication no
453 BatchMode yes 451 BatchMode yes
454 StrictHostKeyChecking yes 452 StrictHostKeyChecking yes
455 LogLevel DEBUG3 453 LogLevel DEBUG3
diff --git a/regress/unittests/Makefile b/regress/unittests/Makefile
index e70b16644..e975f6ca4 100644
--- a/regress/unittests/Makefile
+++ b/regress/unittests/Makefile
@@ -1,5 +1,6 @@
1# $OpenBSD: Makefile,v 1.7 2016/08/19 06:44:13 djm Exp $ 1# $OpenBSD: Makefile,v 1.9 2017/03/14 01:20:29 dtucker Exp $
2REGRESS_FAIL_EARLY= yes 2
3SUBDIR= test_helper sshbuf sshkey bitmap kex hostkeys utf8 match 3REGRESS_FAIL_EARLY?= yes
4SUBDIR= test_helper sshbuf sshkey bitmap kex hostkeys utf8 match conversion
4 5
5.include <bsd.subdir.mk> 6.include <bsd.subdir.mk>
diff --git a/regress/unittests/conversion/Makefile b/regress/unittests/conversion/Makefile
new file mode 100644
index 000000000..cde97dc28
--- /dev/null
+++ b/regress/unittests/conversion/Makefile
@@ -0,0 +1,10 @@
1# $OpenBSD: Makefile,v 1.1 2017/03/14 01:20:29 dtucker Exp $
2
3PROG=test_conversion
4SRCS=tests.c
5REGRESS_TARGETS=run-regress-${PROG}
6
7run-regress-${PROG}: ${PROG}
8 env ${TEST_ENV} ./${PROG}
9
10.include <bsd.regress.mk>
diff --git a/regress/unittests/conversion/tests.c b/regress/unittests/conversion/tests.c
new file mode 100644
index 000000000..6dd77ef42
--- /dev/null
+++ b/regress/unittests/conversion/tests.c
@@ -0,0 +1,51 @@
1/* $OpenBSD: tests.c,v 1.1 2017/03/14 01:20:29 dtucker Exp $ */
2/*
3 * Regress test for conversions
4 *
5 * Placed in the public domain
6 */
7
8#include "includes.h"
9
10#include <sys/types.h>
11#include <sys/param.h>
12#include <stdio.h>
13#ifdef HAVE_STDINT_H
14#include <stdint.h>
15#endif
16#include <stdlib.h>
17#include <string.h>
18
19#include "../test_helper/test_helper.h"
20
21#include "misc.h"
22
23void
24tests(void)
25{
26 char buf[1024];
27
28 TEST_START("conversion_convtime");
29 ASSERT_LONG_EQ(convtime("0"), 0);
30 ASSERT_LONG_EQ(convtime("1"), 1);
31 ASSERT_LONG_EQ(convtime("1S"), 1);
32 /* from the examples in the comment above the function */
33 ASSERT_LONG_EQ(convtime("90m"), 5400);
34 ASSERT_LONG_EQ(convtime("1h30m"), 5400);
35 ASSERT_LONG_EQ(convtime("2d"), 172800);
36 ASSERT_LONG_EQ(convtime("1w"), 604800);
37
38 /* negative time is not allowed */
39 ASSERT_LONG_EQ(convtime("-7"), -1);
40 ASSERT_LONG_EQ(convtime("-9d"), -1);
41
42 /* overflow */
43 snprintf(buf, sizeof buf, "%llu", (unsigned long long)LONG_MAX + 1);
44 ASSERT_LONG_EQ(convtime(buf), -1);
45
46 /* overflow with multiplier */
47 snprintf(buf, sizeof buf, "%lluM", (unsigned long long)LONG_MAX/60 + 1);
48 ASSERT_LONG_EQ(convtime(buf), -1);
49 ASSERT_LONG_EQ(convtime("1000000000000000000000w"), -1);
50 TEST_DONE();
51}
diff --git a/regress/unittests/match/tests.c b/regress/unittests/match/tests.c
index 7ff319c16..e1593367b 100644
--- a/regress/unittests/match/tests.c
+++ b/regress/unittests/match/tests.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tests.c,v 1.3 2016/09/21 17:03:54 djm Exp $ */ 1/* $OpenBSD: tests.c,v 1.4 2017/02/03 23:01:42 djm Exp $ */
2/* 2/*
3 * Regress test for matching functions 3 * Regress test for matching functions
4 * 4 *
@@ -103,6 +103,25 @@ tests(void)
103 /* XXX negated ASSERT_INT_EQ(addr_match_list("127.0.0.1", "!127.0.0.2,10.0.0.1"), 1); */ 103 /* XXX negated ASSERT_INT_EQ(addr_match_list("127.0.0.1", "!127.0.0.2,10.0.0.1"), 1); */
104 TEST_DONE(); 104 TEST_DONE();
105 105
106#define CHECK_FILTER(string,filter,expected) \
107 do { \
108 char *result = match_filter_list((string), (filter)); \
109 ASSERT_STRING_EQ(result, expected); \
110 free(result); \
111 } while (0)
112
113 TEST_START("match_filter_list");
114 CHECK_FILTER("a,b,c", "", "a,b,c");
115 CHECK_FILTER("a,b,c", "a", "b,c");
116 CHECK_FILTER("a,b,c", "b", "a,c");
117 CHECK_FILTER("a,b,c", "c", "a,b");
118 CHECK_FILTER("a,b,c", "a,b", "c");
119 CHECK_FILTER("a,b,c", "a,c", "b");
120 CHECK_FILTER("a,b,c", "b,c", "a");
121 CHECK_FILTER("a,b,c", "a,b,c", "");
122 CHECK_FILTER("a,b,c", "b,c", "a");
123 CHECK_FILTER("", "a,b,c", "");
124 TEST_DONE();
106/* 125/*
107 * XXX TODO 126 * XXX TODO
108 * int match_host_and_ip(const char *, const char *, const char *); 127 * int match_host_and_ip(const char *, const char *, const char *);
diff --git a/regress/unittests/test_helper/test_helper.c b/regress/unittests/test_helper/test_helper.c
index 26ca26b5e..f855137fb 100644
--- a/regress/unittests/test_helper/test_helper.c
+++ b/regress/unittests/test_helper/test_helper.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: test_helper.c,v 1.6 2015/03/03 20:42:49 djm Exp $ */ 1/* $OpenBSD: test_helper.c,v 1.7 2017/03/14 01:10:07 dtucker Exp $ */
2/* 2/*
3 * Copyright (c) 2011 Damien Miller <djm@mindrot.org> 3 * Copyright (c) 2011 Damien Miller <djm@mindrot.org>
4 * 4 *
@@ -442,6 +442,17 @@ assert_u_int(const char *file, int line, const char *a1, const char *a2,
442} 442}
443 443
444void 444void
445assert_long(const char *file, int line, const char *a1, const char *a2,
446 long aa1, long aa2, enum test_predicate pred)
447{
448 TEST_CHECK(aa1, aa2, pred);
449 test_header(file, line, a1, a2, "LONG", pred);
450 fprintf(stderr, "%12s = %ld / 0x%lx\n", a1, aa1, aa1);
451 fprintf(stderr, "%12s = %ld / 0x%lx\n", a2, aa2, aa2);
452 test_die();
453}
454
455void
445assert_long_long(const char *file, int line, const char *a1, const char *a2, 456assert_long_long(const char *file, int line, const char *a1, const char *a2,
446 long long aa1, long long aa2, enum test_predicate pred) 457 long long aa1, long long aa2, enum test_predicate pred)
447{ 458{
diff --git a/regress/unittests/test_helper/test_helper.h b/regress/unittests/test_helper/test_helper.h
index 1d9c66986..615b7832b 100644
--- a/regress/unittests/test_helper/test_helper.h
+++ b/regress/unittests/test_helper/test_helper.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: test_helper.h,v 1.6 2015/01/18 19:52:44 djm Exp $ */ 1/* $OpenBSD: test_helper.h,v 1.7 2017/03/14 01:10:07 dtucker Exp $ */
2/* 2/*
3 * Copyright (c) 2011 Damien Miller <djm@mindrot.org> 3 * Copyright (c) 2011 Damien Miller <djm@mindrot.org>
4 * 4 *
@@ -67,6 +67,9 @@ void assert_size_t(const char *file, int line,
67void assert_u_int(const char *file, int line, 67void assert_u_int(const char *file, int line,
68 const char *a1, const char *a2, 68 const char *a1, const char *a2,
69 u_int aa1, u_int aa2, enum test_predicate pred); 69 u_int aa1, u_int aa2, enum test_predicate pred);
70void assert_long(const char *file, int line,
71 const char *a1, const char *a2,
72 long aa1, long aa2, enum test_predicate pred);
70void assert_long_long(const char *file, int line, 73void assert_long_long(const char *file, int line,
71 const char *a1, const char *a2, 74 const char *a1, const char *a2,
72 long long aa1, long long aa2, enum test_predicate pred); 75 long long aa1, long long aa2, enum test_predicate pred);
@@ -110,6 +113,8 @@ void assert_u64(const char *file, int line,
110 assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_EQ) 113 assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_EQ)
111#define ASSERT_U_INT_EQ(a1, a2) \ 114#define ASSERT_U_INT_EQ(a1, a2) \
112 assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_EQ) 115 assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_EQ)
116#define ASSERT_LONG_EQ(a1, a2) \
117 assert_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_EQ)
113#define ASSERT_LONG_LONG_EQ(a1, a2) \ 118#define ASSERT_LONG_LONG_EQ(a1, a2) \
114 assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_EQ) 119 assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_EQ)
115#define ASSERT_CHAR_EQ(a1, a2) \ 120#define ASSERT_CHAR_EQ(a1, a2) \
@@ -139,6 +144,8 @@ void assert_u64(const char *file, int line,
139 assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_NE) 144 assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_NE)
140#define ASSERT_U_INT_NE(a1, a2) \ 145#define ASSERT_U_INT_NE(a1, a2) \
141 assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_NE) 146 assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_NE)
147#define ASSERT_LONG_NE(a1, a2) \
148 assert_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_NE)
142#define ASSERT_LONG_LONG_NE(a1, a2) \ 149#define ASSERT_LONG_LONG_NE(a1, a2) \
143 assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_NE) 150 assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_NE)
144#define ASSERT_CHAR_NE(a1, a2) \ 151#define ASSERT_CHAR_NE(a1, a2) \
@@ -166,6 +173,8 @@ void assert_u64(const char *file, int line,
166 assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LT) 173 assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LT)
167#define ASSERT_U_INT_LT(a1, a2) \ 174#define ASSERT_U_INT_LT(a1, a2) \
168 assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LT) 175 assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LT)
176#define ASSERT_LONG_LT(a1, a2) \
177 assert_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LT)
169#define ASSERT_LONG_LONG_LT(a1, a2) \ 178#define ASSERT_LONG_LONG_LT(a1, a2) \
170 assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LT) 179 assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LT)
171#define ASSERT_CHAR_LT(a1, a2) \ 180#define ASSERT_CHAR_LT(a1, a2) \
@@ -193,6 +202,8 @@ void assert_u64(const char *file, int line,
193 assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LE) 202 assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LE)
194#define ASSERT_U_INT_LE(a1, a2) \ 203#define ASSERT_U_INT_LE(a1, a2) \
195 assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LE) 204 assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LE)
205#define ASSERT_LONG_LE(a1, a2) \
206 assert_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LE)
196#define ASSERT_LONG_LONG_LE(a1, a2) \ 207#define ASSERT_LONG_LONG_LE(a1, a2) \
197 assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LE) 208 assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LE)
198#define ASSERT_CHAR_LE(a1, a2) \ 209#define ASSERT_CHAR_LE(a1, a2) \
@@ -220,6 +231,8 @@ void assert_u64(const char *file, int line,
220 assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GT) 231 assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GT)
221#define ASSERT_U_INT_GT(a1, a2) \ 232#define ASSERT_U_INT_GT(a1, a2) \
222 assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GT) 233 assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GT)
234#define ASSERT_LONG_GT(a1, a2) \
235 assert_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GT)
223#define ASSERT_LONG_LONG_GT(a1, a2) \ 236#define ASSERT_LONG_LONG_GT(a1, a2) \
224 assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GT) 237 assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GT)
225#define ASSERT_CHAR_GT(a1, a2) \ 238#define ASSERT_CHAR_GT(a1, a2) \
@@ -247,6 +260,8 @@ void assert_u64(const char *file, int line,
247 assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GE) 260 assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GE)
248#define ASSERT_U_INT_GE(a1, a2) \ 261#define ASSERT_U_INT_GE(a1, a2) \
249 assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GE) 262 assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GE)
263#define ASSERT_LONG_GE(a1, a2) \
264 assert_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GE)
250#define ASSERT_LONG_LONG_GE(a1, a2) \ 265#define ASSERT_LONG_LONG_GE(a1, a2) \
251 assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GE) 266 assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GE)
252#define ASSERT_CHAR_GE(a1, a2) \ 267#define ASSERT_CHAR_GE(a1, a2) \
diff --git a/regress/unittests/utf8/tests.c b/regress/unittests/utf8/tests.c
index 31f9fe9c3..f0bbca509 100644
--- a/regress/unittests/utf8/tests.c
+++ b/regress/unittests/utf8/tests.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tests.c,v 1.3 2016/12/19 04:55:18 djm Exp $ */ 1/* $OpenBSD: tests.c,v 1.4 2017/02/19 00:11:29 djm Exp $ */
2/* 2/*
3 * Regress test for the utf8.h *mprintf() API 3 * Regress test for the utf8.h *mprintf() API
4 * 4 *
@@ -15,10 +15,7 @@
15 15
16#include "utf8.h" 16#include "utf8.h"
17 17
18void badarg(void); 18static void
19void one(const char *, const char *, int, int, int, const char *);
20
21void
22badarg(void) 19badarg(void)
23{ 20{
24 char buf[16]; 21 char buf[16];
@@ -33,8 +30,8 @@ badarg(void)
33 TEST_DONE(); 30 TEST_DONE();
34} 31}
35 32
36void 33static void
37one(const char *name, const char *mbs, int width, 34one(int utf8, const char *name, const char *mbs, int width,
38 int wantwidth, int wantlen, const char *wants) 35 int wantwidth, int wantlen, const char *wants)
39{ 36{
40 char buf[16]; 37 char buf[16];
@@ -43,7 +40,7 @@ one(const char *name, const char *mbs, int width,
43 40
44 if (wantlen == -2) 41 if (wantlen == -2)
45 wantlen = strlen(wants); 42 wantlen = strlen(wants);
46 (void)strlcpy(buf, "utf8_", sizeof(buf)); 43 (void)strlcpy(buf, utf8 ? "utf8_" : "c_", sizeof(buf));
47 (void)strlcat(buf, name, sizeof(buf)); 44 (void)strlcat(buf, name, sizeof(buf));
48 TEST_START(buf); 45 TEST_START(buf);
49 wp = wantwidth == -2 ? NULL : &width; 46 wp = wantwidth == -2 ? NULL : &width;
@@ -65,19 +62,41 @@ tests(void)
65 TEST_DONE(); 62 TEST_DONE();
66 63
67 badarg(); 64 badarg();
68 one("empty", "", 2, 0, 0, ""); 65 one(1, "empty", "", 2, 0, 0, "");
69 one("ascii", "x", -2, -2, -2, "x"); 66 one(1, "ascii", "x", -2, -2, -2, "x");
70 one("newline", "a\nb", -2, -2, -2, "a\nb"); 67 one(1, "newline", "a\nb", -2, -2, -2, "a\nb");
71 one("cr", "a\rb", -2, -2, -2, "a\rb"); 68 one(1, "cr", "a\rb", -2, -2, -2, "a\rb");
72 one("tab", "a\tb", -2, -2, -2, "a\tb"); 69 one(1, "tab", "a\tb", -2, -2, -2, "a\tb");
73 one("esc", "\033x", -2, -2, -2, "\\033x"); 70 one(1, "esc", "\033x", -2, -2, -2, "\\033x");
74 one("inv_badbyte", "\377x", -2, -2, -2, "\\377x"); 71 one(1, "inv_badbyte", "\377x", -2, -2, -2, "\\377x");
75 one("inv_nocont", "\341x", -2, -2, -2, "\\341x"); 72 one(1, "inv_nocont", "\341x", -2, -2, -2, "\\341x");
76 one("inv_nolead", "a\200b", -2, -2, -2, "a\\200b"); 73 one(1, "inv_nolead", "a\200b", -2, -2, -2, "a\\200b");
77 one("sz_ascii", "1234567890123456", -2, -2, 16, "123456789012345"); 74 one(1, "sz_ascii", "1234567890123456", -2, -2, 16, "123456789012345");
78 one("sz_esc", "123456789012\033", -2, -2, 16, "123456789012"); 75 one(1, "sz_esc", "123456789012\033", -2, -2, 16, "123456789012");
79 one("width_ascii", "123", 2, 2, -1, "12"); 76 one(1, "width_ascii", "123", 2, 2, -1, "12");
80 one("width_double", "a\343\201\201", 2, 1, -1, "a"); 77 one(1, "width_double", "a\343\201\201", 2, 1, -1, "a");
81 one("double_fit", "a\343\201\201", 3, 3, 4, "a\343\201\201"); 78 one(1, "double_fit", "a\343\201\201", 3, 3, 4, "a\343\201\201");
82 one("double_spc", "a\343\201\201", 4, 3, 4, "a\343\201\201"); 79 one(1, "double_spc", "a\343\201\201", 4, 3, 4, "a\343\201\201");
80
81 TEST_START("C_setlocale");
82 loc = setlocale(LC_CTYPE, "C");
83 ASSERT_PTR_NE(loc, NULL);
84 TEST_DONE();
85
86 badarg();
87 one(0, "empty", "", 2, 0, 0, "");
88 one(0, "ascii", "x", -2, -2, -2, "x");
89 one(0, "newline", "a\nb", -2, -2, -2, "a\nb");
90 one(0, "cr", "a\rb", -2, -2, -2, "a\rb");
91 one(0, "tab", "a\tb", -2, -2, -2, "a\tb");
92 one(0, "esc", "\033x", -2, -2, -2, "\\033x");
93 one(0, "inv_badbyte", "\377x", -2, -2, -2, "\\377x");
94 one(0, "inv_nocont", "\341x", -2, -2, -2, "\\341x");
95 one(0, "inv_nolead", "a\200b", -2, -2, -2, "a\\200b");
96 one(0, "sz_ascii", "1234567890123456", -2, -2, 16, "123456789012345");
97 one(0, "sz_esc", "123456789012\033", -2, -2, 16, "123456789012");
98 one(0, "width_ascii", "123", 2, 2, -1, "12");
99 one(0, "width_double", "a\343\201\201", 2, 1, -1, "a");
100 one(0, "double_fit", "a\343\201\201", 7, 5, -1, "a\\343");
101 one(0, "double_spc", "a\343\201\201", 13, 13, 13, "a\\343\\201\\201");
83} 102}