From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Don't assume that "E" response to NEGOTIATE_SSL_CODE means pre-7 |
Date: | 2011-08-27 20:38:18 |
Message-ID: | E1QxPdy-0001zk-R1@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Don't assume that "E" response to NEGOTIATE_SSL_CODE means pre-7.0 server.
These days, such a response is far more likely to signify a server-side
problem, such as fork failure. Reporting "server does not support SSL"
(in sslmode=require) could be quite misleading. But the results could
be even worse in sslmode=prefer: if the problem was transient and the
next connection attempt succeeds, we'll have silently fallen back to
protocol version 2.0, possibly disabling features the user needs.
Hence, it seems best to just eliminate the assumption that backing off
to non-SSL/2.0 protocol is the way to recover from an "E" response, and
instead treat the server error the same as we would in non-SSL cases.
I tested this change against a pre-7.0 server, and found that there
was a second logic bug in the "prefer" path: the test to decide whether
to make a fallback connection attempt assumed that we must have opened
conn->ssl, which in fact does not happen given an "E" response. After
fixing that, the code does indeed connect successfully to pre-7.0,
as long as you didn't set sslmode=require. (If you did, you get
"Unsupported frontend protocol", which isn't completely off base
given the server certainly doesn't support SSL.)
Since there seems no reason to believe that pre-7.0 servers exist anymore
in the wild, back-patch to all supported branches.
Branch
------
REL9_1_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/5f81cf34e3e45ae4d464618c0b61914a60282aba
Modified Files
--------------
src/interfaces/libpq/fe-connect.c | 44 ++++++++++++++----------------------
1 files changed, 17 insertions(+), 27 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2011-08-27 20:38:19 | pgsql: Don't assume that "E" response to NEGOTIATE_SSL_CODE means pre-7 |
Previous Message | Peter Eisentraut | 2011-08-27 20:30:10 | pgsql: Document minimum required version of DocBook XSL stylesheets |