1 /* A Bison parser, made by GNU Bison 3.0.4. */ 2 3 /* Bison implementation for Yacc-like parsers in C 4 5 Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. 6 7 This program is free software: you can redistribute it and/or modify 8 it under the terms of the GNU General Public License as published by 9 the Free Software Foundation, either version 3 of the License, or 10 (at your option) any later version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 19 20 /* As a special exception, you may create a larger work that contains 21 part or all of the Bison parser skeleton and distribute that work 22 under terms of your choice, so long as that work isn't itself a 23 parser generator using the skeleton or a modified version thereof 24 as a parser skeleton. Alternatively, if you modify or redistribute 25 the parser skeleton itself, you may (at your option) remove this 26 special exception, which will cause the skeleton and the resulting 27 Bison output files to be licensed under the GNU General Public 28 License without this special exception. 29 30 This special exception was added by the Free Software Foundation in 31 version 2.2 of Bison. */ 32 33 /* C LALR(1) parser skeleton written by Richard Stallman, by 34 simplifying the original so-called "semantic" parser. */ 35 36 /* All symbols defined below should begin with yy or YY, to avoid 37 infringing on user name space. This should be done even for local 38 variables, as they might otherwise be expanded by user macros. 39 There are some unavoidable exceptions within include files to 40 define necessary library symbols; they are noted "INFRINGES ON 41 USER NAME SPACE" below. */ 42 43 /* Identify Bison output. */ 44 #define YYBISON 1 45 46 /* Bison version. */ 47 #define YYBISON_VERSION "3.0.4" 48 49 /* Skeleton name. */ 50 #define YYSKELETON_NAME "yacc.c" 51 52 /* Pure parsers. */ 53 #define YYPURE 0 54 55 /* Push parsers. */ 56 #define YYPUSH 0 57 58 /* Pull parsers. */ 59 #define YYPULL 1 60 61 62 63 64 /* Copy the first part of user declarations. */ 65 #line 10 "configparser.y" /* yacc.c:339 */ 66 67 #include "config.h" 68 69 #include <stdarg.h> 70 #include <stdio.h> 71 #include <string.h> 72 #include <stdlib.h> 73 #include <assert.h> 74 75 #include "options.h" 76 #include "util.h" 77 #include "dname.h" 78 #include "tsig.h" 79 #include "rrl.h" 80 #include "configyyrename.h" 81 int c_lex(void); 82 void c_error(const char *message); 83 84 #ifdef __cplusplus 85 extern "C" 86 #endif /* __cplusplus */ 87 88 /* these need to be global, otherwise they cannot be used inside yacc */ 89 extern config_parser_state_type* cfg_parser; 90 91 #if 0 92 #define OUTYY(s) printf s /* used ONLY when debugging */ 93 #else 94 #define OUTYY(s) 95 #endif 96 97 98 #line 99 "configparser.c" /* yacc.c:339 */ 99 100 # ifndef YY_NULLPTR 101 # if defined __cplusplus && 201103L <= __cplusplus 102 # define YY_NULLPTR nullptr 103 # else 104 # define YY_NULLPTR 0 105 # endif 106 # endif 107 108 /* Enabling verbose error messages. */ 109 #ifdef YYERROR_VERBOSE 110 # undef YYERROR_VERBOSE 111 # define YYERROR_VERBOSE 1 112 #else 113 # define YYERROR_VERBOSE 0 114 #endif 115 116 /* In a future release of Bison, this section will be replaced 117 by #include "configparser.h". */ 118 #ifndef YY_YY_CONFIGPARSER_H_INCLUDED 119 # define YY_YY_CONFIGPARSER_H_INCLUDED 120 /* Debug traces. */ 121 #ifndef YYDEBUG 122 # define YYDEBUG 0 123 #endif 124 #if YYDEBUG 125 extern int yydebug; 126 #endif 127 128 /* Token type. */ 129 #ifndef YYTOKENTYPE 130 # define YYTOKENTYPE 131 enum yytokentype 132 { 133 SPACE = 258, 134 LETTER = 259, 135 NEWLINE = 260, 136 COMMENT = 261, 137 COLON = 262, 138 ANY = 263, 139 ZONESTR = 264, 140 STRING = 265, 141 VAR_SERVER = 266, 142 VAR_NAME = 267, 143 VAR_IP_ADDRESS = 268, 144 VAR_IP_TRANSPARENT = 269, 145 VAR_DEBUG_MODE = 270, 146 VAR_IP4_ONLY = 271, 147 VAR_IP6_ONLY = 272, 148 VAR_DATABASE = 273, 149 VAR_IDENTITY = 274, 150 VAR_NSID = 275, 151 VAR_LOGFILE = 276, 152 VAR_SERVER_COUNT = 277, 153 VAR_TCP_COUNT = 278, 154 VAR_PIDFILE = 279, 155 VAR_PORT = 280, 156 VAR_STATISTICS = 281, 157 VAR_CHROOT = 282, 158 VAR_USERNAME = 283, 159 VAR_ZONESDIR = 284, 160 VAR_XFRDFILE = 285, 161 VAR_DIFFFILE = 286, 162 VAR_XFRD_RELOAD_TIMEOUT = 287, 163 VAR_TCP_QUERY_COUNT = 288, 164 VAR_TCP_TIMEOUT = 289, 165 VAR_IPV4_EDNS_SIZE = 290, 166 VAR_IPV6_EDNS_SIZE = 291, 167 VAR_DO_IP4 = 292, 168 VAR_DO_IP6 = 293, 169 VAR_TCP_MSS = 294, 170 VAR_OUTGOING_TCP_MSS = 295, 171 VAR_IP_FREEBIND = 296, 172 VAR_ZONEFILE = 297, 173 VAR_ZONE = 298, 174 VAR_ALLOW_NOTIFY = 299, 175 VAR_REQUEST_XFR = 300, 176 VAR_NOTIFY = 301, 177 VAR_PROVIDE_XFR = 302, 178 VAR_SIZE_LIMIT_XFR = 303, 179 VAR_NOTIFY_RETRY = 304, 180 VAR_OUTGOING_INTERFACE = 305, 181 VAR_ALLOW_AXFR_FALLBACK = 306, 182 VAR_KEY = 307, 183 VAR_ALGORITHM = 308, 184 VAR_SECRET = 309, 185 VAR_AXFR = 310, 186 VAR_UDP = 311, 187 VAR_VERBOSITY = 312, 188 VAR_HIDE_VERSION = 313, 189 VAR_PATTERN = 314, 190 VAR_INCLUDEPATTERN = 315, 191 VAR_ZONELISTFILE = 316, 192 VAR_REMOTE_CONTROL = 317, 193 VAR_CONTROL_ENABLE = 318, 194 VAR_CONTROL_INTERFACE = 319, 195 VAR_CONTROL_PORT = 320, 196 VAR_SERVER_KEY_FILE = 321, 197 VAR_SERVER_CERT_FILE = 322, 198 VAR_CONTROL_KEY_FILE = 323, 199 VAR_CONTROL_CERT_FILE = 324, 200 VAR_XFRDIR = 325, 201 VAR_RRL_SIZE = 326, 202 VAR_RRL_RATELIMIT = 327, 203 VAR_RRL_SLIP = 328, 204 VAR_RRL_IPV4_PREFIX_LENGTH = 329, 205 VAR_RRL_IPV6_PREFIX_LENGTH = 330, 206 VAR_RRL_WHITELIST_RATELIMIT = 331, 207 VAR_RRL_WHITELIST = 332, 208 VAR_ZONEFILES_CHECK = 333, 209 VAR_ZONEFILES_WRITE = 334, 210 VAR_LOG_TIME_ASCII = 335, 211 VAR_ROUND_ROBIN = 336, 212 VAR_ZONESTATS = 337, 213 VAR_REUSEPORT = 338, 214 VAR_VERSION = 339, 215 VAR_MAX_REFRESH_TIME = 340, 216 VAR_MIN_REFRESH_TIME = 341, 217 VAR_MAX_RETRY_TIME = 342, 218 VAR_MIN_RETRY_TIME = 343, 219 VAR_MULTI_MASTER_CHECK = 344, 220 VAR_MINIMAL_RESPONSES = 345 221 }; 222 #endif 223 /* Tokens. */ 224 #define SPACE 258 225 #define LETTER 259 226 #define NEWLINE 260 227 #define COMMENT 261 228 #define COLON 262 229 #define ANY 263 230 #define ZONESTR 264 231 #define STRING 265 232 #define VAR_SERVER 266 233 #define VAR_NAME 267 234 #define VAR_IP_ADDRESS 268 235 #define VAR_IP_TRANSPARENT 269 236 #define VAR_DEBUG_MODE 270 237 #define VAR_IP4_ONLY 271 238 #define VAR_IP6_ONLY 272 239 #define VAR_DATABASE 273 240 #define VAR_IDENTITY 274 241 #define VAR_NSID 275 242 #define VAR_LOGFILE 276 243 #define VAR_SERVER_COUNT 277 244 #define VAR_TCP_COUNT 278 245 #define VAR_PIDFILE 279 246 #define VAR_PORT 280 247 #define VAR_STATISTICS 281 248 #define VAR_CHROOT 282 249 #define VAR_USERNAME 283 250 #define VAR_ZONESDIR 284 251 #define VAR_XFRDFILE 285 252 #define VAR_DIFFFILE 286 253 #define VAR_XFRD_RELOAD_TIMEOUT 287 254 #define VAR_TCP_QUERY_COUNT 288 255 #define VAR_TCP_TIMEOUT 289 256 #define VAR_IPV4_EDNS_SIZE 290 257 #define VAR_IPV6_EDNS_SIZE 291 258 #define VAR_DO_IP4 292 259 #define VAR_DO_IP6 293 260 #define VAR_TCP_MSS 294 261 #define VAR_OUTGOING_TCP_MSS 295 262 #define VAR_IP_FREEBIND 296 263 #define VAR_ZONEFILE 297 264 #define VAR_ZONE 298 265 #define VAR_ALLOW_NOTIFY 299 266 #define VAR_REQUEST_XFR 300 267 #define VAR_NOTIFY 301 268 #define VAR_PROVIDE_XFR 302 269 #define VAR_SIZE_LIMIT_XFR 303 270 #define VAR_NOTIFY_RETRY 304 271 #define VAR_OUTGOING_INTERFACE 305 272 #define VAR_ALLOW_AXFR_FALLBACK 306 273 #define VAR_KEY 307 274 #define VAR_ALGORITHM 308 275 #define VAR_SECRET 309 276 #define VAR_AXFR 310 277 #define VAR_UDP 311 278 #define VAR_VERBOSITY 312 279 #define VAR_HIDE_VERSION 313 280 #define VAR_PATTERN 314 281 #define VAR_INCLUDEPATTERN 315 282 #define VAR_ZONELISTFILE 316 283 #define VAR_REMOTE_CONTROL 317 284 #define VAR_CONTROL_ENABLE 318 285 #define VAR_CONTROL_INTERFACE 319 286 #define VAR_CONTROL_PORT 320 287 #define VAR_SERVER_KEY_FILE 321 288 #define VAR_SERVER_CERT_FILE 322 289 #define VAR_CONTROL_KEY_FILE 323 290 #define VAR_CONTROL_CERT_FILE 324 291 #define VAR_XFRDIR 325 292 #define VAR_RRL_SIZE 326 293 #define VAR_RRL_RATELIMIT 327 294 #define VAR_RRL_SLIP 328 295 #define VAR_RRL_IPV4_PREFIX_LENGTH 329 296 #define VAR_RRL_IPV6_PREFIX_LENGTH 330 297 #define VAR_RRL_WHITELIST_RATELIMIT 331 298 #define VAR_RRL_WHITELIST 332 299 #define VAR_ZONEFILES_CHECK 333 300 #define VAR_ZONEFILES_WRITE 334 301 #define VAR_LOG_TIME_ASCII 335 302 #define VAR_ROUND_ROBIN 336 303 #define VAR_ZONESTATS 337 304 #define VAR_REUSEPORT 338 305 #define VAR_VERSION 339 306 #define VAR_MAX_REFRESH_TIME 340 307 #define VAR_MIN_REFRESH_TIME 341 308 #define VAR_MAX_RETRY_TIME 342 309 #define VAR_MIN_RETRY_TIME 343 310 #define VAR_MULTI_MASTER_CHECK 344 311 #define VAR_MINIMAL_RESPONSES 345 312 313 /* Value type. */ 314 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 315 316 union YYSTYPE 317 { 318 #line 42 "configparser.y" /* yacc.c:355 */ 319 320 char* str; 321 322 #line 323 "configparser.c" /* yacc.c:355 */ 323 }; 324 325 typedef union YYSTYPE YYSTYPE; 326 # define YYSTYPE_IS_TRIVIAL 1 327 # define YYSTYPE_IS_DECLARED 1 328 #endif 329 330 331 extern YYSTYPE yylval; 332 333 int yyparse (void); 334 335 #endif /* !YY_YY_CONFIGPARSER_H_INCLUDED */ 336 337 /* Copy the second part of user declarations. */ 338 339 #line 340 "configparser.c" /* yacc.c:358 */ 340 341 #ifdef short 342 # undef short 343 #endif 344 345 #ifdef YYTYPE_UINT8 346 typedef YYTYPE_UINT8 yytype_uint8; 347 #else 348 typedef unsigned char yytype_uint8; 349 #endif 350 351 #ifdef YYTYPE_INT8 352 typedef YYTYPE_INT8 yytype_int8; 353 #else 354 typedef signed char yytype_int8; 355 #endif 356 357 #ifdef YYTYPE_UINT16 358 typedef YYTYPE_UINT16 yytype_uint16; 359 #else 360 typedef unsigned short int yytype_uint16; 361 #endif 362 363 #ifdef YYTYPE_INT16 364 typedef YYTYPE_INT16 yytype_int16; 365 #else 366 typedef short int yytype_int16; 367 #endif 368 369 #ifndef YYSIZE_T 370 # ifdef __SIZE_TYPE__ 371 # define YYSIZE_T __SIZE_TYPE__ 372 # elif defined size_t 373 # define YYSIZE_T size_t 374 # elif ! defined YYSIZE_T 375 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 376 # define YYSIZE_T size_t 377 # else 378 # define YYSIZE_T unsigned int 379 # endif 380 #endif 381 382 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 383 384 #ifndef YY_ 385 # if defined YYENABLE_NLS && YYENABLE_NLS 386 # if ENABLE_NLS 387 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 388 # define YY_(Msgid) dgettext ("bison-runtime", Msgid) 389 # endif 390 # endif 391 # ifndef YY_ 392 # define YY_(Msgid) Msgid 393 # endif 394 #endif 395 396 #ifndef YY_ATTRIBUTE 397 # if (defined __GNUC__ \ 398 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ 399 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C 400 # define YY_ATTRIBUTE(Spec) __attribute__(Spec) 401 # else 402 # define YY_ATTRIBUTE(Spec) /* empty */ 403 # endif 404 #endif 405 406 #ifndef YY_ATTRIBUTE_PURE 407 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) 408 #endif 409 410 #ifndef YY_ATTRIBUTE_UNUSED 411 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) 412 #endif 413 414 #if !defined _Noreturn \ 415 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) 416 # if defined _MSC_VER && 1200 <= _MSC_VER 417 # define _Noreturn __declspec (noreturn) 418 # else 419 # define _Noreturn YY_ATTRIBUTE ((__noreturn__)) 420 # endif 421 #endif 422 423 /* Suppress unused-variable warnings by "using" E. */ 424 #if ! defined lint || defined __GNUC__ 425 # define YYUSE(E) ((void) (E)) 426 #else 427 # define YYUSE(E) /* empty */ 428 #endif 429 430 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ 431 /* Suppress an incorrect diagnostic about yylval being uninitialized. */ 432 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ 433 _Pragma ("GCC diagnostic push") \ 434 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ 435 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") 436 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ 437 _Pragma ("GCC diagnostic pop") 438 #else 439 # define YY_INITIAL_VALUE(Value) Value 440 #endif 441 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 442 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 443 # define YY_IGNORE_MAYBE_UNINITIALIZED_END 444 #endif 445 #ifndef YY_INITIAL_VALUE 446 # define YY_INITIAL_VALUE(Value) /* Nothing. */ 447 #endif 448 449 450 #if ! defined yyoverflow || YYERROR_VERBOSE 451 452 /* The parser invokes alloca or malloc; define the necessary symbols. */ 453 454 # ifdef YYSTACK_USE_ALLOCA 455 # if YYSTACK_USE_ALLOCA 456 # ifdef __GNUC__ 457 # define YYSTACK_ALLOC __builtin_alloca 458 # elif defined __BUILTIN_VA_ARG_INCR 459 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 460 # elif defined _AIX 461 # define YYSTACK_ALLOC __alloca 462 # elif defined _MSC_VER 463 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ 464 # define alloca _alloca 465 # else 466 # define YYSTACK_ALLOC alloca 467 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS 468 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 469 /* Use EXIT_SUCCESS as a witness for stdlib.h. */ 470 # ifndef EXIT_SUCCESS 471 # define EXIT_SUCCESS 0 472 # endif 473 # endif 474 # endif 475 # endif 476 # endif 477 478 # ifdef YYSTACK_ALLOC 479 /* Pacify GCC's 'empty if-body' warning. */ 480 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) 481 # ifndef YYSTACK_ALLOC_MAXIMUM 482 /* The OS might guarantee only one guard page at the bottom of the stack, 483 and a page size can be as small as 4096 bytes. So we cannot safely 484 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 485 to allow for a few compiler-allocated temporary stack slots. */ 486 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 487 # endif 488 # else 489 # define YYSTACK_ALLOC YYMALLOC 490 # define YYSTACK_FREE YYFREE 491 # ifndef YYSTACK_ALLOC_MAXIMUM 492 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 493 # endif 494 # if (defined __cplusplus && ! defined EXIT_SUCCESS \ 495 && ! ((defined YYMALLOC || defined malloc) \ 496 && (defined YYFREE || defined free))) 497 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 498 # ifndef EXIT_SUCCESS 499 # define EXIT_SUCCESS 0 500 # endif 501 # endif 502 # ifndef YYMALLOC 503 # define YYMALLOC malloc 504 # if ! defined malloc && ! defined EXIT_SUCCESS 505 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 506 # endif 507 # endif 508 # ifndef YYFREE 509 # define YYFREE free 510 # if ! defined free && ! defined EXIT_SUCCESS 511 void free (void *); /* INFRINGES ON USER NAME SPACE */ 512 # endif 513 # endif 514 # endif 515 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ 516 517 518 #if (! defined yyoverflow \ 519 && (! defined __cplusplus \ 520 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 521 522 /* A type that is properly aligned for any stack member. */ 523 union yyalloc 524 { 525 yytype_int16 yyss_alloc; 526 YYSTYPE yyvs_alloc; 527 }; 528 529 /* The size of the maximum gap between one aligned stack and the next. */ 530 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 531 532 /* The size of an array large to enough to hold all stacks, each with 533 N elements. */ 534 # define YYSTACK_BYTES(N) \ 535 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 536 + YYSTACK_GAP_MAXIMUM) 537 538 # define YYCOPY_NEEDED 1 539 540 /* Relocate STACK from its old location to the new one. The 541 local variables YYSIZE and YYSTACKSIZE give the old and new number of 542 elements in the stack, and YYPTR gives the new location of the 543 stack. Advance YYPTR to a properly aligned location for the next 544 stack. */ 545 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 546 do \ 547 { \ 548 YYSIZE_T yynewbytes; \ 549 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 550 Stack = &yyptr->Stack_alloc; \ 551 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 552 yyptr += yynewbytes / sizeof (*yyptr); \ 553 } \ 554 while (0) 555 556 #endif 557 558 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED 559 /* Copy COUNT objects from SRC to DST. The source and destination do 560 not overlap. */ 561 # ifndef YYCOPY 562 # if defined __GNUC__ && 1 < __GNUC__ 563 # define YYCOPY(Dst, Src, Count) \ 564 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) 565 # else 566 # define YYCOPY(Dst, Src, Count) \ 567 do \ 568 { \ 569 YYSIZE_T yyi; \ 570 for (yyi = 0; yyi < (Count); yyi++) \ 571 (Dst)[yyi] = (Src)[yyi]; \ 572 } \ 573 while (0) 574 # endif 575 # endif 576 #endif /* !YYCOPY_NEEDED */ 577 578 /* YYFINAL -- State number of the termination state. */ 579 #define YYFINAL 2 580 /* YYLAST -- Last index in YYTABLE. */ 581 #define YYLAST 187 582 583 /* YYNTOKENS -- Number of terminals. */ 584 #define YYNTOKENS 91 585 /* YYNNTS -- Number of nonterminals. */ 586 #define YYNNTS 95 587 /* YYNRULES -- Number of rules. */ 588 #define YYNRULES 178 589 /* YYNSTATES -- Number of states. */ 590 #define YYNSTATES 265 591 592 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned 593 by yylex, with out-of-bounds checking. */ 594 #define YYUNDEFTOK 2 595 #define YYMAXUTOK 345 596 597 #define YYTRANSLATE(YYX) \ 598 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 599 600 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM 601 as returned by yylex, without out-of-bounds checking. */ 602 static const yytype_uint8 yytranslate[] = 603 { 604 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 605 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 606 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 607 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 608 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 609 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 610 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 611 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 612 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 613 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 614 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 615 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 616 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 617 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 618 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 619 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 620 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 621 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 622 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 623 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 624 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 625 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 626 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 627 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 628 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 629 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 630 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 631 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 632 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 633 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 634 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 635 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 636 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 637 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 638 85, 86, 87, 88, 89, 90 639 }; 640 641 #if YYDEBUG 642 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ 643 static const yytype_uint16 yyrline[] = 644 { 645 0, 77, 77, 77, 78, 78, 79, 79, 80, 83, 646 91, 91, 92, 92, 92, 92, 93, 93, 93, 93, 647 93, 94, 94, 94, 94, 95, 95, 95, 95, 96, 648 96, 96, 97, 97, 97, 98, 98, 98, 99, 99, 649 100, 100, 101, 101, 101, 102, 102, 102, 103, 103, 650 103, 104, 104, 104, 105, 105, 105, 106, 107, 129, 651 137, 145, 153, 161, 169, 181, 193, 201, 209, 217, 652 226, 232, 238, 268, 274, 285, 296, 307, 315, 323, 653 329, 335, 343, 349, 355, 361, 367, 373, 379, 385, 654 393, 401, 409, 417, 425, 433, 441, 451, 459, 469, 655 479, 489, 497, 505, 514, 519, 520, 521, 521, 521, 656 522, 522, 522, 523, 525, 533, 541, 551, 557, 563, 657 569, 577, 611, 611, 612, 612, 613, 613, 613, 614, 658 614, 614, 615, 615, 615, 616, 616, 616, 617, 617, 659 617, 618, 618, 619, 631, 642, 679, 679, 680, 680, 660 681, 701, 710, 719, 730, 734, 742, 754, 767, 781, 661 794, 805, 816, 828, 839, 847, 857, 867, 877, 887, 662 896, 909, 909, 910, 910, 910, 911, 925, 938 663 }; 664 #endif 665 666 #if YYDEBUG || YYERROR_VERBOSE || 0 667 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 668 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 669 static const char *const yytname[] = 670 { 671 "$end", "error", "$undefined", "SPACE", "LETTER", "NEWLINE", "COMMENT", 672 "COLON", "ANY", "ZONESTR", "STRING", "VAR_SERVER", "VAR_NAME", 673 "VAR_IP_ADDRESS", "VAR_IP_TRANSPARENT", "VAR_DEBUG_MODE", "VAR_IP4_ONLY", 674 "VAR_IP6_ONLY", "VAR_DATABASE", "VAR_IDENTITY", "VAR_NSID", 675 "VAR_LOGFILE", "VAR_SERVER_COUNT", "VAR_TCP_COUNT", "VAR_PIDFILE", 676 "VAR_PORT", "VAR_STATISTICS", "VAR_CHROOT", "VAR_USERNAME", 677 "VAR_ZONESDIR", "VAR_XFRDFILE", "VAR_DIFFFILE", 678 "VAR_XFRD_RELOAD_TIMEOUT", "VAR_TCP_QUERY_COUNT", "VAR_TCP_TIMEOUT", 679 "VAR_IPV4_EDNS_SIZE", "VAR_IPV6_EDNS_SIZE", "VAR_DO_IP4", "VAR_DO_IP6", 680 "VAR_TCP_MSS", "VAR_OUTGOING_TCP_MSS", "VAR_IP_FREEBIND", "VAR_ZONEFILE", 681 "VAR_ZONE", "VAR_ALLOW_NOTIFY", "VAR_REQUEST_XFR", "VAR_NOTIFY", 682 "VAR_PROVIDE_XFR", "VAR_SIZE_LIMIT_XFR", "VAR_NOTIFY_RETRY", 683 "VAR_OUTGOING_INTERFACE", "VAR_ALLOW_AXFR_FALLBACK", "VAR_KEY", 684 "VAR_ALGORITHM", "VAR_SECRET", "VAR_AXFR", "VAR_UDP", "VAR_VERBOSITY", 685 "VAR_HIDE_VERSION", "VAR_PATTERN", "VAR_INCLUDEPATTERN", 686 "VAR_ZONELISTFILE", "VAR_REMOTE_CONTROL", "VAR_CONTROL_ENABLE", 687 "VAR_CONTROL_INTERFACE", "VAR_CONTROL_PORT", "VAR_SERVER_KEY_FILE", 688 "VAR_SERVER_CERT_FILE", "VAR_CONTROL_KEY_FILE", "VAR_CONTROL_CERT_FILE", 689 "VAR_XFRDIR", "VAR_RRL_SIZE", "VAR_RRL_RATELIMIT", "VAR_RRL_SLIP", 690 "VAR_RRL_IPV4_PREFIX_LENGTH", "VAR_RRL_IPV6_PREFIX_LENGTH", 691 "VAR_RRL_WHITELIST_RATELIMIT", "VAR_RRL_WHITELIST", 692 "VAR_ZONEFILES_CHECK", "VAR_ZONEFILES_WRITE", "VAR_LOG_TIME_ASCII", 693 "VAR_ROUND_ROBIN", "VAR_ZONESTATS", "VAR_REUSEPORT", "VAR_VERSION", 694 "VAR_MAX_REFRESH_TIME", "VAR_MIN_REFRESH_TIME", "VAR_MAX_RETRY_TIME", 695 "VAR_MIN_RETRY_TIME", "VAR_MULTI_MASTER_CHECK", "VAR_MINIMAL_RESPONSES", 696 "$accept", "toplevelvars", "toplevelvar", "serverstart", 697 "contents_server", "content_server", "server_ip_address", 698 "server_ip_transparent", "server_ip_freebind", "server_debug_mode", 699 "server_verbosity", "server_hide_version", "server_ip4_only", 700 "server_ip6_only", "server_do_ip4", "server_do_ip6", "server_reuseport", 701 "server_database", "server_identity", "server_version", "server_nsid", 702 "server_logfile", "server_log_time_ascii", "server_round_robin", 703 "server_minimal_responses", "server_server_count", "server_tcp_count", 704 "server_pidfile", "server_port", "server_statistics", "server_chroot", 705 "server_username", "server_zonesdir", "server_zonelistfile", 706 "server_xfrdir", "server_difffile", "server_xfrdfile", 707 "server_xfrd_reload_timeout", "server_tcp_query_count", 708 "server_tcp_timeout", "server_tcp_mss", "server_outgoing_tcp_mss", 709 "server_ipv4_edns_size", "server_ipv6_edns_size", "server_rrl_size", 710 "server_rrl_ratelimit", "server_rrl_slip", 711 "server_rrl_ipv4_prefix_length", "server_rrl_ipv6_prefix_length", 712 "server_rrl_whitelist_ratelimit", "server_zonefiles_check", 713 "server_zonefiles_write", "rcstart", "contents_rc", "content_rc", 714 "rc_control_enable", "rc_control_port", "rc_control_interface", 715 "rc_server_key_file", "rc_server_cert_file", "rc_control_key_file", 716 "rc_control_cert_file", "patternstart", "contents_pattern", 717 "content_pattern", "zone_config_item", "pattern_name", "include_pattern", 718 "zonestart", "contents_zone", "content_zone", "zone_name", 719 "zone_zonefile", "zone_zonestats", "zone_allow_notify", 720 "zone_request_xfr", "zone_size_limit_xfr", "zone_request_xfr_data", 721 "zone_notify", "zone_notify_retry", "zone_provide_xfr", 722 "zone_outgoing_interface", "zone_allow_axfr_fallback", 723 "zone_rrl_whitelist", "zone_max_refresh_time", "zone_min_refresh_time", 724 "zone_max_retry_time", "zone_min_retry_time", "zone_multi_master_check", 725 "keystart", "contents_key", "content_key", "key_name", "key_algorithm", 726 "key_secret", YY_NULLPTR 727 }; 728 #endif 729 730 # ifdef YYPRINT 731 /* YYTOKNUM[NUM] -- (External) token number corresponding to the 732 (internal) symbol number NUM (which must be that of a token). */ 733 static const yytype_uint16 yytoknum[] = 734 { 735 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 736 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 737 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 738 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 739 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 740 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 741 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 742 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 743 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 744 345 745 }; 746 # endif 747 748 #define YYPACT_NINF -34 749 750 #define yypact_value_is_default(Yystate) \ 751 (!!((Yystate) == (-34))) 752 753 #define YYTABLE_NINF -1 754 755 #define yytable_value_is_error(Yytable_value) \ 756 0 757 758 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 759 STATE-NUM. */ 760 static const yytype_int16 yypact[] = 761 { 762 -34, 89, -34, -34, -34, -34, -34, -34, -34, -34, 763 -34, 34, 57, 37, -13, -33, 27, 28, 30, 19, 764 32, 33, 40, 41, 42, 43, 44, 45, 46, 54, 765 62, 63, 77, 78, 34, -34, -34, -34, -34, -34, 766 -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, 767 -34, -34, -34, -34, -34, 82, -34, 57, -34, -34, 768 83, 85, 86, 37, -34, -34, -34, -34, 87, 88, 769 99, 100, 102, 103, 104, 105, 108, 114, 115, 116, 770 117, 118, 119, 120, 121, 123, 125, 126, 127, 128, 771 130, 137, 139, 140, 142, 143, 144, 145, 146, 147, 772 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 773 158, 159, 160, 161, -34, -34, -34, -34, -34, -34, 774 -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, 775 -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, 776 -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, 777 -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, 778 -34, 162, 163, 164, 165, 166, 167, 168, -34, -34, 779 -34, -34, -34, -34, -34, -34, -34, -34, 169, 170, 780 171, 172, -34, 173, 174, -34, -34, -34, -34, -34, 781 -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, 782 -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, 783 -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, 784 -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, 785 -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, 786 -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, 787 -34, -34, -34, -34, -34, -34, -34, -34, -34, 175, 788 176, -34, -34, -34, -34 789 }; 790 791 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. 792 Performed when YYTABLE does not specify something else to do. Zero 793 means the default is an error. */ 794 static const yytype_uint8 yydefact[] = 795 { 796 2, 0, 1, 9, 145, 170, 121, 104, 3, 11, 797 106, 0, 0, 0, 4, 8, 0, 0, 0, 0, 798 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 799 0, 0, 0, 0, 7, 123, 125, 124, 134, 126, 800 136, 127, 128, 141, 129, 130, 131, 132, 133, 135, 801 137, 138, 139, 140, 142, 0, 149, 5, 147, 148, 802 0, 0, 0, 6, 172, 173, 174, 175, 0, 0, 803 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 804 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 805 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 806 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 807 0, 0, 0, 0, 10, 12, 13, 56, 14, 36, 808 37, 15, 16, 49, 50, 54, 17, 18, 55, 19, 809 20, 52, 53, 57, 21, 22, 23, 24, 25, 26, 810 27, 28, 38, 39, 29, 30, 31, 32, 33, 40, 811 41, 34, 35, 42, 43, 44, 45, 46, 47, 48, 812 51, 0, 0, 0, 0, 0, 0, 0, 105, 107, 813 109, 108, 110, 111, 112, 113, 143, 151, 0, 0, 814 0, 0, 154, 0, 0, 155, 160, 162, 163, 144, 815 164, 152, 165, 166, 167, 168, 169, 122, 150, 146, 816 176, 177, 178, 171, 58, 59, 61, 64, 65, 69, 817 70, 72, 73, 77, 78, 79, 80, 81, 82, 83, 818 84, 88, 87, 89, 90, 91, 94, 95, 66, 67, 819 92, 93, 60, 62, 63, 85, 86, 96, 97, 98, 820 99, 100, 101, 102, 103, 74, 75, 68, 71, 76, 821 114, 116, 115, 117, 118, 119, 120, 153, 156, 0, 822 0, 159, 161, 157, 158 823 }; 824 825 /* YYPGOTO[NTERM-NUM]. */ 826 static const yytype_int8 yypgoto[] = 827 { 828 -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, 829 -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, 830 -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, 831 -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, 832 -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, 833 -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, 834 -34, -34, -34, -34, 5, 29, -34, -34, -34, -34, 835 -10, -34, -34, -34, -34, -34, -34, -34, -34, -34, 836 -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, 837 -34, 124, -34, -34, -34 838 }; 839 840 /* YYDEFGOTO[NTERM-NUM]. */ 841 static const yytype_int16 yydefgoto[] = 842 { 843 -1, 1, 8, 9, 14, 114, 115, 116, 117, 118, 844 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 845 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 846 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 847 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 848 159, 160, 10, 15, 168, 169, 170, 171, 172, 173, 849 174, 175, 11, 34, 35, 36, 37, 38, 12, 57, 850 58, 59, 39, 40, 41, 42, 43, 182, 44, 45, 851 46, 47, 48, 49, 50, 51, 52, 53, 54, 13, 852 63, 64, 65, 66, 67 853 }; 854 855 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If 856 positive, shift that token. If negative, reduce the rule whose 857 number is the opposite. If YYTABLE_NINF, syntax error. */ 858 static const yytype_uint16 yytable[] = 859 { 860 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 861 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 862 88, 89, 90, 91, 92, 93, 94, 95, 96, 179, 863 161, 162, 163, 164, 165, 166, 167, 176, 177, 197, 864 178, 56, 183, 184, 97, 98, 16, 199, 99, 60, 865 185, 186, 187, 188, 189, 190, 191, 100, 101, 102, 866 103, 104, 105, 106, 192, 107, 108, 109, 110, 55, 867 111, 112, 193, 194, 180, 181, 17, 113, 18, 19, 868 20, 21, 22, 23, 24, 25, 56, 195, 196, 2, 869 61, 62, 198, 200, 26, 201, 202, 204, 205, 17, 870 3, 18, 19, 20, 21, 22, 23, 24, 25, 206, 871 207, 27, 208, 209, 210, 211, 28, 26, 212, 29, 872 30, 31, 32, 33, 213, 214, 215, 216, 217, 218, 873 219, 220, 4, 221, 27, 222, 223, 224, 225, 28, 874 226, 5, 29, 30, 31, 32, 33, 227, 6, 228, 875 229, 7, 230, 231, 232, 233, 234, 235, 236, 237, 876 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 877 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 878 258, 259, 260, 261, 262, 263, 264, 203 879 }; 880 881 static const yytype_uint8 yycheck[] = 882 { 883 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 884 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 885 33, 34, 35, 36, 37, 38, 39, 40, 41, 10, 886 63, 64, 65, 66, 67, 68, 69, 10, 10, 34, 887 10, 12, 10, 10, 57, 58, 12, 57, 61, 12, 888 10, 10, 10, 10, 10, 10, 10, 70, 71, 72, 889 73, 74, 75, 76, 10, 78, 79, 80, 81, 12, 890 83, 84, 10, 10, 55, 56, 42, 90, 44, 45, 891 46, 47, 48, 49, 50, 51, 57, 10, 10, 0, 892 53, 54, 10, 10, 60, 10, 10, 10, 10, 42, 893 11, 44, 45, 46, 47, 48, 49, 50, 51, 10, 894 10, 77, 10, 10, 10, 10, 82, 60, 10, 85, 895 86, 87, 88, 89, 10, 10, 10, 10, 10, 10, 896 10, 10, 43, 10, 77, 10, 10, 10, 10, 82, 897 10, 52, 85, 86, 87, 88, 89, 10, 59, 10, 898 10, 62, 10, 10, 10, 10, 10, 10, 10, 10, 899 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 900 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 901 10, 10, 10, 10, 10, 10, 10, 63 902 }; 903 904 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 905 symbol of state STATE-NUM. */ 906 static const yytype_uint8 yystos[] = 907 { 908 0, 92, 0, 11, 43, 52, 59, 62, 93, 94, 909 143, 153, 159, 180, 95, 144, 12, 42, 44, 45, 910 46, 47, 48, 49, 50, 51, 60, 77, 82, 85, 911 86, 87, 88, 89, 154, 155, 156, 157, 158, 163, 912 164, 165, 166, 167, 169, 170, 171, 172, 173, 174, 913 175, 176, 177, 178, 179, 12, 156, 160, 161, 162, 914 12, 53, 54, 181, 182, 183, 184, 185, 13, 14, 915 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 916 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 917 35, 36, 37, 38, 39, 40, 41, 57, 58, 61, 918 70, 71, 72, 73, 74, 75, 76, 78, 79, 80, 919 81, 83, 84, 90, 96, 97, 98, 99, 100, 101, 920 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 921 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 922 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 923 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 924 142, 63, 64, 65, 66, 67, 68, 69, 145, 146, 925 147, 148, 149, 150, 151, 152, 10, 10, 10, 10, 926 55, 56, 168, 10, 10, 10, 10, 10, 10, 10, 927 10, 10, 10, 10, 10, 10, 10, 155, 10, 161, 928 10, 10, 10, 182, 10, 10, 10, 10, 10, 10, 929 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 930 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 931 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 932 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 933 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 934 10, 10, 10, 10, 10 935 }; 936 937 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 938 static const yytype_uint8 yyr1[] = 939 { 940 0, 91, 92, 92, 93, 93, 93, 93, 93, 94, 941 95, 95, 96, 96, 96, 96, 96, 96, 96, 96, 942 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 943 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 944 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 945 96, 96, 96, 96, 96, 96, 96, 96, 97, 98, 946 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 947 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 948 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 949 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 950 139, 140, 141, 142, 143, 144, 144, 145, 145, 145, 951 145, 145, 145, 145, 146, 147, 148, 149, 150, 151, 952 152, 153, 154, 154, 155, 155, 156, 156, 156, 156, 953 156, 156, 156, 156, 156, 156, 156, 156, 156, 156, 954 156, 156, 156, 157, 158, 159, 160, 160, 161, 161, 955 162, 163, 164, 165, 166, 167, 168, 168, 168, 169, 956 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 957 180, 181, 181, 182, 182, 182, 183, 184, 185 958 }; 959 960 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ 961 static const yytype_uint8 yyr2[] = 962 { 963 0, 2, 0, 2, 2, 2, 2, 2, 2, 1, 964 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 965 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 966 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 967 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 968 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 969 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 970 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 971 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 972 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 973 2, 2, 2, 2, 1, 2, 0, 1, 1, 1, 974 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 975 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 976 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 977 1, 1, 1, 2, 2, 1, 2, 1, 1, 1, 978 2, 2, 2, 3, 2, 2, 2, 3, 3, 3, 979 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 980 1, 2, 1, 1, 1, 1, 2, 2, 2 981 }; 982 983 984 #define yyerrok (yyerrstatus = 0) 985 #define yyclearin (yychar = YYEMPTY) 986 #define YYEMPTY (-2) 987 #define YYEOF 0 988 989 #define YYACCEPT goto yyacceptlab 990 #define YYABORT goto yyabortlab 991 #define YYERROR goto yyerrorlab 992 993 994 #define YYRECOVERING() (!!yyerrstatus) 995 996 #define YYBACKUP(Token, Value) \ 997 do \ 998 if (yychar == YYEMPTY) \ 999 { \ 1000 yychar = (Token); \ 1001 yylval = (Value); \ 1002 YYPOPSTACK (yylen); \ 1003 yystate = *yyssp; \ 1004 goto yybackup; \ 1005 } \ 1006 else \ 1007 { \ 1008 yyerror (YY_("syntax error: cannot back up")); \ 1009 YYERROR; \ 1010 } \ 1011 while (0) 1012 1013 /* Error token number */ 1014 #define YYTERROR 1 1015 #define YYERRCODE 256 1016 1017 1018 1019 /* Enable debugging if requested. */ 1020 #if YYDEBUG 1021 1022 # ifndef YYFPRINTF 1023 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 1024 # define YYFPRINTF fprintf 1025 # endif 1026 1027 # define YYDPRINTF(Args) \ 1028 do { \ 1029 if (yydebug) \ 1030 YYFPRINTF Args; \ 1031 } while (0) 1032 1033 /* This macro is provided for backward compatibility. */ 1034 #ifndef YY_LOCATION_PRINT 1035 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 1036 #endif 1037 1038 1039 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 1040 do { \ 1041 if (yydebug) \ 1042 { \ 1043 YYFPRINTF (stderr, "%s ", Title); \ 1044 yy_symbol_print (stderr, \ 1045 Type, Value); \ 1046 YYFPRINTF (stderr, "\n"); \ 1047 } \ 1048 } while (0) 1049 1050 1051 /*----------------------------------------. 1052 | Print this symbol's value on YYOUTPUT. | 1053 `----------------------------------------*/ 1054 1055 static void 1056 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 1057 { 1058 FILE *yyo = yyoutput; 1059 YYUSE (yyo); 1060 if (!yyvaluep) 1061 return; 1062 # ifdef YYPRINT 1063 if (yytype < YYNTOKENS) 1064 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 1065 # endif 1066 YYUSE (yytype); 1067 } 1068 1069 1070 /*--------------------------------. 1071 | Print this symbol on YYOUTPUT. | 1072 `--------------------------------*/ 1073 1074 static void 1075 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 1076 { 1077 YYFPRINTF (yyoutput, "%s %s (", 1078 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); 1079 1080 yy_symbol_value_print (yyoutput, yytype, yyvaluep); 1081 YYFPRINTF (yyoutput, ")"); 1082 } 1083 1084 /*------------------------------------------------------------------. 1085 | yy_stack_print -- Print the state stack from its BOTTOM up to its | 1086 | TOP (included). | 1087 `------------------------------------------------------------------*/ 1088 1089 static void 1090 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) 1091 { 1092 YYFPRINTF (stderr, "Stack now"); 1093 for (; yybottom <= yytop; yybottom++) 1094 { 1095 int yybot = *yybottom; 1096 YYFPRINTF (stderr, " %d", yybot); 1097 } 1098 YYFPRINTF (stderr, "\n"); 1099 } 1100 1101 # define YY_STACK_PRINT(Bottom, Top) \ 1102 do { \ 1103 if (yydebug) \ 1104 yy_stack_print ((Bottom), (Top)); \ 1105 } while (0) 1106 1107 1108 /*------------------------------------------------. 1109 | Report that the YYRULE is going to be reduced. | 1110 `------------------------------------------------*/ 1111 1112 static void 1113 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) 1114 { 1115 unsigned long int yylno = yyrline[yyrule]; 1116 int yynrhs = yyr2[yyrule]; 1117 int yyi; 1118 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 1119 yyrule - 1, yylno); 1120 /* The symbols being reduced. */ 1121 for (yyi = 0; yyi < yynrhs; yyi++) 1122 { 1123 YYFPRINTF (stderr, " $%d = ", yyi + 1); 1124 yy_symbol_print (stderr, 1125 yystos[yyssp[yyi + 1 - yynrhs]], 1126 &(yyvsp[(yyi + 1) - (yynrhs)]) 1127 ); 1128 YYFPRINTF (stderr, "\n"); 1129 } 1130 } 1131 1132 # define YY_REDUCE_PRINT(Rule) \ 1133 do { \ 1134 if (yydebug) \ 1135 yy_reduce_print (yyssp, yyvsp, Rule); \ 1136 } while (0) 1137 1138 /* Nonzero means print parse trace. It is left uninitialized so that 1139 multiple parsers can coexist. */ 1140 int yydebug; 1141 #else /* !YYDEBUG */ 1142 # define YYDPRINTF(Args) 1143 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) 1144 # define YY_STACK_PRINT(Bottom, Top) 1145 # define YY_REDUCE_PRINT(Rule) 1146 #endif /* !YYDEBUG */ 1147 1148 1149 /* YYINITDEPTH -- initial size of the parser's stacks. */ 1150 #ifndef YYINITDEPTH 1151 # define YYINITDEPTH 200 1152 #endif 1153 1154 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 1155 if the built-in stack extension method is used). 1156 1157 Do not make this value too large; the results are undefined if 1158 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 1159 evaluated with infinite-precision integer arithmetic. */ 1160 1161 #ifndef YYMAXDEPTH 1162 # define YYMAXDEPTH 10000 1163 #endif 1164 1165 1166 #if YYERROR_VERBOSE 1167 1168 # ifndef yystrlen 1169 # if defined __GLIBC__ && defined _STRING_H 1170 # define yystrlen strlen 1171 # else 1172 /* Return the length of YYSTR. */ 1173 static YYSIZE_T 1174 yystrlen (const char *yystr) 1175 { 1176 YYSIZE_T yylen; 1177 for (yylen = 0; yystr[yylen]; yylen++) 1178 continue; 1179 return yylen; 1180 } 1181 # endif 1182 # endif 1183 1184 # ifndef yystpcpy 1185 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 1186 # define yystpcpy stpcpy 1187 # else 1188 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 1189 YYDEST. */ 1190 static char * 1191 yystpcpy (char *yydest, const char *yysrc) 1192 { 1193 char *yyd = yydest; 1194 const char *yys = yysrc; 1195 1196 while ((*yyd++ = *yys++) != '\0') 1197 continue; 1198 1199 return yyd - 1; 1200 } 1201 # endif 1202 # endif 1203 1204 # ifndef yytnamerr 1205 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary 1206 quotes and backslashes, so that it's suitable for yyerror. The 1207 heuristic is that double-quoting is unnecessary unless the string 1208 contains an apostrophe, a comma, or backslash (other than 1209 backslash-backslash). YYSTR is taken from yytname. If YYRES is 1210 null, do not copy; instead, return the length of what the result 1211 would have been. */ 1212 static YYSIZE_T 1213 yytnamerr (char *yyres, const char *yystr) 1214 { 1215 if (*yystr == '"') 1216 { 1217 YYSIZE_T yyn = 0; 1218 char const *yyp = yystr; 1219 1220 for (;;) 1221 switch (*++yyp) 1222 { 1223 case '\'': 1224 case ',': 1225 goto do_not_strip_quotes; 1226 1227 case '\\': 1228 if (*++yyp != '\\') 1229 goto do_not_strip_quotes; 1230 /* Fall through. */ 1231 default: 1232 if (yyres) 1233 yyres[yyn] = *yyp; 1234 yyn++; 1235 break; 1236 1237 case '"': 1238 if (yyres) 1239 yyres[yyn] = '\0'; 1240 return yyn; 1241 } 1242 do_not_strip_quotes: ; 1243 } 1244 1245 if (! yyres) 1246 return yystrlen (yystr); 1247 1248 return yystpcpy (yyres, yystr) - yyres; 1249 } 1250 # endif 1251 1252 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message 1253 about the unexpected token YYTOKEN for the state stack whose top is 1254 YYSSP. 1255 1256 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is 1257 not large enough to hold the message. In that case, also set 1258 *YYMSG_ALLOC to the required number of bytes. Return 2 if the 1259 required number of bytes is too large to store. */ 1260 static int 1261 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, 1262 yytype_int16 *yyssp, int yytoken) 1263 { 1264 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); 1265 YYSIZE_T yysize = yysize0; 1266 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 1267 /* Internationalized format string. */ 1268 const char *yyformat = YY_NULLPTR; 1269 /* Arguments of yyformat. */ 1270 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 1271 /* Number of reported tokens (one for the "unexpected", one per 1272 "expected"). */ 1273 int yycount = 0; 1274 1275 /* There are many possibilities here to consider: 1276 - If this state is a consistent state with a default action, then 1277 the only way this function was invoked is if the default action 1278 is an error action. In that case, don't check for expected 1279 tokens because there are none. 1280 - The only way there can be no lookahead present (in yychar) is if 1281 this state is a consistent state with a default action. Thus, 1282 detecting the absence of a lookahead is sufficient to determine 1283 that there is no unexpected or expected token to report. In that 1284 case, just report a simple "syntax error". 1285 - Don't assume there isn't a lookahead just because this state is a 1286 consistent state with a default action. There might have been a 1287 previous inconsistent state, consistent state with a non-default 1288 action, or user semantic action that manipulated yychar. 1289 - Of course, the expected token list depends on states to have 1290 correct lookahead information, and it depends on the parser not 1291 to perform extra reductions after fetching a lookahead from the 1292 scanner and before detecting a syntax error. Thus, state merging 1293 (from LALR or IELR) and default reductions corrupt the expected 1294 token list. However, the list is correct for canonical LR with 1295 one exception: it will still contain any token that will not be 1296 accepted due to an error action in a later state. 1297 */ 1298 if (yytoken != YYEMPTY) 1299 { 1300 int yyn = yypact[*yyssp]; 1301 yyarg[yycount++] = yytname[yytoken]; 1302 if (!yypact_value_is_default (yyn)) 1303 { 1304 /* Start YYX at -YYN if negative to avoid negative indexes in 1305 YYCHECK. In other words, skip the first -YYN actions for 1306 this state because they are default actions. */ 1307 int yyxbegin = yyn < 0 ? -yyn : 0; 1308 /* Stay within bounds of both yycheck and yytname. */ 1309 int yychecklim = YYLAST - yyn + 1; 1310 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 1311 int yyx; 1312 1313 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 1314 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR 1315 && !yytable_value_is_error (yytable[yyx + yyn])) 1316 { 1317 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 1318 { 1319 yycount = 1; 1320 yysize = yysize0; 1321 break; 1322 } 1323 yyarg[yycount++] = yytname[yyx]; 1324 { 1325 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); 1326 if (! (yysize <= yysize1 1327 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 1328 return 2; 1329 yysize = yysize1; 1330 } 1331 } 1332 } 1333 } 1334 1335 switch (yycount) 1336 { 1337 # define YYCASE_(N, S) \ 1338 case N: \ 1339 yyformat = S; \ 1340 break 1341 YYCASE_(0, YY_("syntax error")); 1342 YYCASE_(1, YY_("syntax error, unexpected %s")); 1343 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); 1344 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); 1345 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); 1346 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); 1347 # undef YYCASE_ 1348 } 1349 1350 { 1351 YYSIZE_T yysize1 = yysize + yystrlen (yyformat); 1352 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 1353 return 2; 1354 yysize = yysize1; 1355 } 1356 1357 if (*yymsg_alloc < yysize) 1358 { 1359 *yymsg_alloc = 2 * yysize; 1360 if (! (yysize <= *yymsg_alloc 1361 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) 1362 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; 1363 return 1; 1364 } 1365 1366 /* Avoid sprintf, as that infringes on the user's name space. 1367 Don't have undefined behavior even if the translation 1368 produced a string with the wrong number of "%s"s. */ 1369 { 1370 char *yyp = *yymsg; 1371 int yyi = 0; 1372 while ((*yyp = *yyformat) != '\0') 1373 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) 1374 { 1375 yyp += yytnamerr (yyp, yyarg[yyi++]); 1376 yyformat += 2; 1377 } 1378 else 1379 { 1380 yyp++; 1381 yyformat++; 1382 } 1383 } 1384 return 0; 1385 } 1386 #endif /* YYERROR_VERBOSE */ 1387 1388 /*-----------------------------------------------. 1389 | Release the memory associated to this symbol. | 1390 `-----------------------------------------------*/ 1391 1392 static void 1393 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) 1394 { 1395 YYUSE (yyvaluep); 1396 if (!yymsg) 1397 yymsg = "Deleting"; 1398 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 1399 1400 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1401 YYUSE (yytype); 1402 YY_IGNORE_MAYBE_UNINITIALIZED_END 1403 } 1404 1405 1406 1407 1408 /* The lookahead symbol. */ 1409 int yychar; 1410 1411 /* The semantic value of the lookahead symbol. */ 1412 YYSTYPE yylval; 1413 /* Number of syntax errors so far. */ 1414 int yynerrs; 1415 1416 1417 /*----------. 1418 | yyparse. | 1419 `----------*/ 1420 1421 int 1422 yyparse (void) 1423 { 1424 int yystate; 1425 /* Number of tokens to shift before error messages enabled. */ 1426 int yyerrstatus; 1427 1428 /* The stacks and their tools: 1429 'yyss': related to states. 1430 'yyvs': related to semantic values. 1431 1432 Refer to the stacks through separate pointers, to allow yyoverflow 1433 to reallocate them elsewhere. */ 1434 1435 /* The state stack. */ 1436 yytype_int16 yyssa[YYINITDEPTH]; 1437 yytype_int16 *yyss; 1438 yytype_int16 *yyssp; 1439 1440 /* The semantic value stack. */ 1441 YYSTYPE yyvsa[YYINITDEPTH]; 1442 YYSTYPE *yyvs; 1443 YYSTYPE *yyvsp; 1444 1445 YYSIZE_T yystacksize; 1446 1447 int yyn; 1448 int yyresult; 1449 /* Lookahead token as an internal (translated) token number. */ 1450 int yytoken = 0; 1451 /* The variables used to return semantic value and location from the 1452 action routines. */ 1453 YYSTYPE yyval; 1454 1455 #if YYERROR_VERBOSE 1456 /* Buffer for error messages, and its allocated size. */ 1457 char yymsgbuf[128]; 1458 char *yymsg = yymsgbuf; 1459 YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 1460 #endif 1461 1462 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 1463 1464 /* The number of symbols on the RHS of the reduced rule. 1465 Keep to zero when no symbol should be popped. */ 1466 int yylen = 0; 1467 1468 yyssp = yyss = yyssa; 1469 yyvsp = yyvs = yyvsa; 1470 yystacksize = YYINITDEPTH; 1471 1472 YYDPRINTF ((stderr, "Starting parse\n")); 1473 1474 yystate = 0; 1475 yyerrstatus = 0; 1476 yynerrs = 0; 1477 yychar = YYEMPTY; /* Cause a token to be read. */ 1478 goto yysetstate; 1479 1480 /*------------------------------------------------------------. 1481 | yynewstate -- Push a new state, which is found in yystate. | 1482 `------------------------------------------------------------*/ 1483 yynewstate: 1484 /* In all cases, when you get here, the value and location stacks 1485 have just been pushed. So pushing a state here evens the stacks. */ 1486 yyssp++; 1487 1488 yysetstate: 1489 *yyssp = yystate; 1490 1491 if (yyss + yystacksize - 1 <= yyssp) 1492 { 1493 /* Get the current used size of the three stacks, in elements. */ 1494 YYSIZE_T yysize = yyssp - yyss + 1; 1495 1496 #ifdef yyoverflow 1497 { 1498 /* Give user a chance to reallocate the stack. Use copies of 1499 these so that the &'s don't force the real ones into 1500 memory. */ 1501 YYSTYPE *yyvs1 = yyvs; 1502 yytype_int16 *yyss1 = yyss; 1503 1504 /* Each stack pointer address is followed by the size of the 1505 data in use in that stack, in bytes. This used to be a 1506 conditional around just the two extra args, but that might 1507 be undefined if yyoverflow is a macro. */ 1508 yyoverflow (YY_("memory exhausted"), 1509 &yyss1, yysize * sizeof (*yyssp), 1510 &yyvs1, yysize * sizeof (*yyvsp), 1511 &yystacksize); 1512 1513 yyss = yyss1; 1514 yyvs = yyvs1; 1515 } 1516 #else /* no yyoverflow */ 1517 # ifndef YYSTACK_RELOCATE 1518 goto yyexhaustedlab; 1519 # else 1520 /* Extend the stack our own way. */ 1521 if (YYMAXDEPTH <= yystacksize) 1522 goto yyexhaustedlab; 1523 yystacksize *= 2; 1524 if (YYMAXDEPTH < yystacksize) 1525 yystacksize = YYMAXDEPTH; 1526 1527 { 1528 yytype_int16 *yyss1 = yyss; 1529 union yyalloc *yyptr = 1530 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 1531 if (! yyptr) 1532 goto yyexhaustedlab; 1533 YYSTACK_RELOCATE (yyss_alloc, yyss); 1534 YYSTACK_RELOCATE (yyvs_alloc, yyvs); 1535 # undef YYSTACK_RELOCATE 1536 if (yyss1 != yyssa) 1537 YYSTACK_FREE (yyss1); 1538 } 1539 # endif 1540 #endif /* no yyoverflow */ 1541 1542 yyssp = yyss + yysize - 1; 1543 yyvsp = yyvs + yysize - 1; 1544 1545 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 1546 (unsigned long int) yystacksize)); 1547 1548 if (yyss + yystacksize - 1 <= yyssp) 1549 YYABORT; 1550 } 1551 1552 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 1553 1554 if (yystate == YYFINAL) 1555 YYACCEPT; 1556 1557 goto yybackup; 1558 1559 /*-----------. 1560 | yybackup. | 1561 `-----------*/ 1562 yybackup: 1563 1564 /* Do appropriate processing given the current state. Read a 1565 lookahead token if we need one and don't already have one. */ 1566 1567 /* First try to decide what to do without reference to lookahead token. */ 1568 yyn = yypact[yystate]; 1569 if (yypact_value_is_default (yyn)) 1570 goto yydefault; 1571 1572 /* Not known => get a lookahead token if don't already have one. */ 1573 1574 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 1575 if (yychar == YYEMPTY) 1576 { 1577 YYDPRINTF ((stderr, "Reading a token: ")); 1578 yychar = yylex (); 1579 } 1580 1581 if (yychar <= YYEOF) 1582 { 1583 yychar = yytoken = YYEOF; 1584 YYDPRINTF ((stderr, "Now at end of input.\n")); 1585 } 1586 else 1587 { 1588 yytoken = YYTRANSLATE (yychar); 1589 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 1590 } 1591 1592 /* If the proper action on seeing token YYTOKEN is to reduce or to 1593 detect an error, take that action. */ 1594 yyn += yytoken; 1595 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 1596 goto yydefault; 1597 yyn = yytable[yyn]; 1598 if (yyn <= 0) 1599 { 1600 if (yytable_value_is_error (yyn)) 1601 goto yyerrlab; 1602 yyn = -yyn; 1603 goto yyreduce; 1604 } 1605 1606 /* Count tokens shifted since error; after three, turn off error 1607 status. */ 1608 if (yyerrstatus) 1609 yyerrstatus--; 1610 1611 /* Shift the lookahead token. */ 1612 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 1613 1614 /* Discard the shifted token. */ 1615 yychar = YYEMPTY; 1616 1617 yystate = yyn; 1618 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 1619 *++yyvsp = yylval; 1620 YY_IGNORE_MAYBE_UNINITIALIZED_END 1621 1622 goto yynewstate; 1623 1624 1625 /*-----------------------------------------------------------. 1626 | yydefault -- do the default action for the current state. | 1627 `-----------------------------------------------------------*/ 1628 yydefault: 1629 yyn = yydefact[yystate]; 1630 if (yyn == 0) 1631 goto yyerrlab; 1632 goto yyreduce; 1633 1634 1635 /*-----------------------------. 1636 | yyreduce -- Do a reduction. | 1637 `-----------------------------*/ 1638 yyreduce: 1639 /* yyn is the number of a rule to reduce with. */ 1640 yylen = yyr2[yyn]; 1641 1642 /* If YYLEN is nonzero, implement the default value of the action: 1643 '$$ = $1'. 1644 1645 Otherwise, the following line sets YYVAL to garbage. 1646 This behavior is undocumented and Bison 1647 users should not rely upon it. Assigning to YYVAL 1648 unconditionally makes the parser a bit smaller, and it avoids a 1649 GCC warning that YYVAL may be used uninitialized. */ 1650 yyval = yyvsp[1-yylen]; 1651 1652 1653 YY_REDUCE_PRINT (yyn); 1654 switch (yyn) 1655 { 1656 case 9: 1657 #line 84 "configparser.y" /* yacc.c:1646 */ 1658 { OUTYY(("\nP(server:)\n")); 1659 if(cfg_parser->server_settings_seen) { 1660 yyerror("duplicate server: element."); 1661 } 1662 cfg_parser->server_settings_seen = 1; 1663 } 1664 #line 1665 "configparser.c" /* yacc.c:1646 */ 1665 break; 1666 1667 case 58: 1668 #line 108 "configparser.y" /* yacc.c:1646 */ 1669 { 1670 OUTYY(("P(server_ip_address:%s)\n", (yyvsp[0].str))); 1671 if(cfg_parser->current_ip_address_option) { 1672 cfg_parser->current_ip_address_option->next = 1673 (ip_address_option_type*)region_alloc( 1674 cfg_parser->opt->region, sizeof(ip_address_option_type)); 1675 cfg_parser->current_ip_address_option = 1676 cfg_parser->current_ip_address_option->next; 1677 cfg_parser->current_ip_address_option->next=0; 1678 } else { 1679 cfg_parser->current_ip_address_option = 1680 (ip_address_option_type*)region_alloc( 1681 cfg_parser->opt->region, sizeof(ip_address_option_type)); 1682 cfg_parser->current_ip_address_option->next=0; 1683 cfg_parser->opt->ip_addresses = cfg_parser->current_ip_address_option; 1684 } 1685 1686 cfg_parser->current_ip_address_option->address = 1687 region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); 1688 } 1689 #line 1690 "configparser.c" /* yacc.c:1646 */ 1690 break; 1691 1692 case 59: 1693 #line 130 "configparser.y" /* yacc.c:1646 */ 1694 { 1695 OUTYY(("P(server_ip_transparent:%s)\n", (yyvsp[0].str))); 1696 if(strcmp((yyvsp[0].str), "yes") != 0 && strcmp((yyvsp[0].str), "no") != 0) 1697 yyerror("expected yes or no."); 1698 else cfg_parser->opt->ip_transparent = (strcmp((yyvsp[0].str), "yes")==0); 1699 } 1700 #line 1701 "configparser.c" /* yacc.c:1646 */ 1701 break; 1702 1703 case 60: 1704 #line 138 "configparser.y" /* yacc.c:1646 */ 1705 { 1706 OUTYY(("P(server_ip_freebind:%s)\n", (yyvsp[0].str))); 1707 if(strcmp((yyvsp[0].str), "yes") != 0 && strcmp((yyvsp[0].str), "no") != 0) 1708 yyerror("expected yes or no."); 1709 else cfg_parser->opt->ip_freebind = (strcmp((yyvsp[0].str), "yes")==0); 1710 } 1711 #line 1712 "configparser.c" /* yacc.c:1646 */ 1712 break; 1713 1714 case 61: 1715 #line 146 "configparser.y" /* yacc.c:1646 */ 1716 { 1717 OUTYY(("P(server_debug_mode:%s)\n", (yyvsp[0].str))); 1718 if(strcmp((yyvsp[0].str), "yes") != 0 && strcmp((yyvsp[0].str), "no") != 0) 1719 yyerror("expected yes or no."); 1720 else cfg_parser->opt->debug_mode = (strcmp((yyvsp[0].str), "yes")==0); 1721 } 1722 #line 1723 "configparser.c" /* yacc.c:1646 */ 1723 break; 1724 1725 case 62: 1726 #line 154 "configparser.y" /* yacc.c:1646 */ 1727 { 1728 OUTYY(("P(server_verbosity:%s)\n", (yyvsp[0].str))); 1729 if(atoi((yyvsp[0].str)) == 0 && strcmp((yyvsp[0].str), "0") != 0) 1730 yyerror("number expected"); 1731 else cfg_parser->opt->verbosity = atoi((yyvsp[0].str)); 1732 } 1733 #line 1734 "configparser.c" /* yacc.c:1646 */ 1734 break; 1735 1736 case 63: 1737 #line 162 "configparser.y" /* yacc.c:1646 */ 1738 { 1739 OUTYY(("P(server_hide_version:%s)\n", (yyvsp[0].str))); 1740 if(strcmp((yyvsp[0].str), "yes") != 0 && strcmp((yyvsp[0].str), "no") != 0) 1741 yyerror("expected yes or no."); 1742 else cfg_parser->opt->hide_version = (strcmp((yyvsp[0].str), "yes")==0); 1743 } 1744 #line 1745 "configparser.c" /* yacc.c:1646 */ 1745 break; 1746 1747 case 64: 1748 #line 170 "configparser.y" /* yacc.c:1646 */ 1749 { 1750 /* for backwards compatibility in config file with NSD3 */ 1751 OUTYY(("P(server_ip4_only:%s)\n", (yyvsp[0].str))); 1752 if(strcmp((yyvsp[0].str), "yes") != 0 && strcmp((yyvsp[0].str), "no") != 0) 1753 yyerror("expected yes or no."); 1754 else if(strcmp((yyvsp[0].str), "yes")==0) { 1755 cfg_parser->opt->do_ip4 = 1; 1756 cfg_parser->opt->do_ip6 = 0; 1757 } 1758 } 1759 #line 1760 "configparser.c" /* yacc.c:1646 */ 1760 break; 1761 1762 case 65: 1763 #line 182 "configparser.y" /* yacc.c:1646 */ 1764 { 1765 /* for backwards compatibility in config file with NSD3 */ 1766 OUTYY(("P(server_ip6_only:%s)\n", (yyvsp[0].str))); 1767 if(strcmp((yyvsp[0].str), "yes") != 0 && strcmp((yyvsp[0].str), "no") != 0) 1768 yyerror("expected yes or no."); 1769 else if(strcmp((yyvsp[0].str), "yes")==0) { 1770 cfg_parser->opt->do_ip6 = 1; 1771 cfg_parser->opt->do_ip4 = 0; 1772 } 1773 } 1774 #line 1775 "configparser.c" /* yacc.c:1646 */ 1775 break; 1776 1777 case 66: 1778 #line 194 "configparser.y" /* yacc.c:1646 */ 1779 { 1780 OUTYY(("P(server_do_ip4:%s)\n", (yyvsp[0].str))); 1781 if(strcmp((yyvsp[0].str), "yes") != 0 && strcmp((yyvsp[0].str), "no") != 0) 1782 yyerror("expected yes or no."); 1783 else cfg_parser->opt->do_ip4 = (strcmp((yyvsp[0].str), "yes")==0); 1784 } 1785 #line 1786 "configparser.c" /* yacc.c:1646 */ 1786 break; 1787 1788 case 67: 1789 #line 202 "configparser.y" /* yacc.c:1646 */ 1790 { 1791 OUTYY(("P(server_do_ip6:%s)\n", (yyvsp[0].str))); 1792 if(strcmp((yyvsp[0].str), "yes") != 0 && strcmp((yyvsp[0].str), "no") != 0) 1793 yyerror("expected yes or no."); 1794 else cfg_parser->opt->do_ip6 = (strcmp((yyvsp[0].str), "yes")==0); 1795 } 1796 #line 1797 "configparser.c" /* yacc.c:1646 */ 1797 break; 1798 1799 case 68: 1800 #line 210 "configparser.y" /* yacc.c:1646 */ 1801 { 1802 OUTYY(("P(server_reuseport:%s)\n", (yyvsp[0].str))); 1803 if(strcmp((yyvsp[0].str), "yes") != 0 && strcmp((yyvsp[0].str), "no") != 0) 1804 yyerror("expected yes or no."); 1805 else cfg_parser->opt->reuseport = (strcmp((yyvsp[0].str), "yes")==0); 1806 } 1807 #line 1808 "configparser.c" /* yacc.c:1646 */ 1808 break; 1809 1810 case 69: 1811 #line 218 "configparser.y" /* yacc.c:1646 */ 1812 { 1813 OUTYY(("P(server_database:%s)\n", (yyvsp[0].str))); 1814 cfg_parser->opt->database = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); 1815 if(cfg_parser->opt->database[0] == 0 && 1816 cfg_parser->opt->zonefiles_write == 0) 1817 cfg_parser->opt->zonefiles_write = ZONEFILES_WRITE_INTERVAL; 1818 } 1819 #line 1820 "configparser.c" /* yacc.c:1646 */ 1820 break; 1821 1822 case 70: 1823 #line 227 "configparser.y" /* yacc.c:1646 */ 1824 { 1825 OUTYY(("P(server_identity:%s)\n", (yyvsp[0].str))); 1826 cfg_parser->opt->identity = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); 1827 } 1828 #line 1829 "configparser.c" /* yacc.c:1646 */ 1829 break; 1830 1831 case 71: 1832 #line 233 "configparser.y" /* yacc.c:1646 */ 1833 { 1834 OUTYY(("P(server_version:%s)\n", (yyvsp[0].str))); 1835 cfg_parser->opt->version = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); 1836 } 1837 #line 1838 "configparser.c" /* yacc.c:1646 */ 1838 break; 1839 1840 case 72: 1841 #line 239 "configparser.y" /* yacc.c:1646 */ 1842 { 1843 unsigned char* nsid = 0; 1844 size_t nsid_len = 0; 1845 1846 OUTYY(("P(server_nsid:%s)\n", (yyvsp[0].str))); 1847 1848 if (strncasecmp((yyvsp[0].str), "ascii_", 6) == 0) { 1849 nsid_len = strlen((yyvsp[0].str)+6); 1850 if(nsid_len < 65535) { 1851 cfg_parser->opt->nsid = region_alloc(cfg_parser->opt->region, nsid_len*2+1); 1852 hex_ntop((uint8_t*)(yyvsp[0].str)+6, nsid_len, (char*)cfg_parser->opt->nsid, nsid_len*2+1); 1853 } else 1854 yyerror("NSID too long"); 1855 } else if (strlen((yyvsp[0].str)) % 2 != 0) { 1856 yyerror("the NSID must be a hex string of an even length."); 1857 } else { 1858 nsid_len = strlen((yyvsp[0].str)) / 2; 1859 if(nsid_len < 65535) { 1860 nsid = xalloc(nsid_len); 1861 if (hex_pton((yyvsp[0].str), nsid, nsid_len) == -1) 1862 yyerror("hex string cannot be parsed in NSID."); 1863 else 1864 cfg_parser->opt->nsid = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); 1865 free(nsid); 1866 } else 1867 yyerror("NSID too long"); 1868 } 1869 } 1870 #line 1871 "configparser.c" /* yacc.c:1646 */ 1871 break; 1872 1873 case 73: 1874 #line 269 "configparser.y" /* yacc.c:1646 */ 1875 { 1876 OUTYY(("P(server_logfile:%s)\n", (yyvsp[0].str))); 1877 cfg_parser->opt->logfile = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); 1878 } 1879 #line 1880 "configparser.c" /* yacc.c:1646 */ 1880 break; 1881 1882 case 74: 1883 #line 275 "configparser.y" /* yacc.c:1646 */ 1884 { 1885 OUTYY(("P(server_log_time_ascii:%s)\n", (yyvsp[0].str))); 1886 if(strcmp((yyvsp[0].str), "yes") != 0 && strcmp((yyvsp[0].str), "no") != 0) 1887 yyerror("expected yes or no."); 1888 else { 1889 cfg_parser->opt->log_time_ascii = (strcmp((yyvsp[0].str), "yes")==0); 1890 log_time_asc = cfg_parser->opt->log_time_ascii; 1891 } 1892 } 1893 #line 1894 "configparser.c" /* yacc.c:1646 */ 1894 break; 1895 1896 case 75: 1897 #line 286 "configparser.y" /* yacc.c:1646 */ 1898 { 1899 OUTYY(("P(server_round_robin:%s)\n", (yyvsp[0].str))); 1900 if(strcmp((yyvsp[0].str), "yes") != 0 && strcmp((yyvsp[0].str), "no") != 0) 1901 yyerror("expected yes or no."); 1902 else { 1903 cfg_parser->opt->round_robin = (strcmp((yyvsp[0].str), "yes")==0); 1904 round_robin = cfg_parser->opt->round_robin; 1905 } 1906 } 1907 #line 1908 "configparser.c" /* yacc.c:1646 */ 1908 break; 1909 1910 case 76: 1911 #line 297 "configparser.y" /* yacc.c:1646 */ 1912 { 1913 OUTYY(("P(server_minimal_responses:%s)\n", (yyvsp[0].str))); 1914 if(strcmp((yyvsp[0].str), "yes") != 0 && strcmp((yyvsp[0].str), "no") != 0) 1915 yyerror("expected yes or no."); 1916 else { 1917 cfg_parser->opt->minimal_responses = (strcmp((yyvsp[0].str), "yes")==0); 1918 minimal_responses = cfg_parser->opt->minimal_responses; 1919 } 1920 } 1921 #line 1922 "configparser.c" /* yacc.c:1646 */ 1922 break; 1923 1924 case 77: 1925 #line 308 "configparser.y" /* yacc.c:1646 */ 1926 { 1927 OUTYY(("P(server_server_count:%s)\n", (yyvsp[0].str))); 1928 if(atoi((yyvsp[0].str)) <= 0) 1929 yyerror("number greater than zero expected"); 1930 else cfg_parser->opt->server_count = atoi((yyvsp[0].str)); 1931 } 1932 #line 1933 "configparser.c" /* yacc.c:1646 */ 1933 break; 1934 1935 case 78: 1936 #line 316 "configparser.y" /* yacc.c:1646 */ 1937 { 1938 OUTYY(("P(server_tcp_count:%s)\n", (yyvsp[0].str))); 1939 if(atoi((yyvsp[0].str)) <= 0) 1940 yyerror("number greater than zero expected"); 1941 else cfg_parser->opt->tcp_count = atoi((yyvsp[0].str)); 1942 } 1943 #line 1944 "configparser.c" /* yacc.c:1646 */ 1944 break; 1945 1946 case 79: 1947 #line 324 "configparser.y" /* yacc.c:1646 */ 1948 { 1949 OUTYY(("P(server_pidfile:%s)\n", (yyvsp[0].str))); 1950 cfg_parser->opt->pidfile = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); 1951 } 1952 #line 1953 "configparser.c" /* yacc.c:1646 */ 1953 break; 1954 1955 case 80: 1956 #line 330 "configparser.y" /* yacc.c:1646 */ 1957 { 1958 OUTYY(("P(server_port:%s)\n", (yyvsp[0].str))); 1959 cfg_parser->opt->port = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); 1960 } 1961 #line 1962 "configparser.c" /* yacc.c:1646 */ 1962 break; 1963 1964 case 81: 1965 #line 336 "configparser.y" /* yacc.c:1646 */ 1966 { 1967 OUTYY(("P(server_statistics:%s)\n", (yyvsp[0].str))); 1968 if(atoi((yyvsp[0].str)) == 0 && strcmp((yyvsp[0].str), "0") != 0) 1969 yyerror("number expected"); 1970 else cfg_parser->opt->statistics = atoi((yyvsp[0].str)); 1971 } 1972 #line 1973 "configparser.c" /* yacc.c:1646 */ 1973 break; 1974 1975 case 82: 1976 #line 344 "configparser.y" /* yacc.c:1646 */ 1977 { 1978 OUTYY(("P(server_chroot:%s)\n", (yyvsp[0].str))); 1979 cfg_parser->opt->chroot = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); 1980 } 1981 #line 1982 "configparser.c" /* yacc.c:1646 */ 1982 break; 1983 1984 case 83: 1985 #line 350 "configparser.y" /* yacc.c:1646 */ 1986 { 1987 OUTYY(("P(server_username:%s)\n", (yyvsp[0].str))); 1988 cfg_parser->opt->username = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); 1989 } 1990 #line 1991 "configparser.c" /* yacc.c:1646 */ 1991 break; 1992 1993 case 84: 1994 #line 356 "configparser.y" /* yacc.c:1646 */ 1995 { 1996 OUTYY(("P(server_zonesdir:%s)\n", (yyvsp[0].str))); 1997 cfg_parser->opt->zonesdir = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); 1998 } 1999 #line 2000 "configparser.c" /* yacc.c:1646 */ 2000 break; 2001 2002 case 85: 2003 #line 362 "configparser.y" /* yacc.c:1646 */ 2004 { 2005 OUTYY(("P(server_zonelistfile:%s)\n", (yyvsp[0].str))); 2006 cfg_parser->opt->zonelistfile = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); 2007 } 2008 #line 2009 "configparser.c" /* yacc.c:1646 */ 2009 break; 2010 2011 case 86: 2012 #line 368 "configparser.y" /* yacc.c:1646 */ 2013 { 2014 OUTYY(("P(server_xfrdir:%s)\n", (yyvsp[0].str))); 2015 cfg_parser->opt->xfrdir = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); 2016 } 2017 #line 2018 "configparser.c" /* yacc.c:1646 */ 2018 break; 2019 2020 case 87: 2021 #line 374 "configparser.y" /* yacc.c:1646 */ 2022 { 2023 OUTYY(("P(server_difffile:%s)\n", (yyvsp[0].str))); 2024 /* ignore the value for backwards compatibility in config file*/ 2025 } 2026 #line 2027 "configparser.c" /* yacc.c:1646 */ 2027 break; 2028 2029 case 88: 2030 #line 380 "configparser.y" /* yacc.c:1646 */ 2031 { 2032 OUTYY(("P(server_xfrdfile:%s)\n", (yyvsp[0].str))); 2033 cfg_parser->opt->xfrdfile = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); 2034 } 2035 #line 2036 "configparser.c" /* yacc.c:1646 */ 2036 break; 2037 2038 case 89: 2039 #line 386 "configparser.y" /* yacc.c:1646 */ 2040 { 2041 OUTYY(("P(server_xfrd_reload_timeout:%s)\n", (yyvsp[0].str))); 2042 if(atoi((yyvsp[0].str)) == 0 && strcmp((yyvsp[0].str), "0") != 0) 2043 yyerror("number expected"); 2044 cfg_parser->opt->xfrd_reload_timeout = atoi((yyvsp[0].str)); 2045 } 2046 #line 2047 "configparser.c" /* yacc.c:1646 */ 2047 break; 2048 2049 case 90: 2050 #line 394 "configparser.y" /* yacc.c:1646 */ 2051 { 2052 OUTYY(("P(server_tcp_query_count:%s)\n", (yyvsp[0].str))); 2053 if(atoi((yyvsp[0].str)) == 0 && strcmp((yyvsp[0].str), "0") != 0) 2054 yyerror("number expected"); 2055 cfg_parser->opt->tcp_query_count = atoi((yyvsp[0].str)); 2056 } 2057 #line 2058 "configparser.c" /* yacc.c:1646 */ 2058 break; 2059 2060 case 91: 2061 #line 402 "configparser.y" /* yacc.c:1646 */ 2062 { 2063 OUTYY(("P(server_tcp_timeout:%s)\n", (yyvsp[0].str))); 2064 if(atoi((yyvsp[0].str)) == 0 && strcmp((yyvsp[0].str), "0") != 0) 2065 yyerror("number expected"); 2066 cfg_parser->opt->tcp_timeout = atoi((yyvsp[0].str)); 2067 } 2068 #line 2069 "configparser.c" /* yacc.c:1646 */ 2069 break; 2070 2071 case 92: 2072 #line 410 "configparser.y" /* yacc.c:1646 */ 2073 { 2074 OUTYY(("P(server_tcp_mss:%s)\n", (yyvsp[0].str))); 2075 if(atoi((yyvsp[0].str)) == 0 && strcmp((yyvsp[0].str), "0") != 0) 2076 yyerror("number expected"); 2077 cfg_parser->opt->tcp_mss = atoi((yyvsp[0].str)); 2078 } 2079 #line 2080 "configparser.c" /* yacc.c:1646 */ 2080 break; 2081 2082 case 93: 2083 #line 418 "configparser.y" /* yacc.c:1646 */ 2084 { 2085 OUTYY(("P(server_outgoing_tcp_mss:%s)\n", (yyvsp[0].str))); 2086 if(atoi((yyvsp[0].str)) == 0 && strcmp((yyvsp[0].str), "0") != 0) 2087 yyerror("number expected"); 2088 cfg_parser->opt->outgoing_tcp_mss = atoi((yyvsp[0].str)); 2089 } 2090 #line 2091 "configparser.c" /* yacc.c:1646 */ 2091 break; 2092 2093 case 94: 2094 #line 426 "configparser.y" /* yacc.c:1646 */ 2095 { 2096 OUTYY(("P(server_ipv4_edns_size:%s)\n", (yyvsp[0].str))); 2097 if(atoi((yyvsp[0].str)) == 0 && strcmp((yyvsp[0].str), "0") != 0) 2098 yyerror("number expected"); 2099 cfg_parser->opt->ipv4_edns_size = atoi((yyvsp[0].str)); 2100 } 2101 #line 2102 "configparser.c" /* yacc.c:1646 */ 2102 break; 2103 2104 case 95: 2105 #line 434 "configparser.y" /* yacc.c:1646 */ 2106 { 2107 OUTYY(("P(server_ipv6_edns_size:%s)\n", (yyvsp[0].str))); 2108 if(atoi((yyvsp[0].str)) == 0 && strcmp((yyvsp[0].str), "0") != 0) 2109 yyerror("number expected"); 2110 cfg_parser->opt->ipv6_edns_size = atoi((yyvsp[0].str)); 2111 } 2112 #line 2113 "configparser.c" /* yacc.c:1646 */ 2113 break; 2114 2115 case 96: 2116 #line 442 "configparser.y" /* yacc.c:1646 */ 2117 { 2118 OUTYY(("P(server_rrl_size:%s)\n", (yyvsp[0].str))); 2119 #ifdef RATELIMIT 2120 if(atoi((yyvsp[0].str)) <= 0) 2121 yyerror("number greater than zero expected"); 2122 cfg_parser->opt->rrl_size = atoi((yyvsp[0].str)); 2123 #endif 2124 } 2125 #line 2126 "configparser.c" /* yacc.c:1646 */ 2126 break; 2127 2128 case 97: 2129 #line 452 "configparser.y" /* yacc.c:1646 */ 2130 { 2131 OUTYY(("P(server_rrl_ratelimit:%s)\n", (yyvsp[0].str))); 2132 #ifdef RATELIMIT 2133 cfg_parser->opt->rrl_ratelimit = atoi((yyvsp[0].str)); 2134 #endif 2135 } 2136 #line 2137 "configparser.c" /* yacc.c:1646 */ 2137 break; 2138 2139 case 98: 2140 #line 460 "configparser.y" /* yacc.c:1646 */ 2141 { 2142 OUTYY(("P(server_rrl_slip:%s)\n", (yyvsp[0].str))); 2143 #ifdef RATELIMIT 2144 if(atoi((yyvsp[0].str)) < 0) 2145 yyerror("number equal or greater than zero expected"); 2146 cfg_parser->opt->rrl_slip = atoi((yyvsp[0].str)); 2147 #endif 2148 } 2149 #line 2150 "configparser.c" /* yacc.c:1646 */ 2150 break; 2151 2152 case 99: 2153 #line 470 "configparser.y" /* yacc.c:1646 */ 2154 { 2155 OUTYY(("P(server_rrl_ipv4_prefix_length:%s)\n", (yyvsp[0].str))); 2156 #ifdef RATELIMIT 2157 if(atoi((yyvsp[0].str)) < 0 || atoi((yyvsp[0].str)) > 32) 2158 yyerror("invalid IPv4 prefix length"); 2159 cfg_parser->opt->rrl_ipv4_prefix_length = atoi((yyvsp[0].str)); 2160 #endif 2161 } 2162 #line 2163 "configparser.c" /* yacc.c:1646 */ 2163 break; 2164 2165 case 100: 2166 #line 480 "configparser.y" /* yacc.c:1646 */ 2167 { 2168 OUTYY(("P(server_rrl_ipv6_prefix_length:%s)\n", (yyvsp[0].str))); 2169 #ifdef RATELIMIT 2170 if(atoi((yyvsp[0].str)) < 0 || atoi((yyvsp[0].str)) > 64) 2171 yyerror("invalid IPv6 prefix length"); 2172 cfg_parser->opt->rrl_ipv6_prefix_length = atoi((yyvsp[0].str)); 2173 #endif 2174 } 2175 #line 2176 "configparser.c" /* yacc.c:1646 */ 2176 break; 2177 2178 case 101: 2179 #line 490 "configparser.y" /* yacc.c:1646 */ 2180 { 2181 OUTYY(("P(server_rrl_whitelist_ratelimit:%s)\n", (yyvsp[0].str))); 2182 #ifdef RATELIMIT 2183 cfg_parser->opt->rrl_whitelist_ratelimit = atoi((yyvsp[0].str)); 2184 #endif 2185 } 2186 #line 2187 "configparser.c" /* yacc.c:1646 */ 2187 break; 2188 2189 case 102: 2190 #line 498 "configparser.y" /* yacc.c:1646 */ 2191 { 2192 OUTYY(("P(server_zonefiles_check:%s)\n", (yyvsp[0].str))); 2193 if(strcmp((yyvsp[0].str), "yes") != 0 && strcmp((yyvsp[0].str), "no") != 0) 2194 yyerror("expected yes or no."); 2195 else cfg_parser->opt->zonefiles_check = (strcmp((yyvsp[0].str), "yes")==0); 2196 } 2197 #line 2198 "configparser.c" /* yacc.c:1646 */ 2198 break; 2199 2200 case 103: 2201 #line 506 "configparser.y" /* yacc.c:1646 */ 2202 { 2203 OUTYY(("P(server_zonefiles_write:%s)\n", (yyvsp[0].str))); 2204 if(atoi((yyvsp[0].str)) == 0 && strcmp((yyvsp[0].str), "0") != 0) 2205 yyerror("number expected"); 2206 else cfg_parser->opt->zonefiles_write = atoi((yyvsp[0].str)); 2207 } 2208 #line 2209 "configparser.c" /* yacc.c:1646 */ 2209 break; 2210 2211 case 104: 2212 #line 515 "configparser.y" /* yacc.c:1646 */ 2213 { 2214 OUTYY(("\nP(remote-control:)\n")); 2215 } 2216 #line 2217 "configparser.c" /* yacc.c:1646 */ 2217 break; 2218 2219 case 114: 2220 #line 526 "configparser.y" /* yacc.c:1646 */ 2221 { 2222 OUTYY(("P(control_enable:%s)\n", (yyvsp[0].str))); 2223 if(strcmp((yyvsp[0].str), "yes") != 0 && strcmp((yyvsp[0].str), "no") != 0) 2224 yyerror("expected yes or no."); 2225 else cfg_parser->opt->control_enable = (strcmp((yyvsp[0].str), "yes")==0); 2226 } 2227 #line 2228 "configparser.c" /* yacc.c:1646 */ 2228 break; 2229 2230 case 115: 2231 #line 534 "configparser.y" /* yacc.c:1646 */ 2232 { 2233 OUTYY(("P(control_port:%s)\n", (yyvsp[0].str))); 2234 if(atoi((yyvsp[0].str)) == 0) 2235 yyerror("control port number expected"); 2236 else cfg_parser->opt->control_port = atoi((yyvsp[0].str)); 2237 } 2238 #line 2239 "configparser.c" /* yacc.c:1646 */ 2239 break; 2240 2241 case 116: 2242 #line 542 "configparser.y" /* yacc.c:1646 */ 2243 { 2244 ip_address_option_type* o = (ip_address_option_type*)region_alloc( 2245 cfg_parser->opt->region, sizeof(ip_address_option_type)); 2246 OUTYY(("P(control_interface:%s)\n", (yyvsp[0].str))); 2247 o->next = cfg_parser->opt->control_interface; 2248 cfg_parser->opt->control_interface = o; 2249 o->address = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); 2250 } 2251 #line 2252 "configparser.c" /* yacc.c:1646 */ 2252 break; 2253 2254 case 117: 2255 #line 552 "configparser.y" /* yacc.c:1646 */ 2256 { 2257 OUTYY(("P(rc_server_key_file:%s)\n", (yyvsp[0].str))); 2258 cfg_parser->opt->server_key_file = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); 2259 } 2260 #line 2261 "configparser.c" /* yacc.c:1646 */ 2261 break; 2262 2263 case 118: 2264 #line 558 "configparser.y" /* yacc.c:1646 */ 2265 { 2266 OUTYY(("P(rc_server_cert_file:%s)\n", (yyvsp[0].str))); 2267 cfg_parser->opt->server_cert_file = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); 2268 } 2269 #line 2270 "configparser.c" /* yacc.c:1646 */ 2270 break; 2271 2272 case 119: 2273 #line 564 "configparser.y" /* yacc.c:1646 */ 2274 { 2275 OUTYY(("P(rc_control_key_file:%s)\n", (yyvsp[0].str))); 2276 cfg_parser->opt->control_key_file = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); 2277 } 2278 #line 2279 "configparser.c" /* yacc.c:1646 */ 2279 break; 2280 2281 case 120: 2282 #line 570 "configparser.y" /* yacc.c:1646 */ 2283 { 2284 OUTYY(("P(rc_control_cert_file:%s)\n", (yyvsp[0].str))); 2285 cfg_parser->opt->control_cert_file = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); 2286 } 2287 #line 2288 "configparser.c" /* yacc.c:1646 */ 2288 break; 2289 2290 case 121: 2291 #line 578 "configparser.y" /* yacc.c:1646 */ 2292 { 2293 OUTYY(("\nP(pattern:)\n")); 2294 if(cfg_parser->current_zone) { 2295 if(!cfg_parser->current_zone->name) 2296 c_error("previous zone has no name"); 2297 else { 2298 if(!nsd_options_insert_zone(cfg_parser->opt, 2299 cfg_parser->current_zone)) 2300 c_error("duplicate zone"); 2301 } 2302 if(!cfg_parser->current_zone->pattern) 2303 c_error("previous zone has no pattern"); 2304 cfg_parser->current_zone = NULL; 2305 } 2306 if(cfg_parser->current_pattern) { 2307 if(!cfg_parser->current_pattern->pname) 2308 c_error("previous pattern has no name"); 2309 else { 2310 if(!nsd_options_insert_pattern(cfg_parser->opt, 2311 cfg_parser->current_pattern)) 2312 c_error_msg("duplicate pattern %s", 2313 cfg_parser->current_pattern->pname); 2314 } 2315 } 2316 cfg_parser->current_pattern = pattern_options_create( 2317 cfg_parser->opt->region); 2318 cfg_parser->current_allow_notify = 0; 2319 cfg_parser->current_request_xfr = 0; 2320 cfg_parser->current_notify = 0; 2321 cfg_parser->current_provide_xfr = 0; 2322 cfg_parser->current_outgoing_interface = 0; 2323 } 2324 #line 2325 "configparser.c" /* yacc.c:1646 */ 2325 break; 2326 2327 case 143: 2328 #line 620 "configparser.y" /* yacc.c:1646 */ 2329 { 2330 OUTYY(("P(pattern_name:%s)\n", (yyvsp[0].str))); 2331 #ifndef NDEBUG 2332 assert(cfg_parser->current_pattern); 2333 #endif 2334 if(strchr((yyvsp[0].str), ' ')) 2335 c_error_msg("space is not allowed in pattern name: " 2336 "'%s'", (yyvsp[0].str)); 2337 cfg_parser->current_pattern->pname = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); 2338 } 2339 #line 2340 "configparser.c" /* yacc.c:1646 */ 2340 break; 2341 2342 case 144: 2343 #line 632 "configparser.y" /* yacc.c:1646 */ 2344 { 2345 OUTYY(("P(include-pattern:%s)\n", (yyvsp[0].str))); 2346 #ifndef NDEBUG 2347 assert(cfg_parser->current_pattern); 2348 #endif 2349 config_apply_pattern((yyvsp[0].str)); 2350 } 2351 #line 2352 "configparser.c" /* yacc.c:1646 */ 2352 break; 2353 2354 case 145: 2355 #line 643 "configparser.y" /* yacc.c:1646 */ 2356 { 2357 OUTYY(("\nP(zone:)\n")); 2358 if(cfg_parser->current_zone) { 2359 if(!cfg_parser->current_zone->name) 2360 c_error("previous zone has no name"); 2361 else { 2362 if(!nsd_options_insert_zone(cfg_parser->opt, 2363 cfg_parser->current_zone)) 2364 c_error("duplicate zone"); 2365 } 2366 if(!cfg_parser->current_zone->pattern) 2367 c_error("previous zone has no pattern"); 2368 } 2369 if(cfg_parser->current_pattern) { 2370 if(!cfg_parser->current_pattern->pname) 2371 c_error("previous pattern has no name"); 2372 else { 2373 if(!nsd_options_insert_pattern(cfg_parser->opt, 2374 cfg_parser->current_pattern)) 2375 c_error_msg("duplicate pattern %s", 2376 cfg_parser->current_pattern->pname); 2377 } 2378 } 2379 cfg_parser->current_zone = zone_options_create(cfg_parser->opt->region); 2380 cfg_parser->current_zone->part_of_config = 1; 2381 cfg_parser->current_pattern = pattern_options_create( 2382 cfg_parser->opt->region); 2383 cfg_parser->current_pattern->implicit = 1; 2384 cfg_parser->current_zone->pattern = cfg_parser->current_pattern; 2385 cfg_parser->current_allow_notify = 0; 2386 cfg_parser->current_request_xfr = 0; 2387 cfg_parser->current_notify = 0; 2388 cfg_parser->current_provide_xfr = 0; 2389 cfg_parser->current_outgoing_interface = 0; 2390 } 2391 #line 2392 "configparser.c" /* yacc.c:1646 */ 2392 break; 2393 2394 case 150: 2395 #line 682 "configparser.y" /* yacc.c:1646 */ 2396 { 2397 char* s; 2398 OUTYY(("P(zone_name:%s)\n", (yyvsp[0].str))); 2399 #ifndef NDEBUG 2400 assert(cfg_parser->current_zone); 2401 assert(cfg_parser->current_pattern); 2402 #endif 2403 cfg_parser->current_zone->name = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); 2404 s = (char*)region_alloc(cfg_parser->opt->region, 2405 strlen((yyvsp[0].str))+strlen(PATTERN_IMPLICIT_MARKER)+1); 2406 memmove(s, PATTERN_IMPLICIT_MARKER, 2407 strlen(PATTERN_IMPLICIT_MARKER)); 2408 memmove(s+strlen(PATTERN_IMPLICIT_MARKER), (yyvsp[0].str), strlen((yyvsp[0].str))+1); 2409 if(pattern_options_find(cfg_parser->opt, s)) 2410 c_error_msg("zone %s cannot be created because " 2411 "implicit pattern %s already exists", (yyvsp[0].str), s); 2412 cfg_parser->current_pattern->pname = s; 2413 } 2414 #line 2415 "configparser.c" /* yacc.c:1646 */ 2415 break; 2416 2417 case 151: 2418 #line 702 "configparser.y" /* yacc.c:1646 */ 2419 { 2420 OUTYY(("P(zonefile:%s)\n", (yyvsp[0].str))); 2421 #ifndef NDEBUG 2422 assert(cfg_parser->current_pattern); 2423 #endif 2424 cfg_parser->current_pattern->zonefile = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); 2425 } 2426 #line 2427 "configparser.c" /* yacc.c:1646 */ 2427 break; 2428 2429 case 152: 2430 #line 711 "configparser.y" /* yacc.c:1646 */ 2431 { 2432 OUTYY(("P(zonestats:%s)\n", (yyvsp[0].str))); 2433 #ifndef NDEBUG 2434 assert(cfg_parser->current_pattern); 2435 #endif 2436 cfg_parser->current_pattern->zonestats = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); 2437 } 2438 #line 2439 "configparser.c" /* yacc.c:1646 */ 2439 break; 2440 2441 case 153: 2442 #line 720 "configparser.y" /* yacc.c:1646 */ 2443 { 2444 acl_options_type* acl = parse_acl_info(cfg_parser->opt->region, (yyvsp[-1].str), (yyvsp[0].str)); 2445 OUTYY(("P(allow_notify:%s %s)\n", (yyvsp[-1].str), (yyvsp[0].str))); 2446 if(cfg_parser->current_allow_notify) 2447 cfg_parser->current_allow_notify->next = acl; 2448 else 2449 cfg_parser->current_pattern->allow_notify = acl; 2450 cfg_parser->current_allow_notify = acl; 2451 } 2452 #line 2453 "configparser.c" /* yacc.c:1646 */ 2453 break; 2454 2455 case 154: 2456 #line 731 "configparser.y" /* yacc.c:1646 */ 2457 { 2458 } 2459 #line 2460 "configparser.c" /* yacc.c:1646 */ 2460 break; 2461 2462 case 155: 2463 #line 735 "configparser.y" /* yacc.c:1646 */ 2464 { 2465 OUTYY(("P(size_limit_xfr:%s)\n", (yyvsp[0].str))); 2466 if(atoll((yyvsp[0].str)) < 0) 2467 yyerror("number >= 0 expected"); 2468 else cfg_parser->current_pattern->size_limit_xfr = atoll((yyvsp[0].str)); 2469 } 2470 #line 2471 "configparser.c" /* yacc.c:1646 */ 2471 break; 2472 2473 case 156: 2474 #line 743 "configparser.y" /* yacc.c:1646 */ 2475 { 2476 acl_options_type* acl = parse_acl_info(cfg_parser->opt->region, (yyvsp[-1].str), (yyvsp[0].str)); 2477 OUTYY(("P(request_xfr:%s %s)\n", (yyvsp[-1].str), (yyvsp[0].str))); 2478 if(acl->blocked) c_error("blocked address used for request-xfr"); 2479 if(acl->rangetype!=acl_range_single) c_error("address range used for request-xfr"); 2480 if(cfg_parser->current_request_xfr) 2481 cfg_parser->current_request_xfr->next = acl; 2482 else 2483 cfg_parser->current_pattern->request_xfr = acl; 2484 cfg_parser->current_request_xfr = acl; 2485 } 2486 #line 2487 "configparser.c" /* yacc.c:1646 */ 2487 break; 2488 2489 case 157: 2490 #line 755 "configparser.y" /* yacc.c:1646 */ 2491 { 2492 acl_options_type* acl = parse_acl_info(cfg_parser->opt->region, (yyvsp[-1].str), (yyvsp[0].str)); 2493 acl->use_axfr_only = 1; 2494 OUTYY(("P(request_xfr:%s %s)\n", (yyvsp[-1].str), (yyvsp[0].str))); 2495 if(acl->blocked) c_error("blocked address used for request-xfr"); 2496 if(acl->rangetype!=acl_range_single) c_error("address range used for request-xfr"); 2497 if(cfg_parser->current_request_xfr) 2498 cfg_parser->current_request_xfr->next = acl; 2499 else 2500 cfg_parser->current_pattern->request_xfr = acl; 2501 cfg_parser->current_request_xfr = acl; 2502 } 2503 #line 2504 "configparser.c" /* yacc.c:1646 */ 2504 break; 2505 2506 case 158: 2507 #line 768 "configparser.y" /* yacc.c:1646 */ 2508 { 2509 acl_options_type* acl = parse_acl_info(cfg_parser->opt->region, (yyvsp[-1].str), (yyvsp[0].str)); 2510 acl->allow_udp = 1; 2511 OUTYY(("P(request_xfr:%s %s)\n", (yyvsp[-1].str), (yyvsp[0].str))); 2512 if(acl->blocked) c_error("blocked address used for request-xfr"); 2513 if(acl->rangetype!=acl_range_single) c_error("address range used for request-xfr"); 2514 if(cfg_parser->current_request_xfr) 2515 cfg_parser->current_request_xfr->next = acl; 2516 else 2517 cfg_parser->current_pattern->request_xfr = acl; 2518 cfg_parser->current_request_xfr = acl; 2519 } 2520 #line 2521 "configparser.c" /* yacc.c:1646 */ 2521 break; 2522 2523 case 159: 2524 #line 782 "configparser.y" /* yacc.c:1646 */ 2525 { 2526 acl_options_type* acl = parse_acl_info(cfg_parser->opt->region, (yyvsp[-1].str), (yyvsp[0].str)); 2527 OUTYY(("P(notify:%s %s)\n", (yyvsp[-1].str), (yyvsp[0].str))); 2528 if(acl->blocked) c_error("blocked address used for notify"); 2529 if(acl->rangetype!=acl_range_single) c_error("address range used for notify"); 2530 if(cfg_parser->current_notify) 2531 cfg_parser->current_notify->next = acl; 2532 else 2533 cfg_parser->current_pattern->notify = acl; 2534 cfg_parser->current_notify = acl; 2535 } 2536 #line 2537 "configparser.c" /* yacc.c:1646 */ 2537 break; 2538 2539 case 160: 2540 #line 795 "configparser.y" /* yacc.c:1646 */ 2541 { 2542 OUTYY(("P(notify_retry:%s)\n", (yyvsp[0].str))); 2543 if(atoi((yyvsp[0].str)) == 0 && strcmp((yyvsp[0].str), "0") != 0) 2544 yyerror("number expected"); 2545 else { 2546 cfg_parser->current_pattern->notify_retry = atoi((yyvsp[0].str)); 2547 cfg_parser->current_pattern->notify_retry_is_default=0; 2548 } 2549 } 2550 #line 2551 "configparser.c" /* yacc.c:1646 */ 2551 break; 2552 2553 case 161: 2554 #line 806 "configparser.y" /* yacc.c:1646 */ 2555 { 2556 acl_options_type* acl = parse_acl_info(cfg_parser->opt->region, (yyvsp[-1].str), (yyvsp[0].str)); 2557 OUTYY(("P(provide_xfr:%s %s)\n", (yyvsp[-1].str), (yyvsp[0].str))); 2558 if(cfg_parser->current_provide_xfr) 2559 cfg_parser->current_provide_xfr->next = acl; 2560 else 2561 cfg_parser->current_pattern->provide_xfr = acl; 2562 cfg_parser->current_provide_xfr = acl; 2563 } 2564 #line 2565 "configparser.c" /* yacc.c:1646 */ 2565 break; 2566 2567 case 162: 2568 #line 817 "configparser.y" /* yacc.c:1646 */ 2569 { 2570 acl_options_type* acl = parse_acl_info(cfg_parser->opt->region, (yyvsp[0].str), "NOKEY"); 2571 OUTYY(("P(outgoing_interface:%s)\n", (yyvsp[0].str))); 2572 if(acl->rangetype!=acl_range_single) c_error("address range used for outgoing interface"); 2573 if(cfg_parser->current_outgoing_interface) 2574 cfg_parser->current_outgoing_interface->next = acl; 2575 else 2576 cfg_parser->current_pattern->outgoing_interface = acl; 2577 cfg_parser->current_outgoing_interface = acl; 2578 } 2579 #line 2580 "configparser.c" /* yacc.c:1646 */ 2580 break; 2581 2582 case 163: 2583 #line 829 "configparser.y" /* yacc.c:1646 */ 2584 { 2585 OUTYY(("P(allow_axfr_fallback:%s)\n", (yyvsp[0].str))); 2586 if(strcmp((yyvsp[0].str), "yes") != 0 && strcmp((yyvsp[0].str), "no") != 0) 2587 yyerror("expected yes or no."); 2588 else { 2589 cfg_parser->current_pattern->allow_axfr_fallback = (strcmp((yyvsp[0].str), "yes")==0); 2590 cfg_parser->current_pattern->allow_axfr_fallback_is_default = 0; 2591 } 2592 } 2593 #line 2594 "configparser.c" /* yacc.c:1646 */ 2594 break; 2595 2596 case 164: 2597 #line 840 "configparser.y" /* yacc.c:1646 */ 2598 { 2599 OUTYY(("P(zone_rrl_whitelist:%s)\n", (yyvsp[0].str))); 2600 #ifdef RATELIMIT 2601 cfg_parser->current_pattern->rrl_whitelist |= rrlstr2type((yyvsp[0].str)); 2602 #endif 2603 } 2604 #line 2605 "configparser.c" /* yacc.c:1646 */ 2605 break; 2606 2607 case 165: 2608 #line 848 "configparser.y" /* yacc.c:1646 */ 2609 { 2610 OUTYY(("P(zone_max_refresh_time:%s)\n", (yyvsp[0].str))); 2611 if(atoi((yyvsp[0].str)) == 0 && strcmp((yyvsp[0].str), "0") != 0) 2612 yyerror("number expected"); 2613 else { 2614 cfg_parser->current_pattern->max_refresh_time = atoi((yyvsp[0].str)); 2615 cfg_parser->current_pattern->max_refresh_time_is_default = 0; 2616 } 2617 } 2618 #line 2619 "configparser.c" /* yacc.c:1646 */ 2619 break; 2620 2621 case 166: 2622 #line 858 "configparser.y" /* yacc.c:1646 */ 2623 { 2624 OUTYY(("P(zone_min_refresh_time:%s)\n", (yyvsp[0].str))); 2625 if(atoi((yyvsp[0].str)) == 0 && strcmp((yyvsp[0].str), "0") != 0) 2626 yyerror("number expected"); 2627 else { 2628 cfg_parser->current_pattern->min_refresh_time = atoi((yyvsp[0].str)); 2629 cfg_parser->current_pattern->min_refresh_time_is_default = 0; 2630 } 2631 } 2632 #line 2633 "configparser.c" /* yacc.c:1646 */ 2633 break; 2634 2635 case 167: 2636 #line 868 "configparser.y" /* yacc.c:1646 */ 2637 { 2638 OUTYY(("P(zone_max_retry_time:%s)\n", (yyvsp[0].str))); 2639 if(atoi((yyvsp[0].str)) == 0 && strcmp((yyvsp[0].str), "0") != 0) 2640 yyerror("number expected"); 2641 else { 2642 cfg_parser->current_pattern->max_retry_time = atoi((yyvsp[0].str)); 2643 cfg_parser->current_pattern->max_retry_time_is_default = 0; 2644 } 2645 } 2646 #line 2647 "configparser.c" /* yacc.c:1646 */ 2647 break; 2648 2649 case 168: 2650 #line 878 "configparser.y" /* yacc.c:1646 */ 2651 { 2652 OUTYY(("P(zone_min_retry_time:%s)\n", (yyvsp[0].str))); 2653 if(atoi((yyvsp[0].str)) == 0 && strcmp((yyvsp[0].str), "0") != 0) 2654 yyerror("number expected"); 2655 else { 2656 cfg_parser->current_pattern->min_retry_time = atoi((yyvsp[0].str)); 2657 cfg_parser->current_pattern->min_retry_time_is_default = 0; 2658 } 2659 } 2660 #line 2661 "configparser.c" /* yacc.c:1646 */ 2661 break; 2662 2663 case 169: 2664 #line 888 "configparser.y" /* yacc.c:1646 */ 2665 { 2666 OUTYY(("P(zone_multi_master_check:%s)\n", (yyvsp[0].str))); 2667 if(strcmp((yyvsp[0].str), "yes") != 0 && strcmp((yyvsp[0].str), "no") != 0) 2668 yyerror("expected yes or no."); 2669 else cfg_parser->current_pattern->multi_master_check = (strcmp((yyvsp[0].str), "yes")==0); 2670 } 2671 #line 2672 "configparser.c" /* yacc.c:1646 */ 2672 break; 2673 2674 case 170: 2675 #line 897 "configparser.y" /* yacc.c:1646 */ 2676 { 2677 OUTYY(("\nP(key:)\n")); 2678 if(cfg_parser->current_key) { 2679 if(!cfg_parser->current_key->name) c_error("previous key has no name"); 2680 if(!cfg_parser->current_key->algorithm) c_error("previous key has no algorithm"); 2681 if(!cfg_parser->current_key->secret) c_error("previous key has no secret blob"); 2682 key_options_insert(cfg_parser->opt, cfg_parser->current_key); 2683 } 2684 cfg_parser->current_key = key_options_create(cfg_parser->opt->region); 2685 cfg_parser->current_key->algorithm = region_strdup(cfg_parser->opt->region, "sha256"); 2686 } 2687 #line 2688 "configparser.c" /* yacc.c:1646 */ 2688 break; 2689 2690 case 176: 2691 #line 912 "configparser.y" /* yacc.c:1646 */ 2692 { 2693 const dname_type* d; 2694 OUTYY(("P(key_name:%s)\n", (yyvsp[0].str))); 2695 #ifndef NDEBUG 2696 assert(cfg_parser->current_key); 2697 #endif 2698 cfg_parser->current_key->name = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); 2699 d = dname_parse(cfg_parser->opt->region, (yyvsp[0].str)); 2700 if(!d) c_error_msg("Failed to parse tsig key name %s", (yyvsp[0].str)); 2701 else region_recycle(cfg_parser->opt->region, (void*)d, 2702 dname_total_size(d)); 2703 } 2704 #line 2705 "configparser.c" /* yacc.c:1646 */ 2705 break; 2706 2707 case 177: 2708 #line 926 "configparser.y" /* yacc.c:1646 */ 2709 { 2710 OUTYY(("P(key_algorithm:%s)\n", (yyvsp[0].str))); 2711 #ifndef NDEBUG 2712 assert(cfg_parser->current_key); 2713 #endif 2714 if(cfg_parser->current_key->algorithm) 2715 region_recycle(cfg_parser->opt->region, cfg_parser->current_key->algorithm, strlen(cfg_parser->current_key->algorithm)+1); 2716 cfg_parser->current_key->algorithm = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); 2717 if(tsig_get_algorithm_by_name((yyvsp[0].str)) == NULL) 2718 c_error_msg("Bad tsig algorithm %s", (yyvsp[0].str)); 2719 } 2720 #line 2721 "configparser.c" /* yacc.c:1646 */ 2721 break; 2722 2723 case 178: 2724 #line 939 "configparser.y" /* yacc.c:1646 */ 2725 { 2726 uint8_t data[16384]; 2727 int size; 2728 OUTYY(("key_secret:%s)\n", (yyvsp[0].str))); 2729 #ifndef NDEBUG 2730 assert(cfg_parser->current_key); 2731 #endif 2732 cfg_parser->current_key->secret = region_strdup(cfg_parser->opt->region, (yyvsp[0].str)); 2733 size = b64_pton((yyvsp[0].str), data, sizeof(data)); 2734 if(size == -1) { 2735 c_error_msg("Cannot base64 decode tsig secret %s", 2736 cfg_parser->current_key->name? 2737 cfg_parser->current_key->name:""); 2738 } else if(size != 0) { 2739 memset(data, 0xdd, size); /* wipe secret */ 2740 } 2741 } 2742 #line 2743 "configparser.c" /* yacc.c:1646 */ 2743 break; 2744 2745 2746 #line 2747 "configparser.c" /* yacc.c:1646 */ 2747 default: break; 2748 } 2749 /* User semantic actions sometimes alter yychar, and that requires 2750 that yytoken be updated with the new translation. We take the 2751 approach of translating immediately before every use of yytoken. 2752 One alternative is translating here after every semantic action, 2753 but that translation would be missed if the semantic action invokes 2754 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or 2755 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an 2756 incorrect destructor might then be invoked immediately. In the 2757 case of YYERROR or YYBACKUP, subsequent parser actions might lead 2758 to an incorrect destructor call or verbose syntax error message 2759 before the lookahead is translated. */ 2760 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 2761 2762 YYPOPSTACK (yylen); 2763 yylen = 0; 2764 YY_STACK_PRINT (yyss, yyssp); 2765 2766 *++yyvsp = yyval; 2767 2768 /* Now 'shift' the result of the reduction. Determine what state 2769 that goes to, based on the state we popped back to and the rule 2770 number reduced by. */ 2771 2772 yyn = yyr1[yyn]; 2773 2774 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 2775 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 2776 yystate = yytable[yystate]; 2777 else 2778 yystate = yydefgoto[yyn - YYNTOKENS]; 2779 2780 goto yynewstate; 2781 2782 2783 /*--------------------------------------. 2784 | yyerrlab -- here on detecting error. | 2785 `--------------------------------------*/ 2786 yyerrlab: 2787 /* Make sure we have latest lookahead translation. See comments at 2788 user semantic actions for why this is necessary. */ 2789 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); 2790 2791 /* If not already recovering from an error, report this error. */ 2792 if (!yyerrstatus) 2793 { 2794 ++yynerrs; 2795 #if ! YYERROR_VERBOSE 2796 yyerror (YY_("syntax error")); 2797 #else 2798 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ 2799 yyssp, yytoken) 2800 { 2801 char const *yymsgp = YY_("syntax error"); 2802 int yysyntax_error_status; 2803 yysyntax_error_status = YYSYNTAX_ERROR; 2804 if (yysyntax_error_status == 0) 2805 yymsgp = yymsg; 2806 else if (yysyntax_error_status == 1) 2807 { 2808 if (yymsg != yymsgbuf) 2809 YYSTACK_FREE (yymsg); 2810 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); 2811 if (!yymsg) 2812 { 2813 yymsg = yymsgbuf; 2814 yymsg_alloc = sizeof yymsgbuf; 2815 yysyntax_error_status = 2; 2816 } 2817 else 2818 { 2819 yysyntax_error_status = YYSYNTAX_ERROR; 2820 yymsgp = yymsg; 2821 } 2822 } 2823 yyerror (yymsgp); 2824 if (yysyntax_error_status == 2) 2825 goto yyexhaustedlab; 2826 } 2827 # undef YYSYNTAX_ERROR 2828 #endif 2829 } 2830 2831 2832 2833 if (yyerrstatus == 3) 2834 { 2835 /* If just tried and failed to reuse lookahead token after an 2836 error, discard it. */ 2837 2838 if (yychar <= YYEOF) 2839 { 2840 /* Return failure if at end of input. */ 2841 if (yychar == YYEOF) 2842 YYABORT; 2843 } 2844 else 2845 { 2846 yydestruct ("Error: discarding", 2847 yytoken, &yylval); 2848 yychar = YYEMPTY; 2849 } 2850 } 2851 2852 /* Else will try to reuse lookahead token after shifting the error 2853 token. */ 2854 goto yyerrlab1; 2855 2856 2857 /*---------------------------------------------------. 2858 | yyerrorlab -- error raised explicitly by YYERROR. | 2859 `---------------------------------------------------*/ 2860 yyerrorlab: 2861 2862 /* Pacify compilers like GCC when the user code never invokes 2863 YYERROR and the label yyerrorlab therefore never appears in user 2864 code. */ 2865 if (/*CONSTCOND*/ 0) 2866 goto yyerrorlab; 2867 2868 /* Do not reclaim the symbols of the rule whose action triggered 2869 this YYERROR. */ 2870 YYPOPSTACK (yylen); 2871 yylen = 0; 2872 YY_STACK_PRINT (yyss, yyssp); 2873 yystate = *yyssp; 2874 goto yyerrlab1; 2875 2876 2877 /*-------------------------------------------------------------. 2878 | yyerrlab1 -- common code for both syntax error and YYERROR. | 2879 `-------------------------------------------------------------*/ 2880 yyerrlab1: 2881 yyerrstatus = 3; /* Each real token shifted decrements this. */ 2882 2883 for (;;) 2884 { 2885 yyn = yypact[yystate]; 2886 if (!yypact_value_is_default (yyn)) 2887 { 2888 yyn += YYTERROR; 2889 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 2890 { 2891 yyn = yytable[yyn]; 2892 if (0 < yyn) 2893 break; 2894 } 2895 } 2896 2897 /* Pop the current state because it cannot handle the error token. */ 2898 if (yyssp == yyss) 2899 YYABORT; 2900 2901 2902 yydestruct ("Error: popping", 2903 yystos[yystate], yyvsp); 2904 YYPOPSTACK (1); 2905 yystate = *yyssp; 2906 YY_STACK_PRINT (yyss, yyssp); 2907 } 2908 2909 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 2910 *++yyvsp = yylval; 2911 YY_IGNORE_MAYBE_UNINITIALIZED_END 2912 2913 2914 /* Shift the error token. */ 2915 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 2916 2917 yystate = yyn; 2918 goto yynewstate; 2919 2920 2921 /*-------------------------------------. 2922 | yyacceptlab -- YYACCEPT comes here. | 2923 `-------------------------------------*/ 2924 yyacceptlab: 2925 yyresult = 0; 2926 goto yyreturn; 2927 2928 /*-----------------------------------. 2929 | yyabortlab -- YYABORT comes here. | 2930 `-----------------------------------*/ 2931 yyabortlab: 2932 yyresult = 1; 2933 goto yyreturn; 2934 2935 #if !defined yyoverflow || YYERROR_VERBOSE 2936 /*-------------------------------------------------. 2937 | yyexhaustedlab -- memory exhaustion comes here. | 2938 `-------------------------------------------------*/ 2939 yyexhaustedlab: 2940 yyerror (YY_("memory exhausted")); 2941 yyresult = 2; 2942 /* Fall through. */ 2943 #endif 2944 2945 yyreturn: 2946 if (yychar != YYEMPTY) 2947 { 2948 /* Make sure we have latest lookahead translation. See comments at 2949 user semantic actions for why this is necessary. */ 2950 yytoken = YYTRANSLATE (yychar); 2951 yydestruct ("Cleanup: discarding lookahead", 2952 yytoken, &yylval); 2953 } 2954 /* Do not reclaim the symbols of the rule whose action triggered 2955 this YYABORT or YYACCEPT. */ 2956 YYPOPSTACK (yylen); 2957 YY_STACK_PRINT (yyss, yyssp); 2958 while (yyssp != yyss) 2959 { 2960 yydestruct ("Cleanup: popping", 2961 yystos[*yyssp], yyvsp); 2962 YYPOPSTACK (1); 2963 } 2964 #ifndef yyoverflow 2965 if (yyss != yyssa) 2966 YYSTACK_FREE (yyss); 2967 #endif 2968 #if YYERROR_VERBOSE 2969 if (yymsg != yymsgbuf) 2970 YYSTACK_FREE (yymsg); 2971 #endif 2972 return yyresult; 2973 } 2974 #line 958 "configparser.y" /* yacc.c:1906 */ 2975 2976 2977 /* parse helper routines could be here */ 2978