1010 *
1111 *
1212 * 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 $
1414 *
1515 *-------------------------------------------------------------------------
1616 */
@@ -582,8 +582,9 @@ parse_hba(List *line, hbaPort *port, bool *found_p, bool *error_p)
582582 }
583583 else if (strcmp (token , "host" ) == 0 || strcmp (token , "hostssl" ) == 0 )
584584 {
585- SockAddr file_ip_addr , mask ;
586-
585+ struct in_addr file_ip_addr ,
586+ mask ;
587+
587588 if (strcmp (token , "hostssl" ) == 0 )
588589 {
589590#ifdef USE_SSL
@@ -618,25 +619,16 @@ parse_hba(List *line, hbaPort *port, bool *found_p, bool *error_p)
618619 if (!line )
619620 goto hba_syntax ;
620621 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 ;
625624
626625 /* Read the mask field. */
627626 line = lnext (line );
628627 if (!line )
629628 goto hba_syntax ;
630629 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 ;
640632
641633 /* Read the rest of the line. */
642634 line = lnext (line );
@@ -647,7 +639,8 @@ parse_hba(List *line, hbaPort *port, bool *found_p, bool *error_p)
647639 goto hba_syntax ;
648640
649641 /* 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 )
651644 return ;
652645 }
653646 else
0 commit comments