mirror of
https://github.com/opnsense/src.git
synced 2026-04-01 23:45:12 -04:00
Merge changes from vendor branch onto HEAD.
This commit is contained in:
parent
f8307e1233
commit
c91c657ae2
8 changed files with 1260 additions and 344 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -1,4 +1,4 @@
|
|||
## Copyright (c) 1996, 1997 by Internet Software Consortium
|
||||
## Copyright (c) 1996-1999 by Internet Software Consortium
|
||||
##
|
||||
## Permission to use, copy, modify, and distribute this software for any
|
||||
## purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
@ -13,7 +13,8 @@
|
|||
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
## SOFTWARE.
|
||||
|
||||
# $Id: Makefile,v 8.31 1998/03/20 00:49:46 halley Exp $
|
||||
# $Id: Makefile,v 8.47 1999/08/26 18:42:31 vixie Exp $
|
||||
# $FreeBSD$
|
||||
|
||||
DESTDIR=
|
||||
CC= cc
|
||||
|
|
@ -29,18 +30,21 @@ PORTINCL = ${TOP}/port/${SYSTYPE}/include
|
|||
LIBBIND = ${TOP}/lib/libbind.a
|
||||
A=a
|
||||
O=o
|
||||
LEX = lex -I
|
||||
EXE=
|
||||
YACC = yacc -d
|
||||
SYSLIBS = -ll -lutil
|
||||
PIDDIR = /var/run
|
||||
DESTBIN = /usr/local/bin
|
||||
DESTSBIN = /usr/local/sbin
|
||||
DESTEXEC = /usr/local/libexec
|
||||
DESTMAN = /usr/share/man
|
||||
DESTHELP= /usr/share/misc
|
||||
AR= ar cruv
|
||||
DESTETC= /etc
|
||||
DESTRUN= /var/run
|
||||
AR= ar cru
|
||||
INSTALL= install
|
||||
STRIP=-s
|
||||
INSTALL_EXEC=
|
||||
INSTALL_LIB=-o bin -g bin
|
||||
|
||||
PS=ps
|
||||
LDFLAGS=
|
||||
|
|
@ -52,23 +56,25 @@ HOSTNAMECMD= hostname || uname -n
|
|||
PROG= named
|
||||
HDRS= db_defs.h db_glob.h ns_defs.h ns_glob.h named.h pathnames.h
|
||||
SRCS= db_dump.c db_load.c db_lookup.c db_save.c db_update.c \
|
||||
db_glue.c \
|
||||
ns_parser.c ns_lexer.c ns_parseutil.c \
|
||||
db_glue.c db_ixfr.c db_sec.c db_tsig.c \
|
||||
ns_parser.c ns_lexer.c ns_parseutil.c ns_ctl.c \
|
||||
ns_forw.c ns_init.c ns_main.c ns_maint.c ns_req.c \
|
||||
ns_resp.c ns_stats.c ns_ncache.c ns_xfr.c ns_glue.c \
|
||||
ns_udp.c ns_config.c ns_update.c
|
||||
ns_udp.c ns_config.c ns_update.c ns_ixfr.c ns_signal.c \
|
||||
ns_sort.c ns_notify.c
|
||||
OBJS= db_dump.${O} db_load.${O} db_lookup.${O} db_save.${O} db_update.${O} \
|
||||
db_glue.${O} \
|
||||
ns_parser.${O} ns_lexer.${O} ns_parseutil.${O} \
|
||||
db_glue.${O} db_ixfr.${O} db_sec.${O} db_tsig.${O} \
|
||||
ns_parser.${O} ns_lexer.${O} ns_parseutil.${O} ns_ctl.${O} \
|
||||
ns_forw.${O} ns_init.${O} ns_main.${O} ns_maint.${O} ns_req.${O} \
|
||||
ns_resp.${O} ns_stats.${O} ns_ncache.${O} ns_xfr.${O} ns_glue.${O} \
|
||||
ns_udp.${O} ns_config.${O} ns_update.${O}
|
||||
ns_udp.${O} ns_config.${O} ns_update.${O} ns_ixfr.${O} ns_signal.${O} \
|
||||
ns_sort.${O} ns_notify.${O}
|
||||
|
||||
all: ${PROG} pathnames
|
||||
all: ${PROG}${EXE}
|
||||
|
||||
${PROG}: pathnames.h ${OBJS} ${LIBBIND} Makefile tmp_version.${O}
|
||||
${CC} ${CDEBUG} ${LDFLAGS} -o ${PROG} ${OBJS} tmp_version.${O} \
|
||||
${LIBBIND} ${SYSLIBS}
|
||||
${PROG}${EXE}: pathnames.h ${OBJS} ${LIBBIND} Makefile tmp_version.${O}
|
||||
${CC} ${CDEBUG} ${LDFLAGS} ${BOUNDS} -o ${PROG}${EXE} ${OBJS} \
|
||||
tmp_version.${O} ${LIBBIND} ${SYSLIBS}
|
||||
|
||||
ns_parser.c ns_parser.h: ns_parser.y
|
||||
${YACC} ns_parser.y
|
||||
|
|
@ -83,7 +89,7 @@ tmp_version.c: version.c Makefile ../Makefile ${SRCS} ${HDRS}
|
|||
-e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
|
||||
< version.c > tmp_version.c)
|
||||
|
||||
pathnames.h: ${TOP}/.settings Makefile
|
||||
pathnames.h: ${TOP}/.settings Makefile pathtemplate.h
|
||||
rm -f pathnames.h
|
||||
sed -e "s|%DESTSBIN%|${DESTSBIN}|" \
|
||||
-e "s|%DESTEXEC%|${DESTEXEC}|" \
|
||||
|
|
@ -91,19 +97,20 @@ pathnames.h: ${TOP}/.settings Makefile
|
|||
-e "s|%DESTRUN%|${DESTRUN}|" \
|
||||
< pathtemplate.h > pathnames.h
|
||||
|
||||
pathnames: pathnames.${O} pathnames.h ${LIBBIND} Makefile
|
||||
${CC} ${CDEBUG} ${LDFLAGS} -o $@ pathnames.${O} \
|
||||
${LIBBIND} ${SYSLIBS}
|
||||
ns_signal.${O}: ns_signal.c
|
||||
${CC} ${CPPFLAGS} ${CFLAGS} -c $*.c
|
||||
|
||||
.c.${O}:
|
||||
${CC} ${CPPFLAGS} ${CFLAGS} ${BOUNDS} -c $*.c
|
||||
|
||||
distclean: clean
|
||||
rm -f ns_parser.c ns_parser.h
|
||||
|
||||
clean: FRC
|
||||
rm -f ${PROG} ${OBJS} core .depend
|
||||
rm -f ${PROG}${EXE} ${OBJS} core .depend
|
||||
rm -f *.BAK *.CKP *~ *.orig
|
||||
rm -f tmp_version.c tmp_version.${O}
|
||||
rm -f pathnames pathnames.${O} tmp_pathnames.h pathnames.h
|
||||
rm -f y.tab.h y.tab.c
|
||||
rm -f pathnames.h y.tab.h y.tab.c
|
||||
|
||||
depend: ${SRCS} pathnames.h
|
||||
mkdep ${CPPFLAGS} -I${INCL} -I${PORTINCL} ${DEFS} ${SRCS}
|
||||
|
|
@ -111,8 +118,8 @@ depend: ${SRCS} pathnames.h
|
|||
${DESTDIR}${DESTSBIN}:
|
||||
mkdir -p ${DESTDIR}${DESTSBIN}
|
||||
|
||||
install: ${DESTDIR}${DESTSBIN} ${PROG}
|
||||
${INSTALL} ${STRIP} -c -m 755 ${PROG} ${DESTDIR}${DESTSBIN}/${PROG}
|
||||
install: ${DESTDIR}${DESTSBIN} ${PROG}${EXE}
|
||||
${INSTALL} ${STRIP} -c ${INSTALL_EXEC} -m 755 ${PROG}${EXE} ${DESTDIR}${DESTSBIN}/${PROG}${EXE}
|
||||
|
||||
links: FRC
|
||||
@ln -s SRC/*.[chy] SRC/test .; rm -f ns_parser.[ch]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
%{
|
||||
|
||||
/* $FreeBSD$ */
|
||||
/*
|
||||
* Copyright (c) 1985
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
|
|
@ -101,6 +101,7 @@ static char sccsid[] = "@(#)commands.l 5.13 (Berkeley) 7/24/90";
|
|||
|
||||
extern char rootServerName[];
|
||||
extern void PrintHelp();
|
||||
extern void ViewList(char *);
|
||||
|
||||
#define YY_INPUT(buf, result, max_size) \
|
||||
{ \
|
||||
|
|
@ -157,7 +158,7 @@ nslookup_yy_input(buf, result, max_size, intr)
|
|||
|
||||
%}
|
||||
WS [ \t]
|
||||
FLET [A-Za-z0-9.*\\]
|
||||
FLET [A-Za-z0-9.*\\_]
|
||||
LET [A-Za-z0-9.*]
|
||||
NAME [A-Za-z0-9.*=_/-]
|
||||
%%
|
||||
|
|
@ -196,7 +197,7 @@ NAME [A-Za-z0-9.*=_/-]
|
|||
return(1);
|
||||
}
|
||||
^{WS}*view{WS}+{NAME}+{WS}*$ {
|
||||
ViewList(yytext);
|
||||
ViewList((char *)yytext);
|
||||
return(1);
|
||||
}
|
||||
^{WS}*ls{WS}+(("-a"|"-d"|"-h"|"-m"|"-s"){WS}+)?{LET}{NAME}*{WS}+>>?{WS}+{NAME}+{WS}*$ {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* $FreeBSD$ */
|
||||
/*
|
||||
* Copyright (c) 1985, 1989
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
|
|
@ -52,8 +53,8 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)debug.c 5.26 (Berkeley) 3/21/91";
|
||||
static char rcsid[] = "$Id: debug.c,v 8.11 1998/03/19 19:30:54 halley Exp $";
|
||||
static const char sccsid[] = "@(#)debug.c 5.26 (Berkeley) 3/21/91";
|
||||
static const char rcsid[] = "$Id: debug.c,v 8.15 1999/10/13 16:39:16 vixie Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
|
|
@ -89,7 +90,6 @@ static char rcsid[] = "$Id: debug.c,v 8.11 1998/03/19 19:30:54 halley Exp $";
|
|||
/*
|
||||
* Imported from res_debug.c
|
||||
*/
|
||||
extern char *_res_resultcodes[];
|
||||
extern char *_res_opcodes[];
|
||||
|
||||
/*
|
||||
|
|
@ -120,11 +120,11 @@ Fprint_query(const u_char *msg, const u_char *eom, int printHeader, FILE *file)
|
|||
*/
|
||||
hp = (HEADER *)msg;
|
||||
cp = msg + HFIXEDSZ;
|
||||
if (printHeader || (_res.options & RES_DEBUG2)) {
|
||||
if (printHeader || (res.options & RES_DEBUG2)) {
|
||||
fprintf(file," HEADER:\n");
|
||||
fprintf(file,"\topcode = %s", _res_opcodes[hp->opcode]);
|
||||
fprintf(file,", id = %d", ntohs(hp->id));
|
||||
fprintf(file,", rcode = %s\n", _res_resultcodes[hp->rcode]);
|
||||
fprintf(file,", rcode = %s\n", p_rcode(hp->rcode));
|
||||
fprintf(file,"\theader flags: ");
|
||||
if (hp->qr) {
|
||||
fprintf(file," response");
|
||||
|
|
@ -281,9 +281,9 @@ Print_rr(const u_char *ocp, const u_char *msg, const u_char *eom, FILE *file) {
|
|||
NS_GET16(dlen, cp);
|
||||
BOUNDS_CHECK(cp, dlen);
|
||||
|
||||
debug = _res.options & (RES_DEBUG|RES_DEBUG2);
|
||||
debug = res.options & (RES_DEBUG|RES_DEBUG2);
|
||||
if (debug) {
|
||||
if (_res.options & RES_DEBUG2)
|
||||
if (res.options & RES_DEBUG2)
|
||||
fprintf(file,"\n\ttype = %s, class = %s, dlen = %d",
|
||||
p_type(type), p_class(class), dlen);
|
||||
if (type == T_SOA)
|
||||
|
|
@ -623,8 +623,9 @@ Print_rr(const u_char *ocp, const u_char *msg, const u_char *eom, FILE *file) {
|
|||
default: {
|
||||
char buf[2048]; /* XXX need to malloc/realloc. */
|
||||
|
||||
if (ns_sprintrrf(msg, eom - msg, "?", class, type, rrttl,
|
||||
cp1, dlen, NULL, NULL, buf, sizeof buf) < 0) {
|
||||
if (ns_sprintrrf(msg, eom - msg, "?", (ns_class)class,
|
||||
(ns_type)type, rrttl, cp1, dlen, NULL, NULL,
|
||||
buf, sizeof buf) < 0) {
|
||||
perror("ns_sprintrrf");
|
||||
} else {
|
||||
fprintf(file,
|
||||
|
|
@ -634,7 +635,7 @@ Print_rr(const u_char *ocp, const u_char *msg, const u_char *eom, FILE *file) {
|
|||
cp += dlen;
|
||||
}
|
||||
}
|
||||
if (_res.options & RES_DEBUG && type != T_SOA) {
|
||||
if (res.options & RES_DEBUG && type != T_SOA) {
|
||||
fprintf(file,"\tttl = %lu (%s)\n", rrttl, p_time(rrttl));
|
||||
}
|
||||
if (cp != cp1 + dlen) {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* $FreeBSD$ */
|
||||
/*
|
||||
* Copyright (c) 1985, 1989
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
|
|
@ -52,8 +53,8 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)getinfo.c 5.26 (Berkeley) 3/21/91";
|
||||
static char rcsid[] = "$Id: getinfo.c,v 8.11 1998/03/19 19:30:55 halley Exp $";
|
||||
static const char sccsid[] = "@(#)getinfo.c 5.26 (Berkeley) 3/21/91";
|
||||
static const char rcsid[] = "$Id: getinfo.c,v 8.15 1999/10/13 16:39:16 vixie Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
|
|
@ -88,7 +89,6 @@ static char rcsid[] = "$Id: getinfo.c,v 8.11 1998/03/19 19:30:55 halley Exp $";
|
|||
|
||||
#include "res.h"
|
||||
|
||||
extern char *_res_resultcodes[];
|
||||
extern char *res_skip();
|
||||
|
||||
static char *addr_list[MAXADDRS + 1];
|
||||
|
|
@ -109,7 +109,7 @@ ServerTable server[MAXSERVERS];
|
|||
|
||||
typedef union {
|
||||
HEADER qb1;
|
||||
u_char qb2[PACKETSZ*2];
|
||||
u_char qb2[64*1024];
|
||||
} querybuf;
|
||||
|
||||
typedef union {
|
||||
|
|
@ -162,10 +162,10 @@ GetAnswer(nsAddrPtr, queryType, msg, msglen, iquery, hostPtr, isServer)
|
|||
int numAliases = 0;
|
||||
int numAddresses = 0;
|
||||
int n, i, j;
|
||||
int len;
|
||||
int dlen;
|
||||
int status;
|
||||
int numServers;
|
||||
size_t s;
|
||||
Boolean haveAnswer;
|
||||
Boolean printedAnswers = FALSE;
|
||||
|
||||
|
|
@ -179,7 +179,7 @@ GetAnswer(nsAddrPtr, queryType, msg, msglen, iquery, hostPtr, isServer)
|
|||
sizeof(answer), &n);
|
||||
|
||||
if (status != SUCCESS) {
|
||||
if (_res.options & RES_DEBUG2)
|
||||
if (res.options & RES_DEBUG2)
|
||||
printf("SendRequest failed\n");
|
||||
return (status);
|
||||
}
|
||||
|
|
@ -268,11 +268,11 @@ GetAnswer(nsAddrPtr, queryType, msg, msglen, iquery, hostPtr, isServer)
|
|||
continue;
|
||||
}
|
||||
*aliasPtr++ = (char *)bp;
|
||||
n = strlen((char *)bp) + 1;
|
||||
host_aliases_len[numAliases] = n;
|
||||
s = strlen((char *)bp) + 1;
|
||||
host_aliases_len[numAliases] = s;
|
||||
numAliases++;
|
||||
bp += n;
|
||||
buflen -= n;
|
||||
bp += s;
|
||||
buflen -= s;
|
||||
continue;
|
||||
} else if (type == T_PTR) {
|
||||
/*
|
||||
|
|
@ -284,9 +284,9 @@ GetAnswer(nsAddrPtr, queryType, msg, msglen, iquery, hostPtr, isServer)
|
|||
continue;
|
||||
}
|
||||
cp += n;
|
||||
len = strlen((char *)bp) + 1;
|
||||
hostPtr->name = Calloc(1, len);
|
||||
memcpy(hostPtr->name, bp, len);
|
||||
s = strlen((char *)bp) + 1;
|
||||
hostPtr->name = Calloc(1, s);
|
||||
memcpy(hostPtr->name, bp, s);
|
||||
haveAnswer = TRUE;
|
||||
break;
|
||||
} else if (type != T_A) {
|
||||
|
|
@ -316,14 +316,14 @@ GetAnswer(nsAddrPtr, queryType, msg, msglen, iquery, hostPtr, isServer)
|
|||
hostPtr->addrLen = dlen;
|
||||
origClass = class;
|
||||
hostPtr->addrType = (class == C_IN) ? AF_INET : AF_UNSPEC;
|
||||
len = strlen((char *)bp) + 1;
|
||||
hostPtr->name = Calloc(1, len);
|
||||
memcpy(hostPtr->name, bp, len);
|
||||
s = strlen((char *)bp) + 1;
|
||||
hostPtr->name = Calloc(1, s);
|
||||
memcpy(hostPtr->name, bp, s);
|
||||
}
|
||||
bp += (((u_long)bp) % sizeof(align));
|
||||
|
||||
if (bp + dlen >= &hostbuf[sizeof(hostbuf)]) {
|
||||
if (_res.options & RES_DEBUG) {
|
||||
if (res.options & RES_DEBUG) {
|
||||
printf("Size (%d) too big\n", dlen);
|
||||
}
|
||||
break;
|
||||
|
|
@ -417,9 +417,9 @@ GetAnswer(nsAddrPtr, queryType, msg, msglen, iquery, hostPtr, isServer)
|
|||
return(ERROR);
|
||||
}
|
||||
cp += n;
|
||||
len = strlen((char *)bp) + 1;
|
||||
dnamePtr = Calloc(1, len); /* domain name */
|
||||
memcpy(dnamePtr, bp, len);
|
||||
s = strlen((char *)bp) + 1;
|
||||
dnamePtr = Calloc(1, s); /* domain name */
|
||||
memcpy(dnamePtr, bp, s);
|
||||
|
||||
if (cp + 3 * INT16SZ + INT32SZ > eom)
|
||||
return (ERROR);
|
||||
|
|
@ -440,9 +440,9 @@ GetAnswer(nsAddrPtr, queryType, msg, msglen, iquery, hostPtr, isServer)
|
|||
return(ERROR);
|
||||
}
|
||||
cp += n;
|
||||
len = strlen((char *)bp) + 1;
|
||||
namePtr = Calloc(1, len); /* server host name */
|
||||
memcpy(namePtr, bp, len);
|
||||
s = strlen((char *)bp) + 1;
|
||||
namePtr = Calloc(1, s); /* server host name */
|
||||
memcpy(namePtr, bp, s);
|
||||
|
||||
/*
|
||||
* Store the information keyed by the server host name.
|
||||
|
|
@ -579,10 +579,10 @@ GetAnswer(nsAddrPtr, queryType, msg, msglen, iquery, hostPtr, isServer)
|
|||
* Retrieves host name, address and alias information
|
||||
* for a domain.
|
||||
*
|
||||
* Algorithm from res_search().
|
||||
* Algorithm from res_nsearch().
|
||||
*
|
||||
* Results:
|
||||
* ERROR - res_mkquery failed.
|
||||
* ERROR - res_nmkquery failed.
|
||||
* + return values from GetAnswer()
|
||||
*
|
||||
*******************************************************************************
|
||||
|
|
@ -604,6 +604,7 @@ GetHostInfoByName(nsAddrPtr, queryClass, queryType, name, hostPtr, isServer)
|
|||
Boolean got_nodata = FALSE;
|
||||
struct in_addr ina;
|
||||
Boolean tried_as_is = FALSE;
|
||||
char tmp[NS_MAXDNAME];
|
||||
|
||||
/* Catch explicit addresses */
|
||||
if ((queryType == T_A) && IsAddr(name, &ina)) {
|
||||
|
|
@ -624,7 +625,7 @@ GetHostInfoByName(nsAddrPtr, queryClass, queryType, name, hostPtr, isServer)
|
|||
for (cp = name, n = 0; *cp; cp++)
|
||||
if (*cp == '.')
|
||||
n++;
|
||||
if (n == 0 && (cp = hostalias(name))) {
|
||||
if (n == 0 && (cp = res_hostalias(&res, name, tmp, sizeof tmp))) {
|
||||
printf("Aliased to \"%s\"\n\n", cp);
|
||||
return (GetHostDomain(nsAddrPtr, queryClass, queryType,
|
||||
cp, (char *)NULL, hostPtr, isServer));
|
||||
|
|
@ -634,7 +635,7 @@ GetHostInfoByName(nsAddrPtr, queryClass, queryType, name, 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) {
|
||||
if (n >= (int)res.ndots) {
|
||||
result = GetHostDomain(nsAddrPtr, queryClass, queryType,
|
||||
name, (char *)NULL, hostPtr, isServer);
|
||||
if (result == SUCCESS)
|
||||
|
|
@ -650,9 +651,9 @@ GetHostInfoByName(nsAddrPtr, queryClass, queryType, name, hostPtr, isServer)
|
|||
* - there is at least one dot, there is no trailing dot,
|
||||
* and RES_DNSRCH is set.
|
||||
*/
|
||||
if ((n == 0 && _res.options & RES_DEFNAMES) ||
|
||||
(n != 0 && *--cp != '.' && _res.options & RES_DNSRCH))
|
||||
for (domain = _res.dnsrch; *domain; domain++) {
|
||||
if ((n == 0 && res.options & RES_DEFNAMES) ||
|
||||
(n != 0 && *--cp != '.' && res.options & RES_DNSRCH))
|
||||
for (domain = res.dnsrch; *domain; domain++) {
|
||||
result = GetHostDomain(nsAddrPtr, queryClass, queryType,
|
||||
name, *domain, hostPtr, isServer);
|
||||
/*
|
||||
|
|
@ -672,7 +673,7 @@ GetHostInfoByName(nsAddrPtr, queryClass, queryType, name, hostPtr, isServer)
|
|||
if (result == NO_INFO)
|
||||
got_nodata++;
|
||||
if ((result != NXDOMAIN && result != NO_INFO) ||
|
||||
(_res.options & RES_DNSRCH) == 0)
|
||||
(res.options & RES_DNSRCH) == 0)
|
||||
break;
|
||||
}
|
||||
/* if we have not already tried the name "as is", do that now.
|
||||
|
|
@ -722,11 +723,11 @@ GetHostDomain(nsAddrPtr, queryClass, queryType, name, domain, hostPtr, isServer)
|
|||
MAXDNAME, name, MAXDNAME, domain);
|
||||
longname = nbuf;
|
||||
}
|
||||
n = res_mkquery(QUERY, longname, queryClass, queryType,
|
||||
NULL, 0, 0, buf.qb2, sizeof(buf));
|
||||
n = res_nmkquery(&res, QUERY, longname, queryClass, queryType,
|
||||
NULL, 0, 0, buf.qb2, sizeof(buf));
|
||||
if (n < 0) {
|
||||
if (_res.options & RES_DEBUG) {
|
||||
printf("Res_mkquery failed\n");
|
||||
if (res.options & RES_DEBUG) {
|
||||
printf("Res_nmkquery failed\n");
|
||||
}
|
||||
return (ERROR);
|
||||
}
|
||||
|
|
@ -738,7 +739,8 @@ GetHostDomain(nsAddrPtr, queryClass, queryType, name, domain, hostPtr, isServer)
|
|||
*/
|
||||
if (n == NONAUTH) {
|
||||
if (hostPtr->name == NULL) {
|
||||
int len = strlen(longname) + 1;
|
||||
size_t len = strlen(longname) + 1;
|
||||
|
||||
hostPtr->name = Calloc(len, sizeof(char));
|
||||
memcpy(hostPtr->name, longname, len);
|
||||
}
|
||||
|
|
@ -756,7 +758,7 @@ GetHostDomain(nsAddrPtr, queryClass, queryType, name, domain, hostPtr, isServer)
|
|||
* that corresponds to the given address.
|
||||
*
|
||||
* Results:
|
||||
* ERROR - res_mkquery failed.
|
||||
* ERROR - res_nmkquery failed.
|
||||
* + return values from GetAnswer()
|
||||
*
|
||||
*******************************************************************************
|
||||
|
|
@ -778,11 +780,11 @@ GetHostInfoByAddr(nsAddrPtr, address, hostPtr)
|
|||
((unsigned)p[2] & 0xff),
|
||||
((unsigned)p[1] & 0xff),
|
||||
((unsigned)p[0] & 0xff));
|
||||
n = res_mkquery(QUERY, qbuf, C_IN, T_PTR, NULL, 0, NULL,
|
||||
buf.qb2, sizeof buf);
|
||||
n = res_nmkquery(&res, QUERY, qbuf, C_IN, T_PTR, NULL, 0, NULL,
|
||||
buf.qb2, sizeof buf);
|
||||
if (n < 0) {
|
||||
if (_res.options & RES_DEBUG) {
|
||||
printf("res_mkquery() failed\n");
|
||||
if (res.options & RES_DEBUG) {
|
||||
printf("res_nmkquery() failed\n");
|
||||
}
|
||||
return (ERROR);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
/* $FreeBSD$ */
|
||||
/*
|
||||
* Copyright (c) 1985, 1989
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
|
|
@ -51,15 +52,33 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
char copyright[] =
|
||||
"@(#) Copyright (c) 1985,1989 Regents of the University of California.\n\
|
||||
All rights reserved.\n";
|
||||
All rights reserved.\n\
|
||||
@(#) Portions Copyright (c) 1996-1999 Internet Software Consortium.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
static char sccsid[] = "@(#)main.c 5.42 (Berkeley) 3/3/91";
|
||||
static char rcsid[] = "$Id: main.c,v 8.7 1997/04/25 00:27:18 vixie Exp $";
|
||||
static const char sccsid[] = "@(#)main.c 5.42 (Berkeley) 3/3/91";
|
||||
static const char rcsid[] = "$Id: main.c,v 8.13 1999/10/13 16:39:19 vixie Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
|
|
@ -113,10 +132,10 @@ static char rcsid[] = "$Id: main.c,v 8.7 1997/04/25 00:27:18 vixie Exp $";
|
|||
char rootServerName[NAME_LEN] = ROOT_SERVER;
|
||||
|
||||
/*
|
||||
* Import the state information from the resolver library.
|
||||
* Declare a resolver context.
|
||||
*/
|
||||
|
||||
extern struct __res_state _res;
|
||||
struct __res_state res;
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -160,6 +179,13 @@ char *pager;
|
|||
static void CvtAddrToPtr();
|
||||
static void ReadRC();
|
||||
|
||||
/*
|
||||
* Forward declarations.
|
||||
*/
|
||||
void LocalServer(HostInfo *defaultPtr);
|
||||
void res_re_init(void);
|
||||
void res_dnsrch(char *cp);
|
||||
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
|
|
@ -187,7 +213,7 @@ main(argc, argv)
|
|||
* Initialize the resolver library routines.
|
||||
*/
|
||||
|
||||
if (res_init() == -1) {
|
||||
if (res_ninit(&res) == -1) {
|
||||
fprintf(stderr,"*** Can't initialize resolver.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
|
@ -245,8 +271,8 @@ main(argc, argv)
|
|||
*/
|
||||
|
||||
if (inet_aton(*++argv, &addr)) {
|
||||
_res.nscount = 1;
|
||||
_res.nsaddr.sin_addr = addr;
|
||||
res.nscount = 1;
|
||||
res.nsaddr.sin_addr = addr;
|
||||
} else {
|
||||
hp = gethostbyname(*argv);
|
||||
if (hp == NULL) {
|
||||
|
|
@ -256,33 +282,33 @@ main(argc, argv)
|
|||
fputc('\n', stderr);
|
||||
} else {
|
||||
for (i = 0; i < MAXNS && hp->h_addr_list[i] != NULL; i++) {
|
||||
memcpy(&_res.nsaddr_list[i].sin_addr, hp->h_addr_list[i],
|
||||
memcpy(&res.nsaddr_list[i].sin_addr, hp->h_addr_list[i],
|
||||
hp->h_length);
|
||||
}
|
||||
_res.nscount = i;
|
||||
res.nscount = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (_res.nscount == 0 || useLocalServer) {
|
||||
if (res.nscount == 0 || useLocalServer) {
|
||||
LocalServer(defaultPtr);
|
||||
} else {
|
||||
for (i = 0; i < _res.nscount; i++) {
|
||||
if (_res.nsaddr_list[i].sin_addr.s_addr == INADDR_ANY) {
|
||||
for (i = 0; i < res.nscount; i++) {
|
||||
if (res.nsaddr_list[i].sin_addr.s_addr == INADDR_ANY) {
|
||||
LocalServer(defaultPtr);
|
||||
break;
|
||||
} else {
|
||||
result = GetHostInfoByAddr(&(_res.nsaddr_list[i].sin_addr),
|
||||
&(_res.nsaddr_list[i].sin_addr),
|
||||
result = GetHostInfoByAddr(&(res.nsaddr_list[i].sin_addr),
|
||||
&(res.nsaddr_list[i].sin_addr),
|
||||
defaultPtr);
|
||||
if (result != SUCCESS) {
|
||||
fprintf(stderr,
|
||||
"*** Can't find server name for address %s: %s\n",
|
||||
inet_ntoa(_res.nsaddr_list[i].sin_addr),
|
||||
inet_ntoa(res.nsaddr_list[i].sin_addr),
|
||||
DecodeError(result));
|
||||
} else {
|
||||
defaultAddr = _res.nsaddr_list[i].sin_addr;
|
||||
defaultAddr = res.nsaddr_list[i].sin_addr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -293,7 +319,7 @@ main(argc, argv)
|
|||
* command line argument to specify an address.
|
||||
*/
|
||||
|
||||
if (i == _res.nscount) {
|
||||
if (i == res.nscount) {
|
||||
fprintf(stderr, "*** Default servers are not available\n");
|
||||
exit(1);
|
||||
}
|
||||
|
|
@ -304,10 +330,10 @@ main(argc, argv)
|
|||
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUG2
|
||||
_res.options |= RES_DEBUG2;
|
||||
res.options |= RES_DEBUG2;
|
||||
#endif
|
||||
_res.options |= RES_DEBUG;
|
||||
_res.retry = 2;
|
||||
res.options |= RES_DEBUG;
|
||||
res.retry = 2;
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
|
|
@ -350,6 +376,7 @@ main(argc, argv)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
LocalServer(defaultPtr)
|
||||
HostInfo *defaultPtr;
|
||||
{
|
||||
|
|
@ -459,6 +486,7 @@ SetDefaultServer(string, local)
|
|||
char newServer[NAME_LEN];
|
||||
int result;
|
||||
int i;
|
||||
int j;
|
||||
|
||||
/*
|
||||
* Parse the command line. It maybe of the form "server name",
|
||||
|
|
@ -466,13 +494,32 @@ SetDefaultServer(string, local)
|
|||
*/
|
||||
|
||||
if (local) {
|
||||
i = sscanf(string, " lserver %s", newServer);
|
||||
i = matchString (" lserver ", string);
|
||||
if (i > 0) {
|
||||
j = pickString(string + i, newServer, sizeof newServer);
|
||||
if (j == 0) { /* value was too big for newServer variable */
|
||||
fprintf(stderr,
|
||||
"SetDefaultServer: invalid name: %s\n",
|
||||
string + i);
|
||||
return(ERROR);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
i = sscanf(string, " server %s", newServer);
|
||||
i = matchString(" server ", string);
|
||||
if (i > 0) {
|
||||
j = pickString(string + i, newServer, sizeof newServer);
|
||||
if (j == 0) { /* value was too big for newServer variable */
|
||||
fprintf(stderr,
|
||||
"SetDefaultServer: invalid name: %s\n",
|
||||
string + i);
|
||||
return(ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i != 1) {
|
||||
i = sscanf(string, " %s", newServer);
|
||||
if (i != 1) {
|
||||
|
||||
if (i == 0) {
|
||||
i = pickString(string, newServer, sizeof newServer);
|
||||
if (i == 0) { /* value was too big for newServer variable */
|
||||
fprintf(stderr,"SetDefaultServer: invalid name: %s\n", string);
|
||||
return(ERROR);
|
||||
}
|
||||
|
|
@ -662,6 +709,7 @@ LookupHost(string, putToFile)
|
|||
char host[NAME_LEN];
|
||||
char file[PATH_MAX];
|
||||
int result;
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Invalidate the current host information to prevent Finger
|
||||
|
|
@ -676,11 +724,16 @@ LookupHost(string, putToFile)
|
|||
*
|
||||
*/
|
||||
|
||||
sscanf(string, " %s", host); /* removes white space */
|
||||
i = pickString(string, host, sizeof host);
|
||||
if (i == 0) { /* string was too long for host variable */
|
||||
fprintf(stderr, "*** invalid name: %s\n", string);
|
||||
return(ERROR);
|
||||
}
|
||||
|
||||
if (!putToFile) {
|
||||
filePtr = stdout;
|
||||
} else {
|
||||
filePtr = OpenFile(string, file);
|
||||
filePtr = OpenFile(string, file, sizeof file);
|
||||
if (filePtr == NULL) {
|
||||
fprintf(stderr, "*** Can't open %s for writing\n", file);
|
||||
return(ERROR);
|
||||
|
|
@ -734,14 +787,27 @@ LookupHostWithServer(string, putToFile)
|
|||
char server[NAME_LEN];
|
||||
int result;
|
||||
static HostInfo serverInfo;
|
||||
int i;
|
||||
int j;
|
||||
|
||||
curHostValid = FALSE;
|
||||
|
||||
sscanf(string, " %s %s", host, server);
|
||||
i = pickString(string, host, sizeof host);
|
||||
if (i == 0) { /* value was too big for host variable */
|
||||
fprintf(stderr, "*** invalid name: %s\n", string);
|
||||
return(ERROR);
|
||||
}
|
||||
|
||||
j = pickString(string + i, server, sizeof server);
|
||||
if (j == 0) { /* value was too big for server variable */
|
||||
fprintf(stderr, "*** invalid server name: %s\n", string + i);
|
||||
return(ERROR);
|
||||
}
|
||||
|
||||
if (!putToFile) {
|
||||
filePtr = stdout;
|
||||
} else {
|
||||
filePtr = OpenFile(string, file);
|
||||
filePtr = OpenFile(string, file, sizeof file);
|
||||
if (filePtr == NULL) {
|
||||
fprintf(stderr, "*** Can't open %s for writing\n", file);
|
||||
return(ERROR);
|
||||
|
|
@ -818,6 +884,7 @@ SetOption(option)
|
|||
char type[NAME_LEN];
|
||||
char *ptr;
|
||||
int tmp;
|
||||
int i;
|
||||
|
||||
while (isspace(*option))
|
||||
++option;
|
||||
|
|
@ -835,28 +902,34 @@ SetOption(option)
|
|||
} else if (strncmp(option, "ALL", 3) == 0) {
|
||||
ShowOptions();
|
||||
} else if (strncmp(option, "d2", 2) == 0) { /* d2 (more debug) */
|
||||
_res.options |= (RES_DEBUG | RES_DEBUG2);
|
||||
res.options |= (RES_DEBUG | RES_DEBUG2);
|
||||
} else if (strncmp(option, "nod2", 4) == 0) {
|
||||
_res.options &= ~RES_DEBUG2;
|
||||
res.options &= ~RES_DEBUG2;
|
||||
printf("d2 mode disabled; still in debug mode\n");
|
||||
} else if (strncmp(option, "def", 3) == 0) { /* defname */
|
||||
_res.options |= RES_DEFNAMES;
|
||||
res.options |= RES_DEFNAMES;
|
||||
} else if (strncmp(option, "nodef", 5) == 0) {
|
||||
_res.options &= ~RES_DEFNAMES;
|
||||
res.options &= ~RES_DEFNAMES;
|
||||
} else if (strncmp(option, "do", 2) == 0) { /* domain */
|
||||
ptr = strchr(option, '=');
|
||||
if (ptr != NULL) {
|
||||
sscanf(++ptr, "%s", _res.defdname);
|
||||
i = pickString(++ptr, res.defdname, sizeof res.defdname);
|
||||
if (i == 0) { /* name too long or nothing there */
|
||||
fprintf(stderr, "** invalid 'domain' value: %s\n",
|
||||
ptr) ;
|
||||
return(ERROR);
|
||||
}
|
||||
|
||||
res_re_init();
|
||||
}
|
||||
} else if (strncmp(option, "deb", 1) == 0) { /* debug */
|
||||
_res.options |= RES_DEBUG;
|
||||
res.options |= RES_DEBUG;
|
||||
} else if (strncmp(option, "nodeb", 5) == 0) {
|
||||
_res.options &= ~(RES_DEBUG | RES_DEBUG2);
|
||||
res.options &= ~(RES_DEBUG | RES_DEBUG2);
|
||||
} else if (strncmp(option, "ig", 2) == 0) { /* ignore */
|
||||
_res.options |= RES_IGNTC;
|
||||
res.options |= RES_IGNTC;
|
||||
} else if (strncmp(option, "noig", 4) == 0) {
|
||||
_res.options &= ~RES_IGNTC;
|
||||
res.options &= ~RES_IGNTC;
|
||||
} else if (strncmp(option, "po", 2) == 0) { /* port */
|
||||
ptr = strchr(option, '=');
|
||||
if (ptr != NULL) {
|
||||
|
|
@ -864,44 +937,61 @@ SetOption(option)
|
|||
}
|
||||
#ifdef deprecated
|
||||
} else if (strncmp(option, "pri", 3) == 0) { /* primary */
|
||||
_res.options |= RES_PRIMARY;
|
||||
res.options |= RES_PRIMARY;
|
||||
} else if (strncmp(option, "nopri", 5) == 0) {
|
||||
_res.options &= ~RES_PRIMARY;
|
||||
res.options &= ~RES_PRIMARY;
|
||||
#endif
|
||||
} else if (strncmp(option, "q", 1) == 0 || /* querytype */
|
||||
strncmp(option, "ty", 2) == 0) { /* type */
|
||||
ptr = strchr(option, '=');
|
||||
if (ptr != NULL) {
|
||||
sscanf(++ptr, "%s", type);
|
||||
i = pickString(++ptr, type, sizeof type);
|
||||
if (i == 0) { /* value too big or nothing there */
|
||||
fprintf(stderr, "*** invalid type value: %s\n",
|
||||
ptr) ;
|
||||
return(ERROR);
|
||||
}
|
||||
|
||||
queryType = StringToType(type, queryType, stderr);
|
||||
}
|
||||
} else if (strncmp(option, "cl", 2) == 0) { /* query class */
|
||||
ptr = strchr(option, '=');
|
||||
if (ptr != NULL) {
|
||||
sscanf(++ptr, "%s", type);
|
||||
i = pickString(++ptr, type, sizeof type);
|
||||
if (i == 0) { /* value too big or nothing there */
|
||||
fprintf(stderr, "*** invalid class : %s\n",
|
||||
ptr) ;
|
||||
return(ERROR);
|
||||
}
|
||||
|
||||
queryClass = StringToClass(type, queryClass, stderr);
|
||||
}
|
||||
} else if (strncmp(option, "rec", 3) == 0) { /* recurse */
|
||||
_res.options |= RES_RECURSE;
|
||||
res.options |= RES_RECURSE;
|
||||
} else if (strncmp(option, "norec", 5) == 0) {
|
||||
_res.options &= ~RES_RECURSE;
|
||||
res.options &= ~RES_RECURSE;
|
||||
} else if (strncmp(option, "ret", 3) == 0) { /* retry */
|
||||
ptr = strchr(option, '=');
|
||||
if (ptr != NULL) {
|
||||
sscanf(++ptr, "%d", &tmp);
|
||||
if (tmp >= 0) {
|
||||
_res.retry = tmp;
|
||||
res.retry = tmp;
|
||||
}
|
||||
}
|
||||
} else if (strncmp(option, "ro", 2) == 0) { /* root */
|
||||
ptr = strchr(option, '=');
|
||||
if (ptr != NULL) {
|
||||
sscanf(++ptr, "%s", rootServerName);
|
||||
i = pickString(++ptr, rootServerName, sizeof rootServerName);
|
||||
if (i == 0) { /* value too big or nothing there */
|
||||
fprintf(stderr, "*** invalid root server name : %s\n",
|
||||
ptr) ;
|
||||
return(ERROR) ;
|
||||
}
|
||||
}
|
||||
} else if (strncmp(option, "sea", 3) == 0) { /* search list */
|
||||
_res.options |= RES_DNSRCH;
|
||||
res.options |= RES_DNSRCH;
|
||||
} else if (strncmp(option, "nosea", 5) == 0) {
|
||||
_res.options &= ~RES_DNSRCH;
|
||||
res.options &= ~RES_DNSRCH;
|
||||
} else if (strncmp(option, "srchl", 5) == 0) { /* domain search list */
|
||||
ptr = strchr(option, '=');
|
||||
if (ptr != NULL) {
|
||||
|
|
@ -912,13 +1002,13 @@ SetOption(option)
|
|||
if (ptr != NULL) {
|
||||
sscanf(++ptr, "%d", &tmp);
|
||||
if (tmp >= 0) {
|
||||
_res.retrans = tmp;
|
||||
res.retrans = tmp;
|
||||
}
|
||||
}
|
||||
} else if (strncmp(option, "v", 1) == 0) { /* vc */
|
||||
_res.options |= RES_USEVC;
|
||||
res.options |= RES_USEVC;
|
||||
} else if (strncmp(option, "nov", 3) == 0) {
|
||||
_res.options &= ~RES_USEVC;
|
||||
res.options &= ~RES_USEVC;
|
||||
} else {
|
||||
fprintf(stderr, "*** Invalid option: %s\n", option);
|
||||
return(ERROR);
|
||||
|
|
@ -930,45 +1020,45 @@ SetOption(option)
|
|||
/*
|
||||
* Fake a reinitialization when the domain is changed.
|
||||
*/
|
||||
res_re_init()
|
||||
{
|
||||
void
|
||||
res_re_init(void) {
|
||||
register char *cp, **pp;
|
||||
int n;
|
||||
|
||||
/* find components of local domain that might be searched */
|
||||
pp = _res.dnsrch;
|
||||
*pp++ = _res.defdname;
|
||||
for (cp = _res.defdname, n = 0; *cp; cp++)
|
||||
pp = res.dnsrch;
|
||||
*pp++ = res.defdname;
|
||||
for (cp = res.defdname, n = 0; *cp; cp++)
|
||||
if (*cp == '.')
|
||||
n++;
|
||||
cp = _res.defdname;
|
||||
for (; n >= LOCALDOMAINPARTS && pp < _res.dnsrch + MAXDFLSRCH; n--) {
|
||||
cp = res.defdname;
|
||||
for (; n >= LOCALDOMAINPARTS && pp < res.dnsrch + MAXDFLSRCH; n--) {
|
||||
cp = strchr(cp, '.');
|
||||
*pp++ = ++cp;
|
||||
}
|
||||
*pp = 0;
|
||||
_res.options |= RES_INIT;
|
||||
res.options |= RES_INIT;
|
||||
}
|
||||
|
||||
#define SRCHLIST_SEP '/'
|
||||
|
||||
res_dnsrch(cp)
|
||||
register char *cp;
|
||||
{
|
||||
register char **pp;
|
||||
void
|
||||
res_dnsrch(char *cp) {
|
||||
char **pp;
|
||||
int n;
|
||||
|
||||
(void)strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1);
|
||||
if ((cp = strchr(_res.defdname, '\n')) != NULL)
|
||||
(void)strncpy(res.defdname, cp, sizeof(res.defdname) - 1);
|
||||
res.defdname[sizeof(res.defdname) - 1] = '\0';
|
||||
if ((cp = strchr(res.defdname, '\n')) != NULL)
|
||||
*cp = '\0';
|
||||
/*
|
||||
* Set search list to be blank-separated strings
|
||||
* on rest of line.
|
||||
*/
|
||||
cp = _res.defdname;
|
||||
pp = _res.dnsrch;
|
||||
cp = res.defdname;
|
||||
pp = res.dnsrch;
|
||||
*pp++ = cp;
|
||||
for (n = 0; *cp && pp < _res.dnsrch + MAXDNSRCH; cp++) {
|
||||
for (n = 0; *cp && pp < res.dnsrch + MAXDNSRCH; cp++) {
|
||||
if (*cp == SRCHLIST_SEP) {
|
||||
*cp = '\0';
|
||||
n = 1;
|
||||
|
|
@ -1006,24 +1096,24 @@ ShowOptions()
|
|||
}
|
||||
|
||||
printf("Set options:\n");
|
||||
printf(" %sdebug \t", (_res.options & RES_DEBUG) ? "" : "no");
|
||||
printf(" %sdefname\t", (_res.options & RES_DEFNAMES) ? "" : "no");
|
||||
printf(" %ssearch\t", (_res.options & RES_DNSRCH) ? "" : "no");
|
||||
printf(" %srecurse\n", (_res.options & RES_RECURSE) ? "" : "no");
|
||||
printf(" %sdebug \t", (res.options & RES_DEBUG) ? "" : "no");
|
||||
printf(" %sdefname\t", (res.options & RES_DEFNAMES) ? "" : "no");
|
||||
printf(" %ssearch\t", (res.options & RES_DNSRCH) ? "" : "no");
|
||||
printf(" %srecurse\n", (res.options & RES_RECURSE) ? "" : "no");
|
||||
|
||||
printf(" %sd2\t\t", (_res.options & RES_DEBUG2) ? "" : "no");
|
||||
printf(" %svc\t\t", (_res.options & RES_USEVC) ? "" : "no");
|
||||
printf(" %signoretc\t", (_res.options & RES_IGNTC) ? "" : "no");
|
||||
printf(" %sd2\t\t", (res.options & RES_DEBUG2) ? "" : "no");
|
||||
printf(" %svc\t\t", (res.options & RES_USEVC) ? "" : "no");
|
||||
printf(" %signoretc\t", (res.options & RES_IGNTC) ? "" : "no");
|
||||
printf(" port=%u\n", nsport);
|
||||
|
||||
printf(" querytype=%s\t", p_type(queryType));
|
||||
printf(" class=%s\t", p_class(queryClass));
|
||||
printf(" timeout=%d\t", _res.retrans);
|
||||
printf(" retry=%d\n", _res.retry);
|
||||
printf(" timeout=%d\t", res.retrans);
|
||||
printf(" retry=%d\n", res.retry);
|
||||
printf(" root=%s\n", rootServerName);
|
||||
printf(" domain=%s\n", _res.defdname);
|
||||
printf(" domain=%s\n", res.defdname);
|
||||
|
||||
cp = _res.dnsrch;
|
||||
cp = res.dnsrch;
|
||||
if (cp != NULL) {
|
||||
printf(" srchlist=%s", *cp);
|
||||
for (cp++; *cp; cp++) {
|
||||
|
|
@ -1071,7 +1161,7 @@ static void
|
|||
CvtAddrToPtr(name)
|
||||
char *name;
|
||||
{
|
||||
char *p;
|
||||
const char *p;
|
||||
int ip[4];
|
||||
struct in_addr addr;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
.\" $Id: dig.1,v 8.3 1998/03/21 01:01:23 halley Exp $
|
||||
.\" $FreeBSD$
|
||||
.\" $Id: dig.1,v 8.4 1999/10/15 21:29:58 vixie Exp $
|
||||
.\"
|
||||
.\" ++Copyright++ 1993
|
||||
.\" -
|
||||
|
|
@ -296,6 +297,9 @@ Specify class of query. May specify either an
|
|||
integer value to be included in the class field
|
||||
or use the abbreviated mnemonic as discussed
|
||||
above (i.e., in = C_IN).
|
||||
.It Fl k Ar keydir:keyname
|
||||
Sign the query with the TSIG key named keyname
|
||||
that is in the directory keydir.
|
||||
.It Fl envsav
|
||||
This flag specifies that the
|
||||
.Ic dig
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
/* $FreeBSD$ */
|
||||
#ifndef PORT_AFTER_H
|
||||
#define PORT_AFTER_H
|
||||
#define CAN_RECONNECT
|
||||
#define USE_POSIX
|
||||
#define POSIX_SIGNALS
|
||||
|
|
@ -14,6 +17,7 @@
|
|||
#define HAVE_MINIMUM_IFREQ
|
||||
#define HAVE_CHROOT
|
||||
#define CAN_CHANGE_ID
|
||||
#define MISSING_IN6ADDR_ANY
|
||||
|
||||
#define _TIMEZONE timezone
|
||||
|
||||
|
|
@ -24,6 +28,13 @@
|
|||
#define KMEM "/dev/kmem"
|
||||
#define UDPSUM "udpcksum"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/param.h>
|
||||
#if (!defined(BSD)) || (BSD < 199306)
|
||||
#include <sys/bitypes.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* We need to know the IPv6 address family number even on IPv4-only systems.
|
||||
* Note that this is NOT a protocol constant, and that if the system has its
|
||||
|
|
@ -34,4 +45,35 @@
|
|||
*/
|
||||
#ifndef AF_INET6
|
||||
#define AF_INET6 24
|
||||
#else
|
||||
#define HAS_INET6_STRUCTS
|
||||
#define HAVE_SA_LEN
|
||||
#endif
|
||||
|
||||
#ifndef PF_INET6
|
||||
#define PF_INET6 AF_INET6
|
||||
#endif
|
||||
|
||||
#include <port_ipv6.h>
|
||||
|
||||
#ifndef HAS_INET6_STRUCTS
|
||||
/* Replace with structure from later rev of O/S if known. */
|
||||
struct in6_addr {
|
||||
u_int8_t s6_addr[16];
|
||||
};
|
||||
|
||||
/* Replace with structure from later rev of O/S if known. */
|
||||
struct sockaddr_in6 {
|
||||
#ifdef HAVE_SA_LEN
|
||||
u_int8_t sin6_len; /* length of this struct */
|
||||
u_int8_t sin6_family; /* AF_INET6 */
|
||||
#else
|
||||
u_int16_t sin6_family; /* AF_INET6 */
|
||||
#endif
|
||||
u_int16_t sin6_port; /* transport layer port # */
|
||||
u_int32_t sin6_flowinfo; /* IPv6 flow information */
|
||||
struct in6_addr sin6_addr; /* IPv6 address */
|
||||
u_int32_t sin6_scope_id; /* set of interfaces for a scope */
|
||||
};
|
||||
#endif /* HAS_INET6_STRUCTS */
|
||||
#endif /* ! PORT_AFTER_H */
|
||||
|
|
|
|||
Loading…
Reference in a new issue