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