Commit 482ed836 authored by Bruce Momjian's avatar Bruce Momjian

Check SSL_get_error() value SSL_ERROR_SYSCALL to see if SSL_read()

returned -1, per SSL_get_error() documentation.

Nathan Mueller
parent 5587f077
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/be-secure.c,v 1.16 2002/11/07 18:45:51 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/libpq/be-secure.c,v 1.17 2002/12/12 22:42:39 momjian Exp $
* *
* Since the server static private key ($DataDir/server.key) * Since the server static private key ($DataDir/server.key)
* will normally be stored unencrypted so that the database * will normally be stored unencrypted so that the database
...@@ -288,7 +288,10 @@ secure_read(Port *port, void *ptr, size_t len) ...@@ -288,7 +288,10 @@ secure_read(Port *port, void *ptr, size_t len)
case SSL_ERROR_WANT_READ: case SSL_ERROR_WANT_READ:
break; break;
case SSL_ERROR_SYSCALL: case SSL_ERROR_SYSCALL:
if (n == -1)
elog(ERROR, "SSL SYSCALL error: %s", strerror(errno)); elog(ERROR, "SSL SYSCALL error: %s", strerror(errno));
else
strerror(errno));
break; break;
case SSL_ERROR_SSL: case SSL_ERROR_SSL:
elog(ERROR, "SSL error: %s", SSLerrmessage()); elog(ERROR, "SSL error: %s", SSLerrmessage());
...@@ -337,7 +340,10 @@ secure_write(Port *port, const void *ptr, size_t len) ...@@ -337,7 +340,10 @@ secure_write(Port *port, const void *ptr, size_t len)
case SSL_ERROR_WANT_WRITE: case SSL_ERROR_WANT_WRITE:
break; break;
case SSL_ERROR_SYSCALL: case SSL_ERROR_SYSCALL:
if (n == -1)
elog(ERROR, "SSL SYSCALL error: %s", strerror(errno)); elog(ERROR, "SSL SYSCALL error: %s", strerror(errno));
else
strerror(errno));
break; break;
case SSL_ERROR_SSL: case SSL_ERROR_SSL:
elog(ERROR, "SSL error: %s", SSLerrmessage()); elog(ERROR, "SSL error: %s", SSLerrmessage());
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-secure.c,v 1.16 2002/11/07 18:45:51 tgl Exp $ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-secure.c,v 1.17 2002/12/12 22:42:39 momjian Exp $
* *
* NOTES * NOTES
* The client *requires* a valid server certificate. Since * The client *requires* a valid server certificate. Since
...@@ -270,6 +270,7 @@ pqsecure_read(PGconn *conn, void *ptr, size_t len) ...@@ -270,6 +270,7 @@ pqsecure_read(PGconn *conn, void *ptr, size_t len)
case SSL_ERROR_WANT_READ: case SSL_ERROR_WANT_READ:
break; break;
case SSL_ERROR_SYSCALL: case SSL_ERROR_SYSCALL:
if (n == -1)
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
libpq_gettext("SSL SYSCALL error: %s\n"), libpq_gettext("SSL SYSCALL error: %s\n"),
SOCK_STRERROR(SOCK_ERRNO)); SOCK_STRERROR(SOCK_ERRNO));
...@@ -315,6 +316,7 @@ pqsecure_write(PGconn *conn, const void *ptr, size_t len) ...@@ -315,6 +316,7 @@ pqsecure_write(PGconn *conn, const void *ptr, size_t len)
case SSL_ERROR_WANT_WRITE: case SSL_ERROR_WANT_WRITE:
break; break;
case SSL_ERROR_SYSCALL: case SSL_ERROR_SYSCALL:
if (n == -1)
printfPQExpBuffer(&conn->errorMessage, printfPQExpBuffer(&conn->errorMessage,
libpq_gettext("SSL SYSCALL error: %s\n"), libpq_gettext("SSL SYSCALL error: %s\n"),
SOCK_STRERROR(SOCK_ERRNO)); SOCK_STRERROR(SOCK_ERRNO));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment