1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-13 10:02:38 +00:00

Merge nslookup conflicts from 4.9.3-rel import

This commit is contained in:
Peter Wemm 1996-01-07 05:53:23 +00:00
parent 34d59b1442
commit 7756c6b9ec
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=13301
3 changed files with 31 additions and 16 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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);