Refuse "local" lines in pg_hba.conf on platforms that don't support it
authorMagnus Hagander <magnus@hagander.net>
Mon, 30 May 2011 18:11:13 +0000 (20:11 +0200)
committerMagnus Hagander <magnus@hagander.net>
Mon, 30 May 2011 18:43:41 +0000 (20:43 +0200)
This makes the behavior compatible with that of hostssl, which
also throws an error when there is no SSL support included.

src/backend/libpq/hba.c

index c17863fce5fe9618c57f0d12166c7c9f7f042ceb..f3a3b6e2cc1c1368c2626e294f937193e8f761e5 100644 (file)
@@ -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