diff options
author | Bruce Momjian <bruce@momjian.us> | 2002-12-06 03:46:37 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2002-12-06 03:46:37 +0000 |
commit | 8fc86dd593b9e9a2b24779e263ad33c37e15c9f9 (patch) | |
tree | 39402a6de176f209744c1fdedbcc18c28352f34e /src/backend/libpq/hba.c | |
parent | 87cba401a48feff7e547f59fb7ead1a1ab99042a (diff) | |
download | postgresql-8fc86dd593b9e9a2b24779e263ad33c37e15c9f9.tar.gz postgresql-8fc86dd593b9e9a2b24779e263ad33c37e15c9f9.zip |
We have just finished porting the old KAME IPv6 patch over to
postgresql version 7.3, but yea... this patch adds full IPv6
support to postgres. I've tested it out on 7.2.3 and has
been running perfectly stable.
CREDITS:
The KAME Project (Initial patch)
Nigel Kukard <nkukard@lbsd.net>
Johan Jordaan <johanj@lando.co.za>
Diffstat (limited to 'src/backend/libpq/hba.c')
-rw-r--r-- | src/backend/libpq/hba.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c index 396347945e3..5cdf60da96a 100644 --- a/src/backend/libpq/hba.c +++ b/src/backend/libpq/hba.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.88 2002/12/03 21:50:44 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.89 2002/12/06 03:46:26 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -582,9 +582,8 @@ parse_hba(List *line, hbaPort *port, bool *found_p, bool *error_p) } else if (strcmp(token, "host") == 0 || strcmp(token, "hostssl") == 0) { - struct in_addr file_ip_addr, - mask; - + SockAddr file_ip_addr, mask; + if (strcmp(token, "hostssl") == 0) { #ifdef USE_SSL @@ -619,16 +618,25 @@ parse_hba(List *line, hbaPort *port, bool *found_p, bool *error_p) if (!line) goto hba_syntax; token = lfirst(line); - if (!inet_aton(token, &file_ip_addr)) - goto hba_syntax; + + if(SockAddr_pton(&file_ip_addr, token, strlen(token)) < 0){ + goto hba_syntax; + } /* Read the mask field. */ line = lnext(line); if (!line) goto hba_syntax; token = lfirst(line); - if (!inet_aton(token, &mask)) - goto hba_syntax; + + if(SockAddr_pton(&mask, token, strlen(token)) < 0){ + goto hba_syntax; + } + + + if(file_ip_addr.sa.sa_family != mask.sa.sa_family){ + goto hba_syntax; + } /* Read the rest of the line. */ line = lnext(line); @@ -639,8 +647,7 @@ parse_hba(List *line, hbaPort *port, bool *found_p, bool *error_p) goto hba_syntax; /* Must meet network restrictions */ - if (port->raddr.sa.sa_family != AF_INET || - ((file_ip_addr.s_addr ^ port->raddr.in.sin_addr.s_addr) & mask.s_addr) != 0) + if (!isAF_INETx(&port->raddr) || !rangeSockAddr(&port->raddr, &file_ip_addr, &mask)) return; } else |