diff options
author | des <des@FreeBSD.org> | 2014-05-17 03:39:56 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2014-05-17 03:39:56 +0000 |
commit | fd274d1e1702a15248b99ac076fde22196817500 (patch) | |
tree | d4d654bd6677933c5ab803f527dcfeafab410dec | |
parent | 77baea613b30871ef17f139c5ebb092cc7a08242 (diff) | |
download | FreeBSD-src-fd274d1e1702a15248b99ac076fde22196817500.zip FreeBSD-src-fd274d1e1702a15248b99ac076fde22196817500.tar.gz |
Look for root certificates in /usr/local/etc/ssl before /etc/ssl.
MFH: 1 week
-rw-r--r-- | lib/libfetch/common.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/libfetch/common.c b/lib/libfetch/common.c index 5cc7e26..3f8ef3b 100644 --- a/lib/libfetch/common.c +++ b/lib/libfetch/common.c @@ -688,6 +688,8 @@ fetch_ssl_setup_transport_layer(SSL_CTX *ctx, int verbose) /* * Configure peer verification based on environment. */ +#define LOCAL_CERT_FILE "/usr/local/etc/ssl/cert.pem" +#define BASE_CERT_FILE "/etc/ssl/cert.pem" static int fetch_ssl_setup_peer_verification(SSL_CTX *ctx, int verbose) { @@ -696,8 +698,12 @@ fetch_ssl_setup_peer_verification(SSL_CTX *ctx, int verbose) const char *ca_cert_file, *ca_cert_path, *crl_file; if (getenv("SSL_NO_VERIFY_PEER") == NULL) { - ca_cert_file = getenv("SSL_CA_CERT_FILE") != NULL ? - getenv("SSL_CA_CERT_FILE") : "/etc/ssl/cert.pem"; + ca_cert_file = getenv("SSL_CA_CERT_FILE"); + if (ca_cert_file == NULL && + access(LOCAL_CERT_FILE, R_OK) == 0) + ca_cert_file = LOCAL_CERT_FILE; + if (ca_cert_file == NULL) + ca_cert_file = BASE_CERT_FILE; ca_cert_path = getenv("SSL_CA_CERT_PATH"); if (verbose) { fetch_info("Peer verification enabled"); |