diff --git a/include/resolv.h b/include/resolv.h index d49c1722e8e5..5fe95321df3c 100644 --- a/include/resolv.h +++ b/include/resolv.h @@ -53,7 +53,7 @@ * * @(#)resolv.h 8.1 (Berkeley) 6/2/93 * From Id: resolv.h,v 8.18 1997/06/01 20:34:32 vixie Exp - * $Id: resolv.h,v 1.12 1997/05/07 20:00:10 eivind Exp $ + * $Id: resolv.h,v 1.13 1997/06/27 08:32:38 peter Exp $ */ #ifndef _RESOLV_H_ @@ -135,6 +135,7 @@ struct __res_state { #define RES_INSECURE2 0x00000800 /* type 2 security disabled */ #define RES_NOALIASES 0x00001000 /* shuts off HOSTALIASES feature */ #define RES_USE_INET6 0x00002000 /* use/map IPv6 in gethostbyname() */ +#define RES_NOTLDQUERY 0x00004000 /* Don't query TLD names */ #define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH) diff --git a/lib/libc/net/res_init.c b/lib/libc/net/res_init.c index 2fa3cbcbdcb5..bf1228067fd9 100644 --- a/lib/libc/net/res_init.c +++ b/lib/libc/net/res_init.c @@ -56,7 +56,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93"; static char orig_rcsid[] = "From: Id: res_init.c,v 8.8 1997/06/01 20:34:37 vixie Exp"; -static char rcsid[] = "$Id: res_init.c,v 1.12 1997/02/22 15:00:32 peter Exp $"; +static char rcsid[] = "$Id: res_init.c,v 1.13 1997/06/27 08:22:03 peter Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -424,6 +424,8 @@ res_setoptions(options, source) #endif } else if (!strncmp(cp, "inet6", sizeof("inet6") - 1)) { _res.options |= RES_USE_INET6; + } else if (!strncmp(cp, "no_tld_query", sizeof("no_tld_query") - 1)) { + _res.options |= RES_NOTLDQUERY; } else { /* XXX - print a warning here? */ } diff --git a/lib/libc/net/res_query.c b/lib/libc/net/res_query.c index 81108958d323..3716e63dd8f1 100644 --- a/lib/libc/net/res_query.c +++ b/lib/libc/net/res_query.c @@ -56,7 +56,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)res_query.c 8.1 (Berkeley) 6/4/93"; static char orig_rcsid = "From: Id: res_query.c,v 8.10 1997/06/01 20:34:37 vixie Exp"; -static char rcsid[] = "$Id: res_query.c,v 1.13 1997/03/24 06:11:44 imp Exp $"; +static char rcsid[] = "$Id: res_query.c,v 1.14 1997/06/27 08:22:03 peter Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -281,9 +281,9 @@ res_search(name, class, type, answer, anslen) /* if we have not already tried the name "as is", do that now. * note that we do this regardless of how many dots were in the - * name or whether it ends with a dot. + * name or whether it ends with a dot unless NOTLDQUERY is set. */ - if (!tried_as_is) { + if (!tried_as_is && (dots || !(_res.options & RES_NOTLDQUERY))) { ret = res_querydomain(name, NULL, class, type, answer, anslen); if (ret > 0) return (ret); diff --git a/share/man/man5/resolver.5 b/share/man/man5/resolver.5 index 124640a70281..c8cd9a378d98 100644 --- a/share/man/man5/resolver.5 +++ b/share/man/man5/resolver.5 @@ -30,7 +30,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)resolver.5 8.1 (Berkeley) 6/5/93 -.\" $Id: resolver.5,v 1.3 1997/03/07 03:28:05 jmg Exp $ +.\" $Id: resolver.5,v 1.4 1997/05/15 20:05:16 peter Exp $ .\" .Dd November 11, 1993 .Dt RESOLVER 5 @@ -116,17 +116,16 @@ e.g. sortlist 130.155.160.0/255.255.240.0 130.155.0.0 Options allows certain internal resolver variables to be modified. The syntax is .Pp --\fBoptions\fP \fIoption\fP \fI...\fP +\fBoptions\fP \fIoption\fP \fI...\fP .Pp where .Sy option is one of the following: .Pp -.Bl -tag -width nameserver +.Bl -tag -width no_tld_query .It Sy debug sets -.Dv -RES_DEBUG +.Dv RES_DEBUG in _res.options. .It Sy ndots:n sets a threshold for the number of dots which must appear in a name given to @@ -143,13 +142,19 @@ meaning that if there are any dots in a name, the name will be tried first as an absolute name before any .Em search list elements are appended to it. -.Pp -The +.It Sy no_tld_query +tells the resolver not to attempt to resolve a top level domain name, that +is, a name that contains no dots. Use of this option doesn't prevent +the resolver from obeying the standard .Sy domain and .Sy search -keywords are mutually exclusive. +rules with the given name. .El +.Pp +Options may also be specified as a space or tab separated list using the +.Dv RES_OPTIONS +environment variable. .El .Pp The