From 83e406b70ed5d1129e3bd8170ff749c11a319aa4 Mon Sep 17 00:00:00 2001 From: Lefteris Chatzimparmpas Date: Wed, 22 Feb 2012 18:58:35 +0100 Subject: [PATCH] Distinguish SSL read/write error messages printed. --- src/socket.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/socket.c b/src/socket.c index 2e551da..01812ec 100644 --- a/src/socket.c +++ b/src/socket.c @@ -279,8 +279,8 @@ socket_secure_read(session *ssn, char *buf, size_t len) switch (SSL_get_error(ssn->sslsocket, r)) { case SSL_ERROR_ZERO_RETURN: - error("reading data; the connection has been closed " - "cleanly\n"); + error("reading data through SSL; the connection has been " + "closed cleanly\n"); return -1; case SSL_ERROR_NONE: case SSL_ERROR_WANT_READ: @@ -292,16 +292,16 @@ socket_secure_read(session *ssn, char *buf, size_t len) case SSL_ERROR_SYSCALL: e = ERR_get_error(); if (e == 0 && r == 0) - error("reading data; EOF in violation of the " - "protocol\n"); + error("reading data through SSL; EOF in violation of " + "the protocol\n"); else if (e == 0 && r == -1) - error("reading data; %s\n", strerror(errno)); + error("reading data through SSL; %s\n", strerror(errno)); else - error("reading data; %s\n", ERR_error_string(e, - NULL)); + error("reading data through SSL; %s\n", + ERR_error_string(e, NULL)); return -1; case SSL_ERROR_SSL: - error("reading data; %s\n", + error("reading data through SSL; %s\n", ERR_error_string(ERR_get_error(), NULL)); return -1; default: @@ -387,8 +387,8 @@ socket_secure_write(session *ssn, const char *buf, size_t len) switch (SSL_get_error(ssn->sslsocket, r)) { case SSL_ERROR_ZERO_RETURN: - error("writing data; the connection has been closed " - "cleanly\n"); + error("writing data through SSL; the connection has been " + "closed cleanly\n"); return -1; case SSL_ERROR_NONE: case SSL_ERROR_WANT_READ: @@ -400,16 +400,16 @@ socket_secure_write(session *ssn, const char *buf, size_t len) case SSL_ERROR_SYSCALL: e = ERR_get_error(); if (e == 0 && r == 0) - error("writing data; EOF in violation of the " - "protocol\n"); + error("writing data through SSL; EOF in violation of " + "the protocol\n"); else if (e == 0 && r == -1) - error("writing data; %s\n", strerror(errno)); + error("writing data through SSL; %s\n", strerror(errno)); else - error("writing data; %s\n", ERR_error_string(e, - NULL)); + error("writing data through SSL; %s\n", + ERR_error_string(e, NULL)); return -1; case SSL_ERROR_SSL: - error("writing data; %s\n", + error("writing data through SSL; %s\n", ERR_error_string(ERR_get_error(), NULL)); return -1; default: