diff options
author | Colin Watson <cjwatson@debian.org> | 2013-09-14 23:42:11 +0100 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2013-09-14 23:42:11 +0100 |
commit | 327155e6824b3ee13837bdde04e4eb47e147ff46 (patch) | |
tree | 8f8743122403c7a2e6ed919156711fb1520c657f /regress/test-exec.sh | |
parent | 0334ce32304e9ba2a10ee5ca49ca6e8ff3ba6cf4 (diff) | |
parent | 74e339b8f8936bc0d985e053a076d0c9b5e9ea51 (diff) |
* New upstream release (http://www.openssh.com/txt/release-6.3).
- sftp(1): add support for resuming partial downloads using the "reget"
command and on the sftp commandline or on the "get" commandline using
the "-a" (append) option (closes: #158590).
- ssh(1): add an "IgnoreUnknown" configuration option to selectively
suppress errors arising from unknown configuration directives (closes:
#436052).
- sftp(1): update progressmeter when data is acknowledged, not when it's
sent (partially addresses #708372).
- ssh(1): do not fatally exit when attempting to cleanup multiplexing-
created channels that are incompletely opened (closes: #651357).
Diffstat (limited to 'regress/test-exec.sh')
-rw-r--r-- | regress/test-exec.sh | 143 |
1 files changed, 102 insertions, 41 deletions
diff --git a/regress/test-exec.sh b/regress/test-exec.sh index aa4e6e5c0..eee446264 100644 --- a/regress/test-exec.sh +++ b/regress/test-exec.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: test-exec.sh,v 1.37 2010/02/24 06:21:56 djm Exp $ | 1 | # $OpenBSD: test-exec.sh,v 1.46 2013/06/21 02:26:26 djm Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | #SUDO=sudo | 4 | #SUDO=sudo |
@@ -136,30 +136,49 @@ case "$SSHD" in | |||
136 | *) SSHD=`which sshd` ;; | 136 | *) SSHD=`which sshd` ;; |
137 | esac | 137 | esac |
138 | 138 | ||
139 | # Logfiles. | ||
140 | # SSH_LOGFILE should be the debug output of ssh(1) only | ||
141 | # SSHD_LOGFILE should be the debug output of sshd(8) only | ||
142 | # REGRESS_LOGFILE is the output of the test itself stdout and stderr | ||
139 | if [ "x$TEST_SSH_LOGFILE" = "x" ]; then | 143 | if [ "x$TEST_SSH_LOGFILE" = "x" ]; then |
140 | TEST_SSH_LOGFILE=/dev/null | 144 | TEST_SSH_LOGFILE=$OBJ/ssh.log |
145 | fi | ||
146 | if [ "x$TEST_SSHD_LOGFILE" = "x" ]; then | ||
147 | TEST_SSHD_LOGFILE=$OBJ/sshd.log | ||
148 | fi | ||
149 | if [ "x$TEST_REGRESS_LOGFILE" = "x" ]; then | ||
150 | TEST_REGRESS_LOGFILE=$OBJ/regress.log | ||
141 | fi | 151 | fi |
142 | 152 | ||
143 | # Some data for test copies | 153 | # truncate logfiles |
144 | DATA=$OBJ/testdata | 154 | >$TEST_SSH_LOGFILE |
145 | cat $SSHD${EXEEXT} $SSHD${EXEEXT} $SSHD${EXEEXT} $SSHD${EXEEXT} >$DATA | 155 | >$TEST_SSHD_LOGFILE |
156 | >$TEST_REGRESS_LOGFILE | ||
157 | |||
158 | # Create wrapper ssh with logging. We can't just specify "SSH=ssh -E..." | ||
159 | # because sftp and scp don't handle spaces in arguments. | ||
160 | SSHLOGWRAP=$OBJ/ssh-log-wrapper.sh | ||
161 | echo "#!/bin/sh" > $SSHLOGWRAP | ||
162 | echo "exec ${SSH} -E${TEST_SSH_LOGFILE} "'"$@"' >>$SSHLOGWRAP | ||
163 | |||
164 | chmod a+rx $OBJ/ssh-log-wrapper.sh | ||
165 | SSH="$SSHLOGWRAP" | ||
166 | |||
167 | # Some test data. We make a copy because some tests will overwrite it. | ||
168 | # The tests may assume that $DATA exists and is writable and $COPY does | ||
169 | # not exist. | ||
170 | DATANAME=data | ||
171 | DATA=$OBJ/${DATANAME} | ||
172 | cat $SSHD $SSHD $SSHD $SSHD >${DATA} | ||
173 | chmod u+w ${DATA} | ||
174 | COPY=$OBJ/copy | ||
175 | rm -f ${COPY} | ||
146 | 176 | ||
147 | # these should be used in tests | 177 | # these should be used in tests |
148 | export SSH SSHD SSHAGENT SSHADD SSHKEYGEN SSHKEYSCAN SFTP SFTPSERVER SCP | 178 | export SSH SSHD SSHAGENT SSHADD SSHKEYGEN SSHKEYSCAN SFTP SFTPSERVER SCP |
149 | #echo $SSH $SSHD $SSHAGENT $SSHADD $SSHKEYGEN $SSHKEYSCAN $SFTP $SFTPSERVER $SCP | 179 | #echo $SSH $SSHD $SSHAGENT $SSHADD $SSHKEYGEN $SSHKEYSCAN $SFTP $SFTPSERVER $SCP |
150 | 180 | ||
151 | # helper | 181 | # Portable specific functions |
152 | echon() | ||
153 | { | ||
154 | if [ "x`echo -n`" = "x" ]; then | ||
155 | echo -n "$@" | ||
156 | elif [ "x`echo '\c'`" = "x" ]; then | ||
157 | echo "$@\c" | ||
158 | else | ||
159 | fatal "Don't know how to echo without newline." | ||
160 | fi | ||
161 | } | ||
162 | |||
163 | have_prog() | 182 | have_prog() |
164 | { | 183 | { |
165 | saved_IFS="$IFS" | 184 | saved_IFS="$IFS" |
@@ -175,6 +194,37 @@ have_prog() | |||
175 | return 1 | 194 | return 1 |
176 | } | 195 | } |
177 | 196 | ||
197 | jot() { | ||
198 | awk "BEGIN { for (i = $2; i < $2 + $1; i++) { printf \"%d\n\", i } exit }" | ||
199 | } | ||
200 | |||
201 | # Check whether preprocessor symbols are defined in config.h. | ||
202 | config_defined () | ||
203 | { | ||
204 | str=$1 | ||
205 | while test "x$2" != "x" ; do | ||
206 | str="$str|$2" | ||
207 | shift | ||
208 | done | ||
209 | egrep "^#define.*($str)" ${BUILDDIR}/config.h >/dev/null 2>&1 | ||
210 | } | ||
211 | |||
212 | md5 () { | ||
213 | if have_prog md5sum; then | ||
214 | md5sum | ||
215 | elif have_prog openssl; then | ||
216 | openssl md5 | ||
217 | elif have_prog cksum; then | ||
218 | cksum | ||
219 | elif have_prog sum; then | ||
220 | sum | ||
221 | else | ||
222 | wc -c | ||
223 | fi | ||
224 | } | ||
225 | # End of portable specific functions | ||
226 | |||
227 | # helper | ||
178 | cleanup () | 228 | cleanup () |
179 | { | 229 | { |
180 | if [ -f $PIDFILE ]; then | 230 | if [ -f $PIDFILE ]; then |
@@ -199,9 +249,26 @@ cleanup () | |||
199 | fi | 249 | fi |
200 | } | 250 | } |
201 | 251 | ||
252 | start_debug_log () | ||
253 | { | ||
254 | echo "trace: $@" >$TEST_REGRESS_LOGFILE | ||
255 | echo "trace: $@" >$TEST_SSH_LOGFILE | ||
256 | echo "trace: $@" >$TEST_SSHD_LOGFILE | ||
257 | } | ||
258 | |||
259 | save_debug_log () | ||
260 | { | ||
261 | echo $@ >>$TEST_REGRESS_LOGFILE | ||
262 | echo $@ >>$TEST_SSH_LOGFILE | ||
263 | echo $@ >>$TEST_SSHD_LOGFILE | ||
264 | (cat $TEST_REGRESS_LOGFILE; echo) >>$OBJ/failed-regress.log | ||
265 | (cat $TEST_SSH_LOGFILE; echo) >>$OBJ/failed-ssh.log | ||
266 | (cat $TEST_SSHD_LOGFILE; echo) >>$OBJ/failed-sshd.log | ||
267 | } | ||
268 | |||
202 | trace () | 269 | trace () |
203 | { | 270 | { |
204 | echo "trace: $@" >>$TEST_SSH_LOGFILE | 271 | start_debug_log $@ |
205 | if [ "X$TEST_SSH_TRACE" = "Xyes" ]; then | 272 | if [ "X$TEST_SSH_TRACE" = "Xyes" ]; then |
206 | echo "$@" | 273 | echo "$@" |
207 | fi | 274 | fi |
@@ -209,7 +276,7 @@ trace () | |||
209 | 276 | ||
210 | verbose () | 277 | verbose () |
211 | { | 278 | { |
212 | echo "verbose: $@" >>$TEST_SSH_LOGFILE | 279 | start_debug_log $@ |
213 | if [ "X$TEST_SSH_QUIET" != "Xyes" ]; then | 280 | if [ "X$TEST_SSH_QUIET" != "Xyes" ]; then |
214 | echo "$@" | 281 | echo "$@" |
215 | fi | 282 | fi |
@@ -223,31 +290,21 @@ warn () | |||
223 | 290 | ||
224 | fail () | 291 | fail () |
225 | { | 292 | { |
226 | echo "FAIL: $@" >>$TEST_SSH_LOGFILE | 293 | save_debug_log "FAIL: $@" |
227 | RESULT=1 | 294 | RESULT=1 |
228 | echo "$@" | 295 | echo "$@" |
296 | |||
229 | } | 297 | } |
230 | 298 | ||
231 | fatal () | 299 | fatal () |
232 | { | 300 | { |
233 | echo "FATAL: $@" >>$TEST_SSH_LOGFILE | 301 | save_debug_log "FATAL: $@" |
234 | echon "FATAL: " | 302 | printf "FATAL: " |
235 | fail "$@" | 303 | fail "$@" |
236 | cleanup | 304 | cleanup |
237 | exit $RESULT | 305 | exit $RESULT |
238 | } | 306 | } |
239 | 307 | ||
240 | # Check whether preprocessor symbols are defined in config.h. | ||
241 | config_defined () | ||
242 | { | ||
243 | str=$1 | ||
244 | while test "x$2" != "x" ; do | ||
245 | str="$str|$2" | ||
246 | shift | ||
247 | done | ||
248 | egrep "^#define.*($str)" ${BUILDDIR}/config.h >/dev/null 2>&1 | ||
249 | } | ||
250 | |||
251 | RESULT=0 | 308 | RESULT=0 |
252 | PIDFILE=$OBJ/pidfile | 309 | PIDFILE=$OBJ/pidfile |
253 | 310 | ||
@@ -263,7 +320,7 @@ cat << EOF > $OBJ/sshd_config | |||
263 | #ListenAddress ::1 | 320 | #ListenAddress ::1 |
264 | PidFile $PIDFILE | 321 | PidFile $PIDFILE |
265 | AuthorizedKeysFile $OBJ/authorized_keys_%u | 322 | AuthorizedKeysFile $OBJ/authorized_keys_%u |
266 | LogLevel VERBOSE | 323 | LogLevel DEBUG3 |
267 | AcceptEnv _XXX_TEST_* | 324 | AcceptEnv _XXX_TEST_* |
268 | AcceptEnv _XXX_TEST | 325 | AcceptEnv _XXX_TEST |
269 | Subsystem sftp $SFTPSERVER | 326 | Subsystem sftp $SFTPSERVER |
@@ -295,8 +352,10 @@ Host * | |||
295 | ChallengeResponseAuthentication no | 352 | ChallengeResponseAuthentication no |
296 | HostbasedAuthentication no | 353 | HostbasedAuthentication no |
297 | PasswordAuthentication no | 354 | PasswordAuthentication no |
355 | RhostsRSAAuthentication no | ||
298 | BatchMode yes | 356 | BatchMode yes |
299 | StrictHostKeyChecking yes | 357 | StrictHostKeyChecking yes |
358 | LogLevel DEBUG3 | ||
300 | EOF | 359 | EOF |
301 | 360 | ||
302 | if [ ! -z "$TEST_SSH_SSH_CONFOPTS" ]; then | 361 | if [ ! -z "$TEST_SSH_SSH_CONFOPTS" ]; then |
@@ -309,13 +368,15 @@ rm -f $OBJ/known_hosts $OBJ/authorized_keys_$USER | |||
309 | trace "generate keys" | 368 | trace "generate keys" |
310 | for t in rsa rsa1; do | 369 | for t in rsa rsa1; do |
311 | # generate user key | 370 | # generate user key |
312 | rm -f $OBJ/$t | 371 | if [ ! -f $OBJ/$t ] || [ ${SSHKEYGEN} -nt $OBJ/$t ]; then |
313 | ${SSHKEYGEN} -b 1024 -q -N '' -t $t -f $OBJ/$t ||\ | 372 | rm -f $OBJ/$t |
314 | fail "ssh-keygen for $t failed" | 373 | ${SSHKEYGEN} -q -N '' -t $t -f $OBJ/$t ||\ |
374 | fail "ssh-keygen for $t failed" | ||
375 | fi | ||
315 | 376 | ||
316 | # known hosts file for client | 377 | # known hosts file for client |
317 | ( | 378 | ( |
318 | echon 'localhost-with-alias,127.0.0.1,::1 ' | 379 | printf 'localhost-with-alias,127.0.0.1,::1 ' |
319 | cat $OBJ/$t.pub | 380 | cat $OBJ/$t.pub |
320 | ) >> $OBJ/known_hosts | 381 | ) >> $OBJ/known_hosts |
321 | 382 | ||
@@ -370,7 +431,7 @@ if test "$REGRESS_INTEROP_PUTTY" = "yes" ; then | |||
370 | echo "Hostname=127.0.0.1" >> ${OBJ}/.putty/sessions/localhost_proxy | 431 | echo "Hostname=127.0.0.1" >> ${OBJ}/.putty/sessions/localhost_proxy |
371 | echo "PortNumber=$PORT" >> ${OBJ}/.putty/sessions/localhost_proxy | 432 | echo "PortNumber=$PORT" >> ${OBJ}/.putty/sessions/localhost_proxy |
372 | echo "ProxyMethod=5" >> ${OBJ}/.putty/sessions/localhost_proxy | 433 | echo "ProxyMethod=5" >> ${OBJ}/.putty/sessions/localhost_proxy |
373 | echo "ProxyTelnetCommand=sh ${SRC}/sshd-log-wrapper.sh ${SSHD} ${TEST_SSH_LOGFILE} -i -f $OBJ/sshd_proxy" >> ${OBJ}/.putty/sessions/localhost_proxy | 434 | echo "ProxyTelnetCommand=sh ${SRC}/sshd-log-wrapper.sh ${SSHD} ${TEST_SSHD_LOGFILE} -i -f $OBJ/sshd_proxy" >> ${OBJ}/.putty/sessions/localhost_proxy |
374 | 435 | ||
375 | REGRESS_INTEROP_PUTTY=yes | 436 | REGRESS_INTEROP_PUTTY=yes |
376 | fi | 437 | fi |
@@ -378,7 +439,7 @@ fi | |||
378 | # create a proxy version of the client config | 439 | # create a proxy version of the client config |
379 | ( | 440 | ( |
380 | cat $OBJ/ssh_config | 441 | cat $OBJ/ssh_config |
381 | echo proxycommand ${SUDO} sh ${SRC}/sshd-log-wrapper.sh ${SSHD} ${TEST_SSH_LOGFILE} -i -f $OBJ/sshd_proxy | 442 | echo proxycommand ${SUDO} sh ${SRC}/sshd-log-wrapper.sh ${SSHD} ${TEST_SSHD_LOGFILE} -i -f $OBJ/sshd_proxy |
382 | ) > $OBJ/ssh_proxy | 443 | ) > $OBJ/ssh_proxy |
383 | 444 | ||
384 | # check proxy config | 445 | # check proxy config |
@@ -388,7 +449,7 @@ start_sshd () | |||
388 | { | 449 | { |
389 | # start sshd | 450 | # start sshd |
390 | $SUDO ${SSHD} -f $OBJ/sshd_config "$@" -t || fatal "sshd_config broken" | 451 | $SUDO ${SSHD} -f $OBJ/sshd_config "$@" -t || fatal "sshd_config broken" |
391 | $SUDO ${SSHD} -f $OBJ/sshd_config -e "$@" >>$TEST_SSH_LOGFILE 2>&1 | 452 | $SUDO ${SSHD} -f $OBJ/sshd_config "$@" -E$TEST_SSHD_LOGFILE |
392 | 453 | ||
393 | trace "wait for sshd" | 454 | trace "wait for sshd" |
394 | i=0; | 455 | i=0; |