|
Lines 20-31
trial()
Link Here
|
| 20 |
|
20 |
|
| 21 |
trace "test $opt=$arg $expect" |
21 |
trace "test $opt=$arg $expect" |
| 22 |
rm -f $OBJ/actual |
22 |
rm -f $OBJ/actual |
|
|
23 |
got="" |
| 23 |
case "$opt" in |
24 |
case "$opt" in |
| 24 |
localcommand) |
25 |
localcommand) |
| 25 |
${SSH} -F $OBJ/ssh_proxy -o $opt="echo '$arg' >$OBJ/actual" \ |
26 |
${SSH} -F $OBJ/ssh_proxy -o $opt="echo '$arg' >$OBJ/actual" \ |
| 26 |
somehost true |
27 |
somehost true |
| 27 |
got=`cat $OBJ/actual` |
28 |
got=`cat $OBJ/actual` |
| 28 |
;; |
29 |
;; |
|
|
30 |
userknownhostsfile) |
| 31 |
# Move the userknownhosts file to what the expansion says, |
| 32 |
# make sure ssh works then put it back. |
| 33 |
mv "$OBJ/known_hosts" "$OBJ/$expect" |
| 34 |
${SSH} -F $OBJ/ssh_proxy -o $opt="$OBJ/$arg" somehost true && \ |
| 35 |
got="$expect" |
| 36 |
mv "$OBJ/$expect" "$OBJ/known_hosts" |
| 37 |
;; |
| 29 |
matchexec) |
38 |
matchexec) |
| 30 |
(cat $OBJ/ssh_proxy && \ |
39 |
(cat $OBJ/ssh_proxy && \ |
| 31 |
echo "Match Exec \"echo '$arg' >$OBJ/actual\"") \ |
40 |
echo "Match Exec \"echo '$arg' >$OBJ/actual\"") \ |
|
Lines 50-62
trial()
Link Here
|
| 50 |
} |
59 |
} |
| 51 |
|
60 |
|
| 52 |
for i in matchexec localcommand remotecommand controlpath identityagent \ |
61 |
for i in matchexec localcommand remotecommand controlpath identityagent \ |
| 53 |
forwardagent localforward remoteforward; do |
62 |
forwardagent localforward remoteforward userknownhostsfile; do |
| 54 |
verbose $tid $i percent |
63 |
verbose $tid $i percent |
| 55 |
if [ "$i" = "localcommand" ]; then |
64 |
case "$i" in |
| 56 |
REMUSER=$USER |
65 |
localcommand|userknownhostsfile) |
|
|
66 |
# Any test that's going to actually make a connection needs |
| 67 |
# to use the real username. |
| 68 |
REMUSER=$USER ;; |
| 69 |
*) |
| 70 |
REMUSER=remuser ;; |
| 71 |
esac |
| 72 |
if [ "$i" = "$localcommand" ]; then |
| 57 |
trial $i '%T' NONE |
73 |
trial $i '%T' NONE |
| 58 |
else |
|
|
| 59 |
REMUSER=remuser |
| 60 |
fi |
74 |
fi |
| 61 |
# Matches implementation in readconf.c:ssh_connection_hash() |
75 |
# Matches implementation in readconf.c:ssh_connection_hash() |
| 62 |
HASH=`printf "${HOSTNAME}127.0.0.1${PORT}$REMUSER" | |
76 |
HASH=`printf "${HOSTNAME}127.0.0.1${PORT}$REMUSER" | |
|
Lines 65-84
for i in matchexec localcommand remoteco
Link Here
|
| 65 |
trial $i '%C' $HASH |
79 |
trial $i '%C' $HASH |
| 66 |
trial $i '%i' $USERID |
80 |
trial $i '%i' $USERID |
| 67 |
trial $i '%h' 127.0.0.1 |
81 |
trial $i '%h' 127.0.0.1 |
| 68 |
trial $i '%d' $HOME |
|
|
| 69 |
trial $i '%L' $HOST |
82 |
trial $i '%L' $HOST |
| 70 |
trial $i '%l' $HOSTNAME |
83 |
trial $i '%l' $HOSTNAME |
| 71 |
trial $i '%n' somehost |
84 |
trial $i '%n' somehost |
| 72 |
trial $i '%p' $PORT |
85 |
trial $i '%p' $PORT |
| 73 |
trial $i '%r' $REMUSER |
86 |
trial $i '%r' $REMUSER |
| 74 |
trial $i '%u' $USER |
87 |
trial $i '%u' $USER |
| 75 |
trial $i '%%/%C/%i/%h/%d/%L/%l/%n/%p/%r/%u' \ |
88 |
# We can't specify a full path outside the regress dir, so skip tests |
| 76 |
"%/$HASH/$USERID/127.0.0.1/$HOME/$HOST/$HOSTNAME/somehost/$PORT/$REMUSER/$USER" |
89 |
# containing %d for UserKnownHostsFile |
|
|
90 |
if [ "$i" != "userknownhostsfile" ]; then |
| 91 |
trial $i '%d' $HOME |
| 92 |
trial $i '%%/%C/%i/%h/%d/%L/%l/%n/%p/%r/%u' \ |
| 93 |
"%/$HASH/$USERID/127.0.0.1/$HOME/$HOST/$HOSTNAME/somehost/$PORT/$REMUSER/$USER" |
| 94 |
fi |
| 77 |
done |
95 |
done |
| 78 |
|
96 |
|
| 79 |
# Subset of above since we don't expand shell-style variables on anything that |
97 |
# Subset of above since we don't expand shell-style variables on anything that |
| 80 |
# runs a command because the shell will expand those. |
98 |
# runs a command because the shell will expand those. |
| 81 |
for i in controlpath identityagent forwardagent localforward remoteforward; do |
99 |
for i in controlpath identityagent forwardagent localforward remoteforward \ |
|
|
100 |
userknownhostsfile; do |
| 82 |
verbose $tid $i dollar |
101 |
verbose $tid $i dollar |
| 83 |
FOO=bar |
102 |
FOO=bar |
| 84 |
export FOO |
103 |
export FOO |