aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-03-07 06:32:17 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-03-07 06:32:17 +0800
commit7324c70f4166344bf5dc071c3bc8bf3f76ded086 (patch)
tree45eb4ad0442da414de3240beca23bfb55c998ad3
parentcb85cdf89280479cda05952ec5ed398d4305a26d (diff)
downloadgsoc2013-evolution-7324c70f4166344bf5dc071c3bc8bf3f76ded086.tar.gz
gsoc2013-evolution-7324c70f4166344bf5dc071c3bc8bf3f76ded086.tar.zst
gsoc2013-evolution-7324c70f4166344bf5dc071c3bc8bf3f76ded086.zip
compile fixes. (camel_tcp_stream_openssl_enable_ssl): Check to make sure
2002-03-06 Jeffrey Stedfast <fejj@ximian.com> * camel-tcp-stream-openssl.c: compile fixes. (camel_tcp_stream_openssl_enable_ssl): Check to make sure that the sockfd != -1, it's not enough to check that it is non-zero. Also set the sockfd to -1 on fail (open_ssl_connection will close the sockfd on fail). svn path=/trunk/; revision=15953
-rw-r--r--camel/ChangeLog8
-rw-r--r--camel/camel-tcp-stream-openssl.c26
2 files changed, 22 insertions, 12 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 552c5f54a4..d3a42e55fe 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,11 @@
+2002-03-06 Jeffrey Stedfast <fejj@ximian.com>
+
+ * camel-tcp-stream-openssl.c: compile fixes.
+ (camel_tcp_stream_openssl_enable_ssl): Check to make sure that the
+ sockfd != -1, it's not enough to check that it is non-zero. Also
+ set the sockfd to -1 on fail (open_ssl_connection will close the
+ sockfd on fail).
+
2002-03-06 Dan Winship <danw@ximian.com>
* providers/smtp/camel-smtp-transport.c (smtp_construct): Make
diff --git a/camel/camel-tcp-stream-openssl.c b/camel/camel-tcp-stream-openssl.c
index a8256bf0ae..69c2ca139c 100644
--- a/camel/camel-tcp-stream-openssl.c
+++ b/camel/camel-tcp-stream-openssl.c
@@ -242,17 +242,19 @@ camel_tcp_stream_openssl_enable_ssl (CamelTcpStreamOpenSSL *stream)
{
SSL *ssl;
- g_return_val_if_fail (CAMEL_IS_TCP_STREAM_OPENSSL (ssl), -1);
+ g_return_val_if_fail (CAMEL_IS_TCP_STREAM_OPENSSL (stream), -1);
- if (stream->priv->sockfd && !stream->priv->ssl_mode) {
+ if (stream->priv->sockfd != -1 && !stream->priv->ssl_mode) {
ssl = open_ssl_connection (stream->priv->service, stream->priv->sockfd, stream);
- if (ssl == NULL)
+ if (ssl == NULL) {
+ stream->priv->sockfd = -1;
return -1;
+ }
- ssl->priv->ssl = ssl;
+ stream->priv->ssl = ssl;
}
- ssl->priv->ssl_mode = TRUE;
+ stream->priv->ssl_mode = TRUE;
return 0;
}
@@ -355,19 +357,19 @@ stream_write (CamelStream *stream, const char *buffer, size_t n)
fd_set rdset, wrset;
int error, flags, fdmax;
- flags = fcntl (tcp_stream_openssl->priv->sockfd, F_GETFL);
- fcntl (tcp_stream_openssl->priv->sockfd, F_SETFL, flags | O_NONBLOCK);
+ flags = fcntl (openssl->priv->sockfd, F_GETFL);
+ fcntl (openssl->priv->sockfd, F_SETFL, flags | O_NONBLOCK);
- fdmax = MAX (tcp_stream_openssl->priv->sockfd, cancel_fd) + 1;
+ fdmax = MAX (openssl->priv->sockfd, cancel_fd) + 1;
do {
FD_ZERO (&rdset);
FD_ZERO (&wrset);
- FD_SET (tcp_stream_openssl->priv->sockfd, &wrset);
+ FD_SET (openssl->priv->sockfd, &wrset);
FD_SET (cancel_fd, &rdset);
select (fdmax, &rdset, &wrset, 0, NULL);
if (FD_ISSET (cancel_fd, &rdset)) {
- fcntl (tcp_stream_openssl->priv->sockfd, F_SETFL, flags);
+ fcntl (openssl->priv->sockfd, F_SETFL, flags);
errno = EINTR;
return -1;
}
@@ -387,7 +389,7 @@ stream_write (CamelStream *stream, const char *buffer, size_t n)
w = 0;
} else {
error = errno;
- fcntl (tcp_stream_openssl->priv->sockfd, F_SETFL, flags);
+ fcntl (openssl->priv->sockfd, F_SETFL, flags);
errno = error;
return -1;
}
@@ -395,7 +397,7 @@ stream_write (CamelStream *stream, const char *buffer, size_t n)
written += w;
} while (w >= 0 && written < n);
- fcntl (tcp_stream_openssl->priv->sockfd, F_SETFL, flags);
+ fcntl (openssl->priv->sockfd, F_SETFL, flags);
}
return written;