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
This commit is contained in:
Colin Leroy 2011-08-30 16:43:17 +00:00
parent ce0c0b2732
commit be03f1cc40
5 changed files with 29 additions and 13 deletions

View file

@ -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

View file

@ -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

View file

@ -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=

View file

@ -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);

View file

@ -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);