Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-4]: src/dist/bind/bin/host Pull up revisions 1.1-1.2 (new) (req...
details: https://anonhg.NetBSD.org/src/rev/d49069b6486f
branches: netbsd-1-4
changeset: 469778:d49069b6486f
user: he <he%NetBSD.org@localhost>
date: Sat Dec 04 16:52:42 1999 +0000
description:
Pull up revisions 1.1-1.2 (new) (requested by christos and veego):
Update to BIND 8.2.2-P5.
diffstat:
dist/bind/bin/host/host.c | 1956 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 1956 insertions(+), 0 deletions(-)
diffs (truncated from 1960 to 300 lines):
diff -r 2db0e429d3ec -r d49069b6486f dist/bind/bin/host/host.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dist/bind/bin/host/host.c Sat Dec 04 16:52:42 1999 +0000
@@ -0,0 +1,1956 @@
+/* $NetBSD: host.c,v 1.2.2.2 1999/12/04 16:52:42 he Exp $ */
+
+#ifndef lint
+static const char rcsid[] = "Id: host.c,v 8.34 1999/11/11 19:39:10 cyarnell Exp";
+#endif /* not lint */
+
+/*
+ * Copyright (c) 1986
+ * 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.
+ */
+
+/*
+ * 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
+static const char copyright[] =
+"@(#) Copyright (c) 1986 Regents of the University of California.\n\
+ Portions Copyright (c) 1993 Digital Equipment Corporation.\n\
+ Portions Copyright (c) 1996-1999 Internet Software Consortium.\n\
+ All rights reserved.\n";
+#endif /* not lint */
+
+/*
+ * Actually, this program is from Rutgers University, however it is
+ * based on nslookup and other pieces of named tools, so it needs
+ * the above copyright notices.
+ */
+
+/* Import. */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <ctype.h>
+#include <netdb.h>
+#include <resolv.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <memory.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <isc/dst.h>
+
+#include "port_after.h"
+
+/* Global. */
+
+#define SIG_RDATA_BY_NAME 18
+#define NS_HEADERDATA_SIZE 10
+
+#define NUMNS 8
+#define NUMNSADDR 16
+#define NUMMX 50
+#define NUMRR 127 /* max rr's per node to verify signatures for */
+
+#define SUCCESS 0
+#define TIME_OUT -1
+#define NO_INFO -2
+#define ERROR -3
+#define NONAUTH -4
+
+#define MY_PACKETSZ 64*1024 /* need this to hold tcp answers */
+
+typedef union {
+ HEADER qb1;
+ u_char qb2[MY_PACKETSZ];
+} querybuf;
+
+#define SD_RR 1
+#define SD_SIG 2
+#define SD_BADSIG 4
+
+typedef struct {
+ u_char data[MY_PACKETSZ];
+ size_t len;
+} rrstruct;
+
+static char chase_domain[NS_MAXDNAME];
+static int chase_class;
+static int chase_type;
+static char chase_sigorigttl[NS_INT32SZ];
+static rrstruct chase_rr[NUMRR];
+static int chase_rr_num;
+static char chase_lastgoodkey[NS_MAXDNAME];
+static char chase_signer[NS_MAXDNAME];
+static u_char chase_sigrdata[MY_PACKETSZ];
+static size_t chase_sigrdata_len;
+static u_char chase_signature[MY_PACKETSZ];
+static size_t chase_signature_len;
+static int chase_step;
+static int sigchase;
+
+static char cnamebuf[NS_MAXDNAME];
+static u_char hostbuf[NS_MAXDNAME];
+
+static int sockFD;
+static FILE *filePtr;
+
+static struct __res_state res, orig;
+static char *cname = NULL;
+static const char *progname = "amnesia";
+static int getclass = ns_c_in, verbose = 0, list = 0;
+static int server_specified = 0;
+static int gettype;
+static char getdomain[NS_MAXDNAME];
+
+/* Forward. */
+
+static int parsetype(const char *s);
+static int parseclass(const char *s);
+static void printanswer(const struct hostent *hp);
+static void hperror(int errnum);
+static int addrinfo(struct in_addr addr);
+static int gethostinfo(char *name);
+static int getdomaininfo(const char *name, const char *domain);
+static int getinfo(const char *name, const char *domain,
+ int type);
+static int printinfo(const querybuf *answer, const u_char *eom,
+ int filter, int isls);
+static const u_char * pr_rr(const u_char *cp, const u_char *msg, FILE *file,
+ int filter);
+static const char * pr_type(int type);
+static const char * pr_class(int class);
+static const u_char * pr_cdname(const u_char *cp, const u_char *msg,
+ char *name, int namelen);
+static int ListHosts(char *namePtr, int queryType);
+static const char * DecodeError(int result);
+
+static void
+usage(const char *msg) {
+ fprintf(stderr, "%s: usage error (%s)\n", progname, msg);
+ fprintf(stderr, "\
+Usage: %s [-adlrwv] [-t querytype] [-c class] host [server]\n\
+\t-a is equivalent to '-v -t *'\n\
+\t-c class to look for non-Internet data\n\
+\t-d to turn on debugging output\n\
+\t-l to turn on 'list mode'\n\
+\t-r to disable recursive processing\n\
+\t-s recursively chase signature found in answers\n\
+\t-t querytype to look for a specific type of information\n\
+\t-v for verbose output\n\
+\t-w to wait forever until reply\n\
+", progname);
+ exit(1);
+}
+
+/* Public. */
+
+int
+main(int argc, char **argv) {
+ struct in_addr addr;
+ struct hostent *hp;
+ char *s;
+ int inverse = 0, waitmode = 0;
+ int ncnames, ch;
+ int nkeychains, i;
+
+ dst_init();
+
+ if ((progname = strrchr(argv[0], '/')) == NULL)
+ progname = argv[0];
+ else
+ progname++;
+ res_ninit(&res);
+ res.retrans = 5;
+ while ((ch = getopt(argc, argv, "ac:dlrst:vw")) != -1) {
+ switch (ch) {
+ case 'a':
+ verbose = 1;
+ gettype = ns_t_any;
+ break;
+ case 'c':
+ getclass = parseclass(optarg);
+ break;
+ case 'd':
+ res.options |= RES_DEBUG;
+ break;
+ case 'l':
+ list = 1;
+ break;
+ case 'r':
+ res.options &= ~RES_RECURSE;
+ break;
+ case 's':
+ sigchase = 1;
+ break;
+ case 't':
+ gettype = parsetype(optarg);
+ break;
+ case 'v':
+ verbose = 1;
+ break;
+ case 'w':
+ res.retry = 1;
+ res.retrans = 15;
+ waitmode = 1;
+ break;
+ default:
+ usage("unrecogized switch");
+ /*NOTREACHED*/
+ }
+ }
+ if (gettype == 0) {
+ if (verbose)
+ printf ("Forcing `-t a' for signature trace.\n");
+ gettype = ns_t_a;
+ }
+ argc -= optind;
+ argv += optind;
+ if (argc < 1)
+ usage("missing host argument");
+ strncpy(getdomain, *argv++, NS_MAXDNAME);
+ getdomain[NS_MAXDNAME-1] = 0;
+ argc--;
+ if (argc > 1)
+ usage("extra undefined arguments");
+ if (argc == 1) {
+ s = *argv++;
+ argc--;
+ server_specified++;
+
+ if (!inet_aton(s, &addr)) {
+ hp = gethostbyname(s);
+ if (hp == NULL) {
Home |
Main Index |
Thread Index |
Old Index