[evolution-data-server] Factor out function to rehandshake SSL
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Factor out function to rehandshake SSL
- Date: Wed, 2 Jun 2010 22:51:29 +0000 (UTC)
commit 65322588e241089845108d8a31500cbd5dbff87a
Author: Federico Mena Quintero <federico novell com>
Date: Wed Jun 2 15:02:23 2010 -0500
Factor out function to rehandshake SSL
Signed-off-by: Federico Mena Quintero <federico novell com>
camel/camel-tcp-stream-ssl.c | 37 +++++++++++++++++++------------------
1 files changed, 19 insertions(+), 18 deletions(-)
---
diff --git a/camel/camel-tcp-stream-ssl.c b/camel/camel-tcp-stream-ssl.c
index 8400c90..24db04d 100644
--- a/camel/camel-tcp-stream-ssl.c
+++ b/camel/camel-tcp-stream-ssl.c
@@ -1110,6 +1110,22 @@ tcp_socket_ssl_connect (CamelTcpStream *stream, struct addrinfo *host, gboolean
return fd;
}
+static gboolean
+rehandshake_ssl (PRFileDesc *fd)
+{
+ if (SSL_ResetHandshake (fd, FALSE) == SECFailure) {
+ set_errno (PR_GetError ());
+ return FALSE;
+ }
+
+ if (SSL_ForceHandshake (fd) == SECFailure) {
+ set_errno (PR_GetError ());
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
static PRFileDesc *
connect_to_socks4_proxy (CamelTcpStreamSSL *ssl, const gchar *proxy_host, gint proxy_port, struct addrinfo *connect_addr)
{
@@ -1187,16 +1203,8 @@ connect_to_socks4_proxy (CamelTcpStreamSSL *ssl, const gchar *proxy_host, gint p
d (g_print (" could not enable SSL\n"));
goto error;
} else {
- d (g_print (" SSL_ResetHandshake\n"));
- if (SSL_ResetHandshake (fd, FALSE) == SECFailure) {
- set_errno (PR_GetError ());
- d (g_print (" failed\n"));
- goto error;
- }
-
- d (g_print (" SSL_ForceHandshake\n"));
- if (SSL_ForceHandshake (fd) == SECFailure) {
- set_errno (PR_GetError ());
+ d (g_print (" re-handshaking SSL\n"));
+ if (!rehandshake_ssl (fd)) {
d (g_print (" failed\n"));
goto error;
}
@@ -1475,15 +1483,8 @@ camel_tcp_stream_ssl_enable_ssl (CamelTcpStreamSSL *ssl)
ssl->priv->sockfd = fd;
- if (SSL_ResetHandshake (fd, FALSE) == SECFailure) {
- set_errno (PR_GetError ());
- return -1;
- }
-
- if (SSL_ForceHandshake (fd) == SECFailure) {
- set_errno (PR_GetError ());
+ if (!rehandshake_ssl (fd))
return -1;
- }
}
ssl->priv->ssl_mode = TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]