shims/shared/curl: pass both --cafile and --capath to override defaults

This commit is contained in:
Bo Anderson 2021-10-20 15:51:58 +01:00
parent 2734fdbec6
commit 7f54793c49
No known key found for this signature in database
GPG Key ID: 3DB94E204E137D65

View File

@ -13,6 +13,25 @@ fi
source "${HOMEBREW_LIBRARY}/Homebrew/shims/utils.sh"
# SSL_CERT_FILE alone does not clear the CAPath setting.
set_certs=0
if [[ -n "${SSL_CERT_FILE}" ]]
then
set_certs=1
for arg in "$@"
do
if [[ "${arg}" =~ --ca(cert|path) ]]
then
# User passed their own settings - don't use ours!
set_certs=0
fi
done
fi
if [[ ${set_certs} -eq 1 ]]
then
set -- "--cacert" "${SSL_CERT_FILE}" "--capath" "$(dirname "${SSL_CERT_FILE}")" "$@"
fi
try_exec_non_system "${HOMEBREW_CURL:-curl}" "$@"
safe_exec "/usr/bin/curl" "$@"