Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Sep 2009 22:31:29 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org
Subject:   svn commit: r197602 - in stable/6/lib/libc: . net resolv
Message-ID:  <200909282231.n8SMVU1b068197@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Mon Sep 28 22:31:29 2009
New Revision: 197602
URL: http://svn.freebsd.org/changeset/base/197602

Log:
  MFC 193023+193024:
  
  Add an option to enforce strict RFC 1034 compliance.
  Document how to enable strict RFC 1034 enforcements.
  
  PR:		kern/129477

Modified:
  stable/6/lib/libc/   (props changed)
  stable/6/lib/libc/net/resolver.3
  stable/6/lib/libc/resolv/res_comp.c

Modified: stable/6/lib/libc/net/resolver.3
==============================================================================
--- stable/6/lib/libc/net/resolver.3	Mon Sep 28 22:29:28 2009	(r197601)
+++ stable/6/lib/libc/net/resolver.3	Mon Sep 28 22:31:29 2009	(r197602)
@@ -32,7 +32,7 @@
 .\"     @(#)resolver.3	8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd November 4, 2006
+.Dd May 29, 2009
 .Dt RESOLVER 3
 .Os
 .Sh NAME
@@ -405,6 +405,19 @@ function properly if the programmer atte
 .Va _res
 structure in an attempt to replace the per-thread version referred to
 by that macro.
+.Pp
+The following compile-time option can be specified to change the default
+behavior of resolver routines when necessary.
+.Bl -tag -width RES_ENFORCE_RFC1034
+.It Dv RES_ENFORCE_RFC1034
+If this symbol is defined during compile-time,
+.Fn res_search
+will enforce RFC 1034 check, namely, disallow using of underscore character
+within host names.
+This is used by the standard host lookup routines like
+.Xr gethostbyname 3 .
+For compatibility reasons this option is not enabled by default.
+.El
 .Sh RETURN VALUES
 The
 .Fn res_init

Modified: stable/6/lib/libc/resolv/res_comp.c
==============================================================================
--- stable/6/lib/libc/resolv/res_comp.c	Mon Sep 28 22:29:28 2009	(r197601)
+++ stable/6/lib/libc/resolv/res_comp.c	Mon Sep 28 22:31:29 2009	(r197602)
@@ -152,7 +152,11 @@ dn_skipname(const u_char *ptr, const u_c
 #define digitchar(c) ((c) >= 0x30 && (c) <= 0x39)
 
 #define borderchar(c) (alphachar(c) || digitchar(c))
+#ifdef	RES_ENFORCE_RFC1034
+#define middlechar(c) (borderchar(c) || hyphenchar(c))
+#else
 #define middlechar(c) (borderchar(c) || hyphenchar(c) || underscorechar(c))
+#endif
 #define	domainchar(c) ((c) > 0x20 && (c) < 0x7f)
 
 int



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