Re: Brokenness in parsing of pg_hba.conf - Mailing list pgsql-hackers

From Kurt Roeckx
Subject Re: Brokenness in parsing of pg_hba.conf
Date
Msg-id 20040107174424.GA24834@ping.be
Whole thread Raw
In response to Re: Brokenness in parsing of pg_hba.conf  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: Brokenness in parsing of pg_hba.conf
List pgsql-hackers
On Tue, Jan 06, 2004 at 10:52:19PM -0500, Andrew Dunstan wrote:
> 
> A few points.
> 
> 1. clarification of my IRC comment: A quick examination seems to shaw 
> that we use the native getaddrinfo() where it exists, otherwise we use 
> our own, which in turn calls inet_ntoa().
> 2. ip6 has a well defined standard for abbreviation, and is quite 
> important to have since ip6 addresses would otherwise often be tediously 
> long. I haven't found a comparable standard for abbreviating IP4 
> addresses.


SUS does define it for inet_ntoa() and inet_addr():
  a.b.c.d         When four parts are specified, each shall be interpreted as a         byte of data and assigned, from
leftto right, to the four         bytes of an Internet address.  a.b.c         When a three-part address is specified,
thelast part shall be         interpreted as a 16-bit quantity and placed in the rightmost         two bytes of the
networkaddress. This makes the three-part         address format convenient for specifying Class B network
addressesas "128.net.host" .  a.b         When a two-part address is supplied, the last part shall be
interpretedas a 24-bit quantity and placed in the rightmost         three bytes of the network address. This makes the
two-part        address format convenient for specifying Class A network         addresses as "net.host" .  a
Whenonly one part is given, the value shall be stored directly         in the network address without any byte
rearrangement.
    All numbers supplied as parts in IPv4 dotted decimal notation may    be decimal, octal, or hexadecimal, as
specifiedin the ISO C    standard (that is, a leading 0x or 0X implies hexadecimal;    otherwise, a leading '0' implies
octal;otherwise, the number is    interpreted as decimal).
 

For inet_pton() it says:
    If the af argument of inet_pton() is AF_INET, the src string shall    be in the standard IPv4 dotted-decimal form:
ddd.ddd.ddd.ddd
    where "ddd" is a one to three digit decimal number between 0 and    255 (see inet_addr() ). The inet_pton()
functiondoes not accept    other formats (such as the octal numbers, hexadecimal numbers, and    fewer than four
numbersthat inet_addr() accepts).    ^^^^^^^^^^^^^^^^^^^^^^^
 


For getaddrinfo() it says:
    If the nodename argument is not null, it can be a descriptive name    or can be an address string. If the specified
addressfamily is    AF_INET, [IP6] [Option Start]  AF_INET6, [Option End] or AF_UNSPEC,    valid descriptive names
includehost names. If the specified    address family is AF_INET or AF_UNSPEC, address strings using    Internet
standarddot notation as specified in inet_addr() are    valid.
 
    [IP6] [Option Start] If the specified address family is AF_INET6 or    AF_UNSPEC, standard IPv6 text forms
describedin inet_ntop() are    valid. [Option End]
 


I'm not sure what this really says, but I can read it to either
use the inet_addr() or inet_ntop() behaviour.


Kurt



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Brokenness in parsing of pg_hba.conf
Next
From: Bruce Momjian
Date:
Subject: Re: Brokenness in parsing of pg_hba.conf