hba_nolocal.patch

text/x-patch

Filename: hba_nolocal.patch
Type: text/x-patch
Part: 0
Message: Re: Unfriendly handling of pg_hba SSL options with SSL off

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
File+
src/backend/libpq/hba.c 9 0
commit 4c64761b53f1acec54af3c63b436d9f6defb845c
Author: Magnus Hagander <magnus@hagander.net>
Date:   Mon May 30 20:11:13 2011 +0200

    Refuse "local" lines in pg_hba.conf on platforms that don't support it
    
    This makes the behavior compatible with that of hostssl, which
    also throws an error when there is no SSL support included.

diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c
index c17863f..f3a3b6e 100644
--- a/src/backend/libpq/hba.c
+++ b/src/backend/libpq/hba.c
@@ -824,7 +824,16 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
 	token = lfirst(line_item);
 	if (strcmp(token, "local") == 0)
 	{
+#ifdef HAVE_UNIX_SOCKETS
 		parsedline->conntype = ctLocal;
+#else
+		ereport(LOG,
+				(errcode(ERRCODE_CONFIG_FILE_ERROR),
+				 errmsg("local connections are not supported by this build"),
+				 errcontext("line %d of configuration file \"%s\"",
+							line_num, HbaFileName)));
+		return false;
+#endif
 	}
 	else if (strcmp(token, "host") == 0
 			 || strcmp(token, "hostssl") == 0