diff options
author | peter <peter@FreeBSD.org> | 1996-01-07 05:53:23 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1996-01-07 05:53:23 +0000 |
commit | 46b2eb17c93175d7674fcb95f7d33e84cc5f78a7 (patch) | |
tree | 02af46a777fe264540572eaf6bb299459f0055d8 | |
parent | 3ceb3f9b386d7abedbbe6f1daab1aec6b779a22d (diff) | |
download | FreeBSD-src-46b2eb17c93175d7674fcb95f7d33e84cc5f78a7.zip FreeBSD-src-46b2eb17c93175d7674fcb95f7d33e84cc5f78a7.tar.gz |
Merge nslookup conflicts from 4.9.3-rel import
-rw-r--r-- | usr.sbin/nslookup/getinfo.c | 37 | ||||
-rw-r--r-- | usr.sbin/nslookup/main.c | 4 | ||||
-rw-r--r-- | usr.sbin/nslookup/subr.c | 6 |
3 files changed, 31 insertions, 16 deletions
diff --git a/usr.sbin/nslookup/getinfo.c b/usr.sbin/nslookup/getinfo.c index 83efe4f..217c6d2 100644 --- a/usr.sbin/nslookup/getinfo.c +++ b/usr.sbin/nslookup/getinfo.c @@ -55,7 +55,7 @@ #ifndef lint static char sccsid[] = "@(#)getinfo.c 5.26 (Berkeley) 3/21/91"; -static char rcsid[] = "$Id: getinfo.c,v 1.2 1994/09/22 21:50:33 pst Exp $"; +static char rcsid[] = "$Id: getinfo.c,v 1.3 1995/05/30 03:49:14 rgrimes Exp $"; #endif /* not lint */ /* @@ -572,6 +572,7 @@ GetHostInfoByName(nsAddrPtr, queryClass, queryType, name, hostPtr, isServer) register char *cp, **domain; Boolean got_nodata = FALSE; struct in_addr ina; + Boolean tried_as_is = FALSE; /* Catch explicit addresses */ if ((queryType == T_A) && IsAddr(name, &ina)) { @@ -597,6 +598,21 @@ GetHostInfoByName(nsAddrPtr, queryClass, queryType, name, hostPtr, isServer) return (GetHostDomain(nsAddrPtr, queryClass, queryType, cp, (char *)NULL, hostPtr, isServer)); } + + /* + * If there are dots in the name already, let's just give it a try + * 'as is'. The threshold can be set with the "ndots" option. + */ + if (n >= (int)_res.ndots) { + result = GetHostDomain(nsAddrPtr, queryClass, queryType, + name, (char *)NULL, hostPtr, isServer); + if (result == SUCCESS) + return (result); + if (result == NO_INFO) + got_nodata++; + tried_as_is++; + } + /* * We do at least one level of search if * - there is no dot and RES_DEFNAME is set, or @@ -627,17 +643,16 @@ GetHostInfoByName(nsAddrPtr, queryClass, queryType, name, hostPtr, isServer) if ((result != NXDOMAIN && result != NO_INFO) || (_res.options & RES_DNSRCH) == 0) break; - } - /* - * If the search/default failed, try the name as fully-qualified, - * but only if it contained at least one dot (even trailing). - * This is purely a heuristic; we assume that any reasonable query - * about a top-level domain (for servers, SOA, etc) will not use - * res_search. + } + /* 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. */ - if (n && (result = GetHostDomain(nsAddrPtr, queryClass, queryType, - name, (char *)NULL, hostPtr, isServer)) == SUCCESS) - return result; + if (!tried_as_is && + (result = GetHostDomain(nsAddrPtr, queryClass, queryType, + name, (char *)NULL, hostPtr, isServer) + ) == SUCCESS) + return (result); if (got_nodata) result = NO_INFO; return (result); diff --git a/usr.sbin/nslookup/main.c b/usr.sbin/nslookup/main.c index 083acec..8084ffb 100644 --- a/usr.sbin/nslookup/main.c +++ b/usr.sbin/nslookup/main.c @@ -61,7 +61,7 @@ char copyright[] = #ifndef lint static char sccsid[] = "@(#)main.c 5.42 (Berkeley) 3/3/91"; -static char rcsid[] = "$Id: main.c,v 1.2 1994/09/22 21:50:36 pst Exp $"; +static char rcsid[] = "$Id: main.c,v 1.3 1995/05/30 03:49:16 rgrimes Exp $"; #endif /* not lint */ /* @@ -103,7 +103,7 @@ static char rcsid[] = "$Id: main.c,v 1.2 1994/09/22 21:50:36 pst Exp $"; */ #ifndef ROOT_SERVER -#define ROOT_SERVER "ns.internic.net." +#define ROOT_SERVER "a.root-servers.net." #endif char rootServerName[NAME_LEN] = ROOT_SERVER; diff --git a/usr.sbin/nslookup/subr.c b/usr.sbin/nslookup/subr.c index 7fcf25b..4bdff1d 100644 --- a/usr.sbin/nslookup/subr.c +++ b/usr.sbin/nslookup/subr.c @@ -55,7 +55,7 @@ #ifndef lint static char sccsid[] = "@(#)subr.c 5.24 (Berkeley) 3/2/91"; -static char rcsid[] = "$Id: subr.c,v 1.4 1995/08/20 22:32:50 peter Exp $"; +static char rcsid[] = "$Id: subr.c,v 1.5 1995/10/23 12:59:29 peter Exp $"; #endif /* not lint */ /* @@ -117,7 +117,7 @@ void IntrHandler() { extern jmp_buf env; -#if defined(BSD) && BSD >= 199006 && !defined(RISCOS_BSD) +#if defined(BSD) && BSD >= 199006 && !defined(RISCOS_BSD) && !defined(__osf__) extern FILE *yyin; /* scanner input file */ extern void yyrestart(); /* routine to restart scanner after interrupt */ #endif @@ -129,7 +129,7 @@ IntrHandler() filePtr = NULL; } printf("\n"); -#if defined(BSD) && BSD >= 199006 && !defined(RISCOS_BSD) +#if defined(BSD) && BSD >= 199006 && !defined(RISCOS_BSD) && !defined(__osf__) yyrestart(yyin); #endif longjmp(env, 1); |