Merge nslookup conflicts from 4.9.3-rel import

This commit is contained in:
peter 1996-01-07 05:53:23 +00:00
parent 56aa20d943
commit 9e11d51e18
3 changed files with 31 additions and 16 deletions

View File

@ -55,7 +55,7 @@
#ifndef lint #ifndef lint
static char sccsid[] = "@(#)getinfo.c 5.26 (Berkeley) 3/21/91"; 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 */ #endif /* not lint */
/* /*
@ -572,6 +572,7 @@ GetHostInfoByName(nsAddrPtr, queryClass, queryType, name, hostPtr, isServer)
register char *cp, **domain; register char *cp, **domain;
Boolean got_nodata = FALSE; Boolean got_nodata = FALSE;
struct in_addr ina; struct in_addr ina;
Boolean tried_as_is = FALSE;
/* Catch explicit addresses */ /* Catch explicit addresses */
if ((queryType == T_A) && IsAddr(name, &ina)) { if ((queryType == T_A) && IsAddr(name, &ina)) {
@ -597,6 +598,21 @@ GetHostInfoByName(nsAddrPtr, queryClass, queryType, name, hostPtr, isServer)
return (GetHostDomain(nsAddrPtr, queryClass, queryType, return (GetHostDomain(nsAddrPtr, queryClass, queryType,
cp, (char *)NULL, hostPtr, isServer)); 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 * We do at least one level of search if
* - there is no dot and RES_DEFNAME is set, or * - 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) || if ((result != NXDOMAIN && result != NO_INFO) ||
(_res.options & RES_DNSRCH) == 0) (_res.options & RES_DNSRCH) == 0)
break; break;
} }
/* /* if we have not already tried the name "as is", do that now.
* If the search/default failed, try the name as fully-qualified, * note that we do this regardless of how many dots were in the
* but only if it contained at least one dot (even trailing). * name or whether it ends with a dot.
* 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 (n && (result = GetHostDomain(nsAddrPtr, queryClass, queryType, if (!tried_as_is &&
name, (char *)NULL, hostPtr, isServer)) == SUCCESS) (result = GetHostDomain(nsAddrPtr, queryClass, queryType,
return result; name, (char *)NULL, hostPtr, isServer)
) == SUCCESS)
return (result);
if (got_nodata) if (got_nodata)
result = NO_INFO; result = NO_INFO;
return (result); return (result);

View File

@ -61,7 +61,7 @@ char copyright[] =
#ifndef lint #ifndef lint
static char sccsid[] = "@(#)main.c 5.42 (Berkeley) 3/3/91"; 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 */ #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 #ifndef ROOT_SERVER
#define ROOT_SERVER "ns.internic.net." #define ROOT_SERVER "a.root-servers.net."
#endif #endif
char rootServerName[NAME_LEN] = ROOT_SERVER; char rootServerName[NAME_LEN] = ROOT_SERVER;

View File

@ -55,7 +55,7 @@
#ifndef lint #ifndef lint
static char sccsid[] = "@(#)subr.c 5.24 (Berkeley) 3/2/91"; 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 */ #endif /* not lint */
/* /*
@ -117,7 +117,7 @@ void
IntrHandler() IntrHandler()
{ {
extern jmp_buf env; 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 FILE *yyin; /* scanner input file */
extern void yyrestart(); /* routine to restart scanner after interrupt */ extern void yyrestart(); /* routine to restart scanner after interrupt */
#endif #endif
@ -129,7 +129,7 @@ IntrHandler()
filePtr = NULL; filePtr = NULL;
} }
printf("\n"); printf("\n");
#if defined(BSD) && BSD >= 199006 && !defined(RISCOS_BSD) #if defined(BSD) && BSD >= 199006 && !defined(RISCOS_BSD) && !defined(__osf__)
yyrestart(yyin); yyrestart(yyin);
#endif #endif
longjmp(env, 1); longjmp(env, 1);