Support key word 'all' in host column of pg_hba.conf
This commit is contained in:
parent
433c7a6545
commit
bc8624b15d
@ -257,7 +257,7 @@ hostnossl <replaceable>database</replaceable> <replaceable>user</replaceable>
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
You can also write
|
You can also write <literal>all</literal> to match any IP address,
|
||||||
<literal>samehost</literal> to match any of the server's own IP
|
<literal>samehost</literal> to match any of the server's own IP
|
||||||
addresses, or <literal>samenet</literal> to match any address in any
|
addresses, or <literal>samenet</literal> to match any address in any
|
||||||
subnet that the server is directly connected to.
|
subnet that the server is directly connected to.
|
||||||
|
@ -885,8 +885,11 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
|
|||||||
}
|
}
|
||||||
token = lfirst(line_item);
|
token = lfirst(line_item);
|
||||||
|
|
||||||
/* Is it equal to 'samehost' or 'samenet'? */
|
if (strcmp(token, "all\n") == 0)
|
||||||
if (strcmp(token, "samehost\n") == 0)
|
{
|
||||||
|
parsedline->ip_cmp_method = ipCmpAll;
|
||||||
|
}
|
||||||
|
else if (strcmp(token, "samehost\n") == 0)
|
||||||
{
|
{
|
||||||
/* Any IP on this host is allowed to connect */
|
/* Any IP on this host is allowed to connect */
|
||||||
parsedline->ip_cmp_method = ipCmpSameHost;
|
parsedline->ip_cmp_method = ipCmpSameHost;
|
||||||
@ -1503,6 +1506,8 @@ check_hba(hbaPort *port)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case ipCmpAll:
|
||||||
|
break;
|
||||||
case ipCmpSameHost:
|
case ipCmpSameHost:
|
||||||
case ipCmpSameNet:
|
case ipCmpSameNet:
|
||||||
if (!check_same_host_or_net(&port->raddr,
|
if (!check_same_host_or_net(&port->raddr,
|
||||||
|
@ -36,7 +36,8 @@ typedef enum IPCompareMethod
|
|||||||
{
|
{
|
||||||
ipCmpMask,
|
ipCmpMask,
|
||||||
ipCmpSameHost,
|
ipCmpSameHost,
|
||||||
ipCmpSameNet
|
ipCmpSameNet,
|
||||||
|
ipCmpAll
|
||||||
} IPCompareMethod;
|
} IPCompareMethod;
|
||||||
|
|
||||||
typedef enum ConnType
|
typedef enum ConnType
|
||||||
|
Loading…
Reference in New Issue
Block a user