]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
gnutls_recv() returns GNUTLS_E_PREMATURE_TERMINATION on EOF.
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Mon, 7 Feb 2011 15:50:47 +0000 (16:50 +0100)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Mon, 7 Feb 2011 15:50:47 +0000 (16:50 +0100)
NEWS
lib/gnutls_errors.c
lib/gnutls_record.c
lib/includes/gnutls/gnutls.h.in

diff --git a/NEWS b/NEWS
index 4efcc493ef21ea742f861c3ad94e35fcd6aa5aa7..8a65c36e8b0fbc18507cf1a65ea3da85654c0684 100644 (file)
--- 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.
index c7661cd4ad3ffba763d64ab95f7c5c83036da8b2..ca3403c51482e08b5cc2b22fcc03a111d8d07bf0 100644 (file)
@@ -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),
index dda177b9251b7deb657d4baf6e310fe9f0718878..b85c7827ddb770333005635464541e4ccf8aa33c 100644 (file)
@@ -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;
     }
 
index 65d10f3816ee083e03daf20669f64192b900d1dd..1b0c34fbe2204d5f9a01be8a144a4be924e41535 100644 (file)
@@ -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 */