aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-tcp-stream-ssl.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-01-15 14:25:23 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-01-15 14:25:23 +0800
commite12bc65aa5c4d6137d98471c245c24502f8a0b87 (patch)
treedfc599f9a7c8f92ae6d35d4e7777775c5ec99291 /camel/camel-tcp-stream-ssl.c
parenta27517d2d749bda92eb9232840bf8a87cd3ae80a (diff)
downloadgsoc2013-evolution-e12bc65aa5c4d6137d98471c245c24502f8a0b87.tar.gz
gsoc2013-evolution-e12bc65aa5c4d6137d98471c245c24502f8a0b87.tar.zst
gsoc2013-evolution-e12bc65aa5c4d6137d98471c245c24502f8a0b87.zip
Uses an SSL socket now although there's still a few things missing (like
2001-01-15 Jeffrey Stedfast <fejj@ximian.com> * camel-tcp-stream-ssl.c (stream_connect): Uses an SSL socket now although there's still a few things missing (like certificate handling and such). * camel.c (camel_ssl_init): A replacement function for camel_init() that also initializes SSL. svn path=/trunk/; revision=7494
Diffstat (limited to 'camel/camel-tcp-stream-ssl.c')
-rw-r--r--camel/camel-tcp-stream-ssl.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/camel/camel-tcp-stream-ssl.c b/camel/camel-tcp-stream-ssl.c
index 93b2e9da25..b346a02c61 100644
--- a/camel/camel-tcp-stream-ssl.c
+++ b/camel/camel-tcp-stream-ssl.c
@@ -160,7 +160,7 @@ stream_flush (CamelStream *stream)
static int
stream_close (CamelStream *stream)
{
- g_warning ("CamelTcpStreamSSL::close: Better to call ::disconnect.\n");
+ g_warning ("CamelTcpStreamSSL::close called on a stream where ::disconnect is preferred\n");
return PR_Close (((CamelTcpStreamSSL *)stream)->sockfd);
}
@@ -171,7 +171,7 @@ stream_connect (CamelTcpStream *stream, struct hostent *host, int port)
CamelTcpStreamSSL *ssl = CAMEL_TCP_STREAM_SSL (stream);
PRIntervalTime timeout;
PRNetAddr netaddr;
- PRFileDesc *fd;
+ PRFileDesc *fd, *ssl_fd;
g_return_val_if_fail (host != NULL, -1);
@@ -182,15 +182,16 @@ stream_connect (CamelTcpStream *stream, struct hostent *host, int port)
return -1;
fd = PR_OpenTCPSocket (host->h_addrtype);
+ ssl_fd = SSL_ImportFD (NULL, fd);
- if (fd == NULL || PR_Connect (fd, &netaddr, timeout) == PR_FAILURE) {
- if (fd != NULL)
- PR_Close (fd);
+ if (ssl_fd == NULL || PR_Connect (ssl_fd, &netaddr, timeout) == PR_FAILURE) {
+ if (ssl_fd != NULL)
+ PR_Close (ssl_fd);
return -1;
}
- ssl->sockfd = fd;
+ ssl->sockfd = ssl_fd;
return 0;
}
@@ -198,13 +199,6 @@ stream_connect (CamelTcpStream *stream, struct hostent *host, int port)
static int
stream_disconnect (CamelTcpStream *stream)
{
- PRStatus status;
-
- status = PR_Shutdown (((CamelTcpStreamSSL *)stream)->sockfd, PR_SHUTDOWN_BOTH);
-
- if (status == PR_FAILURE)
- return -1;
-
return PR_Close (((CamelTcpStreamSSL *)stream)->sockfd);
}