diff options
Diffstat (limited to 'camel/camel-tcp-stream-ssl.c')
-rw-r--r-- | camel/camel-tcp-stream-ssl.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/camel/camel-tcp-stream-ssl.c b/camel/camel-tcp-stream-ssl.c index ed539451ad..09e5c94a02 100644 --- a/camel/camel-tcp-stream-ssl.c +++ b/camel/camel-tcp-stream-ssl.c @@ -268,20 +268,22 @@ camel_tcp_stream_ssl_enable_ssl (CamelTcpStreamSSL *ssl) g_return_val_if_fail (CAMEL_IS_TCP_STREAM_SSL (ssl), -1); if (ssl->priv->sockfd && !ssl->priv->ssl_mode) { - fd = enable_ssl (ssl, NULL); - if (fd == NULL) { - int errnosave; - + if (!(fd = enable_ssl (ssl, NULL))) { set_errno (PR_GetError ()); - errnosave = errno; - errno = errnosave; - return -1; } - SSL_ResetHandshake (fd, FALSE); - ssl->priv->sockfd = fd; + + if (SSL_ResetHandshake (fd, FALSE) == SECFailure) { + set_errno (PR_GetError ()); + return -1; + } + + if (SSL_ForceHandshake (fd) == -1) { + set_errno (PR_GetError ()); + return -1; + } } ssl->priv->ssl_mode = TRUE; |