Skip site navigation (1)Skip section navigation (2)
Date:      27 Feb 2002 08:01:58 -0500
From:      Bill Triplett <btt@nethouse.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: Illegal Characters in Hostname
Message-ID:  <1014814919.1768.31.camel@fourier>
In-Reply-To: <1014747407.93220.41.camel@dev.nethouse.com>
References:  <1014747407.93220.41.camel@dev.nethouse.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--=-/qRuIGf8gzGwTcNsdjtE
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

As a kind fellow pointed out to me off list, the strict enforcement of
the no underscores is happening in libc, in: 

/usr/src/lib/libc/net/res_comp.c 

The same gentleman offered me a work-around in case I may want to add
underscores to the list of OK characters in hostnames. I know that this
is not FreeBSD's fault and that the RFC's are clear about what is and is
not allowed (except this[1] one?).

The patch to the above mentioned file is attached. I tried ping after
recompiling libc w/patch + ping, and the pings went out fine. Whether or
not the patch breaks anything else, I don't know... probably not going
to use it myself... just including it for follow-up reasons... YMMV,
etc...

Cheers, 
Bill 

[1] http://www.faqs.org/rfcs/rfc1033.html
(Under the NAMES heading) 

Other info found:

http://www.netsys.com/openbsd-misc/1998/11/msg00368.html
  Thread on openbsd mailing list regarding the '_' in hostnames

http://www.acmebw.com/askmrdns/archive.php?category=81&question=604
  Contains link to other relavent RFCs

On Tue, 2002-02-26 at 13:16, Bill Triplett wrote: 
> Greetings,
> 
> Sendmail is bouncing mail because an MX record contains a _ in the
> hostname. I realize this is illegal and will notify the domain
> administrator.
> 
> Just playing around, I noticed that I can resolve the address with host
> and dig, but can't ping it if I use the hostname as the argument to
> ping:
> 
> [btt$] ping dist_internet.<rest omitted>.com
> ping: cannot resolve dist_internet.<rest omitted>.com: Unknown server 
> 
> ----
> 
> So my questions are:
> 
> Is this strict enforcement of hostnames configurable? Not that I would
> want to leave loose enforcement on; just wondering. I noticed that linux
> doesn't seem to have a problem with _'s
> 
> Out of curiosity, what is causing the exception? Something in libc
> maybe? If I turn on debug in /etc/resolv.conf, it sure looks like the
> lookup succeeds (all responses NOERROR), then ping just basically says
> forget it.
> 
> ----
> 
> The system's uname:
> 
> FreeBSD elvis.g-d.com 4.5-STABLE FreeBSD 4.5-STABLE #0: Sat Feb 23
> 12:53:56 EST 2002     root@elvis.g-d.com:/usr/obj/usr/src/sys/ELVIS 
> i386

--=-/qRuIGf8gzGwTcNsdjtE
Content-Disposition: attachment; filename=res_comp.c_patch.txt
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=ISO-8859-1

--- res_comp.c	Fri Aug 27 20:00:16 1999
+++ res_comp.c_uscore	Tue Feb 26 22:37:31 2002
@@ -141,6 +141,7 @@
  * is not careful about this, but for some reason, we're doing it right he=
re.
  */
 #define PERIOD 0x2e
+#define uscorechar(c) ((c) =3D=3D 0x5f)
 #define	hyphenchar(c) ((c) =3D=3D 0x2d)
 #define bslashchar(c) ((c) =3D=3D 0x5c)
 #define periodchar(c) ((c) =3D=3D PERIOD)
@@ -150,7 +151,7 @@
 #define digitchar(c) ((c) >=3D 0x30 && (c) <=3D 0x39)
=20
 #define borderchar(c) (alphachar(c) || digitchar(c))
-#define middlechar(c) (borderchar(c) || hyphenchar(c))
+#define middlechar(c) (borderchar(c) || uscorechar(c) || hyphenchar(c))
 #define	domainchar(c) ((c) > 0x20 && (c) < 0x7f)
=20
 int

--=-/qRuIGf8gzGwTcNsdjtE--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1014814919.1768.31.camel>