- (tim) [regress/agent.sh regress/agent-ptrace.sh] Assign $? to a variable

when used as an error message inside an if statement so we display the
   correct into. agent.sh patch from Petr Lautrbach.
This commit is contained in:
Tim Rice 2014-01-28 10:26:25 -08:00
parent ab16ef4152
commit 6f917ad376
3 changed files with 24 additions and 14 deletions

View File

@ -4,6 +4,9 @@
- (djm) [sshd.c] Use kill(0, ...) instead of killpg(0, ...); the - (djm) [sshd.c] Use kill(0, ...) instead of killpg(0, ...); the
latter being specified to have undefined behaviour in SUSv3; latter being specified to have undefined behaviour in SUSv3;
ok dtucker ok dtucker
- (tim) [regress/agent.sh regress/agent-ptrace.sh] Assign $? to a variable
when used as an error message inside an if statement so we display the
correct into. agent.sh patch from Petr Lautrbach.
20140127 20140127
- (dtucker) [Makefile.in] Remove trailing backslash which some make - (dtucker) [Makefile.in] Remove trailing backslash which some make

View File

@ -45,8 +45,9 @@ else
gdb ${SSHAGENT} ${SSH_AGENT_PID} > ${OBJ}/gdb.out 2>&1 << EOF gdb ${SSHAGENT} ${SSH_AGENT_PID} > ${OBJ}/gdb.out 2>&1 << EOF
quit quit
EOF EOF
if [ $? -ne 0 ]; then r=$?
fail "gdb failed: exit code $?" if [ $r -ne 0 ]; then
fail "gdb failed: exit code $r"
fi fi
egrep 'ptrace: Operation not permitted.|procfs:.*Permission denied.|ttrace.*Permission denied.|procfs:.*: Invalid argument.|Unable to access task ' >/dev/null ${OBJ}/gdb.out egrep 'ptrace: Operation not permitted.|procfs:.*Permission denied.|ttrace.*Permission denied.|procfs:.*: Invalid argument.|Unable to access task ' >/dev/null ${OBJ}/gdb.out
r=$? r=$?

View File

@ -34,40 +34,46 @@ else
fi fi
done done
${SSHADD} -l > /dev/null 2>&1 ${SSHADD} -l > /dev/null 2>&1
if [ $? -ne 0 ]; then r=$?
fail "ssh-add -l failed: exit code $?" if [ $r -ne 0 ]; then
fail "ssh-add -l failed: exit code $r"
fi fi
# the same for full pubkey output # the same for full pubkey output
${SSHADD} -L > /dev/null 2>&1 ${SSHADD} -L > /dev/null 2>&1
if [ $? -ne 0 ]; then r=$?
fail "ssh-add -L failed: exit code $?" if [ $r -ne 0 ]; then
fail "ssh-add -L failed: exit code $r"
fi fi
trace "simple connect via agent" trace "simple connect via agent"
for p in 1 2; do for p in 1 2; do
${SSH} -$p -F $OBJ/ssh_proxy somehost exit 5$p ${SSH} -$p -F $OBJ/ssh_proxy somehost exit 5$p
if [ $? -ne 5$p ]; then r=$?
fail "ssh connect with protocol $p failed (exit code $?)" if [ $r -ne 5$p ]; then
fail "ssh connect with protocol $p failed (exit code $r)"
fi fi
done done
trace "agent forwarding" trace "agent forwarding"
for p in 1 2; do for p in 1 2; do
${SSH} -A -$p -F $OBJ/ssh_proxy somehost ${SSHADD} -l > /dev/null 2>&1 ${SSH} -A -$p -F $OBJ/ssh_proxy somehost ${SSHADD} -l > /dev/null 2>&1
if [ $? -ne 0 ]; then r=$?
fail "ssh-add -l via agent fwd proto $p failed (exit code $?)" if [ $r -ne 0 ]; then
fail "ssh-add -l via agent fwd proto $p failed (exit code $r)"
fi fi
${SSH} -A -$p -F $OBJ/ssh_proxy somehost \ ${SSH} -A -$p -F $OBJ/ssh_proxy somehost \
"${SSH} -$p -F $OBJ/ssh_proxy somehost exit 5$p" "${SSH} -$p -F $OBJ/ssh_proxy somehost exit 5$p"
if [ $? -ne 5$p ]; then r=$?
fail "agent fwd proto $p failed (exit code $?)" if [ $r -ne 5$p ]; then
fail "agent fwd proto $p failed (exit code $r)"
fi fi
done done
trace "delete all agent keys" trace "delete all agent keys"
${SSHADD} -D > /dev/null 2>&1 ${SSHADD} -D > /dev/null 2>&1
if [ $? -ne 0 ]; then r=$?
fail "ssh-add -D failed: exit code $?" if [ $r -ne 0 ]; then
fail "ssh-add -D failed: exit code $r"
fi fi
trace "kill agent" trace "kill agent"