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

Commitbc8624b

Browse files
committed
Support key word 'all' in host column of pg_hba.conf
1 parent433c7a6 commitbc8624b

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

‎doc/src/sgml/client-auth.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ hostnossl <replaceable>database</replaceable> <replaceable>user</replaceable>
257257
</para>
258258

259259
<para>
260-
You can also write
260+
You can also write <literal>all</literal> to match any IP address,
261261
<literal>samehost</literal> to match any of the server's own IP
262262
addresses, or <literal>samenet</literal> to match any address in any
263263
subnet that the server is directly connected to.

‎src/backend/libpq/hba.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -885,8 +885,11 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
885885
}
886886
token=lfirst(line_item);
887887

888-
/* Is it equal to 'samehost' or 'samenet'? */
889-
if (strcmp(token,"samehost\n")==0)
888+
if (strcmp(token,"all\n")==0)
889+
{
890+
parsedline->ip_cmp_method=ipCmpAll;
891+
}
892+
elseif (strcmp(token,"samehost\n")==0)
890893
{
891894
/* Any IP on this host is allowed to connect */
892895
parsedline->ip_cmp_method=ipCmpSameHost;
@@ -1503,6 +1506,8 @@ check_hba(hbaPort *port)
15031506
continue;
15041507
}
15051508
break;
1509+
caseipCmpAll:
1510+
break;
15061511
caseipCmpSameHost:
15071512
caseipCmpSameNet:
15081513
if (!check_same_host_or_net(&port->raddr,

‎src/include/libpq/hba.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ typedef enum IPCompareMethod
3636
{
3737
ipCmpMask,
3838
ipCmpSameHost,
39-
ipCmpSameNet
39+
ipCmpSameNet,
40+
ipCmpAll
4041
}IPCompareMethod;
4142

4243
typedefenumConnType

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp