Re: CIDR in pg_hba.conf - Mailing list pgsql-hackers

From Tom Lane
Subject Re: CIDR in pg_hba.conf
Date
Msg-id 27808.1052324959@sss.pgh.pa.us
Whole thread Raw
In response to Re: CIDR in pg_hba.conf  (Larry Rosenman <ler@lerctr.org>)
Responses Re: CIDR in pg_hba.conf  (Matthew Kirkwood <matthew@hairy.beasts.org>)
List pgsql-hackers
Larry Rosenman <ler@lerctr.org> writes:
> --On Wednesday, May 07, 2003 09:50:55 -0400 Andrew Dunstan 
>> So in hba.c, if we found a / in the IP address, we wouldn't go looking
>> for a separate netmask field.

> Please do this !

It works for me.  One thought though: someday someone might want to get
around to allowing a DNS name in the host field, too.  Can we define a
test that handles all three cases?  Perhaps do this:

* If IP address contains only 0-9 and dot (easily coded with strspn()),
then it's old-style IP address; expect netmask as next field.

* If IP address contains only 0-9, dot, and slash, then it's CIDR;
there's no separate netmask field.

* Otherwise IP address is a DNS name; there's no separate netmask.
(This case can error out for now, unless you're feeling ambitious.)
        regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Binary data representations for new protocol
Next
From: Barry Lind
Date:
Subject: Protocol V3 question