summaryrefslogtreecommitdiff
path: root/regress/test-exec.sh
diff options
context:
space:
mode:
Diffstat (limited to 'regress/test-exec.sh')
-rw-r--r--regress/test-exec.sh45
1 files changed, 39 insertions, 6 deletions
diff --git a/regress/test-exec.sh b/regress/test-exec.sh
index a7a8ddbe6..cc7ea67fe 100644
--- a/regress/test-exec.sh
+++ b/regress/test-exec.sh
@@ -2,10 +2,16 @@
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4PORT=4242 4PORT=4242
5USER=`id -un`
6SUDO=
7#SUDO=sudo 5#SUDO=sudo
8 6
7if [ -x /usr/ucb/whoami ]; then
8 USER=`/usr/ucb/whoami`
9elif whoami >/dev/null 2>&1; then
10 USER=`whoami`
11else
12 USER=`id -un`
13fi
14
9OBJ=$1 15OBJ=$1
10if [ "x$OBJ" = "x" ]; then 16if [ "x$OBJ" = "x" ]; then
11 echo '$OBJ not defined' 17 echo '$OBJ not defined'
@@ -72,6 +78,32 @@ export SSH SSHD SSHAGENT SSHADD SSHKEYGEN SSHKEYSCAN SFTP SFTPSERVER
72#echo $SSH $SSHD $SSHAGENT $SSHADD $SSHKEYGEN $SSHKEYSCAN $SFTP $SFTPSERVER 78#echo $SSH $SSHD $SSHAGENT $SSHADD $SSHKEYGEN $SSHKEYSCAN $SFTP $SFTPSERVER
73 79
74# helper 80# helper
81echon()
82{
83 if [ "x`echo -n`" = "x" ]; then
84 echo -n "$@"
85 elif [ "x`echo '\c'`" = "x" ]; then
86 echo "$@\c"
87 else
88 fatal "Don't know how to echo without newline."
89 fi
90}
91
92have_prog()
93{
94 saved_IFS="$IFS"
95 IFS=":"
96 for i in $PATH
97 do
98 if [ -x $i/$1 ]; then
99 IFS="$saved_IFS"
100 return 0
101 fi
102 done
103 IFS="$saved_IFS"
104 return 1
105}
106
75cleanup () 107cleanup ()
76{ 108{
77 if [ -f $PIDFILE ]; then 109 if [ -f $PIDFILE ]; then
@@ -111,7 +143,7 @@ fail ()
111 143
112fatal () 144fatal ()
113{ 145{
114 echo -n "FATAL: " 146 echon "FATAL: "
115 fail "$@" 147 fail "$@"
116 cleanup 148 cleanup
117 exit $RESULT 149 exit $RESULT
@@ -130,6 +162,7 @@ cat << EOF > $OBJ/sshd_config
130 PidFile $PIDFILE 162 PidFile $PIDFILE
131 AuthorizedKeysFile $OBJ/authorized_keys_%u 163 AuthorizedKeysFile $OBJ/authorized_keys_%u
132 LogLevel QUIET 164 LogLevel QUIET
165 StrictModes no
133EOF 166EOF
134 167
135# server config for proxy connects 168# server config for proxy connects
@@ -169,7 +202,7 @@ for t in rsa rsa1; do
169 202
170 # known hosts file for client 203 # known hosts file for client
171 ( 204 (
172 echo -n 'localhost-with-alias,127.0.0.1,::1 ' 205 echon 'localhost-with-alias,127.0.0.1,::1 '
173 cat $OBJ/$t.pub 206 cat $OBJ/$t.pub
174 ) >> $OBJ/known_hosts 207 ) >> $OBJ/known_hosts
175 208
@@ -189,7 +222,7 @@ chmod 644 $OBJ/authorized_keys_$USER
189# create a proxy version of the client config 222# create a proxy version of the client config
190( 223(
191 cat $OBJ/ssh_config 224 cat $OBJ/ssh_config
192 echo proxycommand ${SSHD} -i -f $OBJ/sshd_proxy 225 echo proxycommand ${SUDO} ${SSHD} -i -f $OBJ/sshd_proxy
193) > $OBJ/ssh_proxy 226) > $OBJ/ssh_proxy
194 227
195# check proxy config 228# check proxy config
@@ -203,7 +236,7 @@ start_sshd ()
203 236
204 trace "wait for sshd" 237 trace "wait for sshd"
205 i=0; 238 i=0;
206 while [ ! -f $PIDFILE -a $i -lt 5 ]; do 239 while [ ! -f $PIDFILE -a $i -lt 10 ]; do
207 i=`expr $i + 1` 240 i=`expr $i + 1`
208 sleep $i 241 sleep $i
209 done 242 done