Remove pg_hba.conf 'local' line for Win32 because it doesn't support unix domain
connections. Andrew Dunstan
This commit is contained in:
parent
513e89b44b
commit
c93872d891
|
@ -60,8 +60,9 @@
|
||||||
|
|
||||||
# TYPE DATABASE USER CIDR-ADDRESS METHOD
|
# TYPE DATABASE USER CIDR-ADDRESS METHOD
|
||||||
|
|
||||||
local all all @authmethod@
|
@remove-line-for-win32@# "local" is for Unix domain socket connections only
|
||||||
# IPv4-style local connections:
|
@remove-line-for-win32@local all all @authmethod@
|
||||||
|
# IPv4 local connections:
|
||||||
host all all 127.0.0.1/32 @authmethod@
|
host all all 127.0.0.1/32 @authmethod@
|
||||||
# IPv6-style local connections:
|
# IPv6 local connections:
|
||||||
host all all ::1/128 @authmethod@
|
host all all ::1/128 @authmethod@
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
* Portions taken from FreeBSD.
|
* Portions taken from FreeBSD.
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.54 2004/09/02 17:58:41 tgl Exp $
|
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.55 2004/10/06 09:01:18 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -147,6 +147,9 @@ char backend_exec[MAXPGPATH];
|
||||||
static void *xmalloc(size_t size);
|
static void *xmalloc(size_t size);
|
||||||
static char *xstrdup(const char *s);
|
static char *xstrdup(const char *s);
|
||||||
static char **replace_token(char **lines, char *token, char *replacement);
|
static char **replace_token(char **lines, char *token, char *replacement);
|
||||||
|
#ifdef WIN32
|
||||||
|
static char **filter_lines_with_token(char **lines, char *token);
|
||||||
|
#endif
|
||||||
static char **readfile(char *path);
|
static char **readfile(char *path);
|
||||||
static void writefile(char *path, char **lines);
|
static void writefile(char *path, char **lines);
|
||||||
static int mkdir_p(char *path, mode_t omode);
|
static int mkdir_p(char *path, mode_t omode);
|
||||||
|
@ -310,6 +313,34 @@ replace_token(char **lines, char *token, char *replacement)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* make a copy of lines without any that contain the token
|
||||||
|
* a sort of poor man's grep -v
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#ifdef WIN32
|
||||||
|
static char **
|
||||||
|
filter_lines_with_token(char **lines, char *token)
|
||||||
|
{
|
||||||
|
int numlines = 1;
|
||||||
|
int i, src, dst;
|
||||||
|
char **result;
|
||||||
|
|
||||||
|
for (i = 0; lines[i]; i++)
|
||||||
|
numlines++;
|
||||||
|
|
||||||
|
result = (char **) xmalloc(numlines * sizeof(char *));
|
||||||
|
|
||||||
|
for (src = 0, dst = 0; src < numlines; src++)
|
||||||
|
{
|
||||||
|
if (lines[src] == NULL || strstr(lines[src], token) == NULL)
|
||||||
|
result[dst++] = lines[src];
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get the lines from a text file
|
* get the lines from a text file
|
||||||
*/
|
*/
|
||||||
|
@ -1093,6 +1124,12 @@ setup_config(void)
|
||||||
|
|
||||||
conflines = readfile(hba_file);
|
conflines = readfile(hba_file);
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
conflines = filter_lines_with_token(conflines,"@remove-line-for-win32@");
|
||||||
|
#else
|
||||||
|
conflines = replace_token(conflines,"@remove-line-for-win32@","");
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_IPV6
|
#ifndef HAVE_IPV6
|
||||||
conflines = replace_token(conflines,
|
conflines = replace_token(conflines,
|
||||||
"host all all ::1",
|
"host all all ::1",
|
||||||
|
|
Loading…
Reference in New Issue