Date: Thu, 21 Feb 2008 18:08:37 -0800 (PST) From: Virgil Champlin <champlin@stupidog.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/120957: net/msntp prohibits host names beginning with a digit Message-ID: <20080222020837.247722E5CBA@whisper.stupidog.org> Resent-Message-ID: <200802220210.m1M2A1Bj014477@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 120957 >Category: ports >Synopsis: net/msntp prohibits host names beginning with a digit >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Feb 22 02:10:01 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Virgil Champlin >Release: FreeBSD 6.2-RELEASE-p10 i386 >Organization: Stupidog.org >Environment: System: FreeBSD whisper.stupidog.org 6.2-RELEASE-p10 FreeBSD 6.2-RELEASE-p10 #12: Tue Jan 15 09:38:13 PST 2008 root@whisper.stupidog.org:/usr/obj/usr/src/sys/STUPIDOG i386 >Description: The current version of msntp (v1.6, October 2000) does not allow host name arguments that begin with a digit. It does this in internet.c by testing the first character of the argument string. If it is a digit, it assumes the string is dotted quad and uses gethostbyaddr(3) for look up. If otherwise, it will use gethostbyname(3). This fails legal host names as defined by RFC-1133. >How-To-Repeat: Use msntp with a legitimate host name that begins with a digit. moose[879] msntp 0.north-america.pool.ntp.org msntp: invalid IP number 0.north-america.pool.ntp.org >Fix: Since gethostbyname(3) already handles dotted quad strings as arguments, simply remove the previously mentioned conditional code in internet.c. Please see the included patch. I contacted the original author of msntp and verified that he no longer maintains nor knows of any current maintainer for msntp. Would it be possible to include the following patch in the net/msntp port? I ask because msntp is the ntp server used by m0n0wall, the FreeBSD based firewall project at http://m0n0.ch/wall/. It is very popular and this bug has bitten there. As usual, I can not thank you enough for all your time and effort. -virgil --- patch-internet.c begins here --- --- internet.c.orig Sat Sep 30 10:42:51 2000 +++ internet.c Thu Feb 21 09:18:31 2008 @@ -77,17 +77,8 @@ /* Look up the Internet name or IP number. */ - if (! isdigit(hostname[0])) { - errno = 0; - host = gethostbyname(hostname); - } else { - if ((ipaddr = inet_addr(hostname)) == (unsigned long)-1) - fatal(0,"invalid IP number %s",hostname); - network_to_address(address,ipaddr); - errno = 0; - host = gethostbyaddr((void *)address,sizeof(struct in_addr), - AF_INET); - } + errno = 0; + host = gethostbyname(hostname); /* Now clear the timer and check the result. */ --- patch-internet.c ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080222020837.247722E5CBA>