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