Skip to content

Commit 78ab803

Browse files
committed
Don't bother to request SSL connection over a Unix socket, since the
postmaster won't accept the request anyway. (If your kernel can't be trusted, SSL will not help you.)
1 parent 608d843 commit 78ab803

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/interfaces/libpq/fe-connect.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.181 2001/11/11 02:09:05 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.182 2002/03/02 00:49:22 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -309,7 +309,8 @@ PQconnectStart(const char *conninfo)
309309
conn->pgpass = tmp ? strdup(tmp) : NULL;
310310
#ifdef USE_SSL
311311
tmp = conninfo_getval(connOptions, "requiressl");
312-
conn->require_ssl = tmp ? (tmp[0] == '1' ? true : false) : false;
312+
if (tmp && tmp[0] == '1')
313+
conn->require_ssl = true;
313314
#endif
314315

315316
/*
@@ -504,8 +505,6 @@ PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions,
504505
#ifdef USE_SSL
505506
if ((tmp = getenv("PGREQUIRESSL")) != NULL)
506507
conn->require_ssl = (tmp[0] == '1') ? true : false;
507-
else
508-
conn->require_ssl = 0;
509508
#endif
510509

511510
if (error)
@@ -871,6 +870,11 @@ connectDBStart(PGconn *conn)
871870
{
872871
UNIXSOCK_PATH(conn->raddr.un, portno, conn->pgunixsocket);
873872
conn->raddr_len = UNIXSOCK_LEN(conn->raddr.un);
873+
#ifdef USE_SSL
874+
/* Don't bother requesting SSL over a Unix socket */
875+
conn->allow_ssl_try = false;
876+
conn->require_ssl = false;
877+
#endif
874878
}
875879
#endif
876880

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy