diff options
author | Matthias Andree <matthias.andree@gmx.de> | 2010-04-18 20:22:27 +0200 |
---|---|---|
committer | Matthias Andree <matthias.andree@gmx.de> | 2010-04-18 20:22:27 +0200 |
commit | 497ba428052f1437187778ceb2293c8eaba5893f (patch) | |
tree | 353f899ae268adf5af1b878207bc72118128dcd8 /socket.c | |
parent | 6da324a5e02587c48cd527522d92a72b66b3b42e (diff) | |
download | fetchmail-497ba428052f1437187778ceb2293c8eaba5893f.tar.gz fetchmail-497ba428052f1437187778ceb2293c8eaba5893f.tar.bz2 fetchmail-497ba428052f1437187778ceb2293c8eaba5893f.zip |
Add --sslcertfile option and FETCHMAIL_NO_DEFAULT_X509_PATHS env var,
and always load the default X.509 trust stores, unless the latter is set.
Diffstat (limited to 'socket.c')
-rw-r--r-- | socket.c | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -857,7 +857,8 @@ static const char *SSLCertGetCN(const char *mycert, * uses SSL *ssl global variable, which is currently defined * in this file */ -int SSLOpen(int sock, char *mycert, char *mykey, const char *myproto, int certck, char *certpath, +int SSLOpen(int sock, char *mycert, char *mykey, const char *myproto, int certck, + char *cacertfile, char *certpath, char *fingerprint, char *servercname, char *label, char **remotename) { struct stat randstat; @@ -921,10 +922,16 @@ int SSLOpen(int sock, char *mycert, char *mykey, const char *myproto, int certck * we provide the callback for output and possible fingerprint checks. */ SSL_CTX_set_verify(_ctx[sock], SSL_VERIFY_PEER, SSL_nock_verify_callback); } - if (certpath) - SSL_CTX_load_verify_locations(_ctx[sock], NULL, certpath); - else - SSL_CTX_set_default_verify_paths(_ctx[sock]); + + { + char *t = getenv("FETCHMAIL_NO_DEFAULT_X509_PATHS"); + + if (t == NULL || t[0] == '\0') + SSL_CTX_set_default_verify_paths(_ctx[sock]); + } + + if (certpath || cacertfile) + SSL_CTX_load_verify_locations(_ctx[sock], cacertfile, certpath); _ssl_context[sock] = SSL_new(_ctx[sock]); |