diff options
Diffstat (limited to 'contrib/bind/bin')
-rw-r--r-- | contrib/bind/bin/named-xfer/named-xfer.c | 1138 | ||||
-rw-r--r-- | contrib/bind/bin/named/Makefile | 56 | ||||
-rw-r--r-- | contrib/bind/bin/named/ns_parser.c | 3150 | ||||
-rw-r--r-- | contrib/bind/bin/named/ns_parser.h | 145 | ||||
-rw-r--r-- | contrib/bind/bin/nslookup/commands.c | 2041 | ||||
-rw-r--r-- | contrib/bind/bin/nslookup/commands.l | 59 | ||||
-rw-r--r-- | contrib/bind/bin/nslookup/debug.c | 21 | ||||
-rw-r--r-- | contrib/bind/bin/nslookup/getinfo.c | 85 | ||||
-rw-r--r-- | contrib/bind/bin/nslookup/main.c | 260 |
9 files changed, 402 insertions, 6553 deletions
diff --git a/contrib/bind/bin/named-xfer/named-xfer.c b/contrib/bind/bin/named-xfer/named-xfer.c index 50c299e..062cc33 100644 --- a/contrib/bind/bin/named-xfer/named-xfer.c +++ b/contrib/bind/bin/named-xfer/named-xfer.c @@ -1,5 +1,5 @@ /* - * The original version of named-xfer by Kevin Dunlap. + * The original version of xfer by Kevin Dunlap. * Completed and integrated with named by David Waitzman * (dwaitzman@bbn.com) 3/14/88. * Modified by M. Karels and O. Kure 10-88. @@ -84,8 +84,7 @@ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. */ -/* - * Portions Copyright (c) 1996-1999 by Internet Software Consortium. +/* Portions Copyright (c) 1996, 1997 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 @@ -101,45 +100,27 @@ * SOFTWARE. */ -/* - * Portions Copyright (c) 1998 by MetaInfo, Incorporated. - * - * 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 MetaInfo Incorporated 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 METAINFO INCORPORATED DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL METAINFO INCORPRATED - * 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. - */ #if !defined(lint) && !defined(SABER) char copyright[] = "@(#) Copyright (c) 1988, 1990 The Regents of the University of California.\n\ portions Copyright (c) 1993 Digital Equipment Corporation\n\ - portions Copyright (c) 1998 MetaInfo, Inc.\n\ portions Copyright (c) 1995, 1996 Internet Software Consorium\n\ All rights reserved.\n"; #endif /* not lint */ #if !defined(lint) && !defined(SABER) -static const char sccsid[] = "@(#)named-xfer.c 4.18 (Berkeley) 3/7/91"; -static const char rcsid[] = "$Id: named-xfer.c,v 8.89 1999/11/09 20:36:54 marka Exp $"; +static char sccsid[] = "@(#)named-xfer.c 4.18 (Berkeley) 3/7/91"; +static char rcsid[] = "$Id: named-xfer.c,v 8.38 1998/03/27 00:19:28 halley Exp $"; #endif /* not lint */ #include "port_before.h" +#include "fd_setsize.h" + #include <sys/types.h> #include <sys/param.h> #include <sys/file.h> #include <sys/stat.h> #include <sys/socket.h> -#include <sys/un.h> #include <netinet/in.h> #include <netdb.h> @@ -160,39 +141,26 @@ static const char rcsid[] = "$Id: named-xfer.c,v 8.89 1999/11/09 20:36:54 marka #include <stdarg.h> #include <isc/eventlib.h> -#include <isc/list.h> #include <isc/logging.h> -/* This still uses malloc/free, but the tsig routines allocate memory with - * memget, and we free it with memput. - */ -#include <isc/memcluster.h> - -#include <isc/dst.h> #include "port_after.h" - #define MAIN_PROGRAM #include "../named/named.h" #undef MAIN_PROGRAM #define MAX_XFER_RESTARTS 2 -#define ENABLE_IXFR 0 - # ifdef SHORT_FNAMES extern long pathconf __P((const char *path, int name)); /* XXX */ # endif - static struct zoneinfo zone; /* zone information */ -static char *ddtfilename = NULL, - *ddtfile = NULL; - -static char *tmpname = NULL, - *tmpiname = NULL, /* temporary file name for ixfr transaction file */ - *domain; /* domain being xfered */ +static char ddtfilename[] = _PATH_TMPXFER, + *ddtfile = ddtfilename, + *tmpname, + *domain; /* domain being xfered */ static int quiet = 0, read_interrupted = 0, @@ -200,48 +168,30 @@ static int quiet = 0, domain_len; /* strlen(domain) */ static FILE *fp = NULL, - *dbfp = NULL, - *ixfp = NULL; + *dbfp = NULL; static char *ProgName; -static void usage(const char *), - tsig_init(const char *); +static void usage(const char *); static int getzone(struct zoneinfo *, u_int32_t, int), print_output(struct zoneinfo *, u_int32_t, u_char *, int, u_char *), netread(int, char *, int, int), writemsg(int, const u_char *, int); -static void ixfr_log(const u_char *msg, int len, int *delete, - FILE *file, struct sockaddr_in *sin, - char *domain, u_int32_t serial_no, int *); static SIG_FN read_alarm(void); static SIG_FN term_handler(void); -static const char *soa_zinfo(struct zoneinfo *, u_char *, u_char*), - *tsig_rcode(int); +static const char *soa_zinfo(struct zoneinfo *, u_char *, u_char*); struct zoneinfo zp_start, zp_finish; static int restarts = 0; -static int check_serial = 0; -static int xfr_qtype = T_AXFR; -static u_int32_t old_serial; FILE *ddt = NULL; -int servermethode[NSMAX]; -char *soa_buf; - -typedef struct _tsig_node { - struct in_addr addr; - DST_KEY *dst_key; - LINK(struct _tsig_node) link; -} tsig_node; - -LIST(tsig_node) tsig_list; /* * Debugging printf. */ +#ifdef DEBUG void dprintf(int level, const char *format, ...) { va_list ap; @@ -251,9 +201,10 @@ dprintf(int level, const char *format, ...) { (void) vfprintf(ddt, format, ap); va_end(ap); } +#endif /*DEBUG*/ -static int -init_xfer_logging() { +static +int init_xfer_logging() { log_channel chan; if (log_new_context(ns_log_max_category, NULL, &log_ctx) < 0) { @@ -292,26 +243,7 @@ void cleanup_for_exit(void) { #ifdef DEBUG if (!debug) #endif - { (void) unlink(tmpname); - if (tmpiname != NULL) - (void) unlink(tmpiname); - } - if(tmpiname) - free(tmpiname); - tmpiname = NULL; - if (ddtfilename != NULL) { - free(ddtfilename); - if (ddtfilename == ddtfile) - ddtfile = NULL; - ddtfilename = NULL; - } - if(tmpname) - free(tmpname); - tmpname = NULL; - if(ddtfile) - free(ddtfile); - ddtfile = NULL; } @@ -320,22 +252,18 @@ main(int argc, char *argv[]) { struct zoneinfo *zp; struct hostent *hp; struct in_addr axfr_src; - char *dbfile = NULL, *tracefile = NULL, *tm = NULL, *tsigfile = NULL; - char *ixfrfile = NULL; - u_int32_t new_serial_no = 0; - int dbfd, ddtd, result, c, fd, ixfd; + char *dbfile = NULL, *tracefile = NULL, *tm = NULL; + int dbfd, ddtd, result, c, fd, closed = 0; u_int32_t serial_no = 0; u_int port = htons(NAMESERVER_PORT); struct stat statbuf; +#ifdef STUBS int stub_only = 0; +#endif int class = C_IN; int n; long num_files; -#ifdef _AUX_SOURCE - set42sig(); -#endif - memset(&axfr_src, 0, sizeof axfr_src); ProgName = strrchr(argv[0], '/'); if (ProgName != NULL) ProgName++; @@ -344,9 +272,10 @@ main(int argc, char *argv[]) { (void) umask(022); - ddtfilename = (char *)malloc(strlen(_PATH_TMPXFER) + 1); - strcpy(ddtfilename, _PATH_TMPXFER); - ddtfile = ddtfilename; + /* this is a hack; closing everything in the parent is hard. */ + num_files = MIN(sysconf(_SC_OPEN_MAX), FD_SETSIZE); + for (fd = num_files - 1; fd > STDERR_FILENO; fd--) + closed += (close(fd) == 0); #ifdef RENICE nice(-40); /* this is the recommended procedure to */ @@ -354,21 +283,24 @@ main(int argc, char *argv[]) { nice(0); /* to "normal" (== 0) - see nice(3) */ #endif - n = LOG_PID; #ifdef LOG_PERROR - n |= LOG_PERROR; -#endif -#if defined(LOG_CONS) && defined(USE_LOG_CONS) - n |= LOG_CONS; + n = LOG_PERROR; +#else + n = 0; #endif #ifdef SYSLOG_42BSD - openlog(ProgName, n); + openlog(ProgName, LOG_PID); +#else + openlog(ProgName, LOG_PID|LOG_CONS|n, LOG_DAEMON); +#endif + axfr_src.s_addr = 0; +#ifdef STUBS + while ((c = getopt(argc, argv, "C:d:l:s:t:z:f:p:P:qx:S")) != EOF) #else - openlog(ProgName, n, LOG_DAEMON); + while ((c = getopt(argc, argv, "C:d:l:s:t:z:f:p:P:qx:")) != EOF) #endif - while ((c = getopt(argc, argv, "C:d:l:s:t:z:f:i:p:P:qx:ST:Z")) != -1) - switch (c) { - case 'C': + switch (c) { + case 'C': class = get_class(optarg); break; case 'd': @@ -390,7 +322,6 @@ main(int argc, char *argv[]) { break; case 's': serial_no = strtoul(optarg, (char **)NULL, 10); - check_serial++; break; case 't': tracefile = optarg; @@ -414,29 +345,17 @@ main(int argc, char *argv[]) { (void) strcpy(tmpname, optarg); #endif /* SHORT_FNAMES */ break; - case 'i': -#if ENABLE_IXFR - ixfrfile = optarg; - tmpiname = (char *) malloc(strlen(optarg) + - sizeof(".XXXXXX") + 1); - if (!tmpiname) - panic("malloc(tmpiname)", NULL); -#ifdef SHORT_FNAMES - filenamecpy(tmpiname, optarg); -#else - (void) strcpy(tmpiname, optarg); -#endif /* SHORT_FNAMES */ -#endif /* ENABLE_IXFR */ - break; case 'p': port = htons((u_int16_t)atoi(optarg)); break; case 'P': port = (u_int16_t)atoi(optarg); break; +#ifdef STUBS case 'S': stub_only = 1; break; +#endif case 'q': quiet++; break; @@ -444,18 +363,13 @@ main(int argc, char *argv[]) { if (!inet_aton(optarg, &axfr_src)) panic("bad -x addr: %s", optarg); break; - case 'T': - tsigfile = optarg; - break; - case 'Z': - xfr_qtype = ns_t_zxfr; - break; case '?': default: usage("unrecognized argument"); /* NOTREACHED */ - } - if (!domain || ((!dbfile) && (!ixfrfile)) || optind >= argc) { + } + + if (!domain || !dbfile || optind >= argc) { if (!domain) usage("no domain"); if (!dbfile) @@ -468,14 +382,6 @@ main(int argc, char *argv[]) { !S_ISREG(statbuf.st_mode) && !S_ISFIFO(statbuf.st_mode)) usage("dbfile must be a regular file or FIFO"); - if (ixfrfile && (stat(ixfrfile, &statbuf) != -1 && - !S_ISREG(statbuf.st_mode) && - !S_ISFIFO(statbuf.st_mode))) - usage("ixfrfile must be a regular file or FIFO"); - if (tsigfile && stat(tsigfile, &statbuf) != -1 && - !S_ISREG(statbuf.st_mode) && - !S_ISFIFO(statbuf.st_mode)) - usage("tsigfile must be a regular file or FIFO"); if (tracefile && (fp = fopen(tracefile, "w")) == NULL) perror(tracefile); (void) strcat(tmpname, ".XXXXXX"); @@ -483,8 +389,8 @@ main(int argc, char *argv[]) { if ((dbfd = mkstemp(tmpname)) == -1) { perror(tmpname); if (!quiet) - syslog(LOG_ERR, "can't make tmpfile (%s): %s\n", - tmpname, strerror(errno)); + syslog(LOG_ERR, "can't make tmpfile (%s): %m\n", + tmpname); exit(XFER_FAIL); } #ifdef HAVE_FCHMOD /* XXX */ @@ -495,8 +401,8 @@ main(int argc, char *argv[]) { { perror(tmpname); if (!quiet) - syslog(LOG_ERR, "can't [f]chmod tmpfile (%s): %s\n", - tmpname, strerror(errno)); + syslog(LOG_ERR, "can't [f]chmod tmpfile (%s): %m\n", + tmpname); exit(XFER_FAIL); } if ((dbfp = fdopen(dbfd, "r+")) == NULL) { @@ -505,36 +411,6 @@ main(int argc, char *argv[]) { syslog(LOG_ERR, "can't fdopen tmpfile (%s)", tmpname); exit(XFER_FAIL); } - if (ixfrfile) { - (void) strcat(tmpiname, ".XXXXXX"); - if ((ixfd = mkstemp(tmpiname)) == -1) { - perror(tmpiname); - if (!quiet) - syslog(LOG_ERR, - "can't make tmpifile (%s): %s\n", - tmpiname, strerror(errno)); - (void) fclose(dbfp); - (void) close(dbfd); - exit(XFER_FAIL); - } -#ifdef HAVE_FCHMOD /* XXX */ - if (fchmod(ixfd, 0644) == -1) -#else - if (chmod(tmpiname, 0644) == -1) -#endif - { - perror(tmpiname); - if (!quiet) - syslog(LOG_ERR, - "can't [f]chmod tmpifile (%s): %s\n", - tmpiname, strerror(errno)); - (void) fclose(dbfp); - (void) close(dbfd); - (void) close(ixfd); - exit(XFER_FAIL); - } - close(ixfd); - } #ifdef DEBUG if (debug) { /* ddtfile is now something like "/usr/tmp/xfer.ddt.XXXXXX" */ @@ -557,8 +433,8 @@ main(int argc, char *argv[]) { setvbuf(ddt, NULL, _IOLBF, 0); } #endif + if (!init_xfer_logging()) { - cleanup_for_exit(); perror("init_xfer_logging"); } @@ -588,25 +464,20 @@ main(int argc, char *argv[]) { (void) signal(SIGFPE, SIG_IGN); #endif /* SIGUSR1&&SIGUSR2 */ - if (dbfile) - dprintf(1, "domain `%s'; file `%s'; serial %u\n", - domain, dbfile, serial_no); - - if (ixfrfile) - dprintf(1, "domain `%s'; ixfrfile `%s'; serial %u\n", - domain, ixfrfile, serial_no); + dprintf(1, "domain `%s'; file `%s'; serial %u; closed %d\n", + domain, dbfile, serial_no, closed); buildservicelist(); buildprotolist(); - tsig_init(tsigfile); - /* init zone data */ zp = &zone; +#ifdef STUBS if (stub_only) zp->z_type = Z_STUB; else +#endif zp->z_type = Z_SECONDARY; zp->z_class = class; zp->z_origin = domain; @@ -619,34 +490,8 @@ main(int argc, char *argv[]) { zp->z_source); for (; optind != argc; optind++) { - int tmpsupportixfr; - tm = argv[optind]; - tmpsupportixfr = ISNOTIXFR; - if ((optind+1) != argc) { - if (strcasecmp("ixfr", argv[optind+1]) == 0) { -#if ENABLE_IXFR - tmpsupportixfr = ISIXFR; - servermethode[zp->z_addrcnt] = tmpsupportixfr; -#endif - optind++; - } else if (strcasecmp("axfr", argv[optind+1]) == 0) { - tmpsupportixfr = ISNOTIXFR; - optind++; - } - } if (!inet_aton(tm, &zp->z_addr[zp->z_addrcnt])) { - if (strcmp("-ixfr",tm)==0) { -#if ENABLE_IXFR - tmpsupportixfr = ISIXFR; - servermethode[zp->z_addrcnt-1] = tmpsupportixfr; -#endif - continue; - } else - if (strcmp("-axfr",tm)==0) { - tmpsupportixfr = ISNOTIXFR; - continue; - } hp = gethostbyname(tm); if (hp == NULL) { syslog(LOG_NOTICE, @@ -657,7 +502,7 @@ main(int argc, char *argv[]) { memcpy(&zp->z_addr[zp->z_addrcnt], hp->h_addr, INADDRSZ); - dprintf(1, "Arg: \"%s\" %s\n", tm,((tmpsupportixfr) ? "IXFR":"AXFR")); + dprintf(1, "Arg: \"%s\"\n", tm); } if (++zp->z_addrcnt >= NSMAX) { zp->z_addrcnt = NSMAX; @@ -667,71 +512,24 @@ main(int argc, char *argv[]) { } dprintf(1, "addrcnt = %d\n", zp->z_addrcnt); - res_ninit(&res); - res.options &= ~(RES_DEFNAMES | RES_DNSRCH | RES_RECURSE); + res_init(); + _res.options &= ~(RES_DEFNAMES | RES_DNSRCH | RES_RECURSE); result = getzone(zp, serial_no, port); - (void) fclose(dbfp); - (void) close(dbfd); - - if (ixfp) - (void) my_fclose(ixfp); - else - close(ixfd); - + (void) my_fclose(dbfp); switch (result) { - case XFER_SUCCESSAXFR: /* ok exit */ - if (tmpiname != NULL) - unlink(tmpiname); - if (ixfrfile) { - /* - * An IXFR was requested but we performed an - * AXFR. Rename the temporary file to the IXFR - * name, named will rename it again to the dbname. - */ - if (movefile(tmpname, ixfrfile) == -1) { - perror("movefile"); -#ifdef DEBUG - if (debug) - (void) unlink(ddtfile); -#endif - if (!quiet) - syslog(LOG_ERR, - "rename %s to %s: %s", - tmpname, ixfrfile, strerror(errno)); - cleanup_for_exit(); - exit(XFER_FAIL); - }; - exit(XFER_SUCCESSAXFRIXFRFILE); - } - if (movefile(tmpname, dbfile) == -1) { - perror("movefile"); + case XFER_SUCCESS: /* ok exit */ + if (rename(tmpname, dbfile) == -1) { + perror("rename"); if (!quiet) - syslog(LOG_ERR, "movefile %s to %s: %m", + syslog(LOG_ERR, "rename %s to %s: %m", tmpname, dbfile); - cleanup_for_exit(); exit(XFER_FAIL); } - exit(XFER_SUCCESSAXFR); - - case XFER_SUCCESSIXFR: - unlink(tmpname); - if (movefile(tmpiname, ixfrfile) == -1) { - perror("movefile"); - if (!quiet) - syslog(LOG_ERR, "movefile %s to %s: %m", - tmpiname, ixfrfile); - cleanup_for_exit(); - exit(XFER_FAIL); - } - cleanup_for_exit(); - exit(XFER_SUCCESSIXFR); + exit(XFER_SUCCESS); case XFER_UPTODATE: /* the zone was already uptodate */ (void) unlink(tmpname); - if (tmpiname != NULL) - (void) unlink(tmpiname); - cleanup_for_exit(); exit(XFER_UPTODATE); default: @@ -739,7 +537,6 @@ main(int argc, char *argv[]) { /* fall through */ case XFER_TIMEOUT: case XFER_FAIL: - (void) unlink(tmpname); cleanup_for_exit(); exit(result); /* error or timeout */ } @@ -750,17 +547,17 @@ main(int argc, char *argv[]) { static char *UsageText[] = { "\t-z zone_to_transfer\n", "\t-f db_file\n", - "\t[-i ixfr_file]\n", - "\t[-s serial_no]\n", + "\t-s serial_no\n", "\t[-d debug_level]\n", "\t[-l debug_log_file]\n", "\t[-t trace_file]\n", "\t[-p port]\n", - "\t[-S] [-Z]\n", +#ifdef STUBS + "\t[-S]\n", +#endif "\t[-C class]\n", "\t[-x axfr-src]\n", - "\t[-T tsig_info_file]\n", - "\tservers [-ixfr|-axfr]...\n", + "\tservers...\n", NULL }; @@ -775,66 +572,13 @@ usage(const char *msg) { exit(XFER_FAIL); } -static void -tsig_init(const char *file) { - char buf[1024]; - int n; - FILE *fp; - char *s; - - if (file == NULL) - return; - fp = fopen(file, "r"); - if (fp == NULL) - return; - dst_init(); - INIT_LIST(tsig_list); - while (1) { - tsig_node *n = malloc(sizeof(tsig_node)); - int alg, secret_len; - char *address, *name; - char *cp; - u_char secret[128]; - - s = fgets(buf, sizeof(buf), fp); - if (s == NULL) - break; - buf[strlen(buf)-1] = 0; - inet_aton(buf, &n->addr); - - fgets(buf, sizeof(buf), fp); - buf[strlen(buf)-1] = 0; - name = strdup(buf); - - fscanf(fp, "%d", &alg); - fgets(buf, sizeof(buf), fp); - - fgets(buf, sizeof(buf), fp); - buf[strlen(buf)-1] = 0; - cp = buf; - while (isspace(*cp)) - cp++; - - secret_len = b64_pton(cp, secret, sizeof(secret)); - n->dst_key = dst_buffer_to_key(name, alg, 0, 0, - secret, secret_len); - - free(name); - APPEND(tsig_list, n, link); - } - fclose(fp); - unlink(file); -} - #define DEF_DNAME '\001' /* '\0' means the root domain */ /* XXX: The following variables should probably all be "static" */ u_int32_t minimum_ttl = 0; -int soa_cnt = 0, scdsoa = 0, methode = ISNOTIXFR; -int delete_soa = 1; -u_int32_t final_serial = 0; -int ixfr_soa = 0; -int firstsoa = 1; +int soa_cnt = 0; +#ifdef STUBS int ns_cnt = 0; +#endif int query_type = 0; int prev_comment = 0; /* was previous record a comment? */ char zone_top[MAXDNAME]; /* the top of the zone */ @@ -848,32 +592,19 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) { u_int len; u_int32_t serial; int s, n, l, error = 0; - int was_ixfr = 0; u_int cnt; u_char *cp, *nmp, *eom, *tmp ; - u_char *buf = NULL, *cpp = NULL; + u_char *buf = NULL; u_int bufsize = 0; char name[MAXDNAME], name2[MAXDNAME]; struct sockaddr_in sin; - struct sockaddr_in local; - int locallen; #ifdef POSIX_SIGNALS struct sigaction sv, osv; #else struct sigvec sv, osv; #endif - int qdcount, ancount, aucount, arcount, class, type; + int qdcount, ancount, aucount, class, type; const char *badsoa_msg = "Nil"; - struct sockaddr_in my_addr; - char my_addr_text[30]; - int alen, ret, tsig_req; - DST_KEY *tsig_key; - ns_tcp_tsig_state tsig_state; - int tsig_signed = 0; - u_char sig[64]; - int siglen; - int ixfr_first = 1; - time_t timesigned; #ifdef DEBUG if (debug) { @@ -917,23 +648,9 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) { if ((l = strlen(zone_top)) != 0 && zone_top[l - 1] == '.') zone_top[l - 1] = '\0'; strcpy(prev_origin, zone_top); - for (cnt = 0; cnt < zp->z_addrcnt; cnt++) { - methode = servermethode[cnt]; - sin.sin_addr = zp->z_addr[cnt]; - dprintf(3, "address [%s] %s\n", - inet_ntoa(sin.sin_addr), - (methode == ISIXFR) ? "IXFR":"AXFR"); - } for (cnt = 0; cnt < zp->z_addrcnt; cnt++) { - methode = ISNOTIXFR; curclass = zp->z_class; - /* - * If we have been given a serial number and a ixfr log - * file name then set methode. - */ - if (check_serial && tmpiname != NULL) - methode = servermethode[cnt]; error = 0; if (buf == NULL) { if ((buf = (u_char *)malloc(2 * PACKETSZ)) == NULL) { @@ -944,7 +661,6 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) { } bufsize = 2 * PACKETSZ; } - try_again: if ((s = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) < 0) { syslog(LOG_INFO, "socket: %m"); error++; @@ -968,72 +684,20 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) { dprintf(2, "connecting to server #%d [%s].%d\n", cnt+1, inet_ntoa(sin.sin_addr), ntohs(sin.sin_port)); if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) { - if (zp->z_axfr_src.s_addr != 0) { - dprintf(2, "connect failed, trying w/o -x"); - zp->z_axfr_src.s_addr = 0; - (void) my_close(s); - goto try_again; - } if (!quiet) syslog(LOG_INFO, - "connect(%s) for zone %s failed: %s", - inet_ntoa(sin.sin_addr), zp->z_origin, strerror(errno)); + "connect(%s) for zone %s failed: %m", + inet_ntoa(sin.sin_addr), zp->z_origin); error++; (void) my_close(s); continue; } - if (methode == ISIXFR) { - hp = (HEADER *) buf; - cpp = buf; - n = res_nmkquery(&res, QUERY, zp->z_origin, curclass, - T_IXFR, NULL, 0, NULL, buf, bufsize); - dprintf(1, "len = %d\n", n); - if (n < 0) { - if (!quiet) - syslog(LOG_INFO, - "zone %s: dn_comp for ixfr failed", - zp->z_origin); - (void) my_close(s); -#ifdef POSIX_SIGNALS - sigaction(SIGALRM, - &osv, - (struct sigaction*)0); -#else - sigvec(SIGALRM, - &osv, - (struct sigvec *)0); -#endif - return (XFER_FAIL); - } - hp->nscount = htons(1+ntohs(hp->nscount)); - cpp += n; - n = dn_comp(zp->z_origin, cpp, bufsize-(cpp-buf), - NULL, NULL); - if (n > 0) - cpp += n; - PUTSHORT(T_SOA, cpp); /* type */ - PUTSHORT(C_IN, cpp); /* class */ - PUTLONG(0, cpp); /* ttl */ - PUTSHORT(22, cpp); /* dlen */ - *cpp++ = 0; /* mname */ - *cpp++ = 0; /* rname */ - PUTLONG(serial_no, cpp); - PUTLONG(0xDEAD, cpp); /* Refresh */ - PUTLONG(0xBEEF, cpp); /* Retry */ - PUTLONG(0xABCD, cpp); /* Expire */ - PUTLONG(0x1776, cpp); /* Min TTL */ - n = cpp-buf; - dprintf(1, "len = %d\n", cpp-buf); - if (debug) - res_pquery(&res, buf, n, ddt); - } - else { - n = res_nmkquery(&res, QUERY, zp->z_origin, curclass, - T_SOA, NULL, 0, NULL, buf, bufsize); + n = res_mkquery(QUERY, zp->z_origin, curclass, + T_SOA, NULL, 0, NULL, buf, bufsize); if (n < 0) { if (!quiet) syslog(LOG_INFO, - "zone %s: res_nmkquery T_SOA failed", + "zone %s: res_mkquery T_SOA failed", zp->z_origin); (void) my_close(s); #ifdef POSIX_SIGNALS @@ -1043,19 +707,6 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) { #endif return (XFER_FAIL); } - } - /* - * Append TSIG to SOA query if desired - */ - tsig_key = tsig_key_from_addr(sin.sin_addr); - if (tsig_key != NULL) { - siglen = sizeof(sig); - ret = ns_sign(buf, &n, bufsize, NOERROR, tsig_key, - NULL, 0, sig, &siglen, timesigned); - if (ret == 0) - tsig_signed = 1; - } - /* * Send length & message for SOA query */ @@ -1068,7 +719,6 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) { /* * Get out your butterfly net and catch the SOA */ - if (netread(s, (char *)buf, INT16SZ, XFER_TIMER) < 0) { error++; (void) my_close(s); @@ -1095,52 +745,16 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) { (void) my_close(s); continue; } - /* - * Verify the TSIG if expected - */ - if (tsig_signed != 0) { - ret = ns_verify(buf, (int *)&len, tsig_key, sig, siglen, - NULL, NULL, ×igned, 0); - if (ret != 0) { - syslog(LOG_NOTICE, - "SOA TSIG verification from server [%s], zone %s: %s (%d)\n", - inet_ntoa(sin.sin_addr), zp->z_origin, - tsig_rcode(ret), ret); - error++; - continue; - } - } - #ifdef DEBUG if (debug >= 3) { (void)fprintf(ddt,"len = %d\n", len); - res_pquery(&res, buf, len, ddt); + fp_nquery(buf, len, ddt); } #endif - if ((methode == ISIXFR) && (ixfp == NULL)) { - delete_soa = 1; - firstsoa = 1; - ixfr_soa = 0; - old_serial = serial_no; - if (ixfp != NULL) { - fflush(ixfp); - /* XXX error */ - ftruncate(fileno(ixfp), 0); - } else if ((ixfp = fopen(tmpiname, "w+")) == NULL) { - perror(tmpiname); - if (!quiet) - syslog(LOG_ERR, - "can't fdopen ixfr log (%s)", - tmpname); - exit(XFER_FAIL); - } - } - hp = (HEADER *) buf; qdcount = ntohs(hp->qdcount); ancount = ntohs(hp->ancount); aucount = ntohs(hp->nscount); - arcount = ntohs(hp->arcount); /* * close socket if any of these apply: @@ -1195,8 +809,8 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) { } NS_GET16(type, tmp); NS_GET16(class, tmp); - if (class != curclass || ((type != T_SOA) && type != T_IXFR) || - ns_samename(zp->z_origin, name2) != 1) { + if (class != curclass || type != T_SOA || + strcasecmp(zp->z_origin, name2) != 0) { syslog(LOG_INFO, "wrong query in resp from [%s], zone %s: [%s %s %s]\n", inet_ntoa(sin.sin_addr), zp->z_origin, @@ -1243,7 +857,7 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) { tmp = cp4 + dlen; } while (1); - if (ns_samename(zp->z_origin, name2) != 1) { + if (strcasecmp(zp->z_origin, name2) != 0) { syslog(LOG_INFO, "wrong answer in resp from [%s], zone %s: [%s %s %s]\n", inet_ntoa(sin.sin_addr), zp->z_origin, @@ -1255,35 +869,16 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) { badsoa_msg = soa_zinfo(&zp_start, tmp, eom); if (badsoa_msg) goto badsoa; - if (SEQ_GT(zp_start.z_serial, serial_no) || !check_serial) { - const char *l, *nl, *t; - + if (SEQ_GT(zp_start.z_serial, serial_no) || !serial_no) { + const char *l, *nl; dprintf(1, "need update, serial %u\n", zp_start.z_serial); hp = (HEADER *) buf; - if ((methode == ISIXFR) && (soa_cnt == 0)) { - if (type == T_IXFR) { - if (ixfp) - ixfr_log(buf, len, &delete_soa, ixfp, - &sin, domain, serial_no, - &ixfr_first); - soa_cnt = 2; - } else { - dprintf(1, - "server %s rejected IXFR and responded with AXFR\n", - inet_ntoa(sin.sin_addr)); - methode = ISNOTIXFR; - was_ixfr++; - soa_cnt++; - } - } + soa_cnt = 0; +#ifdef STUBS ns_cnt = 0; +#endif gettime(&tt); - locallen = sizeof local; - if (getsockname(s, (struct sockaddr *)&local, - &locallen) < 0) { - memset(&local, 0, sizeof local); - } for (l = Version; l; l = nl) { size_t len; if ((nl = strchr(l, '\n')) != NULL) { @@ -1299,62 +894,41 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) { fprintf(dbfp, "; BIND version %.*s\n", (int)len, l); } - fprintf(dbfp, check_serial? - "; zone '%s' last serial %u\n": - "; zone '%s' first transfer\n", + fprintf(dbfp, "; zone '%s' last serial %u\n", domain, serial_no); - t = strdup(inet_ntoa(sin.sin_addr)); - fprintf(dbfp, "; from %s:%d (local %s) using %s at %s", - t, ntohs(sin.sin_port), - inet_ntoa(local.sin_addr), - (methode == ISIXFR) ? "IXFR":"AXFR", + fprintf(dbfp, "; from %s at %s", + inet_ntoa(sin.sin_addr), ctimel(tt.tv_sec)); - free((void *)t); for (;;) { if ((soa_cnt == 0) || (zp->z_type == Z_STUB)) { +#ifdef STUBS if (zp->z_type == Z_STUB) { if (soa_cnt == 1 && ns_cnt == 0) query_type = T_NS; else query_type = T_SOA; - } else if (methode == ISIXFR) - query_type = T_IXFR; - else - query_type = xfr_qtype; - n = res_nmkquery(&res, QUERY, - zp->z_origin, - curclass, query_type, - NULL, 0, - NULL, buf, bufsize); - syslog(LOG_INFO, - "send %s query %d to %s", - (query_type == T_IXFR) ? "IXFR" : - (query_type == T_AXFR) ? "AXFR" : - (query_type == ns_t_zxfr) ? "ZXFR" : - (query_type == T_SOA) ? "SOA" : "NS", - cnt, inet_ntoa(sin.sin_addr)); - dprintf(1, - "send %s query to %s\n", - (query_type == T_IXFR) ? "IXFR" : - (query_type == T_AXFR) ? "AXFR" : - (query_type == ns_t_zxfr) ? "ZXFR" : - (query_type == T_SOA) ? "SOA" : "NS", - inet_ntoa(sin.sin_addr)); - dprintf(1,"bufsize = %d\n", bufsize); + } else +#endif + query_type = T_AXFR; + n = res_mkquery(QUERY, zp->z_origin, + curclass, query_type, + NULL, 0, + NULL, buf, bufsize); if (n < 0) { if (!quiet) { +#ifdef STUBS if (zp->z_type == Z_STUB) syslog(LOG_INFO, (query_type == T_SOA) - ? "zone %s: res_nmkquery T_SOA failed" - : "zone %s: res_nmkquery T_NS failed", + ? "zone %s: res_mkquery T_SOA failed" + : "zone %s: res_mkquery T_NS failed", zp->z_origin); else +#endif syslog(LOG_INFO, - "zone %s: res_nmkquery %s failed", - zp->z_origin, - p_type(query_type)); + "zone %s: res_mkquery T_AXFR failed", + zp->z_origin); } (void) my_close(s); #ifdef POSIX_SIGNALS @@ -1366,25 +940,10 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) { #endif return (XFER_FAIL); } - cpp = buf + n; - /* - * Append TSIG to AXFR query if desired - */ - if (tsig_signed != 0) { - siglen = sizeof(sig); - ns_sign(buf, &n, bufsize, - NOERROR, tsig_key, - NULL, 0, sig, &siglen, - timesigned); - cpp = buf + n; - ns_verify_tcp_init(tsig_key, - sig, siglen, - &tsig_state); - } /* * Send length & msg for zone transfer */ - if (writemsg(s, buf, cpp - buf) < 0) { + if (writemsg(s, buf, n) < 0) { syslog(LOG_INFO, "writemsg: %m"); error++; @@ -1392,8 +951,6 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) { break; } } -/*XXX ZXFR*/ - if (methode == ISNOTIXFR && !was_ixfr) { /* * Receive length & response */ @@ -1409,7 +966,7 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) { buf = (u_char *)realloc(buf, len); if (buf == NULL) { syslog(LOG_INFO, - "malloc(%u) failed for packet from server [%s], zone %s\n", + "malloc(%u) failed for packet from server [%s], zone %s\n", len, inet_ntoa(sin.sin_addr), zp->z_origin); @@ -1425,36 +982,18 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) { error++; break; } - } #ifdef DEBUG if (debug >= 3) { (void)fprintf(ddt,"len = %d\n", len); - res_pquery(&res, buf, len, ddt); + fp_nquery(buf, len, ddt); } if (fp) - res_pquery(&res, buf, len, fp); + fp_nquery(buf, len, fp); #endif - /* - * Verify the TSIG if expected - */ - if (tsig_signed != 0) { - tsig_req = (soa_cnt == 0); - ret = ns_verify_tcp(buf, (int *)&len, - &tsig_state, - tsig_req); - eom = buf + len; - - if (ret != 0) { - syslog(LOG_NOTICE, - "TSIG verification from server [%s], zone %s: %s (%d)\n", - inet_ntoa(sin.sin_addr), - zp->z_origin, - tsig_rcode(ret), ret); - error++; - break; - } - } if (len < HFIXEDSZ) { + struct sockaddr_in my_addr; + char my_addr_text[30]; + int alen; badrec: error++; @@ -1470,54 +1009,25 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) { sin_addr), ntohs(my_addr.sin_port) ); - if ((hp->rcode == REFUSED) && - (len >= HFIXEDSZ)) { - syslog(LOG_INFO, - "[%s] transfer refused from [%s], zone %s\n", - my_addr_text, - inet_ntoa(sin.sin_addr), - zp->z_origin); - } else { - syslog(LOG_INFO, + syslog(LOG_INFO, "[%s] record too short from [%s], zone %s\n", - my_addr_text, - inet_ntoa(sin.sin_addr), - zp->z_origin); - } + my_addr_text, + inet_ntoa(sin.sin_addr), + zp->z_origin); break; } - if (query_type == T_IXFR) - if (hp->rcode != NOERROR) { - dprintf(1, - "server %s did not support IXFR\n", - inet_ntoa(sin.sin_addr)); - methode = ISNOTIXFR; - continue; - }; cp = buf + HFIXEDSZ; - if (ntohs(hp->qdcount) == 1) { - if ((query_type == T_IXFR) && (methode == ISIXFR)) { - dprintf(1, - "server %s rejected IXFR and responded with AXFR\n", - inet_ntoa(sin.sin_addr)); - methode = ISNOTIXFR; - } - n = dn_skipname(cp, eom); - if ((n == -1) || - ((n + QFIXEDSZ) >= (eom - cp))) + if (hp->qdcount) { + if ((n = dn_skipname(cp, eom)) == -1 + || n + QFIXEDSZ >= eom - cp) goto badrec; cp += n + QFIXEDSZ; - } else { - if (methode == ISIXFR && ixfp) - ixfr_log(buf, len, &delete_soa, ixfp, - &sin, domain, serial_no, - &ixfr_first); - } nmp = cp; if ((n = dn_skipname(cp, eom)) == -1) goto badrec; tmp = cp + n; +#ifdef STUBS if (zp->z_type == Z_STUB) { ancount = ntohs(hp->ancount); n = 0; @@ -1581,8 +1091,11 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) { break; } } else { +#endif /*STUBS*/ ancount = ntohs(hp->ancount); - for (n = cnt = 0; cnt < (u_int)ancount; cnt++) { + for (n = cnt = 0; + cnt < (u_int)ancount; + cnt++) { n = print_output(zp, serial_no, buf, len, cp); if (n < 0) @@ -1604,12 +1117,13 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) { error++; break; } +#ifdef STUBS } +#endif - if ((soa_cnt >= 2) && (methode == ISNOTIXFR)) - break; - if ((soa_cnt == -1) && (methode == ISIXFR)) + if (soa_cnt >= 2) break; + } (void) my_close(s); if (error == 0) { @@ -1619,43 +1133,21 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) { #else (void) sigvec(SIGALRM, &osv, (struct sigvec *)0); #endif - if (methode == ISIXFR) { - fprintf(ixfp, "update:\t{add} "); - if (soa_buf) - fputs(soa_buf, ixfp); - fprintf(ixfp, "[END_DELTA]\n"); - (void) my_close(s); - return (XFER_SUCCESSIXFR); - } else { - if (ixfp) { - (void) fclose(ixfp); - ixfp = NULL; - } - return (XFER_SUCCESSAXFR); - } - } - if (ixfp) { - (void) fclose(ixfp); - ixfp = NULL; + return (XFER_SUCCESS); } dprintf(2, "error receiving zone transfer\n"); } else if (zp_start.z_serial == serial_no) { - (void) my_close(s); - dprintf(1, "zone up-to-date, serial %u\n", zp_start.z_serial); - if (ixfp) { - (void) unlink (tmpiname); - (void) fclose(ixfp); - ixfp = NULL; - } - return (XFER_UPTODATE); + (void) my_close(s); + dprintf(1, "zone up-to-date, serial %u\n", zp_start.z_serial); + return (XFER_UPTODATE); } else { - (void) my_close(s); - if (!quiet) - syslog(LOG_NOTICE, + (void) my_close(s); + if (!quiet) + syslog(LOG_NOTICE, "serial from [%s], zone %s: %u lower than current: %u\n", inet_ntoa(sin.sin_addr), zp->z_origin, zp_start.z_serial, serial_no); - return (XFER_FAIL); + return (XFER_FAIL); } } #ifdef POSIX_SIGNALS @@ -1663,11 +1155,6 @@ getzone(struct zoneinfo *zp, u_int32_t serial_no, int port) { #else (void) sigvec(SIGALRM, &osv, (struct sigvec *)0); #endif - if (ixfp) { - (void) unlink (tmpiname); - (void) my_fclose(ixfp); - ixfp = 0; - } if (!error) return (XFER_TIMEOUT); return (XFER_FAIL); @@ -1765,8 +1252,8 @@ writemsg(int rfd, const u_char *msg, int msglen) { iov[1].iov_len = msglen; ret = writev(rfd, iov, 2); if (ret != INT16SZ + msglen) { - syslog(LOG_DEBUG, "writemsg(%d,%#x,%d) failed: %s", - rfd, msg, msglen, strerror(errno)); + syslog(LOG_DEBUG, "writemsg(%d,%p,%d) failed: %s", + rfd, (void *)msg, msglen, strerror(errno)); return (-1); } return (ret); @@ -1895,7 +1382,6 @@ print_output(struct zoneinfo *zp, u_int32_t serial_no, u_char *msg, case T_NSAP: case T_AAAA: case T_KEY: - case ns_t_cert: cp1 = cp; n = dlen; cp += n; @@ -2154,14 +1640,14 @@ print_output(struct zoneinfo *zp, u_int32_t serial_no, u_char *msg, */ if (type == T_SOA) { - if (ns_samename(dname, zp->z_origin) != 1) { + if (strcasecmp(dname, zp->z_origin) != 0) { syslog(LOG_INFO, - "wrong zone name in XFR (wanted \"%s\", got \"%s\")", + "wrong zone name in AXFR (wanted \"%s\", got \"%s\")", zp->z_origin, dname); hp->rcode = FORMERR; return (-1); } - if (soa_cnt == 0) { + if (!soa_cnt) { badsoa_msg = soa_zinfo(&zp_start, rr_type_ptr, eom); if (badsoa_msg) { syslog(LOG_INFO, @@ -2171,33 +1657,13 @@ print_output(struct zoneinfo *zp, u_int32_t serial_no, u_char *msg, return (-1); } if (SEQ_GT(zp_start.z_serial, serial_no) || - !check_serial) { + !serial_no) soa_cnt++; - } else { + else { syslog(LOG_INFO, "serial went backwards after transfer started"); return (-1); } - } else if (soa_cnt == 1) { - badsoa_msg = soa_zinfo(&zp_finish, rr_type_ptr, eom); - if (badsoa_msg) { - syslog(LOG_INFO, - "malformed SOA for zone %s: %s", - zp->z_origin, badsoa_msg); - hp->rcode = FORMERR; - return (-1); - } - if (zp_start.z_serial == zp_finish.z_serial) { - methode = ISNOTIXFR; - } else if (zp_finish.z_serial != serial_no) { - syslog(LOG_INFO, - "Unexpected serial number for zone %s: %u", - zp->z_origin, zp_finish.z_serial); - } - soa_cnt++; - if ((methode == ISIXFR) || (soa_cnt >= 2)) { - return (result); - } } else { badsoa_msg = soa_zinfo(&zp_finish, rr_type_ptr, eom); if (badsoa_msg) { @@ -2207,56 +1673,45 @@ print_output(struct zoneinfo *zp, u_int32_t serial_no, u_char *msg, hp->rcode = FORMERR; return (-1); } - if (methode == ISIXFR) { - if (zp_start.z_serial == zp_finish.z_serial) { - if (scdsoa) { - soa_cnt = -1; - return (result); - } else { - scdsoa = 1; - soa_cnt++; - }; - } else - soa_cnt++; - } else { - dprintf(2, "SOA, serial %u\n", - zp_finish.z_serial); - if (zp_start.z_serial != zp_finish.z_serial) { - dprintf(1, "serial changed, restart\n"); - restarts++; - if (restarts > MAX_XFER_RESTARTS) { + dprintf(2, "SOA, serial %u\n", zp_finish.z_serial); + if (zp_start.z_serial != zp_finish.z_serial) { + dprintf(1, "serial changed, restart\n"); + restarts++; + if (restarts > MAX_XFER_RESTARTS) { + syslog(LOG_INFO, + "too many transfer restarts for zone %s", + zp->z_origin); + hp->rcode = FORMERR; + return (-1); + } + soa_cnt = 0; +#ifdef STUBS + ns_cnt = 0; +#endif + minimum_ttl = 0; + strcpy(prev_origin, zp->z_origin); + prev_dname[0] = DEF_DNAME; + /* + * Flush buffer, truncate file + * and seek to beginning to restart. + */ + fflush(dbfp); + if (ftruncate(fileno(dbfp), 0) != 0) { + if (!quiet) syslog(LOG_INFO, - "too many transfer restarts for zone %s", - zp->z_origin); - hp->rcode = FORMERR; - return (-1); - } - soa_cnt = 0; - ns_cnt = 0; - minimum_ttl = 0; - strcpy(prev_origin, zp->z_origin); - prev_dname[0] = DEF_DNAME; - /* - * Flush buffer, truncate file - * and seek to beginning to restart. - */ - fflush(dbfp); - if (ftruncate(fileno(dbfp), 0) != 0) { - if (!quiet) - syslog(LOG_INFO, - "ftruncate %s: %m\n", - tmpname); - return (-1); - } - fseek(dbfp, 0L, 0); - return (result); + "ftruncate %s: %m\n", + tmpname); + return (-1); } - soa_cnt++; + fseek(dbfp, 0L, 0); return (result); } + soa_cnt++; + return (result); } } +#ifdef STUBS if (zp->z_type == Z_STUB) { if (query_type == T_NS && type == T_NS) ns_cnt++; @@ -2269,8 +1724,9 @@ print_output(struct zoneinfo *zp, u_int32_t serial_no, u_char *msg, if (query_type == T_SOA && type != T_SOA) return (result); } +#endif - if ((!soa_cnt || soa_cnt > 2) && methode == ISNOTIXFR) { + if (!soa_cnt || soa_cnt >= 2) { char *gripe; if (!soa_cnt) @@ -2300,21 +1756,17 @@ print_output(struct zoneinfo *zp, u_int32_t serial_no, u_char *msg, * where the remote server sends MX records soon after the * NS records for a particular domain. If sent earlier, we lose. XXX */ - if (!ns_samedomain(dname, domain)) { + if (!samedomain(dname, domain)) { (void) fprintf(dbfp, "; Ignoring info about %s, not in zone %s.\n", dname, domain); ignore = "; "; } else if (type != T_NS && type != T_A && - ns_samename(zone_top, dname) != 1 && - ns_samename(prev_ns_dname, dname) == 1) + strcasecmp(zone_top, dname) != 0 && + strcasecmp(prev_ns_dname, dname) == 0) { (void) fprintf(dbfp, "; Ignoring extra info about %s, invalid after NS delegation.\n", dname); ignore = "; "; - } else if (class != zp->z_class) { - (void) fprintf(dbfp, "; Ignoring info about %s, not class %s\n", - dname, p_class(zp->z_class)); - ignore = "; "; } /* @@ -2342,13 +1794,13 @@ print_output(struct zoneinfo *zp, u_int32_t serial_no, u_char *msg, /* * If the origin has changed, print the new origin */ - if (ns_samename(prev_origin, origin) != 1) { + if (strcasecmp(prev_origin, origin)) { (void) strcpy(prev_origin, origin); (void) fprintf(dbfp, "%s$ORIGIN %s.\n", ignore, origin); } tab = 0; - if (ns_samename(prev_dname, dname) != 1) { + if (strcasecmp(prev_dname, dname)) { /* * set the prev_dname to be the current dname, then cut off all * characters of dname after (and including) the first '.' @@ -2385,7 +1837,10 @@ print_output(struct zoneinfo *zp, u_int32_t serial_no, u_char *msg, tab = 1; } - (void) fprintf(dbfp, "%d\t", (int) ttl); + if (ttl != minimum_ttl) + (void) fprintf(dbfp, "%d\t", (int) ttl); + else if (tab) + (void) putc('\t', dbfp); (void) fprintf(dbfp, "%s\t%s\t", p_class(class), p_type(type)); cp = cdata; @@ -2630,8 +2085,8 @@ print_output(struct zoneinfo *zp, u_int32_t serial_no, u_char *msg, /* algorithm id */ (void) fprintf(dbfp," %d",*cp++); - /* labels (# of labels in name) */ - (void) fprintf(dbfp," %d",*cp++); + /* labels (# of labels in name) - skip in textual record */ + cp++; /* orig time to live (TTL)) */ (void) fprintf(dbfp," %u", (u_int32_t)ns_get32((u_char*)cp)); @@ -2673,33 +2128,6 @@ print_output(struct zoneinfo *zp, u_int32_t serial_no, u_char *msg, fprintf(dbfp,"\n"); break; - case ns_t_cert: { - int databufsize = n * 4 / 3 + 4; - char *databuf = malloc(databufsize); - - if (databuf == NULL) - panic("cert malloc failed", NULL); - - /* Object id */ - (void) fprintf(dbfp,"%d ", ns_get16((u_char*)cp)); - cp += INT16SZ; - - /* Key tag */ - (void) fprintf(dbfp,"%d ", ns_get16((u_char*)cp)); - cp += INT16SZ; - - /* Algorithm id */ - (void) fprintf(dbfp,"%d ", (u_char)*cp); - cp += 1; - - n = b64_ntop(cp, n - 2 * INT16SZ - 1, databuf, databufsize); - if (n < 0) - panic ("cert b64_ntop failed", NULL); - fprintf (dbfp, "%s\n", databuf); - free(databuf); - break; - } - default: cp1 = cp + n; while (cp < cp1) @@ -2747,199 +2175,3 @@ filenamecpy(char *ddtfile, char *optarg) { (void) strcpy(ddtfile, optarg); } #endif /* SHORT_FNAMES */ - -DST_KEY * -tsig_key_from_addr(struct in_addr addr) { - tsig_node *n; - for (n = HEAD(tsig_list); n != NULL; n = NEXT(n, link)) - if (memcpy(&addr, &n->addr, sizeof(struct in_addr))) - return n->dst_key; - return NULL; -} - -static void -do_section(ns_msg *handle, ns_sect section, int pflag, FILE *file, int *delete) { - int n, sflag, rrnum; - char buf[2048]; /* XXX need to malloc */ - ns_opcode opcode; - ns_rr rr; - const unsigned char *cp; - const unsigned char *eom; - u_int32_t serial; - time_t now; - - time(&now); - - /* - * Print answer records. - */ - sflag = (_res.pfcode & pflag); - if (_res.pfcode && !sflag) - return; - - opcode = (ns_opcode)ns_msg_getflag(*handle, ns_f_opcode); - rrnum = 0; - for (;;) { - if (ns_parserr(handle, section, rrnum, &rr)) { - if (errno != ENODEV) - fprintf(file, ";; ns_parserr: %s\n", - strerror(errno)); - else if (rrnum > 0 && sflag != 0 && - (_res.pfcode & RES_PRF_HEAD1)) - putc('\n', file); - return; - } - if (rrnum == 0 && sflag != 0 && (_res.pfcode & RES_PRF_HEAD1)) - fprintf(file, ";; %s SECTION:\n", - p_section(section, opcode)); - if (section == ns_s_qd) - fprintf(file, ";;\t%s, type = %s, class = %s\n", - ns_rr_name(rr), - p_type(ns_rr_type(rr)), - p_class(ns_rr_class(rr))); - else { - int print_record = 1; - if (rr.type == ns_t_soa) { - print_record = 0; - *delete = !*delete; - cp = ns_rr_rdata(rr); - eom = cp + ns_rr_rdlen(rr); - if ((n = dn_skipname(cp, eom)) < 0) { - rrnum++; - continue; - } - cp += n; - if ((n = dn_skipname(cp, eom)) < 0) { - rrnum++; - continue; - } - cp += n; - NS_GET32(serial, cp); - if (*delete && serial != old_serial) - /*XXX*/; - old_serial = serial; - switch (++ixfr_soa) { - case 1: - final_serial = serial; - if (soa_buf == NULL) { - if ((soa_buf = (char *)malloc(2 * PACKETSZ)) == NULL) { - syslog(LOG_INFO, "malloc(%u) failed", 2 * PACKETSZ); - return; - } - n = ns_sprintrr(handle, &rr, NULL, NULL, - soa_buf, 2*PACKETSZ); - if (n < 0) { - fprintf(file, ";; ns_sprintrr: %s\n", - strerror(errno)); - return; - } - } - print_record = 0; - break; - case 2: - fprintf(file, - "zone:\torigin %s class %s serial %u\n", - ns_rr_name(rr), - p_class(ns_rr_class(rr)), - serial); - print_record = 0; - break; - default: - print_record = 0; - break; - } - - } - - if (print_record) { - if (rr.type != ns_t_soa) { - fprintf(file, "update:\t{%s} ", - *delete ? "delete" : "add"); - - n = ns_sprintrr(handle, &rr, NULL, NULL, - buf, sizeof buf); - if (n < 0) { - fprintf(file, ";; ns_sprintrr: %s\n", - strerror(errno)); - return; - } - fputs(buf, file); - fputc('\n', file); - } - } - - } - rrnum++; - } -} - -static void -ixfr_log(const u_char *msg, int len, int *delete, FILE *file, - struct sockaddr_in *sin, char *domain, u_int32_t serial_no, - int *first_rr) -{ - ns_msg handle; - ns_type type; - ns_class class; - ns_opcode opcode; - ns_rcode rcode; - u_int id, n; - char time[25]; - ns_rr rr; - char *cp; - HEADER *hp; - - if ((_res.options & RES_INIT) == 0 && res_init() == -1) - return; - - if (ns_initparse(msg, len, &handle) < 0) { - fprintf(file, ";; ns_initparse: %s\n", strerror(errno)); - return; - } - opcode = (ns_opcode) ns_msg_getflag(handle, ns_f_opcode); - rcode = (ns_rcode) ns_msg_getflag(handle, ns_f_rcode); - id = ns_msg_id(handle); - - if (ns_parserr(&handle, ns_s_an, 0, &rr)) - { - - (void) fprintf(file,"ns_parserr() failed"); - return; - } - type = (ns_type)rr.type; - class = (ns_class)rr.rr_class; - - if (*first_rr == 1) { - gettime(&tt); - (void) fprintf(file,"%s", LogSignature); - sprintf(time, "at %lu", (u_long)tt.tv_sec); - fprintf(file, - "[IXFR_UPDATE] id %u from [%s].%d %s (named-xfr pid %ld):\n", - id, inet_ntoa(sin->sin_addr), - ntohs(sin->sin_port), time, (long)getpid()); - (*first_rr)++; - } - do_section(&handle, ns_s_an, RES_PRF_ANS, file, delete); -} - -static const char * -tsig_rcode(int rcode) { - static char buffer[64]; - - switch (rcode) { - case ns_r_badkey: - case ns_r_badsig: - case ns_r_badtime: - sprintf(buffer, "message had %s set", p_rcode(rcode)); - return (buffer); - case -ns_r_badkey: - case -ns_r_badsig: - case -ns_r_badtime: - return (p_rcode(-rcode)); - case NS_TSIG_ERROR_NO_TSIG: - return ("no TSIG present"); - default: - break; - } - return ("FORMERR"); -} diff --git a/contrib/bind/bin/named/Makefile b/contrib/bind/bin/named/Makefile index 6eac2b1..28f1ca7 100644 --- a/contrib/bind/bin/named/Makefile +++ b/contrib/bind/bin/named/Makefile @@ -1,4 +1,4 @@ -## Copyright (c) 1996-1999 by Internet Software Consortium +## Copyright (c) 1996, 1997 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,7 @@ ## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS ## SOFTWARE. -# $Id: Makefile,v 8.47 1999/08/26 18:42:31 vixie Exp $ +# $Id: Makefile,v 8.31 1998/03/20 00:49:46 halley Exp $ DESTDIR= CC= cc @@ -29,51 +29,46 @@ PORTINCL = ${TOP}/port/${SYSTYPE}/include LIBBIND = ${TOP}/lib/libbind.a A=a O=o -EXE= +LEX = lex -I 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 -DESTETC= /etc -DESTRUN= /var/run -AR= ar cru +AR= ar cruv INSTALL= install STRIP=-s -INSTALL_EXEC= -INSTALL_LIB=-o bin -g bin PS=ps LDFLAGS= CFLAGS= ${CDEBUG} -I${PORTINCL} -I${INCL} ${DEFS} -VER= LOCAL-`date +%y%m%d.%H%M%S` +VER= LOCAL-`date +%Y%m%d.%H%M%S` 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 db_ixfr.c db_sec.c db_tsig.c \ - ns_parser.c ns_lexer.c ns_parseutil.c ns_ctl.c \ + db_glue.c \ + ns_parser.c ns_lexer.c ns_parseutil.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_ixfr.c ns_signal.c \ - ns_sort.c ns_notify.c + ns_udp.c ns_config.c ns_update.c OBJS= db_dump.${O} db_load.${O} db_lookup.${O} db_save.${O} db_update.${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} \ + db_glue.${O} \ + ns_parser.${O} ns_lexer.${O} ns_parseutil.${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_ixfr.${O} ns_signal.${O} \ - ns_sort.${O} ns_notify.${O} + ns_udp.${O} ns_config.${O} ns_update.${O} -all: ${PROG}${EXE} +all: ${PROG} pathnames -${PROG}${EXE}: pathnames.h ${OBJS} ${LIBBIND} Makefile tmp_version.${O} - ${CC} ${CDEBUG} ${LDFLAGS} ${BOUNDS} -o ${PROG}${EXE} ${OBJS} \ - tmp_version.${O} ${LIBBIND} ${SYSLIBS} +${PROG}: pathnames.h ${OBJS} ${LIBBIND} Makefile tmp_version.${O} + ${CC} ${CDEBUG} ${LDFLAGS} -o ${PROG} ${OBJS} tmp_version.${O} \ + ${LIBBIND} ${SYSLIBS} ns_parser.c ns_parser.h: ns_parser.y ${YACC} ns_parser.y @@ -88,7 +83,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 pathtemplate.h +pathnames.h: ${TOP}/.settings Makefile rm -f pathnames.h sed -e "s|%DESTSBIN%|${DESTSBIN}|" \ -e "s|%DESTEXEC%|${DESTEXEC}|" \ @@ -96,20 +91,19 @@ pathnames.h: ${TOP}/.settings Makefile pathtemplate.h -e "s|%DESTRUN%|${DESTRUN}|" \ < pathtemplate.h > pathnames.h -ns_signal.${O}: ns_signal.c - ${CC} ${CPPFLAGS} ${CFLAGS} -c $*.c - -.c.${O}: - ${CC} ${CPPFLAGS} ${CFLAGS} ${BOUNDS} -c $*.c +pathnames: pathnames.${O} pathnames.h ${LIBBIND} Makefile + ${CC} ${CDEBUG} ${LDFLAGS} -o $@ pathnames.${O} \ + ${LIBBIND} ${SYSLIBS} distclean: clean rm -f ns_parser.c ns_parser.h clean: FRC - rm -f ${PROG}${EXE} ${OBJS} core .depend + rm -f ${PROG} ${OBJS} core .depend rm -f *.BAK *.CKP *~ *.orig rm -f tmp_version.c tmp_version.${O} - rm -f pathnames.h y.tab.h y.tab.c + rm -f pathnames pathnames.${O} tmp_pathnames.h pathnames.h + rm -f y.tab.h y.tab.c depend: ${SRCS} pathnames.h mkdep ${CPPFLAGS} -I${INCL} -I${PORTINCL} ${DEFS} ${SRCS} @@ -117,8 +111,8 @@ depend: ${SRCS} pathnames.h ${DESTDIR}${DESTSBIN}: mkdir -p ${DESTDIR}${DESTSBIN} -install: ${DESTDIR}${DESTSBIN} ${PROG}${EXE} - ${INSTALL} ${STRIP} -c ${INSTALL_EXEC} -m 755 ${PROG}${EXE} ${DESTDIR}${DESTSBIN}/${PROG}${EXE} +install: ${DESTDIR}${DESTSBIN} ${PROG} + ${INSTALL} ${STRIP} -c -m 755 ${PROG} ${DESTDIR}${DESTSBIN}/${PROG} links: FRC @ln -s SRC/*.[chy] SRC/test .; rm -f ns_parser.[ch] diff --git a/contrib/bind/bin/named/ns_parser.c b/contrib/bind/bin/named/ns_parser.c deleted file mode 100644 index 03d0a84..0000000 --- a/contrib/bind/bin/named/ns_parser.c +++ /dev/null @@ -1,3150 +0,0 @@ -#ifndef lint -static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93 (BSDI)"; -#endif -#include <stdlib.h> -#define YYBYACC 1 -#define YYMAJOR 1 -#define YYMINOR 9 -#define YYEMPTY (-1) -#define YYLEX yylex() -#define yyclearin (yychar=YYEMPTY) -#define yyerrok (yyerrflag=0) -#define YYRECOVERING (yyerrflag!=0) -#define YYPREFIX "yy" -#line 2 "ns_parser.y" -#if !defined(lint) && !defined(SABER) -static char rcsid[] = "$Id: ns_parser.y,v 8.51 1999/11/12 05:29:18 vixie Exp $"; -#endif /* not lint */ - -/* - * 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. - */ - -/* Global C stuff goes here. */ - -#include "port_before.h" - -#include <sys/types.h> -#include <sys/socket.h> -#include <sys/un.h> - -#include <netinet/in.h> -#include <arpa/nameser.h> -#include <arpa/inet.h> - -#include <ctype.h> -#include <limits.h> -#include <resolv.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <syslog.h> -#include <time.h> - -#include <isc/eventlib.h> -#include <isc/logging.h> - -#include <isc/dst.h> - -#include "port_after.h" - -#include "named.h" -#include "ns_parseutil.h" -#include "ns_lexer.h" - -#define SYM_ZONE 0x010000 -#define SYM_SERVER 0x020000 -#define SYM_KEY 0x030000 -#define SYM_ACL 0x040000 -#define SYM_CHANNEL 0x050000 -#define SYM_PORT 0x060000 - -#define SYMBOL_TABLE_SIZE 29989 /* should always be prime */ -static symbol_table symtab; - -#define AUTH_TABLE_SIZE 397 /* should always be prime */ -static symbol_table authtab = NULL; - -static zone_config current_zone; -static int should_install; - -static options current_options; -static int seen_options; - -static controls current_controls; - -static topology_config current_topology; -static int seen_topology; - -static server_config current_server; -static int seen_server; - -static char *current_algorithm; -static char *current_secret; - -static log_config current_logging; -static int current_category; -static int chan_type; -static int chan_level; -static u_int chan_flags; -static int chan_facility; -static char *chan_name; -static int chan_versions; -static u_long chan_max_size; - -static log_channel lookup_channel(char *); -static void define_channel(char *, log_channel); -static char *canonical_name(char *); - -int yyparse(); - -#line 103 "ns_parser.y" -typedef union { - char * cp; - int s_int; - long num; - u_long ul_int; - u_int16_t us_int; - struct in_addr ip_addr; - ip_match_element ime; - ip_match_list iml; - rrset_order_list rol; - rrset_order_element roe; - struct dst_key * keyi; - enum axfr_format axfr_fmt; -} YYSTYPE; -#line 130 "y.tab.c" -#define L_EOS 257 -#define L_IPADDR 258 -#define L_NUMBER 259 -#define L_STRING 260 -#define L_QSTRING 261 -#define L_END_INCLUDE 262 -#define T_INCLUDE 263 -#define T_OPTIONS 264 -#define T_DIRECTORY 265 -#define T_PIDFILE 266 -#define T_NAMED_XFER 267 -#define T_DUMP_FILE 268 -#define T_STATS_FILE 269 -#define T_MEMSTATS_FILE 270 -#define T_FAKE_IQUERY 271 -#define T_RECURSION 272 -#define T_FETCH_GLUE 273 -#define T_QUERY_SOURCE 274 -#define T_LISTEN_ON 275 -#define T_PORT 276 -#define T_ADDRESS 277 -#define T_RRSET_ORDER 278 -#define T_ORDER 279 -#define T_NAME 280 -#define T_CLASS 281 -#define T_CONTROLS 282 -#define T_INET 283 -#define T_UNIX 284 -#define T_PERM 285 -#define T_OWNER 286 -#define T_GROUP 287 -#define T_ALLOW 288 -#define T_DATASIZE 289 -#define T_STACKSIZE 290 -#define T_CORESIZE 291 -#define T_DEFAULT 292 -#define T_UNLIMITED 293 -#define T_FILES 294 -#define T_VERSION 295 -#define T_HOSTSTATS 296 -#define T_DEALLOC_ON_EXIT 297 -#define T_TRANSFERS_IN 298 -#define T_TRANSFERS_OUT 299 -#define T_TRANSFERS_PER_NS 300 -#define T_TRANSFER_FORMAT 301 -#define T_MAX_TRANSFER_TIME_IN 302 -#define T_SERIAL_QUERIES 303 -#define T_ONE_ANSWER 304 -#define T_MANY_ANSWERS 305 -#define T_NOTIFY 306 -#define T_AUTH_NXDOMAIN 307 -#define T_MULTIPLE_CNAMES 308 -#define T_USE_IXFR 309 -#define T_MAINTAIN_IXFR_BASE 310 -#define T_CLEAN_INTERVAL 311 -#define T_INTERFACE_INTERVAL 312 -#define T_STATS_INTERVAL 313 -#define T_MAX_LOG_SIZE_IXFR 314 -#define T_HEARTBEAT 315 -#define T_USE_ID_POOL 316 -#define T_MAX_NCACHE_TTL 317 -#define T_HAS_OLD_CLIENTS 318 -#define T_RFC2308_TYPE1 319 -#define T_LAME_TTL 320 -#define T_MIN_ROOTS 321 -#define T_TREAT_CR_AS_SPACE 322 -#define T_LOGGING 323 -#define T_CATEGORY 324 -#define T_CHANNEL 325 -#define T_SEVERITY 326 -#define T_DYNAMIC 327 -#define T_FILE 328 -#define T_VERSIONS 329 -#define T_SIZE 330 -#define T_SYSLOG 331 -#define T_DEBUG 332 -#define T_NULL_OUTPUT 333 -#define T_PRINT_TIME 334 -#define T_PRINT_CATEGORY 335 -#define T_PRINT_SEVERITY 336 -#define T_SORTLIST 337 -#define T_TOPOLOGY 338 -#define T_SERVER 339 -#define T_LONG_AXFR 340 -#define T_BOGUS 341 -#define T_TRANSFERS 342 -#define T_KEYS 343 -#define T_SUPPORT_IXFR 344 -#define T_ZONE 345 -#define T_IN 346 -#define T_CHAOS 347 -#define T_HESIOD 348 -#define T_TYPE 349 -#define T_MASTER 350 -#define T_SLAVE 351 -#define T_STUB 352 -#define T_RESPONSE 353 -#define T_HINT 354 -#define T_MASTERS 355 -#define T_TRANSFER_SOURCE 356 -#define T_PUBKEY 357 -#define T_ALSO_NOTIFY 358 -#define T_DIALUP 359 -#define T_FILE_IXFR 360 -#define T_IXFR_TMP 361 -#define T_TRUSTED_KEYS 362 -#define T_ACL 363 -#define T_ALLOW_UPDATE 364 -#define T_ALLOW_QUERY 365 -#define T_ALLOW_TRANSFER 366 -#define T_ALLOW_RECURSION 367 -#define T_BLACKHOLE 368 -#define T_SEC_KEY 369 -#define T_ALGID 370 -#define T_SECRET 371 -#define T_CHECK_NAMES 372 -#define T_WARN 373 -#define T_FAIL 374 -#define T_IGNORE 375 -#define T_FORWARD 376 -#define T_FORWARDERS 377 -#define T_ONLY 378 -#define T_FIRST 379 -#define T_IF_NO_ANSWER 380 -#define T_IF_NO_DOMAIN 381 -#define T_YES 382 -#define T_TRUE 383 -#define T_NO 384 -#define T_FALSE 385 -#define YYERRCODE 256 -short yylhs[] = { -1, - 0, 31, 31, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 33, 42, 34, 43, 43, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 46, 44, 44, 44, 44, 44, - 44, 44, 49, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 35, 53, 53, 54, 54, 54, 54, - 15, 15, 12, 12, 13, 13, 14, 14, 16, 6, - 6, 5, 5, 4, 4, 55, 56, 48, 48, 48, - 48, 2, 2, 3, 3, 29, 29, 29, 29, 29, - 27, 27, 27, 28, 28, 28, 45, 45, 45, 45, - 51, 51, 51, 51, 26, 26, 26, 26, 52, 52, - 52, 47, 47, 57, 57, 58, 50, 50, 59, 59, - 60, 61, 36, 62, 62, 62, 64, 63, 66, 63, - 68, 68, 68, 68, 69, 69, 70, 71, 71, 71, - 71, 71, 72, 10, 10, 11, 11, 73, 74, 74, - 74, 74, 74, 74, 74, 67, 67, 67, 9, 9, - 75, 65, 65, 65, 8, 8, 8, 7, 76, 37, - 77, 77, 78, 78, 78, 78, 78, 78, 20, 20, - 18, 18, 18, 17, 17, 17, 17, 17, 19, 23, - 80, 79, 79, 79, 81, 41, 82, 82, 82, 24, - 25, 40, 84, 38, 83, 83, 21, 21, 22, 22, - 22, 22, 22, 85, 85, 86, 86, 86, 86, 86, - 86, 86, 86, 86, 86, 86, 89, 86, 86, 86, - 86, 86, 86, 86, 86, 86, 86, 87, 87, 92, - 91, 91, 93, 93, 94, 88, 88, 90, 90, 95, - 95, 96, 39, 97, 97, 98, 98, 1, 30, 30, -}; -short yylen[] = { 2, - 1, 1, 2, 1, 2, 2, 2, 2, 2, 2, - 2, 2, 1, 2, 2, 3, 0, 5, 2, 3, - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, - 2, 2, 5, 2, 0, 5, 2, 2, 4, 4, - 4, 4, 0, 5, 4, 4, 1, 1, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, - 2, 2, 1, 4, 2, 3, 0, 8, 8, 1, - 2, 3, 0, 2, 0, 2, 0, 2, 5, 1, - 1, 1, 1, 1, 1, 2, 2, 1, 1, 2, - 2, 0, 2, 0, 2, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, - 2, 0, 1, 2, 3, 1, 0, 1, 2, 3, - 1, 0, 5, 2, 3, 1, 0, 6, 0, 6, - 1, 1, 2, 1, 2, 2, 2, 0, 1, 1, - 2, 2, 3, 1, 1, 0, 1, 2, 1, 1, - 1, 2, 2, 2, 2, 2, 3, 1, 1, 1, - 1, 2, 3, 1, 1, 1, 1, 1, 0, 6, - 2, 3, 2, 2, 2, 2, 4, 1, 2, 3, - 1, 2, 2, 1, 3, 3, 1, 3, 1, 1, - 1, 2, 3, 1, 0, 6, 2, 2, 1, 3, - 3, 5, 0, 5, 0, 3, 0, 1, 1, 1, - 1, 1, 1, 2, 3, 2, 2, 2, 2, 5, - 2, 2, 4, 4, 4, 2, 0, 5, 2, 2, - 2, 2, 5, 5, 4, 2, 1, 2, 3, 1, - 0, 1, 2, 3, 1, 1, 1, 0, 1, 2, - 3, 1, 4, 2, 3, 5, 5, 1, 1, 1, -}; -short yydefred[] = { 0, - 0, 13, 0, 17, 0, 142, 0, 0, 0, 0, - 215, 0, 0, 2, 4, 0, 0, 0, 0, 0, - 0, 0, 0, 14, 15, 0, 0, 0, 0, 189, - 0, 0, 279, 280, 0, 0, 3, 5, 6, 7, - 8, 9, 10, 11, 12, 16, 0, 80, 0, 0, - 0, 0, 0, 0, 223, 228, 0, 0, 0, 0, - 0, 73, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 53, 0, 0, - 0, 0, 0, 0, 0, 45, 0, 0, 57, 58, - 92, 93, 0, 0, 74, 0, 75, 146, 0, 0, - 0, 0, 0, 0, 0, 0, 273, 0, 274, 0, - 0, 0, 0, 0, 201, 0, 207, 0, 209, 0, - 23, 25, 24, 28, 26, 27, 110, 106, 107, 108, - 109, 29, 30, 31, 0, 0, 47, 0, 0, 0, - 0, 0, 126, 127, 128, 121, 125, 122, 123, 124, - 22, 33, 34, 129, 130, 131, 90, 91, 59, 60, - 61, 32, 38, 39, 35, 36, 62, 63, 64, 65, - 68, 41, 66, 37, 42, 67, 72, 71, 0, 0, - 48, 0, 69, 0, 0, 0, 0, 111, 112, 113, - 0, 117, 118, 119, 120, 44, 0, 18, 0, 19, - 0, 0, 76, 186, 187, 147, 188, 185, 180, 149, - 179, 143, 0, 144, 198, 0, 0, 0, 0, 0, - 0, 0, 0, 224, 0, 0, 275, 0, 0, 203, - 0, 202, 199, 222, 0, 219, 0, 0, 0, 0, - 0, 278, 95, 94, 97, 96, 100, 101, 103, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 114, 115, 116, 40, 0, 20, 0, 0, 0, - 0, 145, 196, 193, 195, 0, 194, 190, 0, 191, - 257, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 247, - 0, 0, 0, 0, 205, 206, 208, 200, 0, 0, - 217, 218, 216, 0, 84, 0, 0, 70, 0, 81, - 52, 56, 141, 0, 0, 0, 49, 51, 50, 55, - 136, 0, 0, 0, 0, 0, 0, 0, 214, 211, - 210, 0, 0, 192, 249, 251, 252, 250, 237, 229, - 230, 232, 231, 233, 236, 0, 0, 241, 0, 0, - 0, 256, 238, 239, 0, 0, 0, 242, 266, 267, - 246, 0, 226, 0, 234, 276, 277, 220, 221, 43, - 86, 0, 0, 82, 54, 0, 139, 46, 0, 134, - 0, 0, 184, 181, 0, 0, 178, 0, 0, 0, - 171, 0, 0, 0, 0, 169, 170, 0, 197, 0, - 212, 105, 0, 0, 0, 265, 0, 0, 0, 0, - 0, 0, 0, 235, 88, 0, 140, 135, 0, 0, - 148, 0, 182, 154, 0, 151, 172, 0, 165, 167, - 168, 164, 173, 174, 175, 150, 0, 176, 213, 260, - 0, 0, 0, 0, 255, 0, 263, 243, 244, 245, - 272, 0, 0, 0, 89, 78, 79, 183, 153, 0, - 0, 0, 0, 163, 177, 240, 0, 258, 253, 254, - 264, 248, 0, 270, 155, 156, 157, 161, 162, 259, - 271, -}; -short yydgoto[] = { 12, - 274, 171, 387, 275, 123, 189, 236, 237, 424, 470, - 471, 282, 347, 413, 283, 284, 145, 146, 147, 148, - 55, 385, 370, 269, 270, 176, 221, 295, 162, 149, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 27, 117, 118, 226, 227, 362, 167, 212, 354, - 119, 120, 51, 52, 168, 169, 363, 364, 355, 356, - 29, 131, 132, 300, 425, 301, 435, 467, 502, 503, - 504, 436, 437, 438, 426, 54, 251, 252, 372, 373, - 36, 271, 254, 134, 331, 332, 481, 401, 402, 492, - 447, 482, 448, 449, 493, 494, 58, 59, -}; -short yysindex[] = { 419, - -172, 0, -236, 0, -91, 0, -224, -211, -71, -178, - 0, 0, 419, 0, 0, -166, -160, -158, -156, -154, - -144, -139, -128, 0, 0, -126, -49, -195, 10, 0, - -178, -198, 0, 0, 12, -178, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 349, 0, -7, -123, - -112, -115, -238, 23, 0, 0, -189, -110, -105, 43, - 31, 0, -98, -96, -94, -85, -76, -73, -190, -190, - -190, -86, -106, 33, -81, -81, -81, -81, -58, -190, - -190, -59, -50, -45, -121, -34, -32, -190, -190, -190, - -190, -190, 51, 56, 63, 64, 66, -190, 68, -190, - -190, 69, 71, -190, 123, 136, -7, 0, -190, 212, - 219, 220, 222, -258, -182, 0, 168, 89, 0, 0, - 0, 0, 73, 62, 0, 93, 0, 0, -181, -216, - -69, 94, -220, 230, 95, 96, 0, 99, 0, 312, - 313, 104, 43, -100, 0, 108, 0, -29, 0, -196, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, -31, -7, 0, 100, 92, 111, - 254, 98, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 43, 43, - 0, 257, 0, 43, 43, 43, 43, 0, 0, 0, - -68, 0, 0, 0, 0, 0, 258, 0, 127, 0, - 111, 126, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 129, 0, 0, -121, -190, 130, 265, -190, - -120, 133, 374, 0, 134, 135, 0, 137, 138, 0, - -25, 0, 0, 0, 141, 0, -178, -178, 21, 32, - 275, 0, 0, 0, 0, 0, 0, 0, 0, 43, - -178, 52, -108, 146, -21, -17, 147, -11, 5, 9, - 14, 0, 0, 0, 0, 148, 0, 116, 121, 286, - 287, 0, 0, 0, 0, -151, 0, 0, 154, 0, - 0, 155, -190, -190, 157, 152, -13, 143, -7, 35, - 294, -190, 160, 161, 300, 302, 304, -68, -70, 0, - 236, 171, 169, 170, 0, 0, 0, 0, 172, 175, - 0, 0, 0, 18, 0, -178, 164, 0, 188, 0, - 0, 0, 0, 322, 147, 191, 0, 0, 0, 0, - 0, 324, 148, 193, 328, 194, -207, -2, 0, 0, - 0, -92, 195, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 111, 331, 0, 196, 197, - 202, 0, 0, 0, 43, 43, 43, 0, 0, 0, - 0, 338, 0, 215, 0, 0, 0, 0, 0, 0, - 0, 232, 216, 0, 0, 237, 0, 0, 239, 0, - 43, 186, 0, 0, -41, 243, 0, -145, 240, -183, - 0, -190, -190, -190, -118, 0, 0, 245, 0, 246, - 0, 0, 249, 250, 251, 0, 379, 202, 255, 22, - 26, 30, 253, 0, 0, 248, 0, 0, 39, 256, - 0, 259, 0, 0, 260, 0, 0, -16, 0, 0, - 0, 0, 0, 0, 0, 0, 261, 0, 0, 0, - -101, 263, 252, 264, 0, 271, 0, 0, 0, 0, - 0, 389, 253, 272, 0, 0, 0, 0, 0, -218, - -81, 187, 192, 0, 0, 0, 273, 0, 0, 0, - 0, 0, 274, 0, 0, 0, 0, 0, 0, 0, - 0, -}; -short yyrindex[] = { 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 522, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 280, 0, 0, - -117, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 282, 0, 0, 0, - 280, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 409, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 282, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 284, 0, 0, 0, 0, 0, 290, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 291, 292, 0, - 0, -222, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 41, -222, 0, 0, 0, 418, 0, 0, 0, - 0, 0, 0, 0, 0, 426, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 429, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 276, 0, 0, 0, - 0, 0, 0, 0, 428, 0, 0, 0, 0, 0, - 0, 0, 431, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 432, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 297, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 433, 0, 0, - 0, 0, 434, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 303, 0, 0, 305, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 436, 0, 0, 0, 0, 0, 0, 0, - 0, 306, 308, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, -}; -short yygindex[] = { 0, - -124, 0, 0, 0, -93, 320, 0, 0, 437, 0, - 0, 0, 0, 0, 0, 285, 425, -84, 0, 102, - 0, 0, 0, 301, 307, -75, 0, 242, -61, -10, - 0, 559, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 456, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 523, 406, 410, 0, 214, 0, 224, - 0, 0, 449, 0, 0, 0, 0, 0, 78, 80, - 0, 0, 0, 149, 158, 0, 0, 335, 0, 217, - 0, 0, 0, 0, 0, 267, 0, 0, 0, 0, - 0, 106, 0, 140, 0, 97, 0, 541, -}; -#define YYTABLESIZE 788 -short yytable[] = { 35, - 178, 179, 180, 144, 308, 227, 476, 144, 163, 164, - 273, 144, 125, 211, 137, 144, 348, 128, 182, 183, - 56, 144, 143, 506, 26, 61, 192, 193, 194, 195, - 196, 28, 439, 30, 122, 245, 202, 144, 204, 205, - 515, 144, 208, 33, 34, 279, 144, 213, 423, 31, - 144, 32, 33, 34, 144, 242, 83, 83, 144, 266, - 48, 57, 144, 265, 177, 177, 177, 177, 157, 135, - 136, 144, 276, 47, 516, 144, 33, 34, 33, 34, - 246, 33, 34, 461, 24, 129, 130, 49, 50, 25, - 38, 218, 219, 143, 220, 264, 39, 143, 40, 337, - 41, 143, 42, 351, 369, 143, 298, 352, 33, 34, - 234, 143, 43, 357, 33, 34, 239, 44, 238, 241, - 247, 248, 249, 250, 235, 239, 83, 143, 45, 358, - 46, 143, 53, 359, 60, 245, 143, 124, 360, 227, - 143, 127, 410, 48, 143, 133, 488, 469, 143, 57, - 489, 139, 143, 150, 490, 172, 480, 140, 141, 33, - 34, 143, 151, 496, 152, 143, 153, 33, 34, 170, - 49, 50, 281, 267, 268, 154, 265, 173, 33, 34, - 246, 464, 187, 188, 155, 304, 465, 156, 307, 165, - 166, 158, 159, 160, 161, 222, 223, 224, 225, 184, - 265, 265, 181, 265, 265, 265, 265, 428, 185, 429, - 174, 175, 430, 186, 431, 432, 433, 434, 33, 34, - 247, 248, 249, 250, 190, 388, 191, 272, 140, 141, - 33, 34, 140, 141, 33, 34, 140, 141, 33, 34, - 140, 141, 33, 34, 261, 209, 140, 141, 33, 34, - 121, 376, 377, 427, 129, 130, 339, 340, 210, 265, - 392, 442, 140, 141, 33, 34, 140, 141, 33, 34, - 345, 140, 141, 33, 34, 140, 141, 33, 34, 140, - 141, 33, 34, 140, 141, 33, 34, 140, 141, 33, - 34, 239, 228, 389, 390, 371, 140, 141, 33, 34, - 140, 141, 33, 34, 292, 293, 294, 399, 400, 197, - 285, 286, 500, 501, 198, 288, 289, 290, 291, 85, - 85, 199, 200, 428, 201, 429, 203, 206, 430, 207, - 431, 432, 433, 434, 214, 411, 380, 381, 382, 142, - 383, 215, 216, 142, 217, 230, 232, 142, 231, 233, - 244, 142, 253, 255, 256, 257, 241, 142, 258, 259, - 403, 371, 384, 260, 263, 265, 265, 265, 166, 272, - 473, 474, 475, 142, 265, 165, 280, 142, 281, 287, - 296, 344, 142, 297, 299, 302, 142, 306, 305, 310, - 142, 268, 333, 334, 142, 335, 336, 338, 142, 343, - 346, 267, 350, 365, 353, 361, 366, 142, 367, 368, - 374, 142, 379, 375, 241, 378, 391, 466, 386, 472, - 393, 394, 395, 62, 396, 517, 397, 405, 408, 406, - 407, 409, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 412, 414, 74, 415, 417, 418, 420, - 421, 441, 422, 443, 444, 445, 75, 76, 77, 446, - 453, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 454, 460, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 177, 311, 455, 457, 456, 458, 450, 451, 452, 463, - 468, 478, 479, 485, 105, 106, 480, 495, 483, 484, - 491, 487, 509, 512, 497, 498, 501, 505, 499, 508, - 500, 1, 459, 107, 510, 108, 109, 511, 514, 520, - 521, 102, 110, 111, 112, 113, 77, 312, 21, 114, - 225, 313, 137, 115, 116, 314, 204, 98, 99, 315, - 132, 104, 138, 166, 87, 133, 261, 262, 268, 152, - 269, 158, 159, 316, 160, 303, 240, 349, 262, 398, - 342, 37, 229, 126, 278, 341, 419, 277, 416, 243, - 519, 518, 462, 477, 317, 309, 507, 486, 440, 513, - 318, 319, 320, 321, 322, 323, 324, 404, 138, 325, - 326, 327, 0, 0, 62, 0, 0, 328, 0, 0, - 0, 329, 330, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 0, 0, 74, 0, 0, 311, - 0, 0, 0, 0, 0, 0, 0, 75, 76, 77, - 0, 0, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 0, 0, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 104, 0, 0, 0, 1, 312, 0, 0, 0, 313, - 2, 3, 4, 314, 0, 105, 106, 315, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 5, 316, 0, 0, 107, 0, 108, 109, 0, 0, - 0, 0, 0, 110, 111, 112, 113, 0, 0, 0, - 114, 0, 317, 0, 115, 116, 0, 0, 318, 319, - 320, 321, 322, 323, 324, 0, 0, 325, 326, 327, - 0, 6, 0, 0, 0, 328, 0, 0, 0, 329, - 330, 0, 0, 0, 0, 0, 0, 7, 0, 0, - 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 9, 10, 0, 0, 0, 0, 0, 11, -}; -short yycheck[] = { 10, - 76, 77, 78, 33, 125, 123, 125, 33, 70, 71, - 42, 33, 125, 107, 125, 33, 125, 256, 80, 81, - 31, 33, 123, 125, 261, 36, 88, 89, 90, 91, - 92, 123, 125, 258, 42, 256, 98, 33, 100, 101, - 259, 33, 104, 260, 261, 170, 33, 109, 256, 261, - 33, 123, 260, 261, 33, 125, 279, 280, 33, 256, - 256, 260, 33, 148, 75, 76, 77, 78, 259, 259, - 260, 33, 166, 123, 293, 33, 260, 261, 260, 261, - 301, 260, 261, 125, 257, 324, 325, 283, 284, 262, - 257, 350, 351, 123, 353, 125, 257, 123, 257, 125, - 257, 123, 257, 125, 256, 123, 231, 125, 260, 261, - 292, 123, 257, 125, 260, 261, 333, 257, 129, 130, - 341, 342, 343, 344, 306, 333, 349, 123, 257, 125, - 257, 123, 123, 125, 123, 256, 123, 261, 125, 257, - 123, 257, 125, 256, 123, 123, 125, 331, 123, 260, - 125, 257, 123, 123, 125, 123, 258, 258, 259, 260, - 261, 123, 261, 125, 261, 123, 261, 260, 261, 276, - 283, 284, 281, 370, 371, 261, 261, 259, 260, 261, - 301, 327, 304, 305, 261, 247, 332, 261, 250, 276, - 277, 382, 383, 384, 385, 378, 379, 380, 381, 259, - 285, 286, 261, 288, 289, 290, 291, 326, 259, 328, - 292, 293, 331, 259, 333, 334, 335, 336, 260, 261, - 341, 342, 343, 344, 259, 319, 259, 259, 258, 259, - 260, 261, 258, 259, 260, 261, 258, 259, 260, 261, - 258, 259, 260, 261, 143, 123, 258, 259, 260, 261, - 258, 313, 314, 256, 324, 325, 267, 268, 123, 344, - 322, 386, 258, 259, 260, 261, 258, 259, 260, 261, - 281, 258, 259, 260, 261, 258, 259, 260, 261, 258, - 259, 260, 261, 258, 259, 260, 261, 258, 259, 260, - 261, 333, 125, 259, 260, 306, 258, 259, 260, 261, - 258, 259, 260, 261, 373, 374, 375, 378, 379, 259, - 209, 210, 329, 330, 259, 214, 215, 216, 217, 279, - 280, 259, 259, 326, 259, 328, 259, 259, 331, 259, - 333, 334, 335, 336, 123, 346, 350, 351, 352, 369, - 354, 123, 123, 369, 123, 257, 285, 369, 276, 257, - 257, 369, 123, 259, 259, 257, 367, 369, 47, 47, - 125, 372, 376, 260, 257, 450, 451, 452, 277, 259, - 432, 433, 434, 369, 459, 276, 123, 369, 281, 123, - 123, 280, 369, 257, 259, 257, 369, 123, 259, 257, - 369, 371, 259, 259, 369, 259, 259, 257, 369, 125, - 349, 370, 257, 288, 258, 258, 286, 369, 123, 123, - 257, 369, 261, 259, 425, 259, 123, 428, 276, 430, - 261, 261, 123, 256, 123, 501, 123, 257, 257, 261, - 261, 257, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 280, 257, 278, 125, 257, 125, 257, - 123, 257, 259, 123, 259, 259, 289, 290, 291, 258, - 123, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 257, 287, 306, 307, 308, 309, 310, 311, 312, - 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 501, 256, 261, 257, 279, 257, 395, 396, 397, 257, - 261, 257, 257, 125, 337, 338, 258, 260, 259, 259, - 258, 257, 261, 125, 259, 257, 330, 257, 259, 257, - 329, 0, 421, 356, 261, 358, 359, 257, 257, 257, - 257, 123, 365, 366, 367, 368, 257, 302, 257, 372, - 257, 306, 125, 376, 377, 310, 257, 257, 257, 314, - 125, 123, 125, 257, 279, 125, 125, 125, 125, 257, - 125, 257, 257, 328, 257, 246, 130, 283, 144, 328, - 270, 13, 117, 51, 169, 269, 363, 168, 355, 131, - 503, 502, 425, 435, 349, 251, 481, 448, 372, 493, - 355, 356, 357, 358, 359, 360, 361, 331, 58, 364, - 365, 366, -1, -1, 256, -1, -1, 372, -1, -1, - -1, 376, 377, 265, 266, 267, 268, 269, 270, 271, - 272, 273, 274, 275, -1, -1, 278, -1, -1, 256, - -1, -1, -1, -1, -1, -1, -1, 289, 290, 291, - -1, -1, 294, 295, 296, 297, 298, 299, 300, 301, - 302, 303, -1, -1, 306, 307, 308, 309, 310, 311, - 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, - 322, -1, -1, -1, 256, 302, -1, -1, -1, 306, - 262, 263, 264, 310, -1, 337, 338, 314, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 282, 328, -1, -1, 356, -1, 358, 359, -1, -1, - -1, -1, -1, 365, 366, 367, 368, -1, -1, -1, - 372, -1, 349, -1, 376, 377, -1, -1, 355, 356, - 357, 358, 359, 360, 361, -1, -1, 364, 365, 366, - -1, 323, -1, -1, -1, 372, -1, -1, -1, 376, - 377, -1, -1, -1, -1, -1, -1, 339, -1, -1, - -1, -1, -1, 345, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 362, 363, -1, -1, -1, -1, -1, 369, -}; -#define YYFINAL 12 -#ifndef YYDEBUG -#define YYDEBUG 0 -#endif -#define YYMAXTOKEN 385 -#if YYDEBUG -char *yyname[] = { -"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -"'!'",0,0,0,0,0,0,0,0,"'*'",0,0,0,0,"'/'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'{'",0,"'}'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"L_EOS", -"L_IPADDR","L_NUMBER","L_STRING","L_QSTRING","L_END_INCLUDE","T_INCLUDE", -"T_OPTIONS","T_DIRECTORY","T_PIDFILE","T_NAMED_XFER","T_DUMP_FILE", -"T_STATS_FILE","T_MEMSTATS_FILE","T_FAKE_IQUERY","T_RECURSION","T_FETCH_GLUE", -"T_QUERY_SOURCE","T_LISTEN_ON","T_PORT","T_ADDRESS","T_RRSET_ORDER","T_ORDER", -"T_NAME","T_CLASS","T_CONTROLS","T_INET","T_UNIX","T_PERM","T_OWNER","T_GROUP", -"T_ALLOW","T_DATASIZE","T_STACKSIZE","T_CORESIZE","T_DEFAULT","T_UNLIMITED", -"T_FILES","T_VERSION","T_HOSTSTATS","T_DEALLOC_ON_EXIT","T_TRANSFERS_IN", -"T_TRANSFERS_OUT","T_TRANSFERS_PER_NS","T_TRANSFER_FORMAT", -"T_MAX_TRANSFER_TIME_IN","T_SERIAL_QUERIES","T_ONE_ANSWER","T_MANY_ANSWERS", -"T_NOTIFY","T_AUTH_NXDOMAIN","T_MULTIPLE_CNAMES","T_USE_IXFR", -"T_MAINTAIN_IXFR_BASE","T_CLEAN_INTERVAL","T_INTERFACE_INTERVAL", -"T_STATS_INTERVAL","T_MAX_LOG_SIZE_IXFR","T_HEARTBEAT","T_USE_ID_POOL", -"T_MAX_NCACHE_TTL","T_HAS_OLD_CLIENTS","T_RFC2308_TYPE1","T_LAME_TTL", -"T_MIN_ROOTS","T_TREAT_CR_AS_SPACE","T_LOGGING","T_CATEGORY","T_CHANNEL", -"T_SEVERITY","T_DYNAMIC","T_FILE","T_VERSIONS","T_SIZE","T_SYSLOG","T_DEBUG", -"T_NULL_OUTPUT","T_PRINT_TIME","T_PRINT_CATEGORY","T_PRINT_SEVERITY", -"T_SORTLIST","T_TOPOLOGY","T_SERVER","T_LONG_AXFR","T_BOGUS","T_TRANSFERS", -"T_KEYS","T_SUPPORT_IXFR","T_ZONE","T_IN","T_CHAOS","T_HESIOD","T_TYPE", -"T_MASTER","T_SLAVE","T_STUB","T_RESPONSE","T_HINT","T_MASTERS", -"T_TRANSFER_SOURCE","T_PUBKEY","T_ALSO_NOTIFY","T_DIALUP","T_FILE_IXFR", -"T_IXFR_TMP","T_TRUSTED_KEYS","T_ACL","T_ALLOW_UPDATE","T_ALLOW_QUERY", -"T_ALLOW_TRANSFER","T_ALLOW_RECURSION","T_BLACKHOLE","T_SEC_KEY","T_ALGID", -"T_SECRET","T_CHECK_NAMES","T_WARN","T_FAIL","T_IGNORE","T_FORWARD", -"T_FORWARDERS","T_ONLY","T_FIRST","T_IF_NO_ANSWER","T_IF_NO_DOMAIN","T_YES", -"T_TRUE","T_NO","T_FALSE", -}; -char *yyrule[] = { -"$accept : config_file", -"config_file : statement_list", -"statement_list : statement", -"statement_list : statement_list statement", -"statement : include_stmt", -"statement : options_stmt L_EOS", -"statement : controls_stmt L_EOS", -"statement : logging_stmt L_EOS", -"statement : server_stmt L_EOS", -"statement : zone_stmt L_EOS", -"statement : trusted_keys_stmt L_EOS", -"statement : acl_stmt L_EOS", -"statement : key_stmt L_EOS", -"statement : L_END_INCLUDE", -"statement : error L_EOS", -"statement : error L_END_INCLUDE", -"include_stmt : T_INCLUDE L_QSTRING L_EOS", -"$$1 :", -"options_stmt : T_OPTIONS $$1 '{' options '}'", -"options : option L_EOS", -"options : options option L_EOS", -"option :", -"option : T_VERSION L_QSTRING", -"option : T_DIRECTORY L_QSTRING", -"option : T_NAMED_XFER L_QSTRING", -"option : T_PIDFILE L_QSTRING", -"option : T_STATS_FILE L_QSTRING", -"option : T_MEMSTATS_FILE L_QSTRING", -"option : T_DUMP_FILE L_QSTRING", -"option : T_FAKE_IQUERY yea_or_nay", -"option : T_RECURSION yea_or_nay", -"option : T_FETCH_GLUE yea_or_nay", -"option : T_NOTIFY yea_or_nay", -"option : T_HOSTSTATS yea_or_nay", -"option : T_DEALLOC_ON_EXIT yea_or_nay", -"option : T_USE_IXFR yea_or_nay", -"option : T_MAINTAIN_IXFR_BASE yea_or_nay", -"option : T_HAS_OLD_CLIENTS yea_or_nay", -"option : T_AUTH_NXDOMAIN yea_or_nay", -"option : T_MULTIPLE_CNAMES yea_or_nay", -"option : T_CHECK_NAMES check_names_type check_names_opt", -"option : T_USE_ID_POOL yea_or_nay", -"option : T_RFC2308_TYPE1 yea_or_nay", -"option : T_LISTEN_ON maybe_port '{' address_match_list '}'", -"option : T_FORWARD forward_opt", -"$$2 :", -"option : T_FORWARDERS $$2 '{' opt_forwarders_list '}'", -"option : T_QUERY_SOURCE query_source", -"option : T_TRANSFER_SOURCE maybe_wild_addr", -"option : T_ALLOW_QUERY '{' address_match_list '}'", -"option : T_ALLOW_RECURSION '{' address_match_list '}'", -"option : T_ALLOW_TRANSFER '{' address_match_list '}'", -"option : T_SORTLIST '{' address_match_list '}'", -"$$3 :", -"option : T_ALSO_NOTIFY $$3 '{' opt_also_notify_list '}'", -"option : T_BLACKHOLE '{' address_match_list '}'", -"option : T_TOPOLOGY '{' address_match_list '}'", -"option : size_clause", -"option : transfer_clause", -"option : T_TRANSFER_FORMAT transfer_format", -"option : T_MAX_TRANSFER_TIME_IN L_NUMBER", -"option : T_SERIAL_QUERIES L_NUMBER", -"option : T_CLEAN_INTERVAL L_NUMBER", -"option : T_INTERFACE_INTERVAL L_NUMBER", -"option : T_STATS_INTERVAL L_NUMBER", -"option : T_MAX_LOG_SIZE_IXFR L_NUMBER", -"option : T_MAX_NCACHE_TTL L_NUMBER", -"option : T_LAME_TTL L_NUMBER", -"option : T_HEARTBEAT L_NUMBER", -"option : T_DIALUP yea_or_nay", -"option : T_RRSET_ORDER '{' rrset_ordering_list '}'", -"option : T_TREAT_CR_AS_SPACE yea_or_nay", -"option : T_MIN_ROOTS L_NUMBER", -"option : error", -"controls_stmt : T_CONTROLS '{' controls '}'", -"controls : control L_EOS", -"controls : controls control L_EOS", -"control :", -"control : T_INET maybe_wild_addr T_PORT in_port T_ALLOW '{' address_match_list '}'", -"control : T_UNIX L_QSTRING T_PERM L_NUMBER T_OWNER L_NUMBER T_GROUP L_NUMBER", -"control : error", -"rrset_ordering_list : rrset_ordering_element L_EOS", -"rrset_ordering_list : rrset_ordering_list rrset_ordering_element L_EOS", -"ordering_class :", -"ordering_class : T_CLASS any_string", -"ordering_type :", -"ordering_type : T_TYPE any_string", -"ordering_name :", -"ordering_name : T_NAME L_QSTRING", -"rrset_ordering_element : ordering_class ordering_type ordering_name T_ORDER L_STRING", -"transfer_format : T_ONE_ANSWER", -"transfer_format : T_MANY_ANSWERS", -"maybe_wild_addr : L_IPADDR", -"maybe_wild_addr : '*'", -"maybe_wild_port : in_port", -"maybe_wild_port : '*'", -"query_source_address : T_ADDRESS maybe_wild_addr", -"query_source_port : T_PORT maybe_wild_port", -"query_source : query_source_address", -"query_source : query_source_port", -"query_source : query_source_address query_source_port", -"query_source : query_source_port query_source_address", -"maybe_port :", -"maybe_port : T_PORT in_port", -"maybe_zero_port :", -"maybe_zero_port : T_PORT in_port", -"yea_or_nay : T_YES", -"yea_or_nay : T_TRUE", -"yea_or_nay : T_NO", -"yea_or_nay : T_FALSE", -"yea_or_nay : L_NUMBER", -"check_names_type : T_MASTER", -"check_names_type : T_SLAVE", -"check_names_type : T_RESPONSE", -"check_names_opt : T_WARN", -"check_names_opt : T_FAIL", -"check_names_opt : T_IGNORE", -"forward_opt : T_ONLY", -"forward_opt : T_FIRST", -"forward_opt : T_IF_NO_ANSWER", -"forward_opt : T_IF_NO_DOMAIN", -"size_clause : T_DATASIZE size_spec", -"size_clause : T_STACKSIZE size_spec", -"size_clause : T_CORESIZE size_spec", -"size_clause : T_FILES size_spec", -"size_spec : any_string", -"size_spec : L_NUMBER", -"size_spec : T_DEFAULT", -"size_spec : T_UNLIMITED", -"transfer_clause : T_TRANSFERS_IN L_NUMBER", -"transfer_clause : T_TRANSFERS_OUT L_NUMBER", -"transfer_clause : T_TRANSFERS_PER_NS L_NUMBER", -"opt_forwarders_list :", -"opt_forwarders_list : forwarders_in_addr_list", -"forwarders_in_addr_list : forwarders_in_addr L_EOS", -"forwarders_in_addr_list : forwarders_in_addr_list forwarders_in_addr L_EOS", -"forwarders_in_addr : L_IPADDR", -"opt_also_notify_list :", -"opt_also_notify_list : also_notify_in_addr_list", -"also_notify_in_addr_list : also_notify_in_addr L_EOS", -"also_notify_in_addr_list : also_notify_in_addr_list also_notify_in_addr L_EOS", -"also_notify_in_addr : L_IPADDR", -"$$4 :", -"logging_stmt : T_LOGGING $$4 '{' logging_opts_list '}'", -"logging_opts_list : logging_opt L_EOS", -"logging_opts_list : logging_opts_list logging_opt L_EOS", -"logging_opts_list : error", -"$$5 :", -"logging_opt : T_CATEGORY category $$5 '{' channel_list '}'", -"$$6 :", -"logging_opt : T_CHANNEL channel_name $$6 '{' channel_opt_list '}'", -"channel_severity : any_string", -"channel_severity : T_DEBUG", -"channel_severity : T_DEBUG L_NUMBER", -"channel_severity : T_DYNAMIC", -"version_modifier : T_VERSIONS L_NUMBER", -"version_modifier : T_VERSIONS T_UNLIMITED", -"size_modifier : T_SIZE size_spec", -"maybe_file_modifiers :", -"maybe_file_modifiers : version_modifier", -"maybe_file_modifiers : size_modifier", -"maybe_file_modifiers : version_modifier size_modifier", -"maybe_file_modifiers : size_modifier version_modifier", -"channel_file : T_FILE L_QSTRING maybe_file_modifiers", -"facility_name : any_string", -"facility_name : T_SYSLOG", -"maybe_syslog_facility :", -"maybe_syslog_facility : facility_name", -"channel_syslog : T_SYSLOG maybe_syslog_facility", -"channel_opt : channel_file", -"channel_opt : channel_syslog", -"channel_opt : T_NULL_OUTPUT", -"channel_opt : T_SEVERITY channel_severity", -"channel_opt : T_PRINT_TIME yea_or_nay", -"channel_opt : T_PRINT_CATEGORY yea_or_nay", -"channel_opt : T_PRINT_SEVERITY yea_or_nay", -"channel_opt_list : channel_opt L_EOS", -"channel_opt_list : channel_opt_list channel_opt L_EOS", -"channel_opt_list : error", -"channel_name : any_string", -"channel_name : T_NULL_OUTPUT", -"channel : channel_name", -"channel_list : channel L_EOS", -"channel_list : channel_list channel L_EOS", -"channel_list : error", -"category_name : any_string", -"category_name : T_DEFAULT", -"category_name : T_NOTIFY", -"category : category_name", -"$$7 :", -"server_stmt : T_SERVER L_IPADDR $$7 '{' server_info_list '}'", -"server_info_list : server_info L_EOS", -"server_info_list : server_info_list server_info L_EOS", -"server_info : T_BOGUS yea_or_nay", -"server_info : T_SUPPORT_IXFR yea_or_nay", -"server_info : T_TRANSFERS L_NUMBER", -"server_info : T_TRANSFER_FORMAT transfer_format", -"server_info : T_KEYS '{' key_list '}'", -"server_info : error", -"address_match_list : address_match_element L_EOS", -"address_match_list : address_match_list address_match_element L_EOS", -"address_match_element : address_match_simple", -"address_match_element : '!' address_match_simple", -"address_match_element : T_SEC_KEY L_STRING", -"address_match_simple : L_IPADDR", -"address_match_simple : L_IPADDR '/' L_NUMBER", -"address_match_simple : L_NUMBER '/' L_NUMBER", -"address_match_simple : address_name", -"address_match_simple : '{' address_match_list '}'", -"address_name : any_string", -"key_ref : any_string", -"key_list_element : key_ref", -"key_list : key_list_element L_EOS", -"key_list : key_list key_list_element L_EOS", -"key_list : error", -"$$8 :", -"key_stmt : T_SEC_KEY $$8 any_string '{' key_definition '}'", -"key_definition : algorithm_id secret", -"key_definition : secret algorithm_id", -"key_definition : error", -"algorithm_id : T_ALGID any_string L_EOS", -"secret : T_SECRET any_string L_EOS", -"acl_stmt : T_ACL any_string '{' address_match_list '}'", -"$$9 :", -"zone_stmt : T_ZONE L_QSTRING optional_class $$9 optional_zone_options_list", -"optional_zone_options_list :", -"optional_zone_options_list : '{' zone_option_list '}'", -"optional_class :", -"optional_class : any_string", -"zone_type : T_MASTER", -"zone_type : T_SLAVE", -"zone_type : T_HINT", -"zone_type : T_STUB", -"zone_type : T_FORWARD", -"zone_option_list : zone_option L_EOS", -"zone_option_list : zone_option_list zone_option L_EOS", -"zone_option : T_TYPE zone_type", -"zone_option : T_FILE L_QSTRING", -"zone_option : T_FILE_IXFR L_QSTRING", -"zone_option : T_IXFR_TMP L_QSTRING", -"zone_option : T_MASTERS maybe_zero_port '{' master_in_addr_list '}'", -"zone_option : T_TRANSFER_SOURCE maybe_wild_addr", -"zone_option : T_CHECK_NAMES check_names_opt", -"zone_option : T_ALLOW_UPDATE '{' address_match_list '}'", -"zone_option : T_ALLOW_QUERY '{' address_match_list '}'", -"zone_option : T_ALLOW_TRANSFER '{' address_match_list '}'", -"zone_option : T_FORWARD zone_forward_opt", -"$$10 :", -"zone_option : T_FORWARDERS $$10 '{' opt_zone_forwarders_list '}'", -"zone_option : T_MAX_TRANSFER_TIME_IN L_NUMBER", -"zone_option : T_MAX_LOG_SIZE_IXFR L_NUMBER", -"zone_option : T_NOTIFY yea_or_nay", -"zone_option : T_MAINTAIN_IXFR_BASE yea_or_nay", -"zone_option : T_PUBKEY L_NUMBER L_NUMBER L_NUMBER L_QSTRING", -"zone_option : T_PUBKEY L_STRING L_NUMBER L_NUMBER L_QSTRING", -"zone_option : T_ALSO_NOTIFY '{' opt_notify_in_addr_list '}'", -"zone_option : T_DIALUP yea_or_nay", -"zone_option : error", -"master_in_addr_list : master_in_addr L_EOS", -"master_in_addr_list : master_in_addr_list master_in_addr L_EOS", -"master_in_addr : L_IPADDR", -"opt_notify_in_addr_list :", -"opt_notify_in_addr_list : notify_in_addr_list", -"notify_in_addr_list : notify_in_addr L_EOS", -"notify_in_addr_list : notify_in_addr_list notify_in_addr L_EOS", -"notify_in_addr : L_IPADDR", -"zone_forward_opt : T_ONLY", -"zone_forward_opt : T_FIRST", -"opt_zone_forwarders_list :", -"opt_zone_forwarders_list : zone_forwarders_in_addr_list", -"zone_forwarders_in_addr_list : zone_forwarders_in_addr L_EOS", -"zone_forwarders_in_addr_list : zone_forwarders_in_addr_list zone_forwarders_in_addr L_EOS", -"zone_forwarders_in_addr : L_IPADDR", -"trusted_keys_stmt : T_TRUSTED_KEYS '{' trusted_keys_list '}'", -"trusted_keys_list : trusted_key L_EOS", -"trusted_keys_list : trusted_keys_list trusted_key L_EOS", -"trusted_key : L_STRING L_NUMBER L_NUMBER L_NUMBER L_QSTRING", -"trusted_key : L_STRING L_STRING L_NUMBER L_NUMBER L_QSTRING", -"in_port : L_NUMBER", -"any_string : L_STRING", -"any_string : L_QSTRING", -}; -#endif -#ifdef YYSTACKSIZE -#undef YYMAXDEPTH -#define YYMAXDEPTH YYSTACKSIZE -#else -#ifdef YYMAXDEPTH -#define YYSTACKSIZE YYMAXDEPTH -#else -#define YYSTACKSIZE 10000 -#define YYMAXDEPTH 10000 -#endif -#endif -#define YYINITSTACKSIZE 200 -int yydebug; -int yynerrs; -struct yystack { - short *ssp; - YYSTYPE *vsp; - short *ss; - YYSTYPE *vs; - int stacksize; - short *sslim; -}; -int yychar; /* some people use this, so we copy it in & out */ -int yyerrflag; /* must be global for yyerrok & YYRECOVERING */ -YYSTYPE yylval; -#line 1776 "ns_parser.y" - -static char * -canonical_name(char *name) { - char canonical[MAXDNAME]; - - if (strlen(name) >= MAXDNAME) - return (NULL); - strcpy(canonical, name); - if (makename(canonical, ".", sizeof canonical) < 0) - return (NULL); - return (savestr(canonical, 0)); -} - -static void -init_acls() { - ip_match_element ime; - ip_match_list iml; - struct in_addr address; - - /* Create the predefined ACLs */ - - address.s_addr = 0U; - - /* ACL "any" */ - ime = new_ip_match_pattern(address, 0); - iml = new_ip_match_list(); - add_to_ip_match_list(iml, ime); - define_acl(savestr("any", 1), iml); - - /* ACL "none" */ - ime = new_ip_match_pattern(address, 0); - ip_match_negate(ime); - iml = new_ip_match_list(); - add_to_ip_match_list(iml, ime); - define_acl(savestr("none", 1), iml); - - /* ACL "localhost" */ - ime = new_ip_match_localhost(); - iml = new_ip_match_list(); - add_to_ip_match_list(iml, ime); - define_acl(savestr("localhost", 1), iml); - - /* ACL "localnets" */ - ime = new_ip_match_localnets(); - iml = new_ip_match_list(); - add_to_ip_match_list(iml, ime); - define_acl(savestr("localnets", 1), iml); -} - -static void -free_sym_value(int type, void *value) { - ns_debug(ns_log_parser, 99, "free_sym_value: type %06x value %p", - type, value); - type &= ~0xffff; - switch (type) { - case SYM_ACL: - free_ip_match_list(value); - break; - case SYM_KEY: - free_key_info(value); - break; - default: - ns_panic(ns_log_parser, 1, - "unhandled case in free_sym_value()"); - /* NOTREACHED */ - break; - } -} - -static log_channel -lookup_channel(char *name) { - symbol_value value; - - if (lookup_symbol(symtab, name, SYM_CHANNEL, &value)) - return ((log_channel)(value.pointer)); - return (NULL); -} - -static void -define_channel(char *name, log_channel channel) { - symbol_value value; - - value.pointer = channel; - define_symbol(symtab, name, SYM_CHANNEL, value, SYMBOL_FREE_KEY); -} - -static void -define_builtin_channels() { - define_channel(savestr("default_syslog", 1), syslog_channel); - define_channel(savestr("default_debug", 1), debug_channel); - define_channel(savestr("default_stderr", 1), stderr_channel); - define_channel(savestr("null", 1), null_channel); -} - -static void -parser_setup() { - seen_options = 0; - seen_topology = 0; - symtab = new_symbol_table(SYMBOL_TABLE_SIZE, NULL); - if (authtab != NULL) - free_symbol_table(authtab); - authtab = new_symbol_table(AUTH_TABLE_SIZE, free_sym_value); - init_acls(); - define_builtin_channels(); - INIT_LIST(current_controls); -} - -static void -parser_cleanup() { - if (symtab != NULL) - free_symbol_table(symtab); - symtab = NULL; - /* - * We don't clean up authtab here because the ip_match_lists are in - * use. - */ -} - -/* - * Public Interface - */ - -ip_match_list -lookup_acl(char *name) { - symbol_value value; - - if (lookup_symbol(authtab, name, SYM_ACL, &value)) - return ((ip_match_list)(value.pointer)); - return (NULL); -} - -void -define_acl(char *name, ip_match_list iml) { - symbol_value value; - - INSIST(name != NULL); - INSIST(iml != NULL); - - value.pointer = iml; - define_symbol(authtab, name, SYM_ACL, value, - SYMBOL_FREE_KEY|SYMBOL_FREE_VALUE); - ns_debug(ns_log_parser, 7, "acl %s", name); - dprint_ip_match_list(ns_log_parser, iml, 2, "allow ", "deny "); -} - -struct dst_key * -lookup_key(char *name) { - symbol_value value; - - if (lookup_symbol(authtab, name, SYM_KEY, &value)) - return ((struct dst_key *)(value.pointer)); - return (NULL); -} - -void -define_key(char *name, struct dst_key *dst_key) { - symbol_value value; - - INSIST(name != NULL); - INSIST(dst_key != NULL); - - value.pointer = dst_key; - define_symbol(authtab, name, SYM_KEY, value, SYMBOL_FREE_VALUE); - dprint_key_info(dst_key); -} - -void -parse_configuration(const char *filename) { - FILE *config_stream; - - config_stream = fopen(filename, "r"); - if (config_stream == NULL) - ns_panic(ns_log_parser, 0, "can't open '%s'", filename); - - lexer_setup(); - parser_setup(); - lexer_begin_file(filename, config_stream); - (void)yyparse(); - lexer_end_file(); - parser_cleanup(); -} - -void -parser_initialize(void) { - lexer_initialize(); -} - -void -parser_shutdown(void) { - if (authtab != NULL) - free_symbol_table(authtab); - lexer_shutdown(); -} -#line 1216 "y.tab.c" -/* allocate initial stack */ -#if defined(__STDC__) || defined(__cplusplus) -static int yyinitstack(struct yystack *sp) -#else -static int yyinitstack(sp) - struct yystack *sp; -#endif -{ - int newsize; - short *newss; - YYSTYPE *newvs; - - newsize = YYINITSTACKSIZE; - newss = (short *)malloc(newsize * sizeof *newss); - newvs = (YYSTYPE *)malloc(newsize * sizeof *newvs); - sp->ss = sp->ssp = newss; - sp->vs = sp->vsp = newvs; - if (newss == NULL || newvs == NULL) return -1; - sp->stacksize = newsize; - sp->sslim = newss + newsize - 1; - return 0; -} - -/* double stack size, up to YYMAXDEPTH */ -#if defined(__STDC__) || defined(__cplusplus) -static int yygrowstack(struct yystack *sp) -#else -static int yygrowstack(sp) - struct yystack *sp; -#endif -{ - int newsize, i; - short *newss; - YYSTYPE *newvs; - - if ((newsize = sp->stacksize) >= YYMAXDEPTH) return -1; - if ((newsize *= 2) > YYMAXDEPTH) newsize = YYMAXDEPTH; - i = sp->ssp - sp->ss; - if ((newss = (short *)realloc(sp->ss, newsize * sizeof *newss)) == NULL) - return -1; - sp->ss = newss; - sp->ssp = newss + i; - if ((newvs = (YYSTYPE *)realloc(sp->vs, newsize * sizeof *newvs)) == NULL) - return -1; - sp->vs = newvs; - sp->vsp = newvs + i; - sp->stacksize = newsize; - sp->sslim = newss + newsize - 1; - return 0; -} - -#define YYFREESTACK(sp) { free((sp)->ss); free((sp)->vs); } - -#define YYABORT goto yyabort -#define YYREJECT goto yyabort -#define YYACCEPT goto yyaccept -#define YYERROR goto yyerrlab -int -yyparse() -{ - register int yym, yyn, yystate, yych; - register YYSTYPE *yyvsp; - YYSTYPE yyval; - struct yystack yystk; -#if YYDEBUG - register char *yys; - extern char *getenv(); - - if (yys = getenv("YYDEBUG")) - { - yyn = *yys; - if (yyn >= '0' && yyn <= '9') - yydebug = yyn - '0'; - } -#endif - - yynerrs = 0; - yyerrflag = 0; - yychar = yych = YYEMPTY; - - if (yyinitstack(&yystk)) goto yyoverflow; - *yystk.ssp = yystate = 0; - -yyloop: - if (yyn = yydefred[yystate]) goto yyreduce; - if (yych < 0) - { - if ((yych = YYLEX) < 0) yych = 0; - yychar = yych; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yych <= YYMAXTOKEN) yys = yyname[yych]; - if (!yys) yys = "illegal-symbol"; - printf("%sdebug: state %d, reading %d (%s)\n", - YYPREFIX, yystate, yych, yys); - } -#endif - } - if ((yyn = yysindex[yystate]) && (yyn += yych) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yych) - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: state %d, shifting to state %d\n", - YYPREFIX, yystate, yytable[yyn]); -#endif - if (yystk.ssp >= yystk.sslim && yygrowstack(&yystk)) - goto yyoverflow; - *++yystk.ssp = yystate = yytable[yyn]; - *++yystk.vsp = yylval; - yychar = yych = YYEMPTY; - if (yyerrflag > 0) --yyerrflag; - goto yyloop; - } - if ((yyn = yyrindex[yystate]) && (yyn += yych) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yych) - { - yyn = yytable[yyn]; - goto yyreduce; - } - if (yyerrflag) goto yyinrecovery; -#ifdef lint - goto yynewerror; -#endif -yynewerror: - yyerror("syntax error"); -#ifdef lint - goto yyerrlab; -#endif -yyerrlab: - ++yynerrs; -yyinrecovery: - if (yyerrflag < 3) - { - yyerrflag = 3; - for (;;) - { - if ((yyn = yysindex[*yystk.ssp]) && - (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: state %d, error recovery shifting\ - to state %d\n", YYPREFIX, *yystk.ssp, yytable[yyn]); -#endif - if (yystk.ssp >= yystk.sslim && yygrowstack(&yystk)) - goto yyoverflow; - *++yystk.ssp = yystate = yytable[yyn]; - *++yystk.vsp = yylval; - goto yyloop; - } - else - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: error recovery discarding state %d\n", - YYPREFIX, *yystk.ssp); -#endif - if (yystk.ssp <= yystk.ss) goto yyabort; - --yystk.ssp; - --yystk.vsp; - } - } - } - else - { - if (yych == 0) goto yyabort; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yych <= YYMAXTOKEN) yys = yyname[yych]; - if (!yys) yys = "illegal-symbol"; - printf("%sdebug: state %d, error recovery discards token %d (%s)\n", - YYPREFIX, yystate, yych, yys); - } -#endif - yychar = yych = YYEMPTY; - goto yyloop; - } -yyreduce: -#if YYDEBUG - if (yydebug) - printf("%sdebug: state %d, reducing by rule %d (%s)\n", - YYPREFIX, yystate, yyn, yyrule[yyn]); -#endif - yym = yylen[yyn]; - yyvsp = yystk.vsp; /* for speed in code under switch() */ - yyval = yyvsp[1-yym]; - switch (yyn) - { -case 1: -#line 241 "ns_parser.y" -{ - if (EMPTY(current_controls)) - ns_ctl_defaults(¤t_controls); - ns_ctl_install(¤t_controls); - } -break; -case 16: -#line 266 "ns_parser.y" -{ lexer_begin_file(yyvsp[-1].cp, NULL); } -break; -case 17: -#line 274 "ns_parser.y" -{ - if (seen_options) - parser_error(0, "cannot redefine options"); - current_options = new_options(); - } -break; -case 18: -#line 280 "ns_parser.y" -{ - if (!seen_options) - set_options(current_options, 0); - else - free_options(current_options); - current_options = NULL; - seen_options = 1; - } -break; -case 22: -#line 296 "ns_parser.y" -{ - if (current_options->version != NULL) - freestr(current_options->version); - current_options->version = yyvsp[0].cp; - } -break; -case 23: -#line 302 "ns_parser.y" -{ - if (current_options->directory != NULL) - freestr(current_options->directory); - current_options->directory = yyvsp[0].cp; - } -break; -case 24: -#line 308 "ns_parser.y" -{ - if (current_options->named_xfer != NULL) - freestr(current_options->named_xfer); - current_options->named_xfer = yyvsp[0].cp; - } -break; -case 25: -#line 314 "ns_parser.y" -{ - if (current_options->pid_filename != NULL) - freestr(current_options->pid_filename); - current_options->pid_filename = yyvsp[0].cp; - } -break; -case 26: -#line 320 "ns_parser.y" -{ - if (current_options->stats_filename != NULL) - freestr(current_options->stats_filename); - current_options->stats_filename = yyvsp[0].cp; - } -break; -case 27: -#line 326 "ns_parser.y" -{ - if (current_options->memstats_filename != NULL) - freestr(current_options->memstats_filename); - current_options->memstats_filename = yyvsp[0].cp; - } -break; -case 28: -#line 332 "ns_parser.y" -{ - if (current_options->dump_filename != NULL) - freestr(current_options->dump_filename); - current_options->dump_filename = yyvsp[0].cp; - } -break; -case 29: -#line 338 "ns_parser.y" -{ - set_global_boolean_option(current_options, - OPTION_FAKE_IQUERY, yyvsp[0].num); - } -break; -case 30: -#line 343 "ns_parser.y" -{ - set_global_boolean_option(current_options, - OPTION_NORECURSE, !yyvsp[0].num); - } -break; -case 31: -#line 348 "ns_parser.y" -{ - set_global_boolean_option(current_options, - OPTION_NOFETCHGLUE, !yyvsp[0].num); - } -break; -case 32: -#line 353 "ns_parser.y" -{ - set_global_boolean_option(current_options, - OPTION_NONOTIFY, !yyvsp[0].num); - } -break; -case 33: -#line 358 "ns_parser.y" -{ - set_global_boolean_option(current_options, - OPTION_HOSTSTATS, yyvsp[0].num); - } -break; -case 34: -#line 363 "ns_parser.y" -{ - set_global_boolean_option(current_options, - OPTION_DEALLOC_ON_EXIT, yyvsp[0].num); - } -break; -case 35: -#line 368 "ns_parser.y" -{ - set_global_boolean_option(current_options, OPTION_USE_IXFR, yyvsp[0].num); - } -break; -case 36: -#line 372 "ns_parser.y" -{ - set_global_boolean_option(current_options, - OPTION_MAINTAIN_IXFR_BASE, yyvsp[0].num); - } -break; -case 37: -#line 377 "ns_parser.y" -{ - set_global_boolean_option(current_options, - OPTION_MAINTAIN_IXFR_BASE, yyvsp[0].num); - set_global_boolean_option(current_options, - OPTION_NORFC2308_TYPE1, yyvsp[0].num); - set_global_boolean_option(current_options, - OPTION_NONAUTH_NXDOMAIN, !yyvsp[0].num); - } -break; -case 38: -#line 386 "ns_parser.y" -{ - set_global_boolean_option(current_options, OPTION_NONAUTH_NXDOMAIN, - !yyvsp[0].num); - } -break; -case 39: -#line 391 "ns_parser.y" -{ - set_global_boolean_option(current_options, - OPTION_MULTIPLE_CNAMES, yyvsp[0].num); - } -break; -case 40: -#line 396 "ns_parser.y" -{ - current_options->check_names[yyvsp[-1].s_int] = (enum severity)yyvsp[0].s_int; - } -break; -case 41: -#line 400 "ns_parser.y" -{ - set_global_boolean_option(current_options, - OPTION_USE_ID_POOL, yyvsp[0].num); - } -break; -case 42: -#line 405 "ns_parser.y" -{ - set_global_boolean_option(current_options, - OPTION_NORFC2308_TYPE1, !yyvsp[0].num); - } -break; -case 43: -#line 410 "ns_parser.y" -{ - char port_string[10]; - symbol_value value; - - (void)sprintf(port_string, "%u", yyvsp[-3].us_int); - if (lookup_symbol(symtab, port_string, SYM_PORT, NULL)) - parser_error(0, - "cannot redefine listen-on for port %u", - ntohs(yyvsp[-3].us_int)); - else { - add_listen_on(current_options, yyvsp[-3].us_int, yyvsp[-1].iml); - value.pointer = NULL; - define_symbol(symtab, savestr(port_string, 1), - SYM_PORT, value, SYMBOL_FREE_KEY); - } - - } -break; -case 45: -#line 429 "ns_parser.y" -{ - if (current_options->fwdtab) { - free_forwarders(current_options->fwdtab); - current_options->fwdtab = NULL; - } - } -break; -case 48: -#line 438 "ns_parser.y" -{ - current_options->axfr_src = yyvsp[0].ip_addr; - } -break; -case 49: -#line 442 "ns_parser.y" -{ - if (current_options->query_acl) { - parser_warning(0, - "options allow-query acl already set; skipping"); - free_ip_match_list(yyvsp[-1].iml); - } else - current_options->query_acl = yyvsp[-1].iml; - } -break; -case 50: -#line 451 "ns_parser.y" -{ - if (current_options->recursion_acl) { - parser_warning(0, - "options allow-recursion acl already set; skipping"); - free_ip_match_list(yyvsp[-1].iml); - } else - current_options->recursion_acl = yyvsp[-1].iml; - } -break; -case 51: -#line 460 "ns_parser.y" -{ - if (current_options->transfer_acl) { - parser_warning(0, - "options allow-transfer acl already set; skipping"); - free_ip_match_list(yyvsp[-1].iml); - } else - current_options->transfer_acl = yyvsp[-1].iml; - } -break; -case 52: -#line 469 "ns_parser.y" -{ - if (current_options->sortlist) { - parser_warning(0, - "options sortlist already set; skipping"); - free_ip_match_list(yyvsp[-1].iml); - } else - current_options->sortlist = yyvsp[-1].iml; - } -break; -case 53: -#line 478 "ns_parser.y" -{ - if (current_options->also_notify) { - parser_warning(0, - "duplicate also-notify clause: overwriting"); - free_also_notify(current_options); - current_options->also_notify = NULL; - } - } -break; -case 55: -#line 488 "ns_parser.y" -{ - if (current_options->blackhole_acl) { - parser_warning(0, - "options blackhole already set; skipping"); - free_ip_match_list(yyvsp[-1].iml); - } else - current_options->blackhole_acl = yyvsp[-1].iml; - } -break; -case 56: -#line 497 "ns_parser.y" -{ - if (current_options->topology) { - parser_warning(0, - "options topology already set; skipping"); - free_ip_match_list(yyvsp[-1].iml); - } else - current_options->topology = yyvsp[-1].iml; - } -break; -case 57: -#line 506 "ns_parser.y" -{ - /* To get around the $$ = $1 default rule. */ - } -break; -case 59: -#line 511 "ns_parser.y" -{ - current_options->transfer_format = yyvsp[0].axfr_fmt; - } -break; -case 60: -#line 515 "ns_parser.y" -{ - current_options->max_transfer_time_in = yyvsp[0].num * 60; - } -break; -case 61: -#line 519 "ns_parser.y" -{ - current_options->serial_queries = yyvsp[0].num; - } -break; -case 62: -#line 523 "ns_parser.y" -{ - current_options->clean_interval = yyvsp[0].num * 60; - } -break; -case 63: -#line 527 "ns_parser.y" -{ - current_options->interface_interval = yyvsp[0].num * 60; - } -break; -case 64: -#line 531 "ns_parser.y" -{ - current_options->stats_interval = yyvsp[0].num * 60; - } -break; -case 65: -#line 535 "ns_parser.y" -{ - current_options->max_log_size_ixfr = yyvsp[0].num; - } -break; -case 66: -#line 539 "ns_parser.y" -{ - current_options->max_ncache_ttl = yyvsp[0].num; - } -break; -case 67: -#line 543 "ns_parser.y" -{ - current_options->lame_ttl = yyvsp[0].num; - } -break; -case 68: -#line 547 "ns_parser.y" -{ - current_options->heartbeat_interval = yyvsp[0].num * 60; - } -break; -case 69: -#line 551 "ns_parser.y" -{ - set_global_boolean_option(current_options, - OPTION_NODIALUP, !yyvsp[0].num); - } -break; -case 70: -#line 556 "ns_parser.y" -{ - if (current_options->ordering) - free_rrset_order_list(current_options->ordering); - current_options->ordering = yyvsp[-1].rol; - } -break; -case 71: -#line 562 "ns_parser.y" -{ - set_global_boolean_option(current_options, - OPTION_TREAT_CR_AS_SPACE, yyvsp[0].num); - } -break; -case 72: -#line 567 "ns_parser.y" -{ - if (yyvsp[0].num >= 1) - current_options->minroots = yyvsp[0].num; - } -break; -case 78: -#line 587 "ns_parser.y" -{ - ns_ctl_add(¤t_controls, ns_ctl_new_inet(yyvsp[-6].ip_addr, yyvsp[-4].us_int, yyvsp[-1].iml)); - } -break; -case 79: -#line 591 "ns_parser.y" -{ - ns_ctl_add(¤t_controls, ns_ctl_new_unix(yyvsp[-6].cp, yyvsp[-4].num, yyvsp[-2].num, yyvsp[0].num)); - } -break; -case 81: -#line 598 "ns_parser.y" -{ - rrset_order_list rol; - - rol = new_rrset_order_list(); - if (yyvsp[-1].roe != NULL) { - add_to_rrset_order_list(rol, yyvsp[-1].roe); - } - - yyval.rol = rol; - } -break; -case 82: -#line 609 "ns_parser.y" -{ - if (yyvsp[-1].roe != NULL) { - add_to_rrset_order_list(yyvsp[-2].rol, yyvsp[-1].roe); - } - yyval.rol = yyvsp[-2].rol; - } -break; -case 83: -#line 618 "ns_parser.y" -{ - yyval.s_int = C_ANY; - } -break; -case 84: -#line 622 "ns_parser.y" -{ - symbol_value value; - - if (lookup_symbol(constants, yyvsp[0].cp, SYM_CLASS, &value)) - yyval.s_int = value.integer; - else { - parser_error(0, "unknown class '%s'; using ANY", yyvsp[0].cp); - yyval.s_int = C_ANY; - } - freestr(yyvsp[0].cp); - } -break; -case 85: -#line 636 "ns_parser.y" -{ - yyval.s_int = ns_t_any; - } -break; -case 86: -#line 640 "ns_parser.y" -{ - int success; - - if (strcmp(yyvsp[0].cp, "*") == 0) { - yyval.s_int = ns_t_any; - } else { - yyval.s_int = __sym_ston(__p_type_syms, yyvsp[0].cp, &success); - if (success == 0) { - yyval.s_int = ns_t_any; - parser_error(0, - "unknown type '%s'; assuming ANY", - yyvsp[0].cp); - } - } - freestr(yyvsp[0].cp); - } -break; -case 87: -#line 658 "ns_parser.y" -{ - yyval.cp = savestr("*", 1); - } -break; -case 88: -#line 662 "ns_parser.y" -{ - if (strcmp(".",yyvsp[0].cp) == 0 || strcmp("*.",yyvsp[0].cp) == 0) { - yyval.cp = savestr("*", 1); - freestr(yyvsp[0].cp); - } else { - yyval.cp = yyvsp[0].cp ; - } - /* XXX Should do any more name validation here? */ - } -break; -case 89: -#line 674 "ns_parser.y" -{ - enum ordering o; - - if (strlen(yyvsp[0].cp) == 0) { - parser_error(0, "null order name"); - yyval.roe = NULL ; - } else { - o = lookup_ordering(yyvsp[0].cp); - if (o == unknown_order) { - o = (enum ordering)DEFAULT_ORDERING; - parser_error(0, - "invalid order name '%s'; using %s", - yyvsp[0].cp, p_order(o)); - } - - freestr(yyvsp[0].cp); - - yyval.roe = new_rrset_order_element(yyvsp[-4].s_int, yyvsp[-3].s_int, yyvsp[-2].cp, o); - } - } -break; -case 90: -#line 697 "ns_parser.y" -{ - yyval.axfr_fmt = axfr_one_answer; - } -break; -case 91: -#line 701 "ns_parser.y" -{ - yyval.axfr_fmt = axfr_many_answers; - } -break; -case 92: -#line 706 "ns_parser.y" -{ yyval.ip_addr = yyvsp[0].ip_addr; } -break; -case 93: -#line 707 "ns_parser.y" -{ yyval.ip_addr.s_addr = htonl(INADDR_ANY); } -break; -case 94: -#line 710 "ns_parser.y" -{ yyval.us_int = yyvsp[0].us_int; } -break; -case 95: -#line 711 "ns_parser.y" -{ yyval.us_int = htons(0); } -break; -case 96: -#line 715 "ns_parser.y" -{ - current_options->query_source.sin_addr = yyvsp[0].ip_addr; - } -break; -case 97: -#line 721 "ns_parser.y" -{ - current_options->query_source.sin_port = yyvsp[0].us_int; - } -break; -case 102: -#line 732 "ns_parser.y" -{ yyval.us_int = htons(NS_DEFAULTPORT); } -break; -case 103: -#line 733 "ns_parser.y" -{ yyval.us_int = yyvsp[0].us_int; } -break; -case 104: -#line 736 "ns_parser.y" -{ yyval.us_int = htons(0); } -break; -case 105: -#line 737 "ns_parser.y" -{ yyval.us_int = yyvsp[0].us_int; } -break; -case 106: -#line 742 "ns_parser.y" -{ - yyval.num = 1; - } -break; -case 107: -#line 746 "ns_parser.y" -{ - yyval.num = 1; - } -break; -case 108: -#line 750 "ns_parser.y" -{ - yyval.num = 0; - } -break; -case 109: -#line 754 "ns_parser.y" -{ - yyval.num = 0; - } -break; -case 110: -#line 758 "ns_parser.y" -{ - if (yyvsp[0].num == 1 || yyvsp[0].num == 0) { - yyval.num = yyvsp[0].num; - } else { - parser_warning(0, - "number should be 0 or 1; assuming 1"); - yyval.num = 1; - } - } -break; -case 111: -#line 770 "ns_parser.y" -{ - yyval.s_int = primary_trans; - } -break; -case 112: -#line 774 "ns_parser.y" -{ - yyval.s_int = secondary_trans; - } -break; -case 113: -#line 778 "ns_parser.y" -{ - yyval.s_int = response_trans; - } -break; -case 114: -#line 784 "ns_parser.y" -{ - yyval.s_int = warn; - } -break; -case 115: -#line 788 "ns_parser.y" -{ - yyval.s_int = fail; - } -break; -case 116: -#line 792 "ns_parser.y" -{ - yyval.s_int = ignore; - } -break; -case 117: -#line 798 "ns_parser.y" -{ - set_global_boolean_option(current_options, - OPTION_FORWARD_ONLY, 1); - } -break; -case 118: -#line 803 "ns_parser.y" -{ - set_global_boolean_option(current_options, - OPTION_FORWARD_ONLY, 0); - } -break; -case 119: -#line 808 "ns_parser.y" -{ - parser_warning(0, "forward if-no-answer is unimplemented"); - } -break; -case 120: -#line 812 "ns_parser.y" -{ - parser_warning(0, "forward if-no-domain is unimplemented"); - } -break; -case 121: -#line 818 "ns_parser.y" -{ - current_options->data_size = yyvsp[0].ul_int; - } -break; -case 122: -#line 822 "ns_parser.y" -{ - current_options->stack_size = yyvsp[0].ul_int; - } -break; -case 123: -#line 826 "ns_parser.y" -{ - current_options->core_size = yyvsp[0].ul_int; - } -break; -case 124: -#line 830 "ns_parser.y" -{ - current_options->files = yyvsp[0].ul_int; - } -break; -case 125: -#line 836 "ns_parser.y" -{ - u_long result; - - if (unit_to_ulong(yyvsp[0].cp, &result)) - yyval.ul_int = result; - else { - parser_error(0, "invalid unit string '%s'", yyvsp[0].cp); - /* 0 means "use default" */ - yyval.ul_int = 0; - } - freestr(yyvsp[0].cp); - } -break; -case 126: -#line 849 "ns_parser.y" -{ - yyval.ul_int = (u_long)yyvsp[0].num; - } -break; -case 127: -#line 853 "ns_parser.y" -{ - yyval.ul_int = 0; - } -break; -case 128: -#line 857 "ns_parser.y" -{ - yyval.ul_int = ULONG_MAX; - } -break; -case 129: -#line 863 "ns_parser.y" -{ - current_options->transfers_in = (u_long) yyvsp[0].num; - } -break; -case 130: -#line 867 "ns_parser.y" -{ - current_options->transfers_out = (u_long) yyvsp[0].num; - } -break; -case 131: -#line 871 "ns_parser.y" -{ - current_options->transfers_per_ns = (u_long) yyvsp[0].num; - } -break; -case 134: -#line 881 "ns_parser.y" -{ - /* nothing */ - } -break; -case 135: -#line 885 "ns_parser.y" -{ - /* nothing */ - } -break; -case 136: -#line 891 "ns_parser.y" -{ - add_global_forwarder(current_options, yyvsp[0].ip_addr); - } -break; -case 139: -#line 901 "ns_parser.y" -{ - /* nothing */ - } -break; -case 140: -#line 905 "ns_parser.y" -{ - /* nothing */ - } -break; -case 141: -#line 911 "ns_parser.y" -{ - add_global_also_notify(current_options, yyvsp[0].ip_addr); - } -break; -case 142: -#line 921 "ns_parser.y" -{ - current_logging = begin_logging(); - } -break; -case 143: -#line 925 "ns_parser.y" -{ - end_logging(current_logging, 1); - current_logging = NULL; - } -break; -case 147: -#line 937 "ns_parser.y" -{ - current_category = yyvsp[0].s_int; - } -break; -case 149: -#line 942 "ns_parser.y" -{ - chan_type = log_null; - chan_flags = 0; - chan_level = log_info; - } -break; -case 150: -#line 948 "ns_parser.y" -{ - log_channel current_channel = NULL; - - if (lookup_channel(yyvsp[-4].cp) != NULL) { - parser_error(0, "can't redefine channel '%s'", yyvsp[-4].cp); - freestr(yyvsp[-4].cp); - } else { - switch (chan_type) { - case log_file: - current_channel = - log_new_file_channel(chan_flags, - chan_level, - chan_name, NULL, - chan_versions, - chan_max_size); - freestr(chan_name); - chan_name = NULL; - break; - case log_syslog: - current_channel = - log_new_syslog_channel(chan_flags, - chan_level, - chan_facility); - break; - case log_null: - current_channel = log_new_null_channel(); - break; - default: - ns_panic(ns_log_parser, 1, - "unknown channel type: %d", - chan_type); - } - if (current_channel == NULL) - ns_panic(ns_log_parser, 0, - "couldn't create channel"); - define_channel(yyvsp[-4].cp, current_channel); - } - } -break; -case 151: -#line 989 "ns_parser.y" -{ - symbol_value value; - - if (lookup_symbol(constants, yyvsp[0].cp, SYM_LOGGING, &value)) { - chan_level = value.integer; - } else { - parser_error(0, "unknown severity '%s'", yyvsp[0].cp); - chan_level = log_debug(99); - } - freestr(yyvsp[0].cp); - } -break; -case 152: -#line 1001 "ns_parser.y" -{ - chan_level = log_debug(1); - } -break; -case 153: -#line 1005 "ns_parser.y" -{ - chan_level = yyvsp[0].num; - } -break; -case 154: -#line 1009 "ns_parser.y" -{ - chan_level = 0; - chan_flags |= LOG_USE_CONTEXT_LEVEL|LOG_REQUIRE_DEBUG; - } -break; -case 155: -#line 1016 "ns_parser.y" -{ - chan_versions = yyvsp[0].num; - } -break; -case 156: -#line 1020 "ns_parser.y" -{ - chan_versions = LOG_MAX_VERSIONS; - } -break; -case 157: -#line 1026 "ns_parser.y" -{ - chan_max_size = yyvsp[0].ul_int; - } -break; -case 158: -#line 1032 "ns_parser.y" -{ - chan_versions = 0; - chan_max_size = ULONG_MAX; - } -break; -case 159: -#line 1037 "ns_parser.y" -{ - chan_max_size = ULONG_MAX; - } -break; -case 160: -#line 1041 "ns_parser.y" -{ - chan_versions = 0; - } -break; -case 163: -#line 1049 "ns_parser.y" -{ - chan_flags |= LOG_CLOSE_STREAM; - chan_type = log_file; - chan_name = yyvsp[-1].cp; - } -break; -case 164: -#line 1057 "ns_parser.y" -{ yyval.cp = yyvsp[0].cp; } -break; -case 165: -#line 1058 "ns_parser.y" -{ yyval.cp = savestr("syslog", 1); } -break; -case 166: -#line 1061 "ns_parser.y" -{ yyval.s_int = LOG_DAEMON; } -break; -case 167: -#line 1063 "ns_parser.y" -{ - symbol_value value; - - if (lookup_symbol(constants, yyvsp[0].cp, SYM_SYSLOG, &value)) { - yyval.s_int = value.integer; - } else { - parser_error(0, "unknown facility '%s'", yyvsp[0].cp); - yyval.s_int = LOG_DAEMON; - } - freestr(yyvsp[0].cp); - } -break; -case 168: -#line 1077 "ns_parser.y" -{ - chan_type = log_syslog; - chan_facility = yyvsp[0].s_int; - } -break; -case 169: -#line 1083 "ns_parser.y" -{ /* nothing to do */ } -break; -case 170: -#line 1084 "ns_parser.y" -{ /* nothing to do */ } -break; -case 171: -#line 1086 "ns_parser.y" -{ - chan_type = log_null; - } -break; -case 172: -#line 1089 "ns_parser.y" -{ /* nothing to do */ } -break; -case 173: -#line 1091 "ns_parser.y" -{ - if (yyvsp[0].num) - chan_flags |= LOG_TIMESTAMP; - else - chan_flags &= ~LOG_TIMESTAMP; - } -break; -case 174: -#line 1098 "ns_parser.y" -{ - if (yyvsp[0].num) - chan_flags |= LOG_PRINT_CATEGORY; - else - chan_flags &= ~LOG_PRINT_CATEGORY; - } -break; -case 175: -#line 1105 "ns_parser.y" -{ - if (yyvsp[0].num) - chan_flags |= LOG_PRINT_LEVEL; - else - chan_flags &= ~LOG_PRINT_LEVEL; - } -break; -case 180: -#line 1119 "ns_parser.y" -{ yyval.cp = savestr("null", 1); } -break; -case 181: -#line 1123 "ns_parser.y" -{ - log_channel channel; - symbol_value value; - - if (current_category >= 0) { - channel = lookup_channel(yyvsp[0].cp); - if (channel != NULL) { - add_log_channel(current_logging, - current_category, channel); - } else - parser_error(0, "unknown channel '%s'", yyvsp[0].cp); - } - freestr(yyvsp[0].cp); - } -break; -case 186: -#line 1145 "ns_parser.y" -{ yyval.cp = savestr("default", 1); } -break; -case 187: -#line 1146 "ns_parser.y" -{ yyval.cp = savestr("notify", 1); } -break; -case 188: -#line 1150 "ns_parser.y" -{ - symbol_value value; - - if (lookup_symbol(constants, yyvsp[0].cp, SYM_CATEGORY, &value)) - yyval.s_int = value.integer; - else { - parser_error(0, "invalid logging category '%s'", - yyvsp[0].cp); - yyval.s_int = -1; - } - freestr(yyvsp[0].cp); - } -break; -case 189: -#line 1169 "ns_parser.y" -{ - const char *ip_printable; - symbol_value value; - - ip_printable = inet_ntoa(yyvsp[0].ip_addr); - value.pointer = NULL; - if (lookup_symbol(symtab, ip_printable, SYM_SERVER, NULL)) - seen_server = 1; - else - seen_server = 0; - if (seen_server) - parser_error(0, "cannot redefine server '%s'", - ip_printable); - else - define_symbol(symtab, savestr(ip_printable, 1), - SYM_SERVER, value, - SYMBOL_FREE_KEY); - current_server = begin_server(yyvsp[0].ip_addr); - } -break; -case 190: -#line 1189 "ns_parser.y" -{ - end_server(current_server, !seen_server); - } -break; -case 193: -#line 1199 "ns_parser.y" -{ - set_server_option(current_server, SERVER_INFO_BOGUS, yyvsp[0].num); - } -break; -case 194: -#line 1203 "ns_parser.y" -{ - set_server_option(current_server, SERVER_INFO_SUPPORT_IXFR, yyvsp[0].num); - } -break; -case 195: -#line 1207 "ns_parser.y" -{ - set_server_transfers(current_server, (int)yyvsp[0].num); - } -break; -case 196: -#line 1211 "ns_parser.y" -{ - set_server_transfer_format(current_server, yyvsp[0].axfr_fmt); - } -break; -case 199: -#line 1223 "ns_parser.y" -{ - ip_match_list iml; - - iml = new_ip_match_list(); - if (yyvsp[-1].ime != NULL) - add_to_ip_match_list(iml, yyvsp[-1].ime); - yyval.iml = iml; - } -break; -case 200: -#line 1232 "ns_parser.y" -{ - if (yyvsp[-1].ime != NULL) - add_to_ip_match_list(yyvsp[-2].iml, yyvsp[-1].ime); - yyval.iml = yyvsp[-2].iml; - } -break; -case 202: -#line 1241 "ns_parser.y" -{ - if (yyvsp[0].ime != NULL) - ip_match_negate(yyvsp[0].ime); - yyval.ime = yyvsp[0].ime; - } -break; -case 203: -#line 1247 "ns_parser.y" -{ - char *key_name; - struct dst_key *dst_key; - - key_name = canonical_name(yyvsp[0].cp); - if (key_name == NULL) { - parser_error(0, "can't make key name '%s' canonical", - yyvsp[0].cp); - key_name = savestr("__bad_key__", 1); - } - dst_key = find_key(key_name, NULL); - if (dst_key == NULL) { - parser_error(0, "key \"%s\" not found", key_name); - yyval.ime = NULL; - } - else - yyval.ime = new_ip_match_key(dst_key); - } -break; -case 204: -#line 1268 "ns_parser.y" -{ - yyval.ime = new_ip_match_pattern(yyvsp[0].ip_addr, 32); - } -break; -case 205: -#line 1272 "ns_parser.y" -{ - if (yyvsp[0].num < 0 || yyvsp[0].num > 32) { - parser_error(0, "mask bits out of range; skipping"); - yyval.ime = NULL; - } else { - yyval.ime = new_ip_match_pattern(yyvsp[-2].ip_addr, yyvsp[0].num); - if (yyval.ime == NULL) - parser_error(0, - "address/mask mismatch; skipping"); - } - } -break; -case 206: -#line 1284 "ns_parser.y" -{ - struct in_addr ia; - - if (yyvsp[-2].num > 255) { - parser_error(0, "address out of range; skipping"); - yyval.ime = NULL; - } else { - if (yyvsp[0].num < 0 || yyvsp[0].num > 32) { - parser_error(0, - "mask bits out of range; skipping"); - yyval.ime = NULL; - } else { - ia.s_addr = htonl((yyvsp[-2].num & 0xff) << 24); - yyval.ime = new_ip_match_pattern(ia, yyvsp[0].num); - if (yyval.ime == NULL) - parser_error(0, - "address/mask mismatch; skipping"); - } - } - } -break; -case 208: -#line 1306 "ns_parser.y" -{ - char name[256]; - - /* - * We want to be able to clean up this iml later so - * we give it a name and treat it like any other acl. - */ - sprintf(name, "__internal_%p", yyvsp[-1].iml); - define_acl(savestr(name, 1), yyvsp[-1].iml); - yyval.ime = new_ip_match_indirect(yyvsp[-1].iml); - } -break; -case 209: -#line 1320 "ns_parser.y" -{ - ip_match_list iml; - - iml = lookup_acl(yyvsp[0].cp); - if (iml == NULL) { - parser_error(0, "unknown ACL '%s'", yyvsp[0].cp); - yyval.ime = NULL; - } else - yyval.ime = new_ip_match_indirect(iml); - freestr(yyvsp[0].cp); - } -break; -case 210: -#line 1338 "ns_parser.y" -{ - struct dst_key *dst_key; - char *key_name; - - key_name = canonical_name(yyvsp[0].cp); - if (key_name == NULL) { - parser_error(0, "can't make key name '%s' canonical", - yyvsp[0].cp); - yyval.keyi = NULL; - } else { - dst_key = lookup_key(key_name); - if (dst_key == NULL) { - parser_error(0, "unknown key '%s'", key_name); - yyval.keyi = NULL; - } else - yyval.keyi = dst_key; - freestr(key_name); - } - freestr(yyvsp[0].cp); - } -break; -case 211: -#line 1361 "ns_parser.y" -{ - if (yyvsp[0].keyi == NULL) - parser_error(0, "empty key not added to server list "); - else - add_server_key_info(current_server, yyvsp[0].keyi); - } -break; -case 215: -#line 1375 "ns_parser.y" -{ - current_algorithm = NULL; - current_secret = NULL; - } -break; -case 216: -#line 1380 "ns_parser.y" -{ - struct dst_key *dst_key; - char *key_name; - - key_name = canonical_name(yyvsp[-3].cp); - if (key_name == NULL) { - parser_error(0, "can't make key name '%s' canonical", - yyvsp[-3].cp); - } else if (lookup_key(key_name) != NULL) { - parser_error(0, "can't redefine key '%s'", key_name); - freestr(key_name); - } else { - if (current_algorithm == NULL || - current_secret == NULL) { - parser_error(0, "skipping bad key '%s'", - key_name); - freestr(key_name); - } else { - dst_key = new_key_info(key_name, - current_algorithm, - current_secret); - if (dst_key != NULL) { - define_key(key_name, dst_key); - if (secretkey_info == NULL) - secretkey_info = - new_key_info_list(); - add_to_key_info_list(secretkey_info, - dst_key); - } - } - } - freestr(yyvsp[-3].cp); - } -break; -case 217: -#line 1416 "ns_parser.y" -{ - current_algorithm = yyvsp[-1].cp; - current_secret = yyvsp[0].cp; - } -break; -case 218: -#line 1421 "ns_parser.y" -{ - current_algorithm = yyvsp[0].cp; - current_secret = yyvsp[-1].cp; - } -break; -case 219: -#line 1426 "ns_parser.y" -{ - current_algorithm = NULL; - current_secret = NULL; - } -break; -case 220: -#line 1432 "ns_parser.y" -{ yyval.cp = yyvsp[-1].cp; } -break; -case 221: -#line 1435 "ns_parser.y" -{ yyval.cp = yyvsp[-1].cp; } -break; -case 222: -#line 1443 "ns_parser.y" -{ - if (lookup_acl(yyvsp[-3].cp) != NULL) { - parser_error(0, "can't redefine ACL '%s'", yyvsp[-3].cp); - freestr(yyvsp[-3].cp); - } else - define_acl(yyvsp[-3].cp, yyvsp[-1].iml); - } -break; -case 223: -#line 1457 "ns_parser.y" -{ - int sym_type; - symbol_value value; - char *zone_name; - - if (!seen_options) - parser_error(0, - "no options statement before first zone; using previous/default"); - sym_type = SYM_ZONE | (yyvsp[0].num & 0xffff); - value.pointer = NULL; - zone_name = canonical_name(yyvsp[-1].cp); - if (zone_name == NULL) { - parser_error(0, "can't make zone name '%s' canonical", - yyvsp[-1].cp); - should_install = 0; - zone_name = savestr("__bad_zone__", 1); - } else { - if (lookup_symbol(symtab, zone_name, sym_type, NULL)) { - should_install = 0; - parser_error(0, - "cannot redefine zone '%s' class %s", - *zone_name ? zone_name : ".", - p_class(yyvsp[0].num)); - } else { - should_install = 1; - define_symbol(symtab, savestr(zone_name, 1), - sym_type, value, - SYMBOL_FREE_KEY); - } - } - freestr(yyvsp[-1].cp); - current_zone = begin_zone(zone_name, yyvsp[0].num); - } -break; -case 224: -#line 1491 "ns_parser.y" -{ - end_zone(current_zone, should_install); - } -break; -case 227: -#line 1501 "ns_parser.y" -{ - yyval.num = C_IN; - } -break; -case 228: -#line 1505 "ns_parser.y" -{ - symbol_value value; - - if (lookup_symbol(constants, yyvsp[0].cp, SYM_CLASS, &value)) - yyval.num = value.integer; - else { - /* the zone validator will give the error */ - yyval.num = C_NONE; - } - freestr(yyvsp[0].cp); - } -break; -case 229: -#line 1519 "ns_parser.y" -{ - yyval.s_int = Z_MASTER; - } -break; -case 230: -#line 1523 "ns_parser.y" -{ - yyval.s_int = Z_SLAVE; - } -break; -case 231: -#line 1527 "ns_parser.y" -{ - yyval.s_int = Z_HINT; - } -break; -case 232: -#line 1531 "ns_parser.y" -{ - yyval.s_int = Z_STUB; - } -break; -case 233: -#line 1535 "ns_parser.y" -{ - yyval.s_int = Z_FORWARD; - } -break; -case 236: -#line 1545 "ns_parser.y" -{ - if (!set_zone_type(current_zone, yyvsp[0].s_int)) - parser_warning(0, "zone type already set; skipping"); - } -break; -case 237: -#line 1550 "ns_parser.y" -{ - if (!set_zone_filename(current_zone, yyvsp[0].cp)) - parser_warning(0, - "zone filename already set; skipping"); - } -break; -case 238: -#line 1556 "ns_parser.y" -{ - if (!set_zone_ixfr_file(current_zone, yyvsp[0].cp)) - parser_warning(0, - "zone ixfr data base already set; skipping"); - } -break; -case 239: -#line 1562 "ns_parser.y" -{ - if (!set_zone_ixfr_tmp(current_zone, yyvsp[0].cp)) - parser_warning(0, - "zone ixfr temp filename already set; skipping"); - } -break; -case 240: -#line 1568 "ns_parser.y" -{ - set_zone_master_port(current_zone, yyvsp[-3].us_int); - } -break; -case 241: -#line 1572 "ns_parser.y" -{ - set_zone_transfer_source(current_zone, yyvsp[0].ip_addr); - } -break; -case 242: -#line 1576 "ns_parser.y" -{ - if (!set_zone_checknames(current_zone, (enum severity)yyvsp[0].s_int)) - parser_warning(0, - "zone checknames already set; skipping"); - } -break; -case 243: -#line 1582 "ns_parser.y" -{ - if (!set_zone_update_acl(current_zone, yyvsp[-1].iml)) - parser_warning(0, - "zone update acl already set; skipping"); - } -break; -case 244: -#line 1588 "ns_parser.y" -{ - if (!set_zone_query_acl(current_zone, yyvsp[-1].iml)) - parser_warning(0, - "zone query acl already set; skipping"); - } -break; -case 245: -#line 1594 "ns_parser.y" -{ - if (!set_zone_transfer_acl(current_zone, yyvsp[-1].iml)) - parser_warning(0, - "zone transfer acl already set; skipping"); - } -break; -case 247: -#line 1601 "ns_parser.y" -{ - struct zoneinfo *zp = current_zone.opaque; - if (zp->z_fwdtab) { - free_forwarders(zp->z_fwdtab); - zp->z_fwdtab = NULL; - } - - } -break; -case 249: -#line 1611 "ns_parser.y" -{ - if (!set_zone_transfer_time_in(current_zone, yyvsp[0].num*60)) - parser_warning(0, - "zone max transfer time (in) already set; skipping"); - } -break; -case 250: -#line 1617 "ns_parser.y" -{ - set_zone_max_log_size_ixfr(current_zone, yyvsp[0].num); - } -break; -case 251: -#line 1621 "ns_parser.y" -{ - set_zone_notify(current_zone, yyvsp[0].num); - } -break; -case 252: -#line 1625 "ns_parser.y" -{ - set_zone_maintain_ixfr_base(current_zone, yyvsp[0].num); - } -break; -case 253: -#line 1629 "ns_parser.y" -{ - /* flags proto alg key */ - set_zone_pubkey(current_zone, yyvsp[-3].num, yyvsp[-2].num, yyvsp[-1].num, yyvsp[0].cp); - } -break; -case 254: -#line 1634 "ns_parser.y" -{ - /* flags proto alg key */ - char *endp; - int flags = (int) strtol(yyvsp[-3].cp, &endp, 0); - if (*endp != '\0') - ns_panic(ns_log_parser, 1, - "Invalid flags string: %s", yyvsp[-3].cp); - set_zone_pubkey(current_zone, flags, yyvsp[-2].num, yyvsp[-1].num, yyvsp[0].cp); - - } -break; -case 256: -#line 1646 "ns_parser.y" -{ - set_zone_dialup(current_zone, yyvsp[0].num); - } -break; -case 258: -#line 1653 "ns_parser.y" -{ - /* nothing */ - } -break; -case 259: -#line 1657 "ns_parser.y" -{ - /* nothing */ - } -break; -case 260: -#line 1663 "ns_parser.y" -{ - add_zone_master(current_zone, yyvsp[0].ip_addr); - } -break; -case 263: -#line 1673 "ns_parser.y" -{ - /* nothing */ - } -break; -case 264: -#line 1677 "ns_parser.y" -{ - /* nothing */ - } -break; -case 265: -#line 1683 "ns_parser.y" -{ - add_zone_notify(current_zone, yyvsp[0].ip_addr); - } -break; -case 266: -#line 1689 "ns_parser.y" -{ - set_zone_boolean_option(current_zone, OPTION_FORWARD_ONLY, 1); - } -break; -case 267: -#line 1693 "ns_parser.y" -{ - set_zone_boolean_option(current_zone, OPTION_FORWARD_ONLY, 0); - } -break; -case 268: -#line 1699 "ns_parser.y" -{ - set_zone_forward(current_zone); - } -break; -case 270: -#line 1706 "ns_parser.y" -{ - /* nothing */ - } -break; -case 271: -#line 1710 "ns_parser.y" -{ - /* nothing */ - } -break; -case 272: -#line 1716 "ns_parser.y" -{ - add_zone_forwarder(current_zone, yyvsp[0].ip_addr); - } -break; -case 273: -#line 1726 "ns_parser.y" -{ - } -break; -case 274: -#line 1730 "ns_parser.y" -{ - /* nothing */ - } -break; -case 275: -#line 1734 "ns_parser.y" -{ - /* nothing */ - } -break; -case 276: -#line 1739 "ns_parser.y" -{ - /* name flags proto alg key */ - set_trusted_key(yyvsp[-4].cp, yyvsp[-3].num, yyvsp[-2].num, yyvsp[-1].num, yyvsp[0].cp); - } -break; -case 277: -#line 1744 "ns_parser.y" -{ - /* name flags proto alg key */ - char *endp; - int flags = (int) strtol(yyvsp[-3].cp, &endp, 0); - if (*endp != '\0') - ns_panic(ns_log_parser, 1, - "Invalid flags string: %s", yyvsp[-3].cp); - set_trusted_key(yyvsp[-4].cp, flags, yyvsp[-2].num, yyvsp[-1].num, yyvsp[0].cp); - } -break; -case 278: -#line 1760 "ns_parser.y" -{ - if (yyvsp[0].num < 0 || yyvsp[0].num > 65535) { - parser_warning(0, - "invalid IP port number '%d'; setting port to 0", - yyvsp[0].num); - yyvsp[0].num = 0; - } else - yyval.us_int = htons(yyvsp[0].num); - } -break; -#line 3093 "y.tab.c" - } - yystk.ssp -= yym; - yystate = *yystk.ssp; - yystk.vsp -= yym; - yym = yylhs[yyn]; - yych = yychar; - if (yystate == 0 && yym == 0) - { -#if YYDEBUG - if (yydebug) - printf("%sdebug: after reduction, shifting from state 0 to\ - state %d\n", YYPREFIX, YYFINAL); -#endif - yystate = YYFINAL; - *++yystk.ssp = YYFINAL; - *++yystk.vsp = yyval; - if (yych < 0) - { - if ((yych = YYLEX) < 0) yych = 0; - yychar = yych; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yych <= YYMAXTOKEN) yys = yyname[yych]; - if (!yys) yys = "illegal-symbol"; - printf("%sdebug: state %d, reading %d (%s)\n", - YYPREFIX, YYFINAL, yych, yys); - } -#endif - } - if (yych == 0) goto yyaccept; - goto yyloop; - } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) - yystate = yytable[yyn]; - else - yystate = yydgoto[yym]; -#if YYDEBUG - if (yydebug) - printf("%sdebug: after reduction, shifting from state %d \ -to state %d\n", YYPREFIX, *yystk.ssp, yystate); -#endif - if (yystk.ssp >= yystk.sslim && yygrowstack(&yystk)) - goto yyoverflow; - *++yystk.ssp = yystate; - *++yystk.vsp = yyval; - goto yyloop; -yyoverflow: - yyerror("yacc stack overflow"); -yyabort: - YYFREESTACK(&yystk); - return (1); -yyaccept: - YYFREESTACK(&yystk); - return (0); -} diff --git a/contrib/bind/bin/named/ns_parser.h b/contrib/bind/bin/named/ns_parser.h deleted file mode 100644 index 571fb47..0000000 --- a/contrib/bind/bin/named/ns_parser.h +++ /dev/null @@ -1,145 +0,0 @@ -#define YYEMPTY (-1) -#define L_EOS 257 -#define L_IPADDR 258 -#define L_NUMBER 259 -#define L_STRING 260 -#define L_QSTRING 261 -#define L_END_INCLUDE 262 -#define T_INCLUDE 263 -#define T_OPTIONS 264 -#define T_DIRECTORY 265 -#define T_PIDFILE 266 -#define T_NAMED_XFER 267 -#define T_DUMP_FILE 268 -#define T_STATS_FILE 269 -#define T_MEMSTATS_FILE 270 -#define T_FAKE_IQUERY 271 -#define T_RECURSION 272 -#define T_FETCH_GLUE 273 -#define T_QUERY_SOURCE 274 -#define T_LISTEN_ON 275 -#define T_PORT 276 -#define T_ADDRESS 277 -#define T_RRSET_ORDER 278 -#define T_ORDER 279 -#define T_NAME 280 -#define T_CLASS 281 -#define T_CONTROLS 282 -#define T_INET 283 -#define T_UNIX 284 -#define T_PERM 285 -#define T_OWNER 286 -#define T_GROUP 287 -#define T_ALLOW 288 -#define T_DATASIZE 289 -#define T_STACKSIZE 290 -#define T_CORESIZE 291 -#define T_DEFAULT 292 -#define T_UNLIMITED 293 -#define T_FILES 294 -#define T_VERSION 295 -#define T_HOSTSTATS 296 -#define T_DEALLOC_ON_EXIT 297 -#define T_TRANSFERS_IN 298 -#define T_TRANSFERS_OUT 299 -#define T_TRANSFERS_PER_NS 300 -#define T_TRANSFER_FORMAT 301 -#define T_MAX_TRANSFER_TIME_IN 302 -#define T_SERIAL_QUERIES 303 -#define T_ONE_ANSWER 304 -#define T_MANY_ANSWERS 305 -#define T_NOTIFY 306 -#define T_AUTH_NXDOMAIN 307 -#define T_MULTIPLE_CNAMES 308 -#define T_USE_IXFR 309 -#define T_MAINTAIN_IXFR_BASE 310 -#define T_CLEAN_INTERVAL 311 -#define T_INTERFACE_INTERVAL 312 -#define T_STATS_INTERVAL 313 -#define T_MAX_LOG_SIZE_IXFR 314 -#define T_HEARTBEAT 315 -#define T_USE_ID_POOL 316 -#define T_MAX_NCACHE_TTL 317 -#define T_HAS_OLD_CLIENTS 318 -#define T_RFC2308_TYPE1 319 -#define T_LAME_TTL 320 -#define T_MIN_ROOTS 321 -#define T_TREAT_CR_AS_SPACE 322 -#define T_LOGGING 323 -#define T_CATEGORY 324 -#define T_CHANNEL 325 -#define T_SEVERITY 326 -#define T_DYNAMIC 327 -#define T_FILE 328 -#define T_VERSIONS 329 -#define T_SIZE 330 -#define T_SYSLOG 331 -#define T_DEBUG 332 -#define T_NULL_OUTPUT 333 -#define T_PRINT_TIME 334 -#define T_PRINT_CATEGORY 335 -#define T_PRINT_SEVERITY 336 -#define T_SORTLIST 337 -#define T_TOPOLOGY 338 -#define T_SERVER 339 -#define T_LONG_AXFR 340 -#define T_BOGUS 341 -#define T_TRANSFERS 342 -#define T_KEYS 343 -#define T_SUPPORT_IXFR 344 -#define T_ZONE 345 -#define T_IN 346 -#define T_CHAOS 347 -#define T_HESIOD 348 -#define T_TYPE 349 -#define T_MASTER 350 -#define T_SLAVE 351 -#define T_STUB 352 -#define T_RESPONSE 353 -#define T_HINT 354 -#define T_MASTERS 355 -#define T_TRANSFER_SOURCE 356 -#define T_PUBKEY 357 -#define T_ALSO_NOTIFY 358 -#define T_DIALUP 359 -#define T_FILE_IXFR 360 -#define T_IXFR_TMP 361 -#define T_TRUSTED_KEYS 362 -#define T_ACL 363 -#define T_ALLOW_UPDATE 364 -#define T_ALLOW_QUERY 365 -#define T_ALLOW_TRANSFER 366 -#define T_ALLOW_RECURSION 367 -#define T_BLACKHOLE 368 -#define T_SEC_KEY 369 -#define T_ALGID 370 -#define T_SECRET 371 -#define T_CHECK_NAMES 372 -#define T_WARN 373 -#define T_FAIL 374 -#define T_IGNORE 375 -#define T_FORWARD 376 -#define T_FORWARDERS 377 -#define T_ONLY 378 -#define T_FIRST 379 -#define T_IF_NO_ANSWER 380 -#define T_IF_NO_DOMAIN 381 -#define T_YES 382 -#define T_TRUE 383 -#define T_NO 384 -#define T_FALSE 385 -typedef union { - char * cp; - int s_int; - long num; - u_long ul_int; - u_int16_t us_int; - struct in_addr ip_addr; - ip_match_element ime; - ip_match_list iml; - rrset_order_list rol; - rrset_order_element roe; - struct dst_key * keyi; - enum axfr_format axfr_fmt; -} YYSTYPE; -extern YYSTYPE yylval; diff --git a/contrib/bind/bin/nslookup/commands.c b/contrib/bind/bin/nslookup/commands.c deleted file mode 100644 index fead60f..0000000 --- a/contrib/bind/bin/nslookup/commands.c +++ /dev/null @@ -1,2041 +0,0 @@ -/* A lexical scanner generated by flex */ - -/* Scanner skeleton version: - * /master/usr.bin/lex/skel.c,v 1.2 1996/05/30 12:31:07 bostic Exp - */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 - -#include <stdio.h> - - -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif -#endif - - -#ifdef __cplusplus - -#include <stdlib.h> -#include <unistd.h> - -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -#if __STDC__ - -#define YY_USE_PROTOS -#define YY_USE_CONST - -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include <io.h> -#include <stdlib.h> -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN yy_start = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START ((yy_start - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#define YY_BUF_SIZE 16384 - -typedef struct yy_buffer_state *YY_BUFFER_STATE; - -extern int yyleng; -extern FILE *yyin, *yyout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ - YY_RESTORE_YY_MORE_OFFSET \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, yytext_ptr ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ -typedef unsigned int yy_size_t; - - -struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - }; - -static YY_BUFFER_STATE yy_current_buffer = 0; - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - */ -#define YY_CURRENT_BUFFER yy_current_buffer - - -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; - -static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - -int yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart YY_PROTO(( FILE *input_file )); - -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) - -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); - -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) - -typedef unsigned char YY_CHAR; -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; -typedef int yy_state_type; -extern char *yytext; -#define yytext_ptr yytext - -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; - -#define YY_NUM_RULES 22 -#define YY_END_OF_BUFFER 23 -static yyconst short int yy_accept[171] = - { 0, - 0, 0, 23, 22, 21, 22, 22, 19, 22, 22, - 22, 22, 22, 22, 22, 22, 22, 0, 20, 0, - 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 16, 0, 0, 14, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 15, 0, 3, 0, 0, 13, 0, 9, 0, - 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, - - 0, 0, 12, 0, 0, 0, 17, 0, 6, 0, - 0, 0, 0, 0, 0, 0, 7, 0, 0, 7, - 0, 0, 0, 0, 9, 0, 0, 11, 0, 0, - 0, 0, 6, 0, 0, 0, 0, 0, 8, 0, - 0, 0, 0, 0, 1, 0, 0, 0, 5, 0, - 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, - 0, 0, 0, 0, 5, 0, 8, 0, 10, 0 - } ; - -static yyconst int yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 1, 1, 5, 4, 6, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 1, 1, 1, - 6, 7, 8, 1, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 1, 9, 1, 1, 10, 1, 11, 4, 4, 12, - - 13, 14, 15, 16, 17, 4, 4, 18, 19, 20, - 21, 22, 4, 23, 24, 25, 4, 26, 27, 28, - 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static yyconst int yy_meta[29] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1 - } ; - -static yyconst short int yy_base[203] = - { 0, - 504, 0, 497, 626, 626, 484, 28, 626, 56, 58, - 65, 52, 49, 47, 55, 57, 61, 477, 626, 0, - 626, 451, 79, 0, 62, 71, 63, 67, 73, 75, - 103, 626, 450, 94, 626, 90, 74, 96, 113, 95, - 94, 107, 141, 150, 100, 106, 105, 159, 108, 104, - 72, 128, 110, 168, 626, 175, 184, 137, 0, 144, - 160, 152, 193, 200, 153, 187, 185, 225, 195, 235, - 202, 626, 244, 626, 186, 204, 626, 215, 626, 254, - 218, 237, 245, 257, 626, 241, 273, 282, 291, 301, - 263, 0, 284, 265, 312, 322, 283, 277, 331, 626, - - 338, 268, 626, 347, 356, 275, 626, 365, 626, 375, - 466, 384, 393, 314, 402, 411, 626, 418, 333, 626, - 427, 436, 445, 448, 626, 455, 464, 626, 474, 483, - 493, 496, 626, 503, 512, 341, 0, 349, 626, 515, - 522, 525, 532, 535, 626, 542, 551, 358, 626, 560, - 377, 563, 570, 579, 386, 582, 626, 589, 598, 395, - 0, 607, 616, 413, 626, 420, 626, 429, 626, 626, - 460, 459, 458, 448, 441, 440, 439, 432, 423, 416, - 405, 398, 389, 380, 368, 361, 352, 336, 325, 306, - 294, 287, 267, 247, 240, 228, 209, 207, 198, 173, - - 162, 144 - } ; - -static yyconst short int yy_def[203] = - { 0, - 171, 170, 170, 170, 170, 172, 170, 170, 173, 172, - 173, 11, 11, 11, 11, 11, 11, 172, 170, 7, - 170, 11, 172, 11, 11, 11, 11, 11, 11, 11, - 174, 170, 11, 172, 170, 11, 11, 11, 11, 11, - 11, 11, 175, 176, 11, 11, 11, 177, 11, 11, - 11, 11, 11, 172, 170, 175, 176, 57, 57, 11, - 11, 11, 178, 172, 11, 11, 11, 179, 11, 180, - 172, 170, 174, 170, 11, 73, 170, 172, 170, 178, - 172, 172, 11, 73, 170, 11, 181, 182, 183, 180, - 90, 90, 11, 90, 184, 185, 11, 11, 172, 170, - - 181, 172, 170, 186, 187, 172, 170, 188, 170, 189, - 90, 190, 191, 11, 192, 172, 170, 186, 172, 170, - 193, 194, 189, 172, 170, 190, 195, 170, 191, 196, - 197, 172, 170, 193, 194, 135, 135, 172, 170, 172, - 198, 172, 199, 172, 170, 197, 200, 172, 170, 201, - 172, 172, 198, 202, 172, 172, 170, 199, 200, 159, - 159, 201, 202, 172, 170, 172, 170, 172, 170, 0, - 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, - 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, - 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, - - 170, 170 - } ; - -static yyconst short int yy_nxt[655] = - { 0, - 6, 7, 8, 9, 6, 6, 6, 10, 9, 9, - 9, 9, 11, 12, 9, 13, 9, 14, 9, 9, - 9, 9, 15, 16, 9, 17, 9, 9, 18, 20, - 21, 22, 18, 18, 18, 23, 22, 22, 22, 22, - 24, 25, 22, 26, 22, 27, 22, 22, 22, 22, - 28, 29, 22, 30, 22, 22, 18, 31, 32, 34, - 35, 38, 18, 18, 18, 18, 31, 32, 37, 41, - 39, 18, 18, 18, 33, 40, 33, 42, 37, 33, - 34, 35, 33, 38, 33, 41, 39, 40, 33, 33, - 33, 42, 36, 46, 33, 34, 35, 67, 33, 33, - - 33, 33, 33, 18, 31, 32, 45, 18, 18, 44, - 18, 18, 18, 47, 48, 50, 51, 33, 52, 53, - 61, 33, 33, 33, 60, 49, 62, 33, 66, 68, - 65, 33, 33, 33, 33, 33, 69, 33, 71, 72, - 33, 18, 54, 55, 163, 73, 74, 18, 18, 18, - 18, 57, 19, 76, 77, 33, 59, 18, 18, 18, - 48, 32, 162, 64, 18, 44, 18, 18, 18, 54, - 55, 33, 75, 160, 70, 18, 54, 55, 83, 33, - 33, 18, 18, 18, 18, 57, 19, 33, 84, 85, - 18, 18, 18, 18, 78, 79, 89, 86, 158, 18, - - 18, 18, 19, 71, 72, 76, 77, 153, 93, 146, - 81, 81, 33, 33, 33, 81, 78, 79, 81, 95, - 19, 94, 33, 81, 82, 18, 68, 32, 143, 88, - 88, 44, 18, 18, 88, 18, 90, 19, 96, 19, - 141, 92, 18, 18, 18, 73, 74, 136, 18, 18, - 44, 18, 18, 18, 18, 78, 79, 97, 84, 85, - 18, 18, 18, 98, 106, 107, 110, 134, 33, 102, - 103, 111, 33, 18, 99, 100, 106, 107, 115, 18, - 18, 18, 18, 102, 103, 108, 109, 131, 18, 18, - 18, 18, 89, 32, 129, 105, 105, 44, 18, 18, - - 105, 18, 90, 19, 33, 114, 126, 18, 18, 18, - 33, 33, 18, 95, 19, 130, 18, 18, 18, 18, - 18, 18, 18, 96, 19, 123, 18, 18, 18, 18, - 18, 18, 99, 100, 119, 120, 121, 70, 18, 99, - 100, 33, 148, 149, 18, 18, 18, 18, 116, 117, - 138, 139, 105, 18, 18, 18, 18, 119, 120, 148, - 149, 118, 18, 18, 18, 18, 108, 109, 113, 18, - 18, 122, 18, 18, 18, 18, 110, 19, 150, 19, - 112, 18, 18, 18, 18, 124, 125, 154, 19, 104, - 18, 18, 18, 18, 127, 128, 164, 165, 88, 18, - - 18, 18, 18, 115, 32, 101, 18, 18, 44, 18, - 18, 18, 116, 117, 164, 165, 91, 70, 18, 116, - 117, 166, 167, 87, 18, 18, 18, 18, 132, 133, - 168, 169, 80, 18, 18, 18, 18, 135, 19, 63, - 58, 56, 137, 18, 18, 18, 138, 139, 43, 124, - 125, 18, 18, 18, 140, 18, 124, 125, 33, 18, - 4, 18, 18, 18, 18, 127, 128, 110, 18, 18, - 142, 18, 18, 18, 18, 127, 128, 33, 33, 19, - 18, 18, 18, 18, 130, 32, 19, 18, 18, 44, - 18, 18, 18, 18, 144, 145, 170, 132, 133, 18, - - 18, 18, 147, 18, 132, 133, 5, 170, 170, 18, - 18, 18, 18, 135, 19, 170, 150, 19, 18, 18, - 18, 151, 18, 152, 128, 170, 154, 19, 18, 18, - 18, 155, 18, 156, 157, 170, 144, 145, 18, 18, - 18, 70, 18, 144, 145, 170, 170, 170, 18, 18, - 18, 18, 159, 19, 170, 170, 170, 161, 18, 18, - 18, 150, 19, 170, 152, 128, 18, 18, 18, 142, - 18, 152, 128, 170, 170, 170, 18, 18, 18, 18, - 154, 19, 170, 156, 157, 18, 18, 18, 70, 18, - 156, 157, 170, 170, 170, 18, 18, 18, 18, 159, - - 19, 170, 170, 170, 18, 18, 18, 18, 166, 167, - 170, 170, 170, 18, 18, 18, 18, 168, 169, 170, - 170, 170, 18, 18, 18, 3, 170, 170, 170, 170, - 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, - 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, - 170, 170, 170, 170 - } ; - -static yyconst short int yy_chk[655] = - { 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 9, 9, 9, 10, - 10, 13, 9, 9, 9, 11, 11, 11, 12, 16, - 14, 11, 11, 11, 14, 15, 13, 17, 25, 12, - 23, 23, 15, 26, 16, 29, 27, 28, 17, 25, - 27, 30, 11, 37, 28, 34, 34, 51, 26, 51, - - 29, 37, 30, 31, 31, 31, 36, 31, 31, 31, - 31, 31, 31, 38, 39, 40, 41, 36, 41, 42, - 46, 41, 40, 38, 45, 39, 47, 45, 50, 52, - 49, 50, 47, 46, 42, 49, 53, 53, 58, 58, - 39, 43, 43, 43, 202, 60, 60, 43, 43, 43, - 44, 44, 44, 62, 62, 52, 44, 44, 44, 48, - 48, 48, 201, 48, 48, 48, 48, 48, 48, 54, - 54, 60, 61, 200, 54, 56, 56, 56, 65, 62, - 65, 56, 56, 56, 57, 57, 57, 61, 66, 66, - 57, 57, 57, 63, 63, 63, 69, 67, 199, 63, - - 63, 63, 64, 71, 71, 76, 76, 198, 75, 197, - 64, 64, 67, 75, 66, 64, 78, 78, 64, 81, - 81, 78, 69, 64, 64, 68, 68, 68, 196, 68, - 68, 68, 68, 68, 68, 70, 70, 70, 82, 82, - 195, 70, 70, 70, 73, 73, 73, 194, 73, 73, - 73, 73, 73, 73, 80, 80, 80, 83, 84, 84, - 80, 80, 80, 86, 91, 91, 94, 193, 86, 102, - 102, 94, 83, 87, 87, 87, 106, 106, 98, 87, - 87, 87, 88, 88, 88, 93, 93, 192, 88, 88, - 88, 89, 89, 89, 191, 89, 89, 89, 89, 89, - - 89, 90, 90, 90, 98, 97, 190, 90, 90, 90, - 97, 93, 95, 95, 95, 114, 95, 95, 95, 95, - 95, 95, 96, 96, 96, 189, 96, 96, 96, 96, - 96, 96, 99, 99, 119, 119, 188, 99, 101, 101, - 101, 114, 136, 136, 101, 101, 101, 104, 104, 104, - 138, 138, 187, 104, 104, 104, 105, 105, 105, 148, - 148, 186, 105, 105, 105, 108, 108, 108, 185, 108, - 108, 108, 108, 108, 108, 110, 110, 110, 151, 151, - 184, 110, 110, 110, 112, 112, 112, 155, 155, 183, - 112, 112, 112, 113, 113, 113, 160, 160, 182, 113, - - 113, 113, 115, 115, 115, 181, 115, 115, 115, 115, - 115, 115, 116, 116, 164, 164, 180, 116, 118, 118, - 118, 166, 166, 179, 118, 118, 118, 121, 121, 121, - 168, 168, 178, 121, 121, 121, 122, 122, 122, 177, - 176, 175, 122, 122, 122, 123, 123, 123, 174, 124, - 124, 123, 123, 123, 124, 126, 126, 126, 173, 172, - 171, 126, 126, 126, 127, 127, 127, 111, 127, 127, - 127, 127, 127, 127, 129, 129, 129, 33, 22, 18, - 129, 129, 129, 130, 130, 130, 6, 130, 130, 130, - 130, 130, 130, 131, 131, 131, 3, 132, 132, 131, - - 131, 131, 132, 134, 134, 134, 1, 0, 0, 134, - 134, 134, 135, 135, 135, 0, 140, 140, 135, 135, - 135, 140, 141, 141, 141, 0, 142, 142, 141, 141, - 141, 142, 143, 143, 143, 0, 144, 144, 143, 143, - 143, 144, 146, 146, 146, 0, 0, 0, 146, 146, - 146, 147, 147, 147, 0, 0, 0, 147, 147, 147, - 150, 150, 150, 0, 152, 152, 150, 150, 150, 152, - 153, 153, 153, 0, 0, 0, 153, 153, 153, 154, - 154, 154, 0, 156, 156, 154, 154, 154, 156, 158, - 158, 158, 0, 0, 0, 158, 158, 158, 159, 159, - - 159, 0, 0, 0, 159, 159, 159, 162, 162, 162, - 0, 0, 0, 162, 162, 162, 163, 163, 163, 0, - 0, 0, 163, 163, 163, 170, 170, 170, 170, 170, - 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, - 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, - 170, 170, 170, 170 - } ; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *yytext; -#line 1 "commands.l" -#define INITIAL 0 -#line 2 "commands.l" - -/* - * Copyright (c) 1985 - * 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. - */ - -#ifndef lint -static char sccsid[] = "@(#)commands.l 5.13 (Berkeley) 7/24/90"; -#endif /* not lint */ - -/* - ******************************************************************************* - * - * commands.l - * - * Andrew Cherenson CS298-26 Fall 1985 - * - * Lex input file for the nslookup program command interpreter. - * When a sequence is recognized, the associated action - * routine is called. The action routine may need to - * parse the string for additional information. - * - * Recognized commands: (identifiers are shown in uppercase) - * - * server NAME - set default server to NAME, using default server - * lserver NAME - set default server to NAME, using initial server - * finger [NAME] - finger the optional NAME - * exit - exit the program - * root - set default server to the root - * ls NAME - list the domain NAME - * view FILE - sorts and view the file with more - * set OPTION - set an option - * help - print help information - * ? - print help information - * NAME - print info about the host/domain NAME - * using default server. - * NAME1 NAME2 - as above, but use NAME2 as server - * - * - * yylex Results: - * 0 upon end-of-file. - * 1 after each command. - * - ******************************************************************************* - */ - -#include "port_before.h" -#include <sys/types.h> -#include "port_after.h" -#include "res.h" - -extern char rootServerName[]; -extern void PrintHelp(); -extern void ViewList(char *); - - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); -#else -extern int yywrap YY_PROTO(( void )); -#endif -#endif - -#ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr )); -#endif - -#ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); -#endif - -#ifndef YY_NO_INPUT -#ifdef __cplusplus -static int yyinput YY_PROTO(( void )); -#else -static int input YY_PROTO(( void )); -#endif -#endif - -#if YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); -#endif - -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include <stdlib.h> -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ - -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ - { \ - int c = '*', n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ - && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL int yylex YY_PROTO(( void )) -#endif - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -#define YY_RULE_SETUP \ - if ( yyleng > 0 ) \ - yy_current_buffer->yy_at_bol = \ - (yytext[yyleng - 1] == '\n'); \ - YY_USER_ACTION - -YY_DECL - { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - -#line 110 "commands.l" - - - if ( yy_init ) - { - yy_init = 0; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! yy_start ) - yy_start = 1; /* first start state */ - - if ( ! yyin ) - yyin = stdin; - - if ( ! yyout ) - yyout = stdout; - - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_load_buffer_state(); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = yy_c_buf_p; - - /* Support of yytext. */ - *yy_cp = yy_hold_char; - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = yy_start; - yy_current_state += YY_AT_BOL(); -yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 171 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 626 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - - -do_action: /* This label is used only to access EOF actions. */ - - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - goto yy_find_action; - -case 1: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 111 "commands.l" -{ - /* - * 0 == use current server to find - * the new one. - * 1 == use original server to find - * the new one. - */ - SetDefaultServer(yytext, 0); - return(1); - } - YY_BREAK -case 2: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 121 "commands.l" -{ - SetDefaultServer(yytext, 1); - return(1); - } - YY_BREAK -case 3: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 125 "commands.l" -{ - return(0); - } - YY_BREAK -case 4: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 128 "commands.l" -{ - SetDefaultServer(rootServerName, 1); - return(1); - } - YY_BREAK -case 5: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 132 "commands.l" -{ - /* - * 2nd arg. - * 0 == output to stdout - * 1 == output to file - */ - Finger(yytext, 1); - return(1); - } - YY_BREAK -case 6: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 141 "commands.l" -{ - Finger(yytext, 0); - return(1); - } - YY_BREAK -case 7: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 145 "commands.l" -{ - ViewList((char *)yytext); - return(1); - } - YY_BREAK -case 8: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 149 "commands.l" -{ - /* - * 2nd arg. - * 0 == output to stdout - * 1 == output to file - */ - ListHosts(yytext, 1); - return(1); - } - YY_BREAK -case 9: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 158 "commands.l" -{ - ListHosts(yytext, 0); - return(1); - } - YY_BREAK -case 10: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 162 "commands.l" -{ - /* - * 2nd arg. - * 0 == output to stdout - * 1 == output to file - */ - ListHostsByType(yytext, 1); - return(1); - } - YY_BREAK -case 11: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 171 "commands.l" -{ - ListHostsByType(yytext, 0); - return(1); - } - YY_BREAK -case 12: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 175 "commands.l" -{ - SetOption(yytext); - return(1); - } - YY_BREAK -case 13: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 179 "commands.l" -{ - PrintHelp(); - return(1); - } - YY_BREAK -case 14: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 183 "commands.l" -{ - extern void PrintHelp(); - - PrintHelp(); - return(1); - } - YY_BREAK -case 15: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 189 "commands.l" -{ - /* - * 0 == output to stdout - * 1 == output to file - */ - LookupHost(yytext, 1); - return(1); - } - YY_BREAK -case 16: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 197 "commands.l" -{ - LookupHost(yytext, 0); - return(1); - } - YY_BREAK -case 17: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 201 "commands.l" -{ - /* - * 0 == output to stdout - * 1 == output to file - */ - LookupHostWithServer(yytext, 1); - return(1); - } - YY_BREAK -case 18: -*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ -yy_c_buf_p = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -#line 209 "commands.l" -{ - LookupHostWithServer(yytext, 0); - return(1); - } - YY_BREAK -case 19: -YY_RULE_SETUP -#line 213 "commands.l" -{ - return(1); - } - YY_BREAK -case 20: -YY_RULE_SETUP -#line 216 "commands.l" -{ - printf("Unrecognized command: %s", - yytext); - return(1); - } - YY_BREAK -case 21: -YY_RULE_SETUP -#line 221 "commands.l" -{ ; } - YY_BREAK -case 22: -YY_RULE_SETUP -#line 222 "commands.l" -ECHO; - YY_BREAK -case YY_STATE_EOF(INITIAL): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; - YY_RESTORE_YY_MORE_OFFSET - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = yytext_ptr + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = yy_c_buf_p; - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; - - if ( yywrap() ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of yylex */ - - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ - -static int yy_get_next_buffer() - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; - register int number_to_move, i; - int ret_val; - - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( yy_current_buffer->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_n_chars = 0; - - else - { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; - - int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = yy_current_buffer->yy_buf_size - - number_to_move - 1; -#endif - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); - } - - if ( yy_n_chars == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; - - return ret_val; - } - - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - -static yy_state_type yy_get_previous_state() - { - register yy_state_type yy_current_state; - register char *yy_cp; - - yy_current_state = yy_start; - yy_current_state += YY_AT_BOL(); - - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 171 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; - } - - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif - { - register int yy_is_jam; - register char *yy_cp = yy_c_buf_p; - - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 171 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 170); - - return yy_is_jam ? 0 : yy_current_state; - } - - -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp ) -#else -static void yyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif - { - register char *yy_cp = yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; - - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_n_chars = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ - - -#ifdef __cplusplus -static int yyinput() -#else -static int input() -#endif - { - int c; - - *yy_c_buf_p = yy_hold_char; - - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* This was really a NUL. */ - *yy_c_buf_p = '\0'; - - else - { /* need more input */ - int offset = yy_c_buf_p - yytext_ptr; - ++yy_c_buf_p; - - switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - { - yy_c_buf_p = yytext_ptr + offset; - return EOF; - } - - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + offset; - break; - - case EOB_ACT_LAST_MATCH: -#ifdef __cplusplus - YY_FATAL_ERROR( - "unexpected last match in yyinput()" ); -#else - YY_FATAL_ERROR( - "unexpected last match in input()" ); -#endif - } - } - } - - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; - - yy_current_buffer->yy_at_bol = (c == '\n'); - - return c; - } - - -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); - } - - -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif - { - if ( yy_current_buffer == new_buffer ) - return; - - if ( yy_current_buffer ) - { - /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; - } - - yy_current_buffer = new_buffer; - yy_load_buffer_state(); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yy_did_buffer_switch_on_eof = 1; - } - - -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif - { - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer( b, file ); - - return b; - } - - -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif - { - if ( ! b ) - return; - - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); - - yy_flex_free( (void *) b ); - } - - -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif - -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif - - - { - yy_flush_buffer( b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif - } - - -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) -#else -void yy_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif - - { - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == yy_current_buffer ) - yy_load_buffer_state(); - } - - -#ifndef YY_NO_SCAN_BUFFER -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer( b ); - - return b; - } -#endif - - -#ifndef YY_NO_SCAN_STRING -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *str ) -#else -YY_BUFFER_STATE yy_scan_string( str ) -yyconst char *str; -#endif - { - int len; - for ( len = 0; str[len]; ++len ) - ; - - return yy_scan_bytes( str, len ); - } -#endif - - -#ifndef YY_NO_SCAN_BYTES -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) -yyconst char *bytes; -int len; -#endif - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; - - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer( buf, n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; - } -#endif - - -#ifndef YY_NO_PUSH_STATE -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; - - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); - - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); - - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); - - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - yy_start_stack[yy_start_stack_ptr++] = YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef YY_NO_POP_STATE -static void yy_pop_state() - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -static int yy_top_state() - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } - - - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ - } \ - while ( 0 ) - - -/* Internal utility routines. */ - -#ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; - } -#endif - -#ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) -#else -static int yy_flex_strlen( s ) -yyconst char *s; -#endif - { - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; - } -#endif - - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { - return (void *) malloc( size ); - } - -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); - } - -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } - -#if YY_MAIN -int main() - { - yylex(); - return 0; - } -#endif -#line 222 "commands.l" - diff --git a/contrib/bind/bin/nslookup/commands.l b/contrib/bind/bin/nslookup/commands.l index 286ae95..bb626c7 100644 --- a/contrib/bind/bin/nslookup/commands.l +++ b/contrib/bind/bin/nslookup/commands.l @@ -95,16 +95,69 @@ static char sccsid[] = "@(#)commands.l 5.13 (Berkeley) 7/24/90"; #include "port_before.h" #include <sys/types.h> +#include <histedit.h> #include "port_after.h" #include "res.h" extern char rootServerName[]; extern void PrintHelp(); -extern void ViewList(char *); + +#define YY_INPUT(buf, result, max_size) \ + { \ + nslookup_yy_input((char *)buf, &result, \ + max_size, yy_current_buffer->yy_is_interactive); \ + } + +const char * +nslookup_prompt() +{ + return ("> "); +} + +int +nslookup_yy_input(buf, result, max_size, intr) + char * buf; + int * result; + int max_size; + int intr; +{ + static EditLine *el = NULL; + static History *hist = NULL; + int num = 0; + const char *bp = NULL; + + if (intr) { + if (!el) { + el = el_init("nslookup", yyin, yyout); + hist = history_init(); + history(hist, H_EVENT, 100); + el_set(el, EL_HIST, history, hist); + el_set(el, EL_EDITOR, "emacs"); + el_set(el, EL_PROMPT, nslookup_prompt); + el_set(el, EL_SIGNAL, 1); + el_source(el, NULL); + } + + if ((bp = el_gets(el, &num)) == NULL || num == 0) { + *result = 0; + return; + } + + *result = (num > max_size) ? max_size : num; + strncpy(buf, bp, *result); + history(hist, H_ENTER, bp); + } else { + if ( ((*result = fread( buf, 1, max_size, yyin )) == 0) + && ferror( yyin ) ) + yy_fatal_error( "input in flex scanner failed" ); + } + + return; +} %} WS [ \t] -FLET [A-Za-z0-9.*\\_] +FLET [A-Za-z0-9.*\\] LET [A-Za-z0-9.*] NAME [A-Za-z0-9.*=_/-] %% @@ -143,7 +196,7 @@ NAME [A-Za-z0-9.*=_/-] return(1); } ^{WS}*view{WS}+{NAME}+{WS}*$ { - ViewList((char *)yytext); + ViewList(yytext); return(1); } ^{WS}*ls{WS}+(("-a"|"-d"|"-h"|"-m"|"-s"){WS}+)?{LET}{NAME}*{WS}+>>?{WS}+{NAME}+{WS}*$ { diff --git a/contrib/bind/bin/nslookup/debug.c b/contrib/bind/bin/nslookup/debug.c index 2448381..af03daa 100644 --- a/contrib/bind/bin/nslookup/debug.c +++ b/contrib/bind/bin/nslookup/debug.c @@ -52,8 +52,8 @@ */ #ifndef lint -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 $"; +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 $"; #endif /* not lint */ /* @@ -80,6 +80,7 @@ static const char rcsid[] = "$Id: debug.c,v 8.15 1999/10/13 16:39:16 vixie Exp $ #include <netdb.h> #include <resolv.h> #include <stdio.h> +#include <string.h> #include "port_after.h" @@ -88,6 +89,7 @@ static const char rcsid[] = "$Id: debug.c,v 8.15 1999/10/13 16:39:16 vixie Exp $ /* * Imported from res_debug.c */ +extern char *_res_resultcodes[]; extern char *_res_opcodes[]; /* @@ -118,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", p_rcode(hp->rcode)); + fprintf(file,", rcode = %s\n", _res_resultcodes[hp->rcode]); fprintf(file,"\theader flags: "); if (hp->qr) { fprintf(file," response"); @@ -279,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) @@ -621,9 +623,8 @@ 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, "?", (ns_class)class, - (ns_type)type, rrttl, cp1, dlen, NULL, NULL, - buf, sizeof buf) < 0) { + if (ns_sprintrrf(msg, eom - msg, "?", class, type, rrttl, + cp1, dlen, NULL, NULL, buf, sizeof buf) < 0) { perror("ns_sprintrrf"); } else { fprintf(file, @@ -633,7 +634,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) { diff --git a/contrib/bind/bin/nslookup/getinfo.c b/contrib/bind/bin/nslookup/getinfo.c index 6f4ecff..abd747b 100644 --- a/contrib/bind/bin/nslookup/getinfo.c +++ b/contrib/bind/bin/nslookup/getinfo.c @@ -52,8 +52,8 @@ */ #ifndef lint -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 $"; +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 $"; #endif /* not lint */ /* @@ -88,6 +88,7 @@ static const char rcsid[] = "$Id: getinfo.c,v 8.15 1999/10/13 16:39:16 vixie Exp #include "res.h" +extern char *_res_resultcodes[]; extern char *res_skip(); static char *addr_list[MAXADDRS + 1]; @@ -108,7 +109,7 @@ ServerTable server[MAXSERVERS]; typedef union { HEADER qb1; - u_char qb2[64*1024]; + u_char qb2[PACKETSZ*2]; } querybuf; typedef union { @@ -161,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; @@ -178,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); } @@ -267,11 +268,11 @@ GetAnswer(nsAddrPtr, queryType, msg, msglen, iquery, hostPtr, isServer) continue; } *aliasPtr++ = (char *)bp; - s = strlen((char *)bp) + 1; - host_aliases_len[numAliases] = s; + n = strlen((char *)bp) + 1; + host_aliases_len[numAliases] = n; numAliases++; - bp += s; - buflen -= s; + bp += n; + buflen -= n; continue; } else if (type == T_PTR) { /* @@ -283,9 +284,9 @@ GetAnswer(nsAddrPtr, queryType, msg, msglen, iquery, hostPtr, isServer) continue; } cp += n; - s = strlen((char *)bp) + 1; - hostPtr->name = Calloc(1, s); - memcpy(hostPtr->name, bp, s); + len = strlen((char *)bp) + 1; + hostPtr->name = Calloc(1, len); + memcpy(hostPtr->name, bp, len); haveAnswer = TRUE; break; } else if (type != T_A) { @@ -315,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; - s = strlen((char *)bp) + 1; - hostPtr->name = Calloc(1, s); - memcpy(hostPtr->name, bp, s); + len = strlen((char *)bp) + 1; + hostPtr->name = Calloc(1, len); + memcpy(hostPtr->name, bp, len); } - bp += (((u_int32_t)bp) % sizeof(align)); + 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; @@ -416,9 +417,9 @@ GetAnswer(nsAddrPtr, queryType, msg, msglen, iquery, hostPtr, isServer) return(ERROR); } cp += n; - s = strlen((char *)bp) + 1; - dnamePtr = Calloc(1, s); /* domain name */ - memcpy(dnamePtr, bp, s); + len = strlen((char *)bp) + 1; + dnamePtr = Calloc(1, len); /* domain name */ + memcpy(dnamePtr, bp, len); if (cp + 3 * INT16SZ + INT32SZ > eom) return (ERROR); @@ -439,9 +440,9 @@ GetAnswer(nsAddrPtr, queryType, msg, msglen, iquery, hostPtr, isServer) return(ERROR); } cp += n; - s = strlen((char *)bp) + 1; - namePtr = Calloc(1, s); /* server host name */ - memcpy(namePtr, bp, s); + len = strlen((char *)bp) + 1; + namePtr = Calloc(1, len); /* server host name */ + memcpy(namePtr, bp, len); /* * Store the information keyed by the server host name. @@ -578,10 +579,10 @@ GetAnswer(nsAddrPtr, queryType, msg, msglen, iquery, hostPtr, isServer) * Retrieves host name, address and alias information * for a domain. * -* Algorithm from res_nsearch(). +* Algorithm from res_search(). * * Results: -* ERROR - res_nmkquery failed. +* ERROR - res_mkquery failed. * + return values from GetAnswer() * ******************************************************************************* @@ -603,7 +604,6 @@ 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 +624,7 @@ GetHostInfoByName(nsAddrPtr, queryClass, queryType, name, hostPtr, isServer) for (cp = name, n = 0; *cp; cp++) if (*cp == '.') n++; - if (n == 0 && (cp = res_hostalias(&res, name, tmp, sizeof tmp))) { + if (n == 0 && (cp = hostalias(name))) { printf("Aliased to \"%s\"\n\n", cp); return (GetHostDomain(nsAddrPtr, queryClass, queryType, cp, (char *)NULL, hostPtr, isServer)); @@ -634,7 +634,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 +650,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 +672,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 +722,11 @@ GetHostDomain(nsAddrPtr, queryClass, queryType, name, domain, hostPtr, isServer) MAXDNAME, name, MAXDNAME, domain); longname = nbuf; } - n = res_nmkquery(&res, QUERY, longname, queryClass, queryType, - NULL, 0, 0, buf.qb2, sizeof(buf)); + n = res_mkquery(QUERY, longname, queryClass, queryType, + NULL, 0, 0, buf.qb2, sizeof(buf)); if (n < 0) { - if (res.options & RES_DEBUG) { - printf("Res_nmkquery failed\n"); + if (_res.options & RES_DEBUG) { + printf("Res_mkquery failed\n"); } return (ERROR); } @@ -738,8 +738,7 @@ GetHostDomain(nsAddrPtr, queryClass, queryType, name, domain, hostPtr, isServer) */ if (n == NONAUTH) { if (hostPtr->name == NULL) { - size_t len = strlen(longname) + 1; - + int len = strlen(longname) + 1; hostPtr->name = Calloc(len, sizeof(char)); memcpy(hostPtr->name, longname, len); } @@ -757,7 +756,7 @@ GetHostDomain(nsAddrPtr, queryClass, queryType, name, domain, hostPtr, isServer) * that corresponds to the given address. * * Results: -* ERROR - res_nmkquery failed. +* ERROR - res_mkquery failed. * + return values from GetAnswer() * ******************************************************************************* @@ -779,11 +778,11 @@ GetHostInfoByAddr(nsAddrPtr, address, hostPtr) ((unsigned)p[2] & 0xff), ((unsigned)p[1] & 0xff), ((unsigned)p[0] & 0xff)); - n = res_nmkquery(&res, QUERY, qbuf, C_IN, T_PTR, NULL, 0, NULL, - buf.qb2, sizeof buf); + n = res_mkquery(QUERY, qbuf, C_IN, T_PTR, NULL, 0, NULL, + buf.qb2, sizeof buf); if (n < 0) { - if (res.options & RES_DEBUG) { - printf("res_nmkquery() failed\n"); + if (_res.options & RES_DEBUG) { + printf("res_mkquery() failed\n"); } return (ERROR); } diff --git a/contrib/bind/bin/nslookup/main.c b/contrib/bind/bin/nslookup/main.c index d36c0f4..67309a4 100644 --- a/contrib/bind/bin/nslookup/main.c +++ b/contrib/bind/bin/nslookup/main.c @@ -51,33 +51,15 @@ * 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\ - @(#) Portions Copyright (c) 1996-1999 Internet Software Consortium.\n"; + All rights reserved.\n"; #endif /* not lint */ #ifndef lint -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 $"; +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 $"; #endif /* not lint */ /* @@ -131,10 +113,10 @@ static const char rcsid[] = "$Id: main.c,v 8.13 1999/10/13 16:39:19 vixie Exp $" char rootServerName[NAME_LEN] = ROOT_SERVER; /* - * Declare a resolver context. + * Import the state information from the resolver library. */ -struct __res_state res; +extern struct __res_state _res; /* @@ -178,13 +160,6 @@ char *pager; static void CvtAddrToPtr(); static void ReadRC(); -/* - * Forward declarations. - */ -void LocalServer(HostInfo *defaultPtr); -void res_re_init(void); -void res_dnsrch(char *cp); - /* ****************************************************************************** @@ -212,7 +187,7 @@ main(argc, argv) * Initialize the resolver library routines. */ - if (res_ninit(&res) == -1) { + if (res_init() == -1) { fprintf(stderr,"*** Can't initialize resolver.\n"); exit(1); } @@ -270,8 +245,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) { @@ -281,33 +256,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; } } @@ -318,7 +293,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); } @@ -329,10 +304,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 */ /* @@ -369,18 +344,12 @@ main(argc, argv) * Yylex returns 0 when ^D or 'exit' is typed. */ - printf("> "); - fflush(stdout); - while(yylex()) { - printf("> "); - fflush(stdout); - } + while(yylex()); } exit(0); } -void LocalServer(defaultPtr) HostInfo *defaultPtr; { @@ -490,7 +459,6 @@ SetDefaultServer(string, local) char newServer[NAME_LEN]; int result; int i; - int j; /* * Parse the command line. It maybe of the form "server name", @@ -498,32 +466,13 @@ SetDefaultServer(string, local) */ if (local) { - 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); - } - } + i = sscanf(string, " lserver %s", newServer); } else { - 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); - } - } + i = sscanf(string, " server %s", newServer); } - - if (i == 0) { - i = pickString(string, newServer, sizeof newServer); - if (i == 0) { /* value was too big for newServer variable */ + if (i != 1) { + i = sscanf(string, " %s", newServer); + if (i != 1) { fprintf(stderr,"SetDefaultServer: invalid name: %s\n", string); return(ERROR); } @@ -713,7 +662,6 @@ LookupHost(string, putToFile) char host[NAME_LEN]; char file[PATH_MAX]; int result; - int i; /* * Invalidate the current host information to prevent Finger @@ -728,16 +676,11 @@ LookupHost(string, putToFile) * */ - 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); - } - + sscanf(string, " %s", host); /* removes white space */ if (!putToFile) { filePtr = stdout; } else { - filePtr = OpenFile(string, file, sizeof file); + filePtr = OpenFile(string, file); if (filePtr == NULL) { fprintf(stderr, "*** Can't open %s for writing\n", file); return(ERROR); @@ -791,27 +734,14 @@ LookupHostWithServer(string, putToFile) char server[NAME_LEN]; int result; static HostInfo serverInfo; - int i; - int j; curHostValid = FALSE; - 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); - } - + sscanf(string, " %s %s", host, server); if (!putToFile) { filePtr = stdout; } else { - filePtr = OpenFile(string, file, sizeof file); + filePtr = OpenFile(string, file); if (filePtr == NULL) { fprintf(stderr, "*** Can't open %s for writing\n", file); return(ERROR); @@ -888,7 +818,6 @@ SetOption(option) char type[NAME_LEN]; char *ptr; int tmp; - int i; while (isspace(*option)) ++option; @@ -906,34 +835,28 @@ 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) { - 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); - } - + sscanf(++ptr, "%s", _res.defdname); 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) { @@ -941,61 +864,44 @@ 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) { - 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); - } - + sscanf(++ptr, "%s", type); queryType = StringToType(type, queryType, stderr); } } else if (strncmp(option, "cl", 2) == 0) { /* query class */ ptr = strchr(option, '='); if (ptr != NULL) { - i = pickString(++ptr, type, sizeof type); - if (i == 0) { /* value too big or nothing there */ - fprintf(stderr, "*** invalid class : %s\n", - ptr) ; - return(ERROR); - } - + sscanf(++ptr, "%s", type); 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) { - 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) ; - } + sscanf(++ptr, "%s", rootServerName); } } 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) { @@ -1006,13 +912,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); @@ -1024,45 +930,45 @@ SetOption(option) /* * Fake a reinitialization when the domain is changed. */ -void -res_re_init(void) { +res_re_init() +{ 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 '/' -void -res_dnsrch(char *cp) { - char **pp; +res_dnsrch(cp) + register char *cp; +{ + register char **pp; int n; - (void)strncpy(res.defdname, cp, sizeof(res.defdname) - 1); - res.defdname[sizeof(res.defdname) - 1] = '\0'; - if ((cp = strchr(res.defdname, '\n')) != NULL) + (void)strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1); + 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; @@ -1100,24 +1006,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(" %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(" %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(" 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++) { @@ -1165,7 +1071,7 @@ static void CvtAddrToPtr(name) char *name; { - const char *p; + char *p; int ip[4]; struct in_addr addr; |