#ifndef lint
static char const 
yyrcsid[] = "$FreeBSD: src/usr.bin/yacc/skeleton.c,v 1.28 2000/01/17 02:04:06 bde Exp $";
#endif
#include <stdlib.h>
#define YYBYACC 1
#define YYMAJOR 1
#define YYMINOR 9
#define YYLEX yylex()
#define YYEMPTY -1
#define yyclearin (yychar=(YYEMPTY))
#define yyerrok (yyerrflag=0)
#define YYRECOVERING() (yyerrflag!=0)
static int yygrowstack();
#define YYPREFIX "yy"
#line 2 "ns_parser.y"
#if !defined(lint) && !defined(SABER)
static char rcsid[] = "$Id: ns_parser.y,v 8.63 2000/12/23 08:14:41 vixie Exp $";
#endif /* not lint */

/*
 * Copyright (c) 1996-2000 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/stat.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 int logged_options_error;

static controls current_controls;

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 104 "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 133 "y.tab.c"
#define YYERRCODE 256
#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_HITCOUNT 274
#define T_QUERY_SOURCE 275
#define T_LISTEN_ON 276
#define T_PORT 277
#define T_ADDRESS 278
#define T_RRSET_ORDER 279
#define T_ORDER 280
#define T_NAME 281
#define T_CLASS 282
#define T_CONTROLS 283
#define T_INET 284
#define T_UNIX 285
#define T_PERM 286
#define T_OWNER 287
#define T_GROUP 288
#define T_ALLOW 289
#define T_DATASIZE 290
#define T_STACKSIZE 291
#define T_CORESIZE 292
#define T_DEFAULT 293
#define T_UNLIMITED 294
#define T_FILES 295
#define T_VERSION 296
#define T_HOSTSTATS 297
#define T_HOSTSTATSMAX 298
#define T_DEALLOC_ON_EXIT 299
#define T_TRANSFERS_IN 300
#define T_TRANSFERS_OUT 301
#define T_TRANSFERS_PER_NS 302
#define T_TRANSFER_FORMAT 303
#define T_MAX_TRANSFER_TIME_IN 304
#define T_SERIAL_QUERIES 305
#define T_ONE_ANSWER 306
#define T_MANY_ANSWERS 307
#define T_NOTIFY 308
#define T_AUTH_NXDOMAIN 309
#define T_MULTIPLE_CNAMES 310
#define T_USE_IXFR 311
#define T_MAINTAIN_IXFR_BASE 312
#define T_CLEAN_INTERVAL 313
#define T_INTERFACE_INTERVAL 314
#define T_STATS_INTERVAL 315
#define T_MAX_LOG_SIZE_IXFR 316
#define T_HEARTBEAT 317
#define T_USE_ID_POOL 318
#define T_MAX_NCACHE_TTL 319
#define T_HAS_OLD_CLIENTS 320
#define T_RFC2308_TYPE1 321
#define T_LAME_TTL 322
#define T_MIN_ROOTS 323
#define T_TREAT_CR_AS_SPACE 324
#define T_LOGGING 325
#define T_CATEGORY 326
#define T_CHANNEL 327
#define T_SEVERITY 328
#define T_DYNAMIC 329
#define T_FILE 330
#define T_VERSIONS 331
#define T_SIZE 332
#define T_SYSLOG 333
#define T_DEBUG 334
#define T_NULL_OUTPUT 335
#define T_PRINT_TIME 336
#define T_PRINT_CATEGORY 337
#define T_PRINT_SEVERITY 338
#define T_SORTLIST 339
#define T_TOPOLOGY 340
#define T_SERVER 341
#define T_LONG_AXFR 342
#define T_BOGUS 343
#define T_TRANSFERS 344
#define T_KEYS 345
#define T_SUPPORT_IXFR 346
#define T_ZONE 347
#define T_IN 348
#define T_CHAOS 349
#define T_HESIOD 350
#define T_TYPE 351
#define T_MASTER 352
#define T_SLAVE 353
#define T_STUB 354
#define T_RESPONSE 355
#define T_HINT 356
#define T_MASTERS 357
#define T_TRANSFER_SOURCE 358
#define T_PUBKEY 359
#define T_ALSO_NOTIFY 360
#define T_DIALUP 361
#define T_FILE_IXFR 362
#define T_IXFR_TMP 363
#define T_TRUSTED_KEYS 364
#define T_ACL 365
#define T_ALLOW_UPDATE 366
#define T_ALLOW_QUERY 367
#define T_ALLOW_TRANSFER 368
#define T_ALLOW_RECURSION 369
#define T_BLACKHOLE 370
#define T_SEC_KEY 371
#define T_ALGID 372
#define T_SECRET 373
#define T_CHECK_NAMES 374
#define T_WARN 375
#define T_FAIL 376
#define T_IGNORE 377
#define T_FORWARD 378
#define T_FORWARDERS 379
#define T_ONLY 380
#define T_FIRST 381
#define T_IF_NO_ANSWER 382
#define T_IF_NO_DOMAIN 383
#define T_YES 384
#define T_TRUE 385
#define T_NO 386
#define T_FALSE 387
const 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,   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,   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,
};
const 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,    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,
    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,
};
const short yydefred[] = {                                      0,
    0,   13,    0,   17,    0,  144,    0,    0,    0,    0,
  217,    0,    0,    2,    4,    0,    0,    0,    0,    0,
    0,    0,    0,   14,   15,    0,    0,    0,    0,  191,
    0,    0,  281,  282,    0,    0,    3,    5,    6,    7,
    8,    9,   10,   11,   12,   16,    0,   82,    0,    0,
    0,    0,    0,    0,  225,  230,    0,    0,    0,    0,
    0,   75,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,   54,
    0,    0,    0,    0,    0,    0,    0,   46,    0,    0,
   58,   59,   94,   95,    0,    0,   76,    0,   77,  148,
    0,    0,    0,    0,    0,    0,    0,    0,  275,    0,
  276,    0,    0,    0,    0,    0,  203,    0,  209,    0,
  211,    0,   23,   25,   24,   28,   26,   27,  112,  108,
  109,  110,  111,   29,   30,   31,   32,    0,    0,   48,
    0,    0,    0,    0,    0,  128,  129,  130,  123,  127,
  124,  125,  126,   22,   34,   66,   35,  131,  132,  133,
   92,   93,   60,   61,   62,   33,   39,   40,   36,   37,
   63,   64,   65,   67,   70,   42,   68,   38,   43,   69,
   74,   73,    0,    0,   49,    0,   71,    0,    0,    0,
    0,  113,  114,  115,    0,  119,  120,  121,  122,   45,
    0,   18,    0,   19,    0,    0,   78,  188,  189,  149,
  190,  187,  182,  151,  181,  145,    0,  146,  200,    0,
    0,    0,    0,    0,    0,    0,    0,  226,    0,    0,
  277,    0,    0,  205,    0,  204,  201,  224,    0,  221,
    0,    0,    0,    0,    0,  280,   97,   96,   99,   98,
  102,  103,  105,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,  116,  117,  118,   41,    0,
   20,    0,    0,    0,    0,  147,  198,  195,  197,    0,
  196,  192,    0,  193,  259,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,  249,    0,    0,    0,    0,  207,  208,
  210,  202,    0,    0,  219,  220,  218,    0,   86,    0,
    0,   72,    0,   83,   53,   57,  143,    0,    0,    0,
   50,   52,   51,   56,  138,    0,    0,    0,    0,    0,
    0,    0,  216,  213,  212,    0,    0,  194,  251,  253,
  254,  252,  239,  231,  232,  234,  233,  235,  238,    0,
    0,  243,    0,    0,    0,  258,  240,  241,    0,    0,
    0,  244,  268,  269,  248,    0,  228,    0,  236,  278,
  279,  222,  223,   44,   88,    0,    0,   84,   55,    0,
  141,   47,    0,  136,    0,    0,  186,  183,    0,    0,
  180,    0,    0,    0,  173,    0,    0,    0,    0,  171,
  172,    0,  199,    0,  214,  107,    0,    0,    0,  267,
    0,    0,    0,    0,    0,    0,    0,  237,   90,    0,
  142,  137,    0,    0,  150,    0,  184,  156,    0,  153,
  174,    0,  167,  169,  170,  166,  175,  176,  177,  152,
    0,  178,  215,  262,    0,    0,    0,    0,  257,    0,
  265,  245,  246,  247,  274,    0,    0,    0,   91,   80,
   81,  185,  155,    0,    0,    0,    0,  165,  179,  242,
    0,  260,  255,  256,  266,  250,    0,  272,  157,  158,
  159,  163,  164,  261,  273,
};
const short yydgoto[] = {                                      12,
  278,  174,  391,  279,  125,  193,  240,  241,  428,  474,
  475,  286,  351,  417,  287,  288,  147,  148,  149,  150,
   55,  389,  374,  273,  274,  179,  225,  299,  164,  151,
   13,   14,   15,   16,   17,   18,   19,   20,   21,   22,
   23,   27,  119,  120,  230,  231,  366,  170,  216,  358,
  121,  122,   51,   52,  171,  172,  367,  368,  359,  360,
   29,  133,  134,  304,  429,  305,  439,  471,  506,  507,
  508,  440,  441,  442,  430,   54,  255,  256,  376,  377,
   36,  275,  258,  136,  335,  336,  485,  405,  406,  496,
  451,  486,  452,  453,  497,  498,   58,   59,
};
const short yysindex[] = {                                    132,
 -175,    0, -236,    0,  -91,    0, -206, -205,  -69, -137,
    0,    0,  132,    0,    0, -165, -156, -152, -147, -145,
 -138, -117, -115,    0,    0, -111,  -42, -207,  -28,    0,
 -137,  -99,    0,    0,   25, -137,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,  360,    0,  -36, -109,
 -112,  -86, -170,   73,    0,    0, -130, -110,  -46,   47,
   93,    0,  -40,  -34,  -27,   -4,   33,   38, -184, -184,
 -184, -184,  -93,   34,  190,   -1,   -1,   -1,   -1,   53,
 -184,   57, -184,   64,   65,   66, -131,   75,   76, -184,
 -184, -184, -184, -184,   77,   78,   79,   -1,   80, -184,
   82, -184, -184,   84,   85, -184,  208,  222,  -36,    0,
 -184,  223,  224,  226,  227, -281, -176,    0,  245,   94,
    0,    0,    0,    0,   81,   67,    0,  102,    0,    0,
   72, -196, -113,  103, -218,  241,  109,  110,    0,  114,
    0,  320,  325,  116,   47,  -81,    0,  120,    0,  -29,
    0, -209,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,  -26,  -36,    0,
  104,  106,  126,  264,  117,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,   47,   47,    0,  268,    0,   47,   47,   47,
   47,    0,    0,    0, -278,    0,    0,    0,    0,    0,
  275,    0,  143,    0,  126,  144,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,  145,    0,    0, -131,
 -184,  146,  283, -184, -120,  150,  385,    0,  151,  152,
    0,  153,  154,    0,  -23,    0,    0,    0,  159,    0,
 -137, -137,   36,   45,  295,    0,    0,    0,    0,    0,
    0,    0,    0,   47, -137,   70, -108,  166,  -19,  -14,
  168,   -9,    8,   12,   18,    0,    0,    0,    0,  169,
    0,  139,  156,  307,  315,    0,    0,    0,    0, -143,
    0,    0,  182,    0,    0,  185, -184, -184,   -1,  184,
 -263,  170,  -36,  -73,  323, -184,  188,  189,  328,  331,
  332, -278, -183,    0,   74,  199,  197,  198,    0,    0,
    0,    0,  203,  204,    0,    0,    0,   22,    0, -137,
  181,    0,  206,    0,    0,    0,    0,  339,  168,  209,
    0,    0,    0,    0,    0,  340,  169,  210,  345,  211,
 -203, -118,    0,    0,    0, -102,  212,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,  126,
  348,    0,  213,  215,  217,    0,    0,    0,   47,   47,
   47,    0,    0,    0,    0,  353,    0,  220,    0,    0,
    0,    0,    0,    0,    0,  219,  201,    0,    0,  221,
    0,    0,  225,    0,   47,  195,    0,    0,  -79,  228,
    0, -226,  229, -199,    0, -184, -184, -184,  -18,    0,
    0,  230,    0,  231,    0,    0,  233,  234,  235,    0,
  359,  217,  232,   26,   30,   37,  240,    0,    0,  239,
    0,    0,   43,  243,    0,  247,    0,    0,  246,    0,
    0, -123,    0,    0,    0,    0,    0,    0,    0,    0,
  249,    0,    0,    0,  -89,  265,  262,  266,    0,  269,
    0,    0,    0,    0,    0,  361,  240,  271,    0,    0,
    0,    0,    0, -215,   -1,  160,  194,    0,    0,    0,
  272,    0,    0,    0,    0,    0,  273,    0,    0,    0,
    0,    0,    0,    0,    0,
};
const short yyrindex[] = {                                      0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,  500,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,  274,    0,    0,
  -90,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,  277,    0,    0,    0,
  274,    0,    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,    0,  277,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,  281,    0,    0,    0,    0,
    0,  282,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  294,  313,    0,    0, -197,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,  -16, -197,    0,    0,    0,
  427,    0,    0,    0,    0,    0,    0,    0,    0,  446,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,  449,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  293,    0,    0,    0,    0,    0,    0,    0,  450,    0,
    0,    0,    0,    0,    0,    0,  451,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,  452,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,  317,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,  453,    0,    0,    0,    0,  454,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,  324,    0,
    0,  326,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,  455,    0,    0,    0,
    0,    0,    0,    0,    0,  329,  330,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,
};
const short yygindex[] = {                                      0,
 -162,    0,    0,    0,  -49,  338,    0,    0,  457,    0,
    0,    0,    0,    0,    0,  303,  436, -100,    0,  108,
    0,    0,    0,  318,  321,  -76,    0,  259,  -63,  -10,
    0,  580,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,  476,    0,    0,    0,    0,    0,    0,
    0,    0,    0,  545,  425,  428,    0,  237,    0,  242,
    0,    0,  465,    0,    0,    0,    0,    0,   95,  101,
    0,    0,    0,  161,  179,    0,    0,  354,    0,  244,
    0,    0,    0,    0,    0,  276,    0,    0,    0,    0,
    0,  125,    0,  165,    0,  121,    0,  563,
};
#define YYTABLESIZE 764
const short yytable[] = {                                      35,
  181,  182,  183,  146,  312,  124,  165,  166,  167,  146,
  283,  246,  127,  146,  139,  277,  352,  185,  146,  187,
   56,  204,  443,  146,   26,   61,  196,  197,  198,  199,
  200,   28,  229,   33,   34,  510,  206,  249,  208,  209,
  146,  145,  212,  519,  146,  465,  270,  217,   48,  269,
  146,   30,  427,   32,  146,   31,   33,   34,  146,  215,
   33,   34,  146,   33,   34,  180,  180,  180,  180,  146,
  222,  223,  302,  224,  159,  146,   49,   50,  520,  146,
   47,   24,   85,   85,  250,  130,   25,  180,  384,  385,
  386,   38,  387,  145,   53,  268,  296,  297,  298,  145,
   39,  341,  468,  145,   40,  355,  480,  469,  145,   41,
  356,   42,  373,  145,  388,  361,   33,   34,   43,  280,
  242,  245,   33,   34,  251,  252,  253,  254,  137,  138,
  145,  243,  362,  473,  145,  249,  363,  431,  243,   44,
  145,   45,  364,   48,  145,   46,  414,   60,  145,   57,
  492,  126,  145,   85,  493,  131,  132,   33,   34,  145,
   57,  494,  271,  272,  269,  145,  229,  500,  484,  145,
  129,   49,   50,  285,  191,  192,  142,  143,   33,   34,
   33,   34,  250,  168,  169,  393,  394,  308,  269,  269,
  311,  269,  269,  269,  269,  135,  403,  404,  407,  160,
  161,  162,  163,  226,  227,  228,  229,  504,  505,  432,
  141,  433,  131,  132,  434,  152,  435,  436,  437,  438,
  153,  123,  251,  252,  253,  254,  154,  446,  142,  143,
   33,   34,  276,  155,  142,  143,   33,   34,  142,  143,
   33,   34,  382,  142,  143,   33,   34,  269,  142,  143,
   33,   34,  265,  380,  381,  243,  156,  176,   33,   34,
  343,  344,  396,   87,   87,  142,  143,   33,   34,  142,
  143,   33,   34,  392,  349,  142,  143,   33,   34,  142,
  143,   33,   34,  142,  143,   33,   34,  142,  143,   33,
   34,  177,  178,  157,  142,  143,   33,   34,  158,  375,
  142,  143,   33,   34,  142,  143,   33,   34,  180,  432,
  173,  433,  175,  184,  434,  186,  435,  436,  437,  438,
  289,  290,  188,  189,  190,  292,  293,  294,  295,  315,
  213,   33,   34,  194,  195,  201,  202,  203,  205,  415,
  207,  144,  210,  211,  214,  218,  219,  144,  220,  221,
  234,  144,  236,  269,  269,  269,  144,  235,  237,  248,
  245,  144,  269,  257,  238,  375,  262,  259,  260,  232,
  261,  263,  477,  478,  479,  264,  267,  316,  144,  239,
  168,  317,  144,  169,  276,  318,  284,    1,  144,  319,
  291,  348,  144,    2,    3,    4,  144,  300,  285,  301,
  144,  306,  303,  320,  309,  310,  314,  144,  272,  337,
  338,  339,  340,  144,    5,  342,  271,  144,  245,  347,
  350,  470,  354,  476,  321,  357,  365,  369,  521,  371,
  322,  323,  324,  325,  326,  327,  328,  372,  378,  329,
  330,  331,  370,  379,  383,  395,  390,  332,  397,  398,
  399,  333,  334,  400,  401,  409,    6,  410,  411,  412,
  413,  416,  418,  419,  422,  421,  424,  425,  445,  426,
  447,  448,    7,  449,  450,  457,  458,  461,    8,  459,
  460,  462,  464,  489,  467,  516,  482,  483,  491,  472,
  484,  505,  487,  488,  180,    9,   10,  495,  499,    1,
   62,  501,   11,  502,  503,  509,  454,  455,  456,   63,
   64,   65,   66,   67,   68,   69,   70,   71,   72,   73,
   74,  512,  513,   75,  504,  515,  514,  518,  524,  525,
   79,  104,  463,   21,   76,   77,   78,  227,  206,   79,
   80,   81,   82,   83,   84,   85,   86,   87,   88,   89,
  100,  139,   90,   91,   92,   93,   94,   95,   96,   97,
   98,   99,  100,  101,  102,  103,  104,  105,  106,  101,
  134,  106,   89,  168,  140,  135,  263,  264,  270,  271,
  154,  266,  160,  107,  108,  161,  162,  307,  244,  353,
  402,  346,   37,  345,  233,  128,  282,  247,  281,  481,
  420,  523,  109,  423,  110,  111,  522,  466,  313,  511,
  408,  112,  113,  114,  115,   62,  490,  517,  116,  444,
  140,    0,  117,  118,   63,   64,   65,   66,   67,   68,
   69,   70,   71,   72,   73,   74,    0,    0,   75,    0,
  315,    0,    0,    0,    0,    0,    0,    0,    0,   76,
   77,   78,    0,    0,   79,   80,   81,   82,   83,   84,
   85,   86,   87,   88,   89,    0,    0,   90,   91,   92,
   93,   94,   95,   96,   97,   98,   99,  100,  101,  102,
  103,  104,  105,  106,    0,    0,    0,    0,  316,    0,
    0,    0,  317,    0,    0,    0,  318,    0,  107,  108,
  319,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,  320,    0,    0,  109,    0,  110,
  111,    0,    0,    0,    0,    0,  112,  113,  114,  115,
    0,    0,    0,  116,    0,  321,    0,  117,  118,    0,
    0,  322,  323,  324,  325,  326,  327,  328,    0,    0,
  329,  330,  331,    0,    0,    0,    0,    0,  332,    0,
    0,    0,  333,  334,
};
const short yycheck[] = {                                      10,
   77,   78,   79,   33,  125,   42,   70,   71,   72,   33,
  173,  125,  125,   33,  125,   42,  125,   81,   33,   83,
   31,   98,  125,   33,  261,   36,   90,   91,   92,   93,
   94,  123,  123,  260,  261,  125,  100,  256,  102,  103,
   33,  123,  106,  259,   33,  125,  256,  111,  256,  150,
   33,  258,  256,  123,   33,  261,  260,  261,   33,  109,
  260,  261,   33,  260,  261,   76,   77,   78,   79,   33,
  352,  353,  235,  355,  259,   33,  284,  285,  294,   33,
  123,  257,  280,  281,  303,  256,  262,   98,  352,  353,
  354,  257,  356,  123,  123,  125,  375,  376,  377,  123,
  257,  125,  329,  123,  257,  125,  125,  334,  123,  257,
  125,  257,  256,  123,  378,  125,  260,  261,  257,  169,
  131,  132,  260,  261,  343,  344,  345,  346,  259,  260,
  123,  335,  125,  333,  123,  256,  125,  256,  335,  257,
  123,  257,  125,  256,  123,  257,  125,  123,  123,  260,
  125,  261,  123,  351,  125,  326,  327,  260,  261,  123,
  260,  125,  372,  373,  265,  123,  257,  125,  258,  123,
  257,  284,  285,  282,  306,  307,  258,  259,  260,  261,
  260,  261,  303,  277,  278,  259,  260,  251,  289,  290,
  254,  292,  293,  294,  295,  123,  380,  381,  125,  384,
  385,  386,  387,  380,  381,  382,  383,  331,  332,  328,
  257,  330,  326,  327,  333,  123,  335,  336,  337,  338,
  261,  258,  343,  344,  345,  346,  261,  390,  258,  259,
  260,  261,  259,  261,  258,  259,  260,  261,  258,  259,
  260,  261,  319,  258,  259,  260,  261,  348,  258,  259,
  260,  261,  145,  317,  318,  335,  261,  259,  260,  261,
  271,  272,  326,  280,  281,  258,  259,  260,  261,  258,
  259,  260,  261,  323,  285,  258,  259,  260,  261,  258,
  259,  260,  261,  258,  259,  260,  261,  258,  259,  260,
  261,  293,  294,  261,  258,  259,  260,  261,  261,  310,
  258,  259,  260,  261,  258,  259,  260,  261,  319,  328,
  277,  330,  123,  261,  333,  259,  335,  336,  337,  338,
  213,  214,  259,  259,  259,  218,  219,  220,  221,  256,
  123,  260,  261,  259,  259,  259,  259,  259,  259,  350,
  259,  371,  259,  259,  123,  123,  123,  371,  123,  123,
  257,  371,  286,  454,  455,  456,  371,  277,  257,  257,
  371,  371,  463,  123,  293,  376,   47,  259,  259,  125,
  257,   47,  436,  437,  438,  260,  257,  304,  371,  308,
  277,  308,  371,  278,  259,  312,  123,  256,  371,  316,
  123,  284,  371,  262,  263,  264,  371,  123,  282,  257,
  371,  257,  259,  330,  259,  123,  257,  371,  373,  259,
  259,  259,  259,  371,  283,  257,  372,  371,  429,  125,
  351,  432,  257,  434,  351,  258,  258,  289,  505,  123,
  357,  358,  359,  360,  361,  362,  363,  123,  257,  366,
  367,  368,  287,  259,  261,  123,  277,  374,  261,  261,
  123,  378,  379,  123,  123,  257,  325,  261,  261,  257,
  257,  281,  257,  125,  125,  257,  257,  123,  257,  259,
  123,  259,  341,  259,  258,  123,  257,  257,  347,  261,
  280,  257,  288,  125,  257,  125,  257,  257,  257,  261,
  258,  332,  259,  259,  505,  364,  365,  258,  260,    0,
  256,  259,  371,  257,  259,  257,  399,  400,  401,  265,
  266,  267,  268,  269,  270,  271,  272,  273,  274,  275,
  276,  257,  261,  279,  331,  257,  261,  257,  257,  257,
  257,  123,  425,  257,  290,  291,  292,  257,  257,  295,
  296,  297,  298,  299,  300,  301,  302,  303,  304,  305,
  257,  125,  308,  309,  310,  311,  312,  313,  314,  315,
  316,  317,  318,  319,  320,  321,  322,  323,  324,  257,
  125,  123,  280,  257,  125,  125,  125,  125,  125,  125,
  257,  146,  257,  339,  340,  257,  257,  250,  132,  287,
  332,  274,   13,  273,  119,   51,  172,  133,  171,  439,
  359,  507,  358,  367,  360,  361,  506,  429,  255,  485,
  335,  367,  368,  369,  370,  256,  452,  497,  374,  376,
   58,   -1,  378,  379,  265,  266,  267,  268,  269,  270,
  271,  272,  273,  274,  275,  276,   -1,   -1,  279,   -1,
  256,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  290,
  291,  292,   -1,   -1,  295,  296,  297,  298,  299,  300,
  301,  302,  303,  304,  305,   -1,   -1,  308,  309,  310,
  311,  312,  313,  314,  315,  316,  317,  318,  319,  320,
  321,  322,  323,  324,   -1,   -1,   -1,   -1,  304,   -1,
   -1,   -1,  308,   -1,   -1,   -1,  312,   -1,  339,  340,
  316,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,  330,   -1,   -1,  358,   -1,  360,
  361,   -1,   -1,   -1,   -1,   -1,  367,  368,  369,  370,
   -1,   -1,   -1,  374,   -1,  351,   -1,  378,  379,   -1,
   -1,  357,  358,  359,  360,  361,  362,  363,   -1,   -1,
  366,  367,  368,   -1,   -1,   -1,   -1,   -1,  374,   -1,
   -1,   -1,  378,  379,
};
#define YYFINAL 12
#ifndef YYDEBUG
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 387
#if YYDEBUG
const char * const 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_HITCOUNT","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_HOSTSTATSMAX",
"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",
};
const char * const 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_HITCOUNT 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_HOSTSTATSMAX L_NUMBER",
"option : T_MAX_LOG_SIZE_IXFR size_spec",
"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 size_spec",
"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
#if YYDEBUG
#include <stdio.h>
#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;
int yyerrflag;
int yychar;
short *yyssp;
YYSTYPE *yyvsp;
YYSTYPE yyval;
YYSTYPE yylval;
short *yyss;
short *yysslim;
YYSTYPE *yyvs;
int yystacksize;
#line 1790 "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;
	logged_options_error = 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);
}

time_t
parse_configuration(const char *filename) {
	FILE *config_stream;
	struct stat sb;

	config_stream = fopen(filename, "r");
	if (config_stream == NULL)
		ns_panic(ns_log_parser, 0, "can't open '%s'", filename);
	if (fstat(fileno(config_stream), &sb) == -1)
		ns_panic(ns_log_parser, 0, "can't stat '%s'", filename);

	lexer_setup();
	parser_setup();
	lexer_begin_file(filename, config_stream);
	(void)yyparse();
	lexer_end_file();
	parser_cleanup();
	return (sb.st_mtime);
}

void
parser_initialize(void) {
	lexer_initialize();
}

void
parser_shutdown(void) {
	if (authtab != NULL)
		free_symbol_table(authtab);
	lexer_shutdown();
}
#line 1228 "y.tab.c"
/* allocate initial stack or double stack size, up to YYMAXDEPTH */
static int yygrowstack()
{
    int newsize, i;
    short *newss;
    YYSTYPE *newvs;

    if ((newsize = yystacksize) == 0)
        newsize = YYINITSTACKSIZE;
    else if (newsize >= YYMAXDEPTH)
        return -1;
    else if ((newsize *= 2) > YYMAXDEPTH)
        newsize = YYMAXDEPTH;
    i = yyssp - yyss;
    newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) :
      (short *)malloc(newsize * sizeof *newss);
    if (newss == NULL)
        return -1;
    yyss = newss;
    yyssp = newss + i;
    newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) :
      (YYSTYPE *)malloc(newsize * sizeof *newvs);
    if (newvs == NULL)
        return -1;
    yyvs = newvs;
    yyvsp = newvs + i;
    yystacksize = newsize;
    yysslim = yyss + newsize - 1;
    return 0;
}

#define YYABORT goto yyabort
#define YYREJECT goto yyabort
#define YYACCEPT goto yyaccept
#define YYERROR goto yyerrlab

#ifndef YYPARSE_PARAM
#if defined(__cplusplus) || __STDC__
#define YYPARSE_PARAM_ARG void
#define YYPARSE_PARAM_DECL
#else	/* ! ANSI-C/C++ */
#define YYPARSE_PARAM_ARG
#define YYPARSE_PARAM_DECL
#endif	/* ANSI-C/C++ */
#else	/* YYPARSE_PARAM */
#ifndef YYPARSE_PARAM_TYPE
#define YYPARSE_PARAM_TYPE void *
#endif
#if defined(__cplusplus) || __STDC__
#define YYPARSE_PARAM_ARG YYPARSE_PARAM_TYPE YYPARSE_PARAM
#define YYPARSE_PARAM_DECL
#else	/* ! ANSI-C/C++ */
#define YYPARSE_PARAM_ARG YYPARSE_PARAM
#define YYPARSE_PARAM_DECL YYPARSE_PARAM_TYPE YYPARSE_PARAM;
#endif	/* ANSI-C/C++ */
#endif	/* ! YYPARSE_PARAM */

int
yyparse (YYPARSE_PARAM_ARG)
    YYPARSE_PARAM_DECL
{
    register int yym, yyn, yystate;
#if YYDEBUG
    register const char *yys;

    if ((yys = getenv("YYDEBUG")))
    {
        yyn = *yys;
        if (yyn >= '0' && yyn <= '9')
            yydebug = yyn - '0';
    }
#endif

    yynerrs = 0;
    yyerrflag = 0;
    yychar = (-1);

    if (yyss == NULL && yygrowstack()) goto yyoverflow;
    yyssp = yyss;
    yyvsp = yyvs;
    *yyssp = yystate = 0;

yyloop:
    if ((yyn = yydefred[yystate])) goto yyreduce;
    if (yychar < 0)
    {
        if ((yychar = yylex()) < 0) yychar = 0;
#if YYDEBUG
        if (yydebug)
        {
            yys = 0;
            if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
            if (!yys) yys = "illegal-symbol";
            printf("%sdebug: state %d, reading %d (%s)\n",
                    YYPREFIX, yystate, yychar, yys);
        }
#endif
    }
    if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
            yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
    {
#if YYDEBUG
        if (yydebug)
            printf("%sdebug: state %d, shifting to state %d\n",
                    YYPREFIX, yystate, yytable[yyn]);
#endif
        if (yyssp >= yysslim && yygrowstack())
        {
            goto yyoverflow;
        }
        *++yyssp = yystate = yytable[yyn];
        *++yyvsp = yylval;
        yychar = (-1);
        if (yyerrflag > 0)  --yyerrflag;
        goto yyloop;
    }
    if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
            yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
    {
        yyn = yytable[yyn];
        goto yyreduce;
    }
    if (yyerrflag) goto yyinrecovery;
#if defined(lint) || defined(__GNUC__)
    goto yynewerror;
#endif
yynewerror:
    yyerror("syntax error");
#if defined(lint) || defined(__GNUC__)
    goto yyerrlab;
#endif
yyerrlab:
    ++yynerrs;
yyinrecovery:
    if (yyerrflag < 3)
    {
        yyerrflag = 3;
        for (;;)
        {
            if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
                    yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
            {
#if YYDEBUG
                if (yydebug)
                    printf("%sdebug: state %d, error recovery shifting\
 to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
#endif
                if (yyssp >= yysslim && yygrowstack())
                {
                    goto yyoverflow;
                }
                *++yyssp = yystate = yytable[yyn];
                *++yyvsp = yylval;
                goto yyloop;
            }
            else
            {
#if YYDEBUG
                if (yydebug)
                    printf("%sdebug: error recovery discarding state %d\n",
                            YYPREFIX, *yyssp);
#endif
                if (yyssp <= yyss) goto yyabort;
                --yyssp;
                --yyvsp;
            }
        }
    }
    else
    {
        if (yychar == 0) goto yyabort;
#if YYDEBUG
        if (yydebug)
        {
            yys = 0;
            if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
            if (!yys) yys = "illegal-symbol";
            printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
                    YYPREFIX, yystate, yychar, yys);
        }
#endif
        yychar = (-1);
        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];
    yyval = yyvsp[1-yym];
    switch (yyn)
    {
case 1:
#line 243 "ns_parser.y"
{
		if (EMPTY(current_controls))
			ns_ctl_defaults(&current_controls);
		ns_ctl_install(&current_controls);
	}
break;
case 16:
#line 268 "ns_parser.y"
{ lexer_begin_file(yyvsp[-1].cp, NULL); }
break;
case 17:
#line 276 "ns_parser.y"
{
		if (seen_options)
			parser_error(0, "cannot redefine options");
		current_options = new_options();
	}
break;
case 18:
#line 282 "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 298 "ns_parser.y"
{
		if (current_options->version != NULL)
			freestr(current_options->version);
		current_options->version = yyvsp[0].cp;
	}
break;
case 23:
#line 304 "ns_parser.y"
{
		if (current_options->directory != NULL)
			freestr(current_options->directory);
		current_options->directory = yyvsp[0].cp;
	}
break;
case 24:
#line 310 "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 316 "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 322 "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 328 "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 334 "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 340 "ns_parser.y"
{
		set_global_boolean_option(current_options,
			OPTION_FAKE_IQUERY, yyvsp[0].num);
	}
break;
case 30:
#line 345 "ns_parser.y"
{
		set_global_boolean_option(current_options,
			OPTION_NORECURSE, !yyvsp[0].num);
	}
break;
case 31:
#line 350 "ns_parser.y"
{
		set_global_boolean_option(current_options,
			OPTION_NOFETCHGLUE, !yyvsp[0].num);
	}
break;
case 32:
#line 355 "ns_parser.y"
{
		set_global_boolean_option(current_options, 
			OPTION_HITCOUNT, yyvsp[0].num);
	}
break;
case 33:
#line 360 "ns_parser.y"
{
		set_global_boolean_option(current_options, 
			OPTION_NONOTIFY, !yyvsp[0].num);
	}
break;
case 34:
#line 365 "ns_parser.y"
{
		set_global_boolean_option(current_options,
			OPTION_HOSTSTATS, yyvsp[0].num);
	}
break;
case 35:
#line 370 "ns_parser.y"
{
		set_global_boolean_option(current_options,
			OPTION_DEALLOC_ON_EXIT, yyvsp[0].num);
	}
break;
case 36:
#line 375 "ns_parser.y"
{
		set_global_boolean_option(current_options, OPTION_USE_IXFR, yyvsp[0].num);
	}
break;
case 37:
#line 379 "ns_parser.y"
{
		set_global_boolean_option(current_options,
					  OPTION_MAINTAIN_IXFR_BASE, yyvsp[0].num);
	}
break;
case 38:
#line 384 "ns_parser.y"
{
		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 39:
#line 391 "ns_parser.y"
{
		set_global_boolean_option(current_options, OPTION_NONAUTH_NXDOMAIN,
				   !yyvsp[0].num);
	}
break;
case 40:
#line 396 "ns_parser.y"
{
		set_global_boolean_option(current_options,
			OPTION_MULTIPLE_CNAMES, yyvsp[0].num);
	}
break;
case 41:
#line 401 "ns_parser.y"
{
		current_options->check_names[yyvsp[-1].s_int] = (enum severity)yyvsp[0].s_int;
	}
break;
case 42:
#line 405 "ns_parser.y"
{
		set_global_boolean_option(current_options,
					  OPTION_USE_ID_POOL, yyvsp[0].num);
	}
break;
case 43:
#line 410 "ns_parser.y"
{
		set_global_boolean_option(current_options,
                        		  OPTION_NORFC2308_TYPE1, !yyvsp[0].num);
	}
break;
case 44:
#line 415 "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 46:
#line 434 "ns_parser.y"
{
		if (current_options->fwdtab) {
			free_forwarders(current_options->fwdtab);
			current_options->fwdtab = NULL;
		}
	}
break;
case 49:
#line 443 "ns_parser.y"
{
		current_options->axfr_src = yyvsp[0].ip_addr;
	}
break;
case 50:
#line 447 "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 51:
#line 456 "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 52:
#line 465 "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 53:
#line 474 "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 54:
#line 483 "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 56:
#line 493 "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 57:
#line 502 "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 58:
#line 511 "ns_parser.y"
{
		/* To get around the $$ = $1 default rule. */
	}
break;
case 60:
#line 516 "ns_parser.y"
{
		current_options->transfer_format = yyvsp[0].axfr_fmt;
	}
break;
case 61:
#line 520 "ns_parser.y"
{
		current_options->max_transfer_time_in = yyvsp[0].num * 60;
	}
break;
case 62:
#line 524 "ns_parser.y"
{
		current_options->serial_queries = yyvsp[0].num;
	}
break;
case 63:
#line 528 "ns_parser.y"
{
		current_options->clean_interval = yyvsp[0].num * 60;
	}
break;
case 64:
#line 532 "ns_parser.y"
{
		current_options->interface_interval = yyvsp[0].num * 60;
	}
break;
case 65:
#line 536 "ns_parser.y"
{
		current_options->stats_interval = yyvsp[0].num * 60;
	}
break;
case 66:
#line 540 "ns_parser.y"
{
		current_options->max_host_stats = yyvsp[0].num;
	}
break;
case 67:
#line 544 "ns_parser.y"
{
		current_options->max_log_size_ixfr = yyvsp[0].ul_int;
	}
break;
case 68:
#line 548 "ns_parser.y"
{
		current_options->max_ncache_ttl = yyvsp[0].num;
	}
break;
case 69:
#line 552 "ns_parser.y"
{
		current_options->lame_ttl = yyvsp[0].num;
	}
break;
case 70:
#line 556 "ns_parser.y"
{
		current_options->heartbeat_interval = yyvsp[0].num * 60;
	}
break;
case 71:
#line 560 "ns_parser.y"
{
		set_global_boolean_option(current_options,
                                          OPTION_NODIALUP, !yyvsp[0].num);
	}
break;
case 72:
#line 565 "ns_parser.y"
{
		if (current_options->ordering)
			free_rrset_order_list(current_options->ordering);
		current_options->ordering = yyvsp[-1].rol;
	}
break;
case 73:
#line 571 "ns_parser.y"
{
		set_global_boolean_option(current_options,
					  OPTION_TREAT_CR_AS_SPACE, yyvsp[0].num);
	}
break;
case 74:
#line 576 "ns_parser.y"
{
		if (yyvsp[0].num >= 1)
			current_options->minroots = yyvsp[0].num;
	}
break;
case 80:
#line 596 "ns_parser.y"
{
		ns_ctl_add(&current_controls, ns_ctl_new_inet(yyvsp[-6].ip_addr, yyvsp[-4].us_int, yyvsp[-1].iml));
	}
break;
case 81:
#line 600 "ns_parser.y"
{
#ifndef NO_SOCKADDR_UN
		ns_ctl_add(&current_controls, ns_ctl_new_unix(yyvsp[-6].cp, yyvsp[-4].num, yyvsp[-2].num, yyvsp[0].num));
#endif
	}
break;
case 83:
#line 609 "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 84:
#line 620 "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 85:
#line 629 "ns_parser.y"
{
		yyval.s_int = C_ANY;
	}
break;
case 86:
#line 633 "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 87:
#line 647 "ns_parser.y"
{
		yyval.s_int = ns_t_any;
	}
break;
case 88:
#line 651 "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 89:
#line 669 "ns_parser.y"
{
		yyval.cp = savestr("*", 1);
	}
break;
case 90:
#line 673 "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 91:
#line 685 "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 92:
#line 708 "ns_parser.y"
{
		yyval.axfr_fmt = axfr_one_answer;
	}
break;
case 93:
#line 712 "ns_parser.y"
{
		yyval.axfr_fmt = axfr_many_answers;
	}
break;
case 94:
#line 717 "ns_parser.y"
{ yyval.ip_addr = yyvsp[0].ip_addr; }
break;
case 95:
#line 718 "ns_parser.y"
{ yyval.ip_addr.s_addr = htonl(INADDR_ANY); }
break;
case 96:
#line 721 "ns_parser.y"
{ yyval.us_int = yyvsp[0].us_int; }
break;
case 97:
#line 722 "ns_parser.y"
{ yyval.us_int = htons(0); }
break;
case 98:
#line 726 "ns_parser.y"
{
		current_options->query_source.sin_addr = yyvsp[0].ip_addr;
	}
break;
case 99:
#line 732 "ns_parser.y"
{
		current_options->query_source.sin_port = yyvsp[0].us_int;
	}
break;
case 104:
#line 743 "ns_parser.y"
{ yyval.us_int = htons(NS_DEFAULTPORT); }
break;
case 105:
#line 744 "ns_parser.y"
{ yyval.us_int = yyvsp[0].us_int; }
break;
case 106:
#line 747 "ns_parser.y"
{ yyval.us_int = htons(0); }
break;
case 107:
#line 748 "ns_parser.y"
{ yyval.us_int = yyvsp[0].us_int; }
break;
case 108:
#line 753 "ns_parser.y"
{ 
		yyval.num = 1;	
	}
break;
case 109:
#line 757 "ns_parser.y"
{ 
		yyval.num = 1;	
	}
break;
case 110:
#line 761 "ns_parser.y"
{ 
		yyval.num = 0;	
	}
break;
case 111:
#line 765 "ns_parser.y"
{ 
		yyval.num = 0;	
	}
break;
case 112:
#line 769 "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 113:
#line 781 "ns_parser.y"
{
		yyval.s_int = primary_trans;
	}
break;
case 114:
#line 785 "ns_parser.y"
{
		yyval.s_int = secondary_trans;
	}
break;
case 115:
#line 789 "ns_parser.y"
{
		yyval.s_int = response_trans;
	}
break;
case 116:
#line 795 "ns_parser.y"
{
		yyval.s_int = warn;
	}
break;
case 117:
#line 799 "ns_parser.y"
{
		yyval.s_int = fail;
	}
break;
case 118:
#line 803 "ns_parser.y"
{
		yyval.s_int = ignore;
	}
break;
case 119:
#line 809 "ns_parser.y"
{
		set_global_boolean_option(current_options,
			OPTION_FORWARD_ONLY, 1);
	}
break;
case 120:
#line 814 "ns_parser.y"
{
		set_global_boolean_option(current_options,
			OPTION_FORWARD_ONLY, 0);
	}
break;
case 121:
#line 819 "ns_parser.y"
{
		parser_warning(0, "forward if-no-answer is unimplemented");
	}
break;
case 122:
#line 823 "ns_parser.y"
{
		parser_warning(0, "forward if-no-domain is unimplemented");
	}
break;
case 123:
#line 829 "ns_parser.y"
{
		current_options->data_size = yyvsp[0].ul_int;
	}
break;
case 124:
#line 833 "ns_parser.y"
{
		current_options->stack_size = yyvsp[0].ul_int;
	}
break;
case 125:
#line 837 "ns_parser.y"
{
		current_options->core_size = yyvsp[0].ul_int;
	}
break;
case 126:
#line 841 "ns_parser.y"
{
		current_options->files = yyvsp[0].ul_int;
	}
break;
case 127:
#line 847 "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 128:
#line 860 "ns_parser.y"
{	
		yyval.ul_int = (u_long)yyvsp[0].num;
	}
break;
case 129:
#line 864 "ns_parser.y"
{
		yyval.ul_int = 0;
	}
break;
case 130:
#line 868 "ns_parser.y"
{
		yyval.ul_int = ULONG_MAX;
	}
break;
case 131:
#line 874 "ns_parser.y"
{
		current_options->transfers_in = (u_long) yyvsp[0].num;
	}
break;
case 132:
#line 878 "ns_parser.y"
{
		current_options->transfers_out = (u_long) yyvsp[0].num;
	}
break;
case 133:
#line 882 "ns_parser.y"
{
		current_options->transfers_per_ns = (u_long) yyvsp[0].num;
	}
break;
case 136:
#line 892 "ns_parser.y"
{
		/* nothing */
	}
break;
case 137:
#line 896 "ns_parser.y"
{
		/* nothing */
	}
break;
case 138:
#line 902 "ns_parser.y"
{
	  	add_global_forwarder(current_options, yyvsp[0].ip_addr);
	}
break;
case 141:
#line 912 "ns_parser.y"
{
		/* nothing */
	}
break;
case 142:
#line 916 "ns_parser.y"
{
		/* nothing */
	}
break;
case 143:
#line 922 "ns_parser.y"
{
	  	add_global_also_notify(current_options, yyvsp[0].ip_addr);
	}
break;
case 144:
#line 932 "ns_parser.y"
{
		current_logging = begin_logging();
	}
break;
case 145:
#line 936 "ns_parser.y"
{
		end_logging(current_logging, 1);
		current_logging = NULL;
	}
break;
case 149:
#line 948 "ns_parser.y"
{
		current_category = yyvsp[0].s_int;
	}
break;
case 151:
#line 953 "ns_parser.y"
{
		chan_type = log_null;
		chan_flags = 0;
		chan_level = log_info;
	}
break;
case 152:
#line 959 "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);
				log_set_file_owner(current_channel,
						   user_id, group_id);
				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 153:
#line 1002 "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 154:
#line 1014 "ns_parser.y"
{
		chan_level = log_debug(1);
	}
break;
case 155:
#line 1018 "ns_parser.y"
{
		chan_level = yyvsp[0].num;
	}
break;
case 156:
#line 1022 "ns_parser.y"
{
		chan_level = 0;
		chan_flags |= LOG_USE_CONTEXT_LEVEL|LOG_REQUIRE_DEBUG;
	}
break;
case 157:
#line 1029 "ns_parser.y"
{
		chan_versions = yyvsp[0].num;
	}
break;
case 158:
#line 1033 "ns_parser.y"
{
		chan_versions = LOG_MAX_VERSIONS;
	}
break;
case 159:
#line 1039 "ns_parser.y"
{
		chan_max_size = yyvsp[0].ul_int;
	}
break;
case 160:
#line 1045 "ns_parser.y"
{
		chan_versions = 0;
		chan_max_size = ULONG_MAX;
	}
break;
case 161:
#line 1050 "ns_parser.y"
{
		chan_max_size = ULONG_MAX;
	}
break;
case 162:
#line 1054 "ns_parser.y"
{
		chan_versions = 0;
	}
break;
case 165:
#line 1062 "ns_parser.y"
{
		chan_flags |= LOG_CLOSE_STREAM;
		chan_type = log_file;
		chan_name = yyvsp[-1].cp;
	}
break;
case 166:
#line 1070 "ns_parser.y"
{ yyval.cp = yyvsp[0].cp; }
break;
case 167:
#line 1071 "ns_parser.y"
{ yyval.cp = savestr("syslog", 1); }
break;
case 168:
#line 1074 "ns_parser.y"
{ yyval.s_int = LOG_DAEMON; }
break;
case 169:
#line 1076 "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 170:
#line 1090 "ns_parser.y"
{
		chan_type = log_syslog;
		chan_facility = yyvsp[0].s_int;
	}
break;
case 171:
#line 1096 "ns_parser.y"
{ /* nothing to do */ }
break;
case 172:
#line 1097 "ns_parser.y"
{ /* nothing to do */ }
break;
case 173:
#line 1099 "ns_parser.y"
{
		chan_type = log_null;
	}
break;
case 174:
#line 1102 "ns_parser.y"
{ /* nothing to do */ }
break;
case 175:
#line 1104 "ns_parser.y"
{
		if (yyvsp[0].num)
			chan_flags |= LOG_TIMESTAMP;
		else
			chan_flags &= ~LOG_TIMESTAMP;
	}
break;
case 176:
#line 1111 "ns_parser.y"
{
		if (yyvsp[0].num)
			chan_flags |= LOG_PRINT_CATEGORY;
		else
			chan_flags &= ~LOG_PRINT_CATEGORY;
	}
break;
case 177:
#line 1118 "ns_parser.y"
{
		if (yyvsp[0].num)
			chan_flags |= LOG_PRINT_LEVEL;
		else
			chan_flags &= ~LOG_PRINT_LEVEL;
	}
break;
case 182:
#line 1132 "ns_parser.y"
{ yyval.cp = savestr("null", 1); }
break;
case 183:
#line 1136 "ns_parser.y"
{
		log_channel channel;

		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 188:
#line 1157 "ns_parser.y"
{ yyval.cp = savestr("default", 1); }
break;
case 189:
#line 1158 "ns_parser.y"
{ yyval.cp = savestr("notify", 1); }
break;
case 190:
#line 1162 "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 191:
#line 1181 "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 192:
#line 1201 "ns_parser.y"
{
		end_server(current_server, !seen_server);
	}
break;
case 195:
#line 1211 "ns_parser.y"
{
		set_server_option(current_server, SERVER_INFO_BOGUS, yyvsp[0].num);
	}
break;
case 196:
#line 1215 "ns_parser.y"
{
		set_server_option(current_server, SERVER_INFO_SUPPORT_IXFR, yyvsp[0].num);
	}
break;
case 197:
#line 1219 "ns_parser.y"
{
		set_server_transfers(current_server, (int)yyvsp[0].num);
	}
break;
case 198:
#line 1223 "ns_parser.y"
{
		set_server_transfer_format(current_server, yyvsp[0].axfr_fmt);
	}
break;
case 201:
#line 1235 "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 202:
#line 1244 "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 204:
#line 1253 "ns_parser.y"
{
		if (yyvsp[0].ime != NULL)
			ip_match_negate(yyvsp[0].ime);
		yyval.ime = yyvsp[0].ime;
	}
break;
case 205:
#line 1259 "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 206:
#line 1280 "ns_parser.y"
{
		yyval.ime = new_ip_match_pattern(yyvsp[0].ip_addr, 32);
	}
break;
case 207:
#line 1284 "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 208:
#line 1296 "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 210:
#line 1318 "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 211:
#line 1332 "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 212:
#line 1350 "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 213:
#line 1373 "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 217:
#line 1387 "ns_parser.y"
{
		current_algorithm = NULL;
		current_secret = NULL;
	}
break;
case 218:
#line 1392 "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 219:
#line 1428 "ns_parser.y"
{
		current_algorithm = yyvsp[-1].cp;
		current_secret = yyvsp[0].cp;
	}
break;
case 220:
#line 1433 "ns_parser.y"
{
		current_algorithm = yyvsp[0].cp;
		current_secret = yyvsp[-1].cp;
	}
break;
case 221:
#line 1438 "ns_parser.y"
{
		current_algorithm = NULL;
		current_secret = NULL;
	}
break;
case 222:
#line 1444 "ns_parser.y"
{ yyval.cp = yyvsp[-1].cp; }
break;
case 223:
#line 1447 "ns_parser.y"
{ yyval.cp = yyvsp[-1].cp; }
break;
case 224:
#line 1455 "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 225:
#line 1469 "ns_parser.y"
{
		int sym_type;
		symbol_value value;
		char *zone_name;

		if (!seen_options && !logged_options_error) {
			parser_error(0,
             "no options statement before first zone; using previous/default");
			logged_options_error = 1;
		}
		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 226:
#line 1505 "ns_parser.y"
{
		end_zone(current_zone, should_install);
	}
break;
case 229:
#line 1515 "ns_parser.y"
{
		yyval.num = C_IN;
	}
break;
case 230:
#line 1519 "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 231:
#line 1533 "ns_parser.y"
{
		yyval.s_int = Z_MASTER;
	}
break;
case 232:
#line 1537 "ns_parser.y"
{
		yyval.s_int = Z_SLAVE;
	}
break;
case 233:
#line 1541 "ns_parser.y"
{
		yyval.s_int = Z_HINT;
	}
break;
case 234:
#line 1545 "ns_parser.y"
{
		yyval.s_int = Z_STUB;
	}
break;
case 235:
#line 1549 "ns_parser.y"
{
		yyval.s_int = Z_FORWARD;
	}
break;
case 238:
#line 1559 "ns_parser.y"
{
		if (!set_zone_type(current_zone, yyvsp[0].s_int))
			parser_warning(0, "zone type already set; skipping");
	}
break;
case 239:
#line 1564 "ns_parser.y"
{
		if (!set_zone_filename(current_zone, yyvsp[0].cp))
			parser_warning(0,
				       "zone filename already set; skipping");
	}
break;
case 240:
#line 1570 "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 241:
#line 1576 "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 242:
#line 1582 "ns_parser.y"
{
		set_zone_master_port(current_zone, yyvsp[-3].us_int);
	}
break;
case 243:
#line 1586 "ns_parser.y"
{
		set_zone_transfer_source(current_zone, yyvsp[0].ip_addr);
	}
break;
case 244:
#line 1590 "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 245:
#line 1596 "ns_parser.y"
{
		if (!set_zone_update_acl(current_zone, yyvsp[-1].iml))
			parser_warning(0,
				      "zone update acl already set; skipping");
	}
break;
case 246:
#line 1602 "ns_parser.y"
{
		if (!set_zone_query_acl(current_zone, yyvsp[-1].iml))
			parser_warning(0,
				      "zone query acl already set; skipping");
	}
break;
case 247:
#line 1608 "ns_parser.y"
{
		if (!set_zone_transfer_acl(current_zone, yyvsp[-1].iml))
			parser_warning(0,
				    "zone transfer acl already set; skipping");
	}
break;
case 249:
#line 1615 "ns_parser.y"
{
		struct zoneinfo *zp = current_zone.opaque;
		if (zp->z_fwdtab) {
                	free_forwarders(zp->z_fwdtab);
			zp->z_fwdtab = NULL;
		}

	}
break;
case 251:
#line 1625 "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 252:
#line 1631 "ns_parser.y"
{
		set_zone_max_log_size_ixfr(current_zone, yyvsp[0].ul_int);
        }
break;
case 253:
#line 1635 "ns_parser.y"
{
		set_zone_notify(current_zone, yyvsp[0].num);
	}
break;
case 254:
#line 1639 "ns_parser.y"
{
		set_zone_maintain_ixfr_base(current_zone, yyvsp[0].num);
	}
break;
case 255:
#line 1643 "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 256:
#line 1648 "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 258:
#line 1660 "ns_parser.y"
{
		 set_zone_dialup(current_zone, yyvsp[0].num);
	}
break;
case 260:
#line 1667 "ns_parser.y"
{
		/* nothing */
	}
break;
case 261:
#line 1671 "ns_parser.y"
{
		/* nothing */
	}
break;
case 262:
#line 1677 "ns_parser.y"
{
	  	add_zone_master(current_zone, yyvsp[0].ip_addr);
	}
break;
case 265:
#line 1687 "ns_parser.y"
{
		/* nothing */
	}
break;
case 266:
#line 1691 "ns_parser.y"
{
		/* nothing */
	}
break;
case 267:
#line 1697 "ns_parser.y"
{
	  	add_zone_notify(current_zone, yyvsp[0].ip_addr);
	}
break;
case 268:
#line 1703 "ns_parser.y"
{
		set_zone_boolean_option(current_zone, OPTION_FORWARD_ONLY, 1);
	}
break;
case 269:
#line 1707 "ns_parser.y"
{
		set_zone_boolean_option(current_zone, OPTION_FORWARD_ONLY, 0);
	}
break;
case 270:
#line 1713 "ns_parser.y"
{
		set_zone_forward(current_zone);
	}
break;
case 272:
#line 1720 "ns_parser.y"
{
		/* nothing */
	}
break;
case 273:
#line 1724 "ns_parser.y"
{
		/* nothing */
	}
break;
case 274:
#line 1730 "ns_parser.y"
{
	  	add_zone_forwarder(current_zone, yyvsp[0].ip_addr);
	}
break;
case 275:
#line 1740 "ns_parser.y"
{
	}
break;
case 276:
#line 1744 "ns_parser.y"
{
		/* nothing */
	}
break;
case 277:
#line 1748 "ns_parser.y"
{
		/* nothing */
	}
break;
case 278:
#line 1753 "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 279:
#line 1758 "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 280:
#line 1774 "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 3121 "y.tab.c"
    }
    yyssp -= yym;
    yystate = *yyssp;
    yyvsp -= yym;
    yym = yylhs[yyn];
    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;
        *++yyssp = YYFINAL;
        *++yyvsp = yyval;
        if (yychar < 0)
        {
            if ((yychar = yylex()) < 0) yychar = 0;
#if YYDEBUG
            if (yydebug)
            {
                yys = 0;
                if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
                if (!yys) yys = "illegal-symbol";
                printf("%sdebug: state %d, reading %d (%s)\n",
                        YYPREFIX, YYFINAL, yychar, yys);
            }
#endif
        }
        if (yychar == 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, *yyssp, yystate);
#endif
    if (yyssp >= yysslim && yygrowstack())
    {
        goto yyoverflow;
    }
    *++yyssp = yystate;
    *++yyvsp = yyval;
    goto yyloop;
yyoverflow:
    yyerror("yacc stack overflow");
yyabort:
    return (1);
yyaccept:
    return (0);
}
