diff options
author | peter <peter@FreeBSD.org> | 1995-08-20 22:22:38 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1995-08-20 22:22:38 +0000 |
commit | 04a32155d857383002ab380d4df3693e396098fe (patch) | |
tree | dd7bf7957853932293666dfd8671760c409bb0b8 /usr.sbin/nslookup | |
parent | 7e251d1b8fa80c3d899c8007e68b9a5bfc83ad0e (diff) | |
download | FreeBSD-src-04a32155d857383002ab380d4df3693e396098fe.zip FreeBSD-src-04a32155d857383002ab380d4df3693e396098fe.tar.gz |
Update 4.9.3.beta9p1 -> 4.9.3-beta24
Diffstat (limited to 'usr.sbin/nslookup')
-rw-r--r-- | usr.sbin/nslookup/Makefile | 134 | ||||
-rw-r--r-- | usr.sbin/nslookup/debug.c | 23 | ||||
-rw-r--r-- | usr.sbin/nslookup/getinfo.c | 2 | ||||
-rw-r--r-- | usr.sbin/nslookup/list.c | 59 | ||||
-rw-r--r-- | usr.sbin/nslookup/main.c | 2 | ||||
-rw-r--r-- | usr.sbin/nslookup/nslookup.help | 6 | ||||
-rw-r--r-- | usr.sbin/nslookup/pathnames.h | 2 | ||||
-rw-r--r-- | usr.sbin/nslookup/res.h | 2 | ||||
-rw-r--r-- | usr.sbin/nslookup/send.c | 2 | ||||
-rw-r--r-- | usr.sbin/nslookup/skip.c | 2 | ||||
-rw-r--r-- | usr.sbin/nslookup/subr.c | 12 |
11 files changed, 205 insertions, 41 deletions
diff --git a/usr.sbin/nslookup/Makefile b/usr.sbin/nslookup/Makefile index 4295c99..36d83b4 100644 --- a/usr.sbin/nslookup/Makefile +++ b/usr.sbin/nslookup/Makefile @@ -1,14 +1,126 @@ -# @(#)Makefile 8.1 (Berkeley) 6/6/93 +# +# @(#)Makefile 5.20 (Berkeley) 10/2/89 +# $Id: Makefile,v 8.2 1995/01/11 08:58:13 vixie Exp $ +# -PROG= nslookup -SRCS= main.c commands.l getinfo.c debug.c send.c skip.c list.c subr.c -MAN8= nslookup.8 -DPADD+= ${LIBL} -LDADD+= -ll -CLEANFILES+=lex.yy.o +## ++Copyright++ 1987 +## - +## Copyright (c) 1987 +## The Regents of the University of California. All rights reserved. +## +## Redistribution and use in source and binary forms, with or without +## modification, are permitted provided that the following conditions +## are met: +## 1. Redistributions of source code must retain the above copyright +## notice, this list of conditions and the following disclaimer. +## 2. Redistributions in binary form must reproduce the above copyright +## notice, this list of conditions and the following disclaimer in the +## documentation and/or other materials provided with the distribution. +## 3. All advertising materials mentioning features or use of this software +## must display the following acknowledgement: +## This product includes software developed by the University of +## California, Berkeley and its contributors. +## 4. Neither the name of the University nor the names of its contributors +## may be used to endorse or promote products derived from this software +## without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +## ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +## ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +## FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +## DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +## OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +## HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +## LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +## OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +## SUCH DAMAGE. +## - +## Portions Copyright (c) 1993 by Digital Equipment Corporation. +## +## 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, and that +## the name of Digital Equipment Corporation not be used in advertising or +## publicity pertaining to distribution of the document or software without +## specific, written prior permission. +## +## THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL +## WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES +## OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT +## CORPORATION 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. +## - +## --Copyright-- -beforeinstall: - install -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/nslookup.help \ - ${DESTDIR}/usr/share/misc +DESTDIR = +DESTBIN = /usr/bin +COMPINCL = ../../compat/include +CC= cc +SHELL= /bin/sh +CDEBUG= -O +INCL = ../../include +RES= ../../res/libresolv.a +COMPLIB= ../../compat/lib/lib44bsd.a +LDFLAGS = +LIBS = -ll +LEX = lex +DESTHELP= /usr/lib +DEFS= -D_PATH_HELPFILE=\"$(DESTHELP)/nslookup.help\" -.include <bsd.prog.mk> +#(bsd/386, 4.4bsd, other net2 descendents) +#DESTHELP= /usr/share/misc +#COMPINCL= . +#COMPLIB= +#LIBS = -ll -lutil +#LEX = lex -I + +#(sgi irix4) +#DESTHELP= /usr/bsd +#DEFS= -xansi -signed -D__STDC__ -D_BSD_SIGNALS \ +# -D_PATH_HELPFILE=\"$(DESTHELP)/nslookup.help\" +#COMPLIB= + +#(sgi irix5) +#DESTHELP= /usr/share/misc +#DEFS= -xansi -signed -D__BIT_TYPES_DEFINED__ -D_BSD_SIGNALS \ +# -D_PATH_HELPFILE=\"$(DESTHELP)/nslookup.help\" +#COMPLIB= + +CFLAGS= ${CDEBUG} -I${INCL} -I${COMPINCL} ${DEFS} +CSRCS= main.c getinfo.c debug.c send.c skip.c list.c subr.c +SRCS= ${CSRCS} commands.c +OBJS= main.o getinfo.o debug.o send.o skip.o list.o subr.o commands.o + +all: nslookup + +nslookup: ${OBJS} ${RES} ${COMPLIB} + ${CC} ${CDEBUG} ${LDFLAGS} -o $@ ${OBJS} \ + ${RES} ${COMPLIB} ${LIBS} + +clean: + rm -f ${OBJS} core nslookup commands.c lex.yy.c lex.yy.o + rm -f *.BAK *.CKP *~ + +cleandir: clean + rm -f tags .depend + +depend: ${SRCS} + mkdep ${CPPFLAGS} -I${INCL} -I${COMPINCL} ${DEFS} ${SRCS} + +install: + ${INSTALL} -s -c -o bin -g bin -m 755 nslookup ${DESTDIR}${DESTBIN}/ + ${INSTALL} -c -o bin -g bin -m 444 nslookup.help \ + ${DESTDIR}${DESTHELP}/ + +lint: ${SRCS} + lint ${SRCS} + +tags: ${CSRCS} + ctags ${CSRCS} + +# DO NOT DELETE THIS LINE -- mkdep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. diff --git a/usr.sbin/nslookup/debug.c b/usr.sbin/nslookup/debug.c index d8af2fc..cdfd5a6 100644 --- a/usr.sbin/nslookup/debug.c +++ b/usr.sbin/nslookup/debug.c @@ -55,7 +55,7 @@ #ifndef lint static char sccsid[] = "@(#)debug.c 5.26 (Berkeley) 3/21/91"; -static char rcsid[] = "$Id: debug.c,v 4.9.1.9 1994/06/06 09:08:43 vixie Exp $"; +static char rcsid[] = "$Id: debug.c,v 8.2 1995/06/29 09:26:34 vixie Exp $"; #endif /* not lint */ /* @@ -140,8 +140,6 @@ Fprint_query(msg, eom, printHeader,file) fprintf(file,", want recursion"); if (hp->ra) fprintf(file,", recursion avail."); - if (hp->pr) - fprintf(file,", primary"); fprintf(file,"\n\tquestions = %d", ntohs(hp->qdcount)); fprintf(file,", answers = %d", ntohs(hp->ancount)); fprintf(file,", authority records = %d", ntohs(hp->nscount)); @@ -334,6 +332,15 @@ Print_rr(cp, msg, eom, file) cp += INT16SZ; fprintf(file,", mail exchanger = "); goto doname; + case T_PX: + fprintf(file,"\tpreference = %u",_getshort((u_char*)cp)); + cp += INT16SZ; + fprintf(file,", RFC 822 = "); + cp = Print_cdname(cp, msg, eom, file); + fprintf(file,"\nX.400 = "); + cp = Print_cdname(cp, msg, eom, file); + (void) putc('\n', file); + break; case T_RT: fprintf(file,"\tpreference = %u",_getshort((u_char*)cp)); cp += INT16SZ; @@ -355,22 +362,24 @@ doname: break; case T_HINFO: + cp2 = cp + dlen; if (n = *cp++) { fprintf(file,"\tCPU = %.*s", n, cp); cp += n; } - if (n = *cp++) { + if ((cp < cp2) && (n = *cp++)) { fprintf(file,"\tOS = %.*s\n", n, cp); cp += n; - } + } else fprintf(file, "\n*** Warning *** OS-type missing\n"); break; case T_ISDN: + cp2 = cp + dlen; if (n = *cp++) { fprintf(file,"\tISDN = \"%.*s", n, cp); cp += n; } - if (n = *cp++) { + if ((cp < cp2) && (n = *cp++)) { fprintf(file,"-%.*s\"\n", n, cp); cp += n; } else fprintf(file,"\"\n"); @@ -426,7 +435,7 @@ doname: while (cp < cp2) { if (n = (unsigned char) *cp++) { for (c = n; c > 0 && cp < cp2; c--) - if (*cp == '\n') { + if ((*cp == '\n') || (*cp == '"')) { (void) putc('\\', file); (void) putc(*cp++, file); } else diff --git a/usr.sbin/nslookup/getinfo.c b/usr.sbin/nslookup/getinfo.c index 610d57ad..4e23566 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 4.9.1.6 1994/06/01 21:10:16 vixie Exp $"; +static char rcsid[] = "$Id: getinfo.c,v 8.1 1994/12/15 06:24:31 vixie Exp $"; #endif /* not lint */ /* diff --git a/usr.sbin/nslookup/list.c b/usr.sbin/nslookup/list.c index e78d143..43f18ab 100644 --- a/usr.sbin/nslookup/list.c +++ b/usr.sbin/nslookup/list.c @@ -55,7 +55,7 @@ #ifndef lint static char sccsid[] = "@(#)list.c 5.23 (Berkeley) 3/21/91"; -static char rcsid[] = "$Id: list.c,v 4.9.1.11 1994/06/06 09:08:43 vixie Exp $"; +static char rcsid[] = "$Id: list.c,v 8.3 1994/12/19 08:35:16 vixie Exp $"; #endif /* not lint */ /* @@ -203,6 +203,8 @@ ListHosts(string, putToFile) qtype = T_HINFO; } else if (strcmp("-m", option) == 0) { qtype = T_MX; + } else if (strcmp("-p", option) == 0) { + qtype = T_PX; } else if (strcmp("-s", option) == 0) { qtype = T_WKS; } else if (strcmp("-d", option) == 0) { @@ -356,6 +358,9 @@ ListSubr(qtype, domain, cmd) case T_MX: fprintf(filePtr, " %-30s\n", "Metric & Host"); break; + case T_PX: + fprintf(filePtr, " %-30s\n", "Mapping information"); + break; case T_AFSDB: fprintf(filePtr, " %-30s\n", "Subtype & Host"); break; @@ -401,6 +406,9 @@ ListSubr(qtype, domain, cmd) case T_NSAP: fprintf(filePtr, " %-30s\n", "NSAP address"); break; + case T_NSAP_PTR: + fprintf(filePtr, " %-30s\n", "NSAP pointer"); + break; case T_NS: fprintf(filePtr, " %-30s\n", "Name Servers"); break; @@ -445,7 +453,7 @@ ListSubr(qtype, domain, cmd) * The server sent too much data to fit the existing buffer -- * allocate a new one. */ - if (len > answerLen) { + if (len > (u_int)answerLen) { if (answerLen != 0) { free(answer); } @@ -686,6 +694,7 @@ PrintListInfo(file, msg, eom, qtype, domain) case T_NS: case T_PTR: + case T_NSAP_PTR: putc(' ', file); if (qtype != T_ANY) fprintf(file,"%s = ", type == T_PTR ? "host" : "server"); @@ -694,16 +703,21 @@ PrintListInfo(file, msg, eom, qtype, domain) case T_HINFO: case T_ISDN: - if (n = *cp++) { - (void)sprintf(name,"%.*s", n, cp); - fprintf(file," %-10s", name); - cp += n; - } else { - fprintf(file," %-10s", " "); - } - if (n = *cp++) { - fprintf(file," %.*s", n, cp); - cp += n; + { + u_char *cp2 = cp + dlen; + if (n = *cp++) { + (void)sprintf(name,"%.*s", n, cp); + fprintf(file," %-10s", name); + cp += n; + } else { + fprintf(file," %-10s", " "); + } + if (cp == cp2) + break; + if (n = *cp++) { + fprintf(file," %.*s", n, cp); + cp += n; + } } break; @@ -746,6 +760,25 @@ PrintListInfo(file, msg, eom, qtype, domain) fprintf(file, " %s", name2); break; + case T_PX: + pref = _getshort((u_char*)cp); + cp += INT16SZ; + fprintf(file," %-3d ",pref); + nameLen = dn_expand(msg, eom, cp, name2, sizeof name2); + if (nameLen < 0) { + fprintf(file, " ***\n"); + return (ERROR); + } + fprintf(file, " %s", name2); + cp += strlen((char *)cp) + 1; + nameLen = dn_expand(msg, eom, cp, name2, sizeof name2); + if (nameLen < 0) { + fprintf(file, " ***\n"); + return (ERROR); + } + fprintf(file, " %s", name2); + break; + case T_TXT: case T_X25: { @@ -756,7 +789,7 @@ PrintListInfo(file, msg, eom, qtype, domain) while (cp < cp2) { if (n = (unsigned char) *cp++) { for (c = n; c > 0 && cp < cp2; c--) - if (*cp == '\n') { + if ((*cp == '\n') || (*cp == '"')) { (void) putc('\\', file); (void) putc(*cp++, file); } else diff --git a/usr.sbin/nslookup/main.c b/usr.sbin/nslookup/main.c index 2324ed8..f0df230 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 4.9.1.3 1993/09/16 09:02:07 vixie Exp $"; +static char rcsid[] = "$Id: main.c,v 8.1 1994/12/15 06:24:31 vixie Exp $"; #endif /* not lint */ /* diff --git a/usr.sbin/nslookup/nslookup.help b/usr.sbin/nslookup/nslookup.help index 2c17d4d..09b6897 100644 --- a/usr.sbin/nslookup/nslookup.help +++ b/usr.sbin/nslookup/nslookup.help @@ -1,4 +1,4 @@ -$Id: nslookup.help,v 4.9.1.3 1993/12/06 00:43:17 vixie Exp $ +$Id: nslookup.help,v 8.2 1995/06/29 09:26:34 vixie Exp $ Commands: (identifiers are shown in uppercase, [] means optional) NAME - print info about the host/domain NAME using default server @@ -16,12 +16,12 @@ set OPTION - set an option root=NAME - set root server to NAME retry=X - set number of retries to X timeout=X - set initial time-out interval to X seconds - querytype=X - set query type, e.g., A,ANY,CNAME,HINFO,MX,NS,PTR,SOA,TXT,WKS + querytype=X - set query type, e.g., A,ANY,CNAME,HINFO,MX,PX,NS,PTR,SOA,TXT,WKS type=X - synonym for querytype class=X - set query class to one of IN (Internet), CHAOS, HESIOD or ANY server NAME - set default server to NAME, using current default server lserver NAME - set default server to NAME, using initial server -finger [USER] - finger the optional NAME at the current default host +finger [USER] - finger the optional USER at the current default host root - set current default server to the root ls [opt] DOMAIN [> FILE] - list addresses in DOMAIN (optional: output to FILE) -a - list canonical names and aliases diff --git a/usr.sbin/nslookup/pathnames.h b/usr.sbin/nslookup/pathnames.h index a915293..bfeae4f 100644 --- a/usr.sbin/nslookup/pathnames.h +++ b/usr.sbin/nslookup/pathnames.h @@ -55,7 +55,7 @@ /* * @(#)pathnames.h 5.1 (Berkeley) 5/28/90 - * $Id: pathnames.h,v 4.9.1.3 1993/09/16 09:02:07 vixie Exp $ + * $Id: pathnames.h,v 8.1 1994/12/15 06:24:31 vixie Exp $ */ #define _PATH_NSLOOKUPRC "/.nslookuprc" diff --git a/usr.sbin/nslookup/res.h b/usr.sbin/nslookup/res.h index e86bc2f..9363f38 100644 --- a/usr.sbin/nslookup/res.h +++ b/usr.sbin/nslookup/res.h @@ -55,7 +55,7 @@ /* * @(#)res.h 5.10 (Berkeley) 6/1/90 - * $Id: res.h,v 4.9.1.3 1994/06/01 21:10:16 vixie Exp $ + * $Id: res.h,v 8.1 1994/12/15 06:24:31 vixie Exp $ */ /* diff --git a/usr.sbin/nslookup/send.c b/usr.sbin/nslookup/send.c index e895bfa..46c74b5 100644 --- a/usr.sbin/nslookup/send.c +++ b/usr.sbin/nslookup/send.c @@ -55,7 +55,7 @@ #ifndef lint static char sccsid[] = "@(#)send.c 5.18 (Berkeley) 3/2/91"; -static char rcsid[] = "$Id: send.c,v 4.9.1.5 1994/06/06 09:08:43 vixie Exp $"; +static char rcsid[] = "$Id: send.c,v 8.1 1994/12/15 06:24:31 vixie Exp $"; #endif /* not lint */ /* diff --git a/usr.sbin/nslookup/skip.c b/usr.sbin/nslookup/skip.c index 4119951..2c78377 100644 --- a/usr.sbin/nslookup/skip.c +++ b/usr.sbin/nslookup/skip.c @@ -55,7 +55,7 @@ #ifndef lint static char sccsid[] = "@(#)skip.c 5.12 (Berkeley) 3/21/91"; -static char rcsid[] = "$Id: skip.c,v 4.9.1.6 1994/06/01 21:10:16 vixie Exp $"; +static char rcsid[] = "$Id: skip.c,v 8.1 1994/12/15 06:24:31 vixie Exp $"; #endif /* not lint */ /* diff --git a/usr.sbin/nslookup/subr.c b/usr.sbin/nslookup/subr.c index f9d9012..c1a93af 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 4.9.1.7 1994/07/19 22:51:24 vixie Exp $"; +static char rcsid[] = "$Id: subr.c,v 8.2 1994/12/15 06:27:07 vixie Exp $"; #endif /* not lint */ /* @@ -372,7 +372,9 @@ DecodeError(result) case NXDOMAIN: return("Non-existent host/domain"); break; case NOTIMP: return("Not implemented"); break; case REFUSED: return("Query refused"); break; +#ifdef NOCHANGE case NOCHANGE: return("No change"); break; +#endif case TIME_OUT: return("Timed out"); break; case NO_INFO: return("No information"); break; case ERROR: return("Unspecified error"); break; @@ -428,6 +430,8 @@ StringToType(type, dflt, errorfile) return(T_NS); /* authoritative server */ if (strcasecmp(type, "MX") == 0) return(T_MX); /* mail exchanger */ + if (strcasecmp(type, "PX") == 0) + return(T_PX); /* mapping information */ if (strcasecmp(type, "CNAME") == 0) return(T_CNAME); /* canonical name */ if (strcasecmp(type, "SOA") == 0) @@ -474,6 +478,8 @@ StringToType(type, dflt, errorfile) return(T_AFSDB); /* DCE or AFS server */ if (strcasecmp(type, "NSAP") == 0) return(T_NSAP); /* NSAP address */ + if (strcasecmp(type, "NSAP_PTR") == 0) + return(T_NSAP_PTR); /* NSAP reverse pointer */ if (errorfile) fprintf(errorfile, "unknown query type: %s\n", type); return(dflt); @@ -524,6 +530,8 @@ DecodeType(type) return("mailbox information"); case T_MX: return("mail exchanger"); + case T_PX: + return("mapping information"); case T_TXT: return("text"); case T_RP: @@ -538,6 +546,8 @@ DecodeType(type) return("router"); case T_NSAP: return("nsap address"); + case T_NSAP_PTR: + return("domain name pointer"); case T_UINFO: return("user information"); case T_UID: |