Support key word 'all' in host column of pg_hba.conf
authorPeter Eisentraut
Mon, 18 Oct 2010 19:14:47 +0000 (22:14 +0300)
committerPeter Eisentraut
Mon, 18 Oct 2010 19:15:44 +0000 (22:15 +0300)
doc/src/sgml/client-auth.sgml
src/backend/libpq/hba.c
src/include/libpq/hba.h

index ab96af8f66da24e2f3a6e83b6ec178511b4d250c..228cfffda3372aadba2cc1c972a38411cb8eda5c 100644 (file)
@@ -257,7 +257,7 @@ hostnossl  database  user
       
 
       
-       You can also write
+       You can also write all to match any IP address,
        samehost to match any of the server's own IP
        addresses, or samenet to match any address in any
        subnet that the server is directly connected to.
index 20c86b7ea3f8503e1c2f48fe924202de2020eebd..173635996268c659ee9b14f0033a17316eb1e246 100644 (file)
@@ -885,8 +885,11 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
        }
        token = lfirst(line_item);
 
-       /* Is it equal to 'samehost' or 'samenet'? */
-       if (strcmp(token, "samehost\n") == 0)
+       if (strcmp(token, "all\n") == 0)
+       {
+           parsedline->ip_cmp_method = ipCmpAll;
+       }
+       else if (strcmp(token, "samehost\n") == 0)
        {
            /* Any IP on this host is allowed to connect */
            parsedline->ip_cmp_method = ipCmpSameHost;
@@ -1503,6 +1506,8 @@ check_hba(hbaPort *port)
                            continue;
                    }
                    break;
+               case ipCmpAll:
+                   break;
                case ipCmpSameHost:
                case ipCmpSameNet:
                    if (!check_same_host_or_net(&port->raddr,
index eb6637f1c74854181c0e44c849d1094a5ac61e0f..aa60d8d4f1741e0d7ff97bbc8d0f9e74aed207a1 100644 (file)
@@ -36,7 +36,8 @@ typedef enum IPCompareMethod
 {
    ipCmpMask,
    ipCmpSameHost,
-   ipCmpSameNet
+   ipCmpSameNet,
+   ipCmpAll
 } IPCompareMethod;
 
 typedef enum ConnType