Re: Bug #838: SSL problems in 7.3 - Mailing list pgsql-bugs

From Nathan Mueller
Subject Re: Bug #838: SSL problems in 7.3
Date
Msg-id 200212102052.OAA06164@norm.cs.wisc.edu
Whole thread Raw
In response to Bug #838: SSL problems in 7.3  (pgsql-bugs@postgresql.org)
Responses Re: Bug #838: SSL problems in 7.3  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: Bug #838: SSL problems in 7.3  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: Bug #838: SSL problems in 7.3  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-bugs
Ok, I tested this out with TLSv1 and it worked fine. I found that the
same mistake was being made on the client side of things too so I
included a patch for that too.

        --Nate

Index: src/backend/libpq/be-secure.c
===================================================================
RCS file: /s/postgresql-7.3.0/src/CVSROOT/postgresql-7.3.0/src/backend/-
libpq/be-secure.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 be-secure.c
--- src/backend/libpq/be-secure.c 2 Dec 2002 03:33:36 -0000 1.1.1.1
+++ src/backend/libpq/be-secure.c 10 Dec 2002 20:23:30 -0000
@@ -288,7 +288,8 @@
                        case SSL_ERROR_WANT_READ:
                                break;
                        case SSL_ERROR_SYSCALL:
-                               elog(ERROR, "SSL SYSCALL error: %s",
                                strerror(errno));
+                               if (n == -1)
+                                   elog(ERROR, "SSL SYSCALL error: %s",
                                    strerror(errno));
                                break;
                        case SSL_ERROR_SSL:
                                elog(ERROR, "SSL error: %s",
                                SSLerrmessage());
Index: src/interfaces/libpq/fe-secure.c
===================================================================
RCS file: /s/postgresql-7.3.0/src/CVSROOT/postgresql-7.3.0/src/interfac-
es/libpq/fe-secure.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 fe-secure.c
--- src/interfaces/libpq/fe-secure.c 2 Dec 2002 03:33:51 -0000 1.1.1.1
+++ src/interfaces/libpq/fe-secure.c 10 Dec 2002 20:24:36 -0000
@@ -270,7 +270,8 @@
                        case SSL_ERROR_WANT_READ:
                                break;
                        case SSL_ERROR_SYSCALL:
-                               printfPQExpBuffer(&conn->errorMessage,
+                               if (n == -1)
+                                   printfPQExpBuffer(&conn->err-
                                    orMessage,
                                                                libpq_g-
                                                                ettext(-
                                                                "SSL
                                                                SYSCALL
                                                                error:
                                                                %s\n"),
                                                                  SOCK_-
                                                                  STRER-
                                                                  ROR(S-
                                                                  OCK_E-
                                                                  RRNO)-
                                                                  );
                                break;
@@ -315,7 +316,8 @@
                        case SSL_ERROR_WANT_WRITE:
                                break;
                        case SSL_ERROR_SYSCALL:
-                               printfPQExpBuffer(&conn->errorMessage,
+                               if (n == -1)
+                                   printfPQExpBuffer(&conn->err-
                                    orMessage,
                                                                libpq_g-
                                                                ettext(-
                                                                "SSL
                                                                SYSCALL
                                                                error:
                                                                %s\n"),
                                                                  SOCK_-
                                                                  STRER-
                                                                  ROR(S-
                                                                  OCK_E-
                                                                  RRNO)-
                                                                  );
                                break;

pgsql-bugs by date:

Previous
From: Nathan Mueller
Date:
Subject: Re: Bug #838: SSL problems in 7.3
Next
From: Bruce Momjian
Date:
Subject: Re: Bug #838: SSL problems in 7.3