Blame SOURCES/gnutls-3.3.8-handshake-reset3.patch

873a72
From 01049f9c00f0a903d4923a054769ef9f2187bd21 Mon Sep 17 00:00:00 2001
873a72
From: Nikos Mavrogiannopoulos <nmav@gnutls.org>
873a72
Date: Fri, 21 Nov 2014 20:18:08 +0100
873a72
Subject: [PATCH] treat GNUTLS_E_GOT_APPLICATION_DATA as non-fatal if initial
873a72
 negotiation is complete
873a72
873a72
This corrects a regression introduced in b5a0de2e6da98866cafb770c3141b7353d030ab2
873a72
Reported by Dan Winship. https://savannah.gnu.org/support/?108690
873a72
---
873a72
 lib/gnutls_handshake.c | 11 ++++++++---
873a72
 lib/gnutls_record.c    |  2 +-
873a72
 2 files changed, 9 insertions(+), 4 deletions(-)
873a72
873a72
diff --git a/lib/gnutls_handshake.c b/lib/gnutls_handshake.c
873a72
index 40d399c..e904f2e 100644
873a72
--- a/lib/gnutls_handshake.c
873a72
+++ b/lib/gnutls_handshake.c
873a72
@@ -2607,6 +2610,8 @@ gnutls_handshake_set_timeout(gnutls_session_t session, unsigned int ms)
873a72
 		/* EAGAIN and INTERRUPTED are always non-fatal */ \
873a72
 		if (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED) \
873a72
 			return ret; \
873a72
+		if (ret == GNUTLS_E_GOT_APPLICATION_DATA && session->internals.initial_negotiation_completed != 0) \
873a72
+			return ret; \
873a72
 		if (ret == GNUTLS_E_LARGE_PACKET && session->internals.handshake_large_loops < 16) { \
873a72
 			session->internals.handshake_large_loops++; \
873a72
 			return ret; \
873a72
diff --git a/lib/gnutls_record.c b/lib/gnutls_record.c
873a72
index 157d12a..40c20fe 100644
873a72
--- a/lib/gnutls_record.c
873a72
+++ b/lib/gnutls_record.c
873a72
@@ -837,7 +837,7 @@ record_add_to_buffers(gnutls_session_t session,
873a72
 			 * reasons). Otherwise it is an unexpected packet
873a72
 			 */
873a72
 			if (type == GNUTLS_ALERT
873a72
-			    || (htype == GNUTLS_HANDSHAKE_CLIENT_HELLO
873a72
+			    || ((htype == GNUTLS_HANDSHAKE_SERVER_HELLO || htype == GNUTLS_HANDSHAKE_CLIENT_HELLO)
873a72
 				&& type == GNUTLS_HANDSHAKE)) {
873a72
 				/* even if data is unexpected put it into the buffer */
873a72
 				_gnutls_record_buffer_put(session, recv->type,
873a72
-- 
873a72
2.1.0
873a72