Clean up some redundant code.

This commit is contained in:
Ville Skyttä 2011-02-05 12:14:42 +02:00
parent 6aecdb5f4c
commit 56c12d5570

View File

@ -1244,12 +1244,10 @@ _known_hosts_real()
[ -r "$configfile" ] && [ -r "$configfile" ] &&
config=( "${config[@]}" "$configfile" ) config=( "${config[@]}" "$configfile" )
else else
[ -r /etc/ssh/ssh_config ] && for i in /etc/ssh/ssh_config "${HOME}/.ssh/config" \
config=( "${config[@]}" "/etc/ssh/ssh_config" ) "${HOME}/.ssh2/config"; do
[ -r "${HOME}/.ssh/config" ] && [ -r $i ] && config=( "${config[@]}" "$i" )
config=( "${config[@]}" "${HOME}/.ssh/config" ) done
[ -r "${HOME}/.ssh2/config" ] &&
config=( "${config[@]}" "${HOME}/.ssh2/config" )
fi fi
# Known hosts files from configs # Known hosts files from configs
@ -1271,28 +1269,16 @@ _known_hosts_real()
IFS=$OIFS IFS=$OIFS
fi fi
# Global known_hosts files
if [ -z "$configfile" ]; then if [ -z "$configfile" ]; then
[ -r /etc/ssh/ssh_known_hosts ] && # Global and user known_hosts files
kh=( "${kh[@]}" /etc/ssh/ssh_known_hosts ) for i in /etc/ssh/ssh_known_hosts /etc/ssh/ssh_known_hosts2 \
[ -r /etc/ssh/ssh_known_hosts2 ] && /etc/known_hosts /etc/known_hosts2 ~/.ssh/known_hosts \
kh=( "${kh[@]}" /etc/ssh/ssh_known_hosts2 ) ~/.ssh/known_hosts2; do
[ -r /etc/known_hosts ] && [ -r $i ] && kh=( "${kh[@]}" $i )
kh=( "${kh[@]}" /etc/known_hosts ) done
[ -r /etc/known_hosts2 ] && for i in /etc/ssh2/knownhosts ~/.ssh2/hostkeys; do
kh=( "${kh[@]}" /etc/known_hosts2 ) [ -d $i ] && khd=( "${khd[@]}" $i/*pub )
[ -d /etc/ssh2/knownhosts ] && done
khd=( "${khd[@]}" /etc/ssh2/knownhosts/*pub )
fi
# User known_hosts files
if [ -z "$configfile" ]; then
[ -r ~/.ssh/known_hosts ] &&
kh=( "${kh[@]}" ~/.ssh/known_hosts )
[ -r ~/.ssh/known_hosts2 ] &&
kh=( "${kh[@]}" ~/.ssh/known_hosts2 )
[ -d ~/.ssh2/hostkeys ] &&
khd=( "${khd[@]}" ~/.ssh2/hostkeys/*pub )
fi fi
# If we have known_hosts files to use # If we have known_hosts files to use