Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc93872d

Browse files
committed
Remove pg_hba.conf 'local' line for Win32 because it doesn't support unix domain
connections.Andrew Dunstan
1 parent513e89b commitc93872d

File tree

2 files changed

+42
-4
lines changed

2 files changed

+42
-4
lines changed

‎src/backend/libpq/pg_hba.conf.sample

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,9 @@
6060

6161
# TYPE DATABASE USER CIDR-ADDRESS METHOD
6262

63-
local all all @authmethod@
64-
# IPv4-style local connections:
63+
@remove-line-for-win32@# "local" is for Unix domain socket connections only
64+
@remove-line-for-win32@local all all @authmethod@
65+
# IPv4 local connections:
6566
host all all 127.0.0.1/32 @authmethod@
66-
# IPv6-style local connections:
67+
# IPv6 local connections:
6768
host all all ::1/128 @authmethod@

‎src/bin/initdb/initdb.c

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* Portions Copyright (c) 1994, Regents of the University of California
4040
* Portions taken from FreeBSD.
4141
*
42-
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.54 2004/09/02 17:58:41 tgl Exp $
42+
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.55 2004/10/06 09:01:18 momjian Exp $
4343
*
4444
*-------------------------------------------------------------------------
4545
*/
@@ -147,6 +147,9 @@ charbackend_exec[MAXPGPATH];
147147
staticvoid*xmalloc(size_tsize);
148148
staticchar*xstrdup(constchar*s);
149149
staticchar**replace_token(char**lines,char*token,char*replacement);
150+
#ifdefWIN32
151+
staticchar**filter_lines_with_token(char**lines,char*token);
152+
#endif
150153
staticchar**readfile(char*path);
151154
staticvoidwritefile(char*path,char**lines);
152155
staticintmkdir_p(char*path,mode_tomode);
@@ -310,6 +313,34 @@ replace_token(char **lines, char *token, char *replacement)
310313

311314
}
312315

316+
/*
317+
* make a copy of lines without any that contain the token
318+
* a sort of poor man's grep -v
319+
*
320+
*/
321+
#ifdefWIN32
322+
staticchar**
323+
filter_lines_with_token(char**lines,char*token)
324+
{
325+
intnumlines=1;
326+
inti,src,dst;
327+
char**result;
328+
329+
for (i=0;lines[i];i++)
330+
numlines++;
331+
332+
result= (char**)xmalloc(numlines*sizeof(char*));
333+
334+
for (src=0,dst=0;src<numlines;src++)
335+
{
336+
if (lines[src]==NULL||strstr(lines[src],token)==NULL)
337+
result[dst++]=lines[src];
338+
}
339+
340+
returnresult;
341+
}
342+
#endif
343+
313344
/*
314345
* get the lines from a text file
315346
*/
@@ -1093,6 +1124,12 @@ setup_config(void)
10931124

10941125
conflines=readfile(hba_file);
10951126

1127+
#ifdefWIN32
1128+
conflines=filter_lines_with_token(conflines,"@remove-line-for-win32@");
1129+
#else
1130+
conflines=replace_token(conflines,"@remove-line-for-win32@","");
1131+
#endif
1132+
10961133
#ifndefHAVE_IPV6
10971134
conflines=replace_token(conflines,
10981135
"host all all ::1",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp