From: Nikos Mavrogiannopoulos Date: Mon, 7 Feb 2011 15:50:47 +0000 (+0100) Subject: gnutls_recv() returns GNUTLS_E_PREMATURE_TERMINATION on EOF. X-Git-Tag: gnutls_2_99_0~306 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=de3bedef9f021bfff050b75421b1873689483ef7;p=thirdparty%2Fgnutls.git gnutls_recv() returns GNUTLS_E_PREMATURE_TERMINATION on EOF. --- diff --git a/NEWS b/NEWS index 4efcc493ef..8a65c36e8b 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,9 @@ See the end for copying conditions. * Version 2.99.0 (unreleased) +** libgnutls: gnutls_recv() return GNUTLS_E_PREMATURE_TERMINATION +on unexpected EOF, instead of GNUTLS_E_UNEXPECTED_PACKET_LENGTH. + ** libgnutls: Added GCM mode (interoperates with tls.secg.org) ** libgnutls-extra: Inner application extension was removed. diff --git a/lib/gnutls_errors.c b/lib/gnutls_errors.c index c7661cd4ad..ca3403c514 100644 --- a/lib/gnutls_errors.c +++ b/lib/gnutls_errors.c @@ -74,6 +74,8 @@ static const gnutls_error_entry error_algorithms[] = { GNUTLS_E_DH_PRIME_UNACCEPTABLE, 1), ERROR_ENTRY (N_("A TLS packet with unexpected length was received."), GNUTLS_E_UNEXPECTED_PACKET_LENGTH, 1), + ERROR_ENTRY (N_("A TLS connection was non-properly terminated."), + GNUTLS_E_PREMATURE_TERMINATION, 1), ERROR_ENTRY (N_ ("The specified session has been invalidated for some reason."), GNUTLS_E_INVALID_SESSION, 1), diff --git a/lib/gnutls_record.c b/lib/gnutls_record.c index dda177b925..b85c7827dd 100644 --- a/lib/gnutls_record.c +++ b/lib/gnutls_record.c @@ -949,7 +949,11 @@ begin: return 0; /* we were expecting close notify */ } session_unresumable (session); - gnutls_assert (); + gnutls_assert(); + + if (ret == 0) + return GNUTLS_E_PREMATURE_TERMINATION; + else return GNUTLS_E_UNEXPECTED_PACKET_LENGTH; } diff --git a/lib/includes/gnutls/gnutls.h.in b/lib/includes/gnutls/gnutls.h.in index 65d10f3816..1b0c34fbe2 100644 --- a/lib/includes/gnutls/gnutls.h.in +++ b/lib/includes/gnutls/gnutls.h.in @@ -1727,6 +1727,7 @@ extern "C" #define GNUTLS_E_SAFE_RENEGOTIATION_FAILED -107 #define GNUTLS_E_UNSAFE_RENEGOTIATION_DENIED -108 #define GNUTLS_E_UNKNOWN_SRP_USERNAME -109 +#define GNUTLS_E_PREMATURE_TERMINATION -110 #define GNUTLS_E_BASE64_ENCODING_ERROR -201 #define GNUTLS_E_INCOMPATIBLE_GCRYPT_LIBRARY -202 /* obsolete */