summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2012-02-18 12:34:30 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2012-02-18 12:34:30 +0100
commit177994dc37aa883428124ddb051e4ada05651311 (patch)
treea08576d70eac29d64ef692c5d9bd941a27b682ed
parentcaced51103979204a5eb8cafd1a4134f01fd6dd1 (diff)
downloadgnutls-177994dc37aa883428124ddb051e4ada05651311.tar.gz
properly report unexpected EOF.
-rw-r--r--lib/gnutls_errors.c3
-rw-r--r--lib/gnutls_record.c12
-rw-r--r--lib/includes/gnutls/gnutls.h.in1
3 files changed, 6 insertions, 10 deletions
diff --git a/lib/gnutls_errors.c b/lib/gnutls_errors.c
index 24f462d769..85542ef4e5 100644
--- a/lib/gnutls_errors.c
+++ b/lib/gnutls_errors.c
@@ -281,7 +281,8 @@ static const gnutls_error_entry error_algorithms[] = {
ERROR_ENTRY (N_("Error interfacing with /dev/crypto"),
GNUTLS_E_CRYPTODEV_IOCTL_ERROR, 1),
-
+ ERROR_ENTRY (N_("Peer has terminated the connection"),
+ GNUTLS_E_SESSION_EOF, 1),
ERROR_ENTRY (N_("Channel binding data not available"),
GNUTLS_E_CHANNEL_BINDING_NOT_AVAILABLE, 1),
diff --git a/lib/gnutls_record.c b/lib/gnutls_record.c
index acd44ae587..5489e41b0b 100644
--- a/lib/gnutls_record.c
+++ b/lib/gnutls_record.c
@@ -609,7 +609,7 @@ record_add_to_buffers (gnutls_session_t session,
/* If we have been expecting for an alert do
*/
session->internals.read_eof = 1;
- ret = GNUTLS_E_INT_RET_0; /* EOF */
+ ret = GNUTLS_E_SESSION_EOF;
goto cleanup;
}
else
@@ -1087,13 +1087,7 @@ begin:
/* bufel is now either deinitialized or buffered somewhere else */
if (ret < 0)
- {
- if (ret == GNUTLS_E_INT_RET_0)
- {
- return 0;
- }
- return gnutls_assert_val(ret);
- }
+ return gnutls_assert_val(ret);
return ret;
@@ -1185,7 +1179,7 @@ _gnutls_recv_int (gnutls_session_t session, content_type_t type,
return ret;
ret = _gnutls_recv_in_buffers(session, type, htype);
- if (ret < 0)
+ if (ret < 0 && ret != GNUTLS_E_SESSION_EOF)
return gnutls_assert_val(ret);
return check_buffers (session, type, data, data_size, seq);
diff --git a/lib/includes/gnutls/gnutls.h.in b/lib/includes/gnutls/gnutls.h.in
index 7e623e17c0..8bbb50422e 100644
--- a/lib/includes/gnutls/gnutls.h.in
+++ b/lib/includes/gnutls/gnutls.h.in
@@ -1888,6 +1888,7 @@ gnutls_ecc_curve_t gnutls_ecc_curve_get(gnutls_session_t session);
#define GNUTLS_E_ILLEGAL_PARAMETER -325
#define GNUTLS_E_NO_PRIORITIES_WERE_SET -326
#define GNUTLS_E_X509_UNSUPPORTED_EXTENSION -327
+#define GNUTLS_E_SESSION_EOF -328
#define GNUTLS_E_UNIMPLEMENTED_FEATURE -1250