result = gnutls_certificate_set_x509_trust_file(*x509_cred,
PROXY_CA_FILE,
GNUTLS_X509_FMT_PEM);
+ if (0 >= result) {
+ LOG(LOG_ERROR,
+ "initialize_tls_session_client(): can't read CA file: '%s'",
+ PROXY_CA_FILE);
+ gnutls_certificate_free_credentials(*x509_cred);
+ return -1;
+ }
+ }
/* If the invalid hostname was specified do nothing, we use a self-signed
* certificate in this case. */
- } else {
- result = 1;
- }
- if (0 >= result) {
- LOG(LOG_ERROR,
- "initialize_tls_session_client(): can't read CA file: '%s'",
- PROXY_CA_FILE);
- gnutls_certificate_free_credentials(*x509_cred);
- return -1;
- }
+
/* And certificate for this website and proxy's private key. */
if (!use_invalid_cert) {
result = gnutls_certificate_set_x509_key_file(*x509_cred,