svn commit: r197601 - in stable/7/lib/libc: . net resolv

Xin LI delphij at FreeBSD.org
Mon Sep 28 22:29:29 UTC 2009


Author: delphij
Date: Mon Sep 28 22:29:28 2009
New Revision: 197601
URL: http://svn.freebsd.org/changeset/base/197601

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/7/lib/libc/   (props changed)
  stable/7/lib/libc/net/resolver.3
  stable/7/lib/libc/resolv/res_comp.c

Modified: stable/7/lib/libc/net/resolver.3
==============================================================================
--- stable/7/lib/libc/net/resolver.3	Mon Sep 28 22:18:38 2009	(r197600)
+++ stable/7/lib/libc/net/resolver.3	Mon Sep 28 22:29:28 2009	(r197601)
@@ -28,7 +28,7 @@
 .\"     @(#)resolver.3	8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd November 4, 2006
+.Dd May 29, 2009
 .Dt RESOLVER 3
 .Os
 .Sh NAME
@@ -401,6 +401,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/7/lib/libc/resolv/res_comp.c
==============================================================================
--- stable/7/lib/libc/resolv/res_comp.c	Mon Sep 28 22:18:38 2009	(r197600)
+++ stable/7/lib/libc/resolv/res_comp.c	Mon Sep 28 22:29:28 2009	(r197601)
@@ -148,7 +148,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


More information about the svn-src-all mailing list