summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2009-09-28 22:29:28 +0000
committerXin LI <delphij@FreeBSD.org>2009-09-28 22:29:28 +0000
commit6e769f46433de9cf7da0394ef6794d1aa22c42b1 (patch)
tree77c4225488c2ba366aedd4b9d0767207d183e733
parent76a624820187a380fcb8f695695667ac4e954b17 (diff)
Notes
-rw-r--r--lib/libc/net/resolver.315
-rw-r--r--lib/libc/resolv/res_comp.c4
2 files changed, 18 insertions, 1 deletions
diff --git a/lib/libc/net/resolver.3 b/lib/libc/net/resolver.3
index e35a5450ccb5..c1a37b3a24c8 100644
--- a/lib/libc/net/resolver.3
+++ b/lib/libc/net/resolver.3
@@ -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 attempts to declare his or her own
.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
diff --git a/lib/libc/resolv/res_comp.c b/lib/libc/resolv/res_comp.c
index a00755fbec0b..81bce5e0a4cc 100644
--- a/lib/libc/resolv/res_comp.c
+++ b/lib/libc/resolv/res_comp.c
@@ -148,7 +148,11 @@ dn_skipname(const u_char *ptr, const u_char *eom) {
#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