*error_r = "SSL certificate not received";
else
*error_r = "Received invalid SSL certificate";
+ return -1;
} else if (ssl_iostream_cert_match_name(conn->ssl_iostream, host) < 0) {
*error_r = t_strdup_printf(
"SSL certificate doesn't match expected host name %s",
host);
+ return -1;
} else {
if (doveadm_debug) {
i_debug("%s: SSL handshake successful",
}
return 0;
}
- i_stream_close(conn->input);
- return -1;
}
static int server_connection_init_ssl(struct server_connection *conn)
{
struct http_client_connection *conn = context;
- if (!conn->client->set.ssl_verify) {
+ if (conn->client->set.ssl_allow_invalid_cert) {
/* skip certificate checks */
http_client_connection_debug(conn, "SSL handshake successful");
return 0;
*error_r = "SSL certificate not received";
else
*error_r = "Received invalid SSL certificate";
+ return -1;
} else {
const char *host = http_client_peer_get_hostname(conn->peer);
*error_r = t_strdup_printf(
"SSL certificate doesn't match expected host name %s", host);
+ return -1;
}
- i_stream_close(conn->conn.input);
- return -1;
}
static int
i_assert(conn->client->ssl_ctx != NULL);
memset(&ssl_set, 0, sizeof(ssl_set));
- if (conn->client->set.ssl_verify) {
+ if (!conn->client->set.ssl_allow_invalid_cert) {
ssl_set.verbose_invalid_cert = TRUE;
ssl_set.verify_remote_cert = TRUE;
ssl_set.require_valid_cert = TRUE;
if (ssl_io->handshake_callback != NULL) {
if (ssl_io->handshake_callback(&error, ssl_io->handshake_context) < 0) {
i_assert(error != NULL);
+ i_stream_close(ssl_io->plain_input);
+ o_stream_close(ssl_io->plain_output);
openssl_iostream_set_error(ssl_io, error);
errno = EINVAL;
return -1;