Skip to content

Commit bc8624b

Browse files
committed
Support key word 'all' in host column of pg_hba.conf
1 parent 433c7a6 commit bc8624b

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+
else if (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+
case ipCmpAll:
1510+
break;
15061511
case ipCmpSameHost:
15071512
case ipCmpSameNet:
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
typedef enum ConnType

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy