INN 2.4.3 readers.conf bug (hostname)

Brandon Hume hume at Den.BOFH.Ca
Mon Apr 17 13:07:59 UTC 2006


There's an apparent problem with hostname-based reader authentication on
IPv6 platforms.

The function Address2Name () doesn't make assumptions as to the case of the
returned hostname, making sure to lowercase it before return, as uwildmat
seems to be a case sensitive function.

Address2Name6 doesn't canonicalize the hostname in the same way, it returns
it in exactly the same way as the resolver.  This causes problems if the
returned hostname has mixed case.

The easiest fix is this (against nnrpd/nnrpd.c):

*** nnrpd.c.old	2006-03-20 00:14:57.000000000 -0400
--- nnrpd.c	2006-04-17 10:05:13.000000000 -0300
***************
*** 385,390 ****
--- 385,391 ----
      int ret;
      bool valid = 0;
      struct addrinfo hints, *res, *res0;
+     char *p;
  
      /* Get the official hostname, store it away. */
      ret = getnameinfo( sa, SA_LEN( sa ), hostname, i, NULL, 0, NI_NAMEREQD );
***************
*** 423,430 ****
  
      freeaddrinfo( res0 );
  
!     if( valid ) return true;
!     else
      {
  	HostErrorStr = mismatch_error;
  	return false;
--- 424,436 ----
  
      freeaddrinfo( res0 );
  
!     if( valid ) {
! 	/* Make all lowercase, for wildmat. */
! 	for (p = hostname; *p; p++)
! 	    if (CTYPE(isupper, (int)*p))
! 		*p = tolower(*p);
! 	return true;
!     } else
      {
  	HostErrorStr = mismatch_error;
  	return false;



More information about the inn-bugs mailing list