_known_hosts(): use files from UserKnownHostsFile options in
addition to standard ones.
This commit is contained in:
parent
dae08c0a52
commit
461df636e6
@ -2510,33 +2510,29 @@ _known_hosts()
|
|||||||
user_kh=$( eval echo $( sed -ne 's/^[ \t]*[Uu][Ss][Ee][Rr][Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee]['"$'\t '"']*\(.*\)$/\1/p' "${config[@]}" ) )
|
user_kh=$( eval echo $( sed -ne 's/^[ \t]*[Uu][Ss][Ee][Rr][Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee]['"$'\t '"']*\(.*\)$/\1/p' "${config[@]}" ) )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# choose which global known hosts file to use
|
# Global known_hosts files
|
||||||
if [ -r "$global_kh" ]; then
|
[ -r "$global_kh" ] &&
|
||||||
kh=( "$global_kh" )
|
kh=( "${kh[@]}" "$global_kh" )
|
||||||
else
|
|
||||||
[ -r /etc/ssh/ssh_known_hosts ] &&
|
[ -r /etc/ssh/ssh_known_hosts ] &&
|
||||||
kh=( "${kh[@]}" "/etc/ssh/ssh_known_hosts" )
|
kh=( "${kh[@]}" /etc/ssh/ssh_known_hosts )
|
||||||
[ -r /etc/ssh/ssh_known_hosts2 ] &&
|
[ -r /etc/ssh/ssh_known_hosts2 ] &&
|
||||||
kh=( "${kh[@]}" "/etc/ssh/ssh_known_hosts2" )
|
kh=( "${kh[@]}" /etc/ssh/ssh_known_hosts2 )
|
||||||
[ -r /etc/known_hosts ] &&
|
[ -r /etc/known_hosts ] &&
|
||||||
kh=( "${kh[@]}" "/etc/known_hosts" )
|
kh=( "${kh[@]}" /etc/known_hosts )
|
||||||
[ -r /etc/known_hosts2 ] &&
|
[ -r /etc/known_hosts2 ] &&
|
||||||
kh=( "${kh[@]}" "/etc/known_hosts2" )
|
kh=( "${kh[@]}" /etc/known_hosts2 )
|
||||||
[ -d /etc/ssh2/knownhosts ] &&
|
[ -d /etc/ssh2/knownhosts ] &&
|
||||||
khd=( "${khd[@]}" "/etc/ssh2/knownhosts/*pub" )
|
khd=( "${khd[@]}" /etc/ssh2/knownhosts/*pub )
|
||||||
fi
|
|
||||||
|
|
||||||
# choose which user known hosts file to use
|
# User known_hosts files
|
||||||
if [ -r "$user_kh" ]; then
|
[ -r "$user_kh" ] &&
|
||||||
kh=( ${kh[@]} "$user_kh" )
|
kh=( "${kh[@]}" "$user_kh" )
|
||||||
else
|
[ -r ~/.ssh/known_hosts" ] &&
|
||||||
[ -r "${HOME}/.ssh/known_hosts" ] &&
|
kh=( "${kh[@]}" ~/.ssh/known_hosts )
|
||||||
kh=( "${kh[@]}" "${HOME}/.ssh/known_hosts" )
|
[ -r ~/.ssh/known_hosts2 ] &&
|
||||||
[ -r "${HOME}/.ssh/known_hosts2" ] &&
|
kh=( "${kh[@]}" ~/.ssh/known_hosts2 )
|
||||||
kh=( "${kh[@]}" "${HOME}/.ssh/known_hosts2" )
|
[ -d ~/.ssh2/hostkeys ] &&
|
||||||
[ -d "${HOME}/.ssh2/hostkeys" ] &&
|
khd=( "${khd[@]}" ~/.ssh2/hostkeys/*pub )
|
||||||
khd=( "${khd[@]}" "${HOME}/.ssh2/hostkeys/*pub" )
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If we have known_hosts files to use
|
# If we have known_hosts files to use
|
||||||
if [ ${#kh[@]} -gt 0 -o ${#khd[@]} -gt 0 ]; then
|
if [ ${#kh[@]} -gt 0 -o ${#khd[@]} -gt 0 ]; then
|
||||||
@ -2583,7 +2579,7 @@ _known_hosts()
|
|||||||
fi
|
fi
|
||||||
# append any available aliases from config files
|
# append any available aliases from config files
|
||||||
if [ ${#config[@]} -gt 0 ] && [ -n "$aliases" ]; then
|
if [ ${#config[@]} -gt 0 ] && [ -n "$aliases" ]; then
|
||||||
local host_aliases=$( sed -ne 's/^[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\?['"$'\t '"']*\([^*?]*\)$/\2/p' "${config[@]}" )
|
local host_aliases=$( sed -ne 's/^[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\?['"$'\t '"']\+\([^*?]*\)$/\2/p' "${config[@]}" )
|
||||||
hosts=$( compgen -W "$host_aliases" -- $ocur )
|
hosts=$( compgen -W "$host_aliases" -- $ocur )
|
||||||
COMPREPLY=( "${COMPREPLY[@]}" $hosts )
|
COMPREPLY=( "${COMPREPLY[@]}" $hosts )
|
||||||
fi
|
fi
|
||||||
|
4
debian/changelog
vendored
4
debian/changelog
vendored
@ -6,8 +6,10 @@ bash-completion (20080617.4) UNRELEASED; urgency=low
|
|||||||
- refactored _filedir using quote_readline()
|
- refactored _filedir using quote_readline()
|
||||||
- fixed COMPREPLY's in _iwconfig
|
- fixed COMPREPLY's in _iwconfig
|
||||||
- fixed _cvs()
|
- fixed _cvs()
|
||||||
|
- _known_hosts(): use files from UserKnownHostsFile options in
|
||||||
|
addition to standard ones.
|
||||||
|
|
||||||
-- David Paleino <d.paleino@gmail.com> Mon, 23 Jun 2008 11:17:54 +0200
|
-- David Paleino <d.paleino@gmail.com> Mon, 23 Jun 2008 11:26:28 +0200
|
||||||
|
|
||||||
bash-completion (20080617.3) unstable; urgency=low
|
bash-completion (20080617.3) unstable; urgency=low
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user