10
10
*
11
11
*
12
12
* IDENTIFICATION
13
- * $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.89 2002/12/06 03:46:26 momjian Exp $
13
+ * $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.90 2002/12/06 04:37:02 momjian Exp $
14
14
*
15
15
*-------------------------------------------------------------------------
16
16
*/
@@ -582,8 +582,9 @@ parse_hba(List *line, hbaPort *port, bool *found_p, bool *error_p)
582
582
}
583
583
else if (strcmp (token , "host" ) == 0 || strcmp (token , "hostssl" ) == 0 )
584
584
{
585
- SockAddr file_ip_addr , mask ;
586
-
585
+ struct in_addr file_ip_addr ,
586
+ mask ;
587
+
587
588
if (strcmp (token , "hostssl" ) == 0 )
588
589
{
589
590
#ifdef USE_SSL
@@ -618,25 +619,16 @@ parse_hba(List *line, hbaPort *port, bool *found_p, bool *error_p)
618
619
if (!line )
619
620
goto hba_syntax ;
620
621
token = lfirst (line );
621
-
622
- if (SockAddr_pton (& file_ip_addr , token , strlen (token )) < 0 ){
623
- goto hba_syntax ;
624
- }
622
+ if (!inet_aton (token , & file_ip_addr ))
623
+ goto hba_syntax ;
625
624
626
625
/* Read the mask field. */
627
626
line = lnext (line );
628
627
if (!line )
629
628
goto hba_syntax ;
630
629
token = lfirst (line );
631
-
632
- if (SockAddr_pton (& mask , token , strlen (token )) < 0 ){
633
- goto hba_syntax ;
634
- }
635
-
636
-
637
- if (file_ip_addr .sa .sa_family != mask .sa .sa_family ){
638
- goto hba_syntax ;
639
- }
630
+ if (!inet_aton (token , & mask ))
631
+ goto hba_syntax ;
640
632
641
633
/* Read the rest of the line. */
642
634
line = lnext (line );
@@ -647,7 +639,8 @@ parse_hba(List *line, hbaPort *port, bool *found_p, bool *error_p)
647
639
goto hba_syntax ;
648
640
649
641
/* Must meet network restrictions */
650
- if (!isAF_INETx (& port -> raddr ) || !rangeSockAddr (& port -> raddr , & file_ip_addr , & mask ))
642
+ if (port -> raddr .sa .sa_family != AF_INET ||
643
+ ((file_ip_addr .s_addr ^ port -> raddr .in .sin_addr .s_addr ) & mask .s_addr ) != 0 )
651
644
return ;
652
645
}
653
646
else
0 commit comments