Otherwise the SSL tests do not properly work.
Fixes Error: HTTP Request failed: Couldn't initialize SSL context: Can't load CA certs from directory /etc/ssl/certs: error:
02001002:system library:fopen:No such file or directory: fopen('/etc/pki/tls/cert.pem','r'), error:
2006D080:BIO routines:BIO_new_file:no such file, error:
0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib
struct http_client_context *http_cctx;
struct http_client *http_client1, *http_client2, *http_client3, *http_client4;
struct ssl_iostream_settings ssl_set;
+ struct stat st;
const char *error;
lib_init();
}
i_zero(&ssl_set);
ssl_set.allow_invalid_cert = TRUE;
- ssl_set.ca_dir = "/etc/ssl/certs"; /* debian */
- ssl_set.ca_file = "/etc/pki/tls/cert.pem"; /* redhat */
+ if (stat("/etc/ssl/certs", &st) == 0 && S_ISDIR(st.st_mode))
+ ssl_set.ca_dir = "/etc/ssl/certs"; /* debian */
+ if (stat("/etc/ssl/certs", &st) == 0 && S_ISREG(st.st_mode))
+ ssl_set.ca_file = "/etc/pki/tls/cert.pem"; /* redhat */
i_zero(&http_set);
http_set.ssl = &ssl_set;