Add /etc/pki/tls/openssl.cnf to list of default openssl config files, search for default ones only if -config is not given.

This commit is contained in:
Ville Skyttä 2009-04-14 14:45:46 +03:00
parent f70bba5b5a
commit 5c0e30473f
3 changed files with 20 additions and 9 deletions

View File

@ -27,6 +27,8 @@ bash-completion (1.x)
* Add more mod-like audio file extensions for xine-based players and timidity.
* Complete on plain alternatives like update-alternatives.
* Rename installed_alternatives() to _installed_alternatives().
* Add /etc/pki/tls/openssl.cnf to list of default openssl config files,
search for default ones only if -config is not given.
[ Todd Zullinger ]
* Make yum complete on filenames after install, deplist, update and upgrade

View File

@ -3548,17 +3548,21 @@ complete -F _bzip2 $filenames bzip2
have openssl && {
_openssl_sections()
{
local config
local config f
config=/etc/ssl/openssl.cnf
[ ! -f $config ] && config=/usr/share/ssl/openssl.cnf
for (( i=2; i < COMP_CWORD; i++ )); do
if [[ "${COMP_WORDS[i]}" == -config ]]; then
config=${COMP_WORDS[i+1]}
break
fi
done
[ ! -f $config ] && return 0
if [ -z "$config" ]; then
for f in /etc/ssl/openssl.cnf /etc/pki/tls/openssl.cnf \
/usr/share/ssl/openssl.cnf; do
[ -f $f ] && config=$f && break
done
fi
[ ! -f "$config" ] && return 0
COMPREPLY=( $( awk '/\[.*\]/ {print $2} ' $config | grep "^$cur" ) )
}

View File

@ -6,10 +6,7 @@
have openssl && {
_openssl_sections()
{
local config
# start with default configuration
config=/etc/pki/tls/openssl.cnf
local config f
# check if a specific configuration file is used
for (( i=2; i < COMP_CWORD; i++ )); do
@ -19,7 +16,15 @@ _openssl_sections()
fi
done
[ ! -f $config ] && return 0
# if no config given, check some usual default locations
if [ -z "$config" ]; then
for f in /etc/ssl/openssl.cnf /etc/pki/tls/openssl.cnf \
/usr/share/ssl/openssl.cnf; do
[ -f $f ] && config=$f && break
done
fi
[ ! -f "$config" ] && return 0
COMPREPLY=( $( awk '/\[.*\]/ {print $2} ' $config | grep "^$cur" ) )
}