Skip to content

Commit

Permalink
fix(openssl): avoid variable conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Aug 20, 2023
1 parent 0d145c9 commit a31906c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions completions/openssl
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@

_comp_cmd_openssl__compgen_sections()
{
local config i f
local config _i _file

# check if a specific configuration file is used
for ((i = 2; i < cword; i++)); do
if [[ ${words[i]} == -config ]]; then
config=${words[i + 1]}
for ((_i = 2; _i < cword; _i++)); do
if [[ ${words[_i]} == -config ]]; then
config=${words[_i + 1]}
break
fi
done

# if no config given, check some usual default locations
if [[ ! $config ]]; then
for f in /etc/ssl/openssl.cnf /etc/pki/tls/openssl.cnf \
for _file in /etc/ssl/openssl.cnf /etc/pki/tls/openssl.cnf \
/usr/share/ssl/openssl.cnf; do
[[ -f $f ]] && config=$f && break
[[ -f $_file ]] && config=$_file && break
done
fi

[[ ! -f $config ]] && return

_comp_compgen_split -- "$(awk '/\[.*\]/ {print $2}' "$config")"
_comp_compgen -U config split -- "$(awk '/\[.*\]/ {print $2}' "$config")"
}

_comp_cmd_openssl__compgen_digests()
Expand Down

0 comments on commit a31906c

Please sign in to comment.