talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit be03f1cc40a574bf022d3de7b80638b2975b862e
parent ce0c0b27320ff29949c129c52c060a538d635115
Author: Colin Leroy <colin@colino.net>
Date:   Tue, 30 Aug 2011 16:43:17 +0000

2011-08-30 [colin]	3.7.10cvs10

	* src/common/socket.c
	* src/common/ssl.c
		Long-term fix for bug #2402, "GnuTLS change breaks socket
		communication", as per http://savannah.gnu.org/support/?107660

Diffstat:
MChangeLog | 7+++++++
MPATCHSETS | 1+
Mconfigure.ac | 2+-
Msrc/common/socket.c | 30+++++++++++++++++++-----------
Msrc/common/ssl.c | 2+-
5 files changed, 29 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,10 @@ +2011-08-30 [colin] 3.7.10cvs10 + + * src/common/socket.c + * src/common/ssl.c + Long-term fix for bug #2402, "GnuTLS change breaks socket + communication", as per http://savannah.gnu.org/support/?107660 + 2011-08-30 [colin] 3.7.10cvs9 * src/etpan/imap-thread.c diff --git a/PATCHSETS b/PATCHSETS @@ -4213,3 +4213,4 @@ ( cvs diff -u -r 1.105.2.167 -r 1.105.2.168 src/prefs_account.c; ) > 3.7.10cvs7.patchset ( cvs diff -u -r 1.3.2.34 -r 1.3.2.35 src/ssl_manager.c; cvs diff -u -r 1.9.2.44 -r 1.9.2.45 src/common/ssl.c; cvs diff -u -r 1.4.2.39 -r 1.4.2.40 src/common/ssl_certificate.c; cvs diff -u -r 1.1.4.15 -r 1.1.4.16 src/common/ssl_certificate.h; cvs diff -u -r 1.1.4.115 -r 1.1.4.116 src/etpan/imap-thread.c; cvs diff -u -r 1.1.2.17 -r 1.1.2.18 src/etpan/nntp-thread.c; ) > 3.7.10cvs8.patchset ( cvs diff -u -r 1.1.4.116 -r 1.1.4.117 src/etpan/imap-thread.c; cvs diff -u -r 1.1.2.18 -r 1.1.2.19 src/etpan/nntp-thread.c; ) > 3.7.10cvs9.patchset +( cvs diff -u -r 1.13.2.46 -r 1.13.2.47 src/common/socket.c; cvs diff -u -r 1.9.2.45 -r 1.9.2.46 src/common/ssl.c; ) > 3.7.10cvs10.patchset diff --git a/configure.ac b/configure.ac @@ -12,7 +12,7 @@ MINOR_VERSION=7 MICRO_VERSION=10 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=9 +EXTRA_VERSION=10 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/common/socket.c b/src/common/socket.c @@ -129,19 +129,21 @@ static guint io_timeout = 60; static GList *sock_connect_data_list = NULL; -static gboolean sock_prepare (GSource *source, +static gboolean ssl_sock_prepare (GSource *source, gint *timeout); -static gboolean sock_check (GSource *source); -static gboolean sock_dispatch (GSource *source, +static gboolean ssl_sock_check (GSource *source); +static gboolean ssl_sock_dispatch (GSource *source, GSourceFunc callback, gpointer user_data); -GSourceFuncs sock_watch_funcs = { - sock_prepare, - sock_check, - sock_dispatch, +#ifdef USE_GNUTLS +GSourceFuncs ssl_watch_funcs = { + ssl_sock_prepare, + ssl_sock_check, + ssl_sock_dispatch, NULL }; +#endif static gint sock_connect_with_timeout (gint sock, const struct sockaddr *serv_addr, @@ -457,13 +459,14 @@ gboolean sock_is_nonblocking_mode(SockInfo *sock) } -static gboolean sock_prepare(GSource *source, gint *timeout) +#ifdef USE_GNUTLS +static gboolean ssl_sock_prepare(GSource *source, gint *timeout) { *timeout = 1; return FALSE; } -static gboolean sock_check(GSource *source) +static gboolean ssl_sock_check(GSource *source) { SockInfo *sock = ((SockSource *)source)->sock; struct timeval timeout = {0, 0}; @@ -475,6 +478,10 @@ static gboolean sock_check(GSource *source) condition = sock->condition; + if ((condition & G_IO_IN) == G_IO_IN && + gnutls_record_check_pending(sock->ssl) != 0) + return TRUE; + FD_ZERO(&fds); FD_SET(sock->sock, &fds); @@ -486,7 +493,7 @@ static gboolean sock_check(GSource *source) return FD_ISSET(sock->sock, &fds) != 0; } -static gboolean sock_dispatch(GSource *source, GSourceFunc callback, +static gboolean ssl_sock_dispatch(GSource *source, GSourceFunc callback, gpointer user_data) { SockInfo *sock = ((SockSource *)source)->sock; @@ -496,6 +503,7 @@ static gboolean sock_dispatch(GSource *source, GSourceFunc callback, return sock->callback(sock, sock->condition, sock->data); } +#endif static gboolean sock_watch_cb(GIOChannel *source, GIOCondition condition, gpointer data) @@ -521,7 +529,7 @@ guint sock_add_watch(SockInfo *sock, GIOCondition condition, SockFunc func, #ifdef USE_GNUTLS if (sock->ssl) { - GSource *source = g_source_new(&sock_watch_funcs, + GSource *source = g_source_new(&ssl_watch_funcs, sizeof(SockSource)); ((SockSource *) source)->sock = sock; g_source_set_priority(source, G_PRIORITY_DEFAULT); diff --git a/src/common/ssl.c b/src/common/ssl.c @@ -270,7 +270,7 @@ gboolean ssl_init_socket_with_method(SockInfo *sockinfo, SSLMethod method) if (session == NULL || r != 0) return FALSE; - gnutls_transport_set_lowat (session, 1); + gnutls_transport_set_lowat (session, 0); gnutls_set_default_priority(session); gnutls_protocol_set_priority (session, proto_prio); gnutls_cipher_set_priority (session, cipher_prio);