diff options
Diffstat (limited to 'usr.sbin/nsd')
-rw-r--r-- | usr.sbin/nsd/acx_nlnetlabs.m4 | 276 | ||||
-rw-r--r-- | usr.sbin/nsd/compat/b64_pton.c | 222 | ||||
-rw-r--r-- | usr.sbin/nsd/compat/memcmp.c | 25 | ||||
-rw-r--r-- | usr.sbin/nsd/compat/snprintf.c | 6 | ||||
-rw-r--r-- | usr.sbin/nsd/compat/strlcat.c | 73 | ||||
-rw-r--r-- | usr.sbin/nsd/configlexer.c | 2572 | ||||
-rw-r--r-- | usr.sbin/nsd/configlexer.lex | 1 | ||||
-rw-r--r-- | usr.sbin/nsd/configparser.c | 2390 | ||||
-rw-r--r-- | usr.sbin/nsd/configparser.h | 168 | ||||
-rw-r--r-- | usr.sbin/nsd/dbaccess.c | 18 | ||||
-rw-r--r-- | usr.sbin/nsd/dbcreate.c | 10 | ||||
-rw-r--r-- | usr.sbin/nsd/difffile.c | 2 | ||||
-rw-r--r-- | usr.sbin/nsd/namedb.h | 1 | ||||
-rw-r--r-- | usr.sbin/nsd/nsd.conf.sample.in | 3 | ||||
-rw-r--r-- | usr.sbin/nsd/options.c | 1 | ||||
-rw-r--r-- | usr.sbin/nsd/options.h | 1 | ||||
-rw-r--r-- | usr.sbin/nsd/region-allocator.h | 17 | ||||
-rw-r--r-- | usr.sbin/nsd/zlexer.c | 2301 | ||||
-rw-r--r-- | usr.sbin/nsd/zlexer.lex | 13 | ||||
-rw-r--r-- | usr.sbin/nsd/zparser.c | 3689 | ||||
-rw-r--r-- | usr.sbin/nsd/zparser.h | 224 |
21 files changed, 11882 insertions, 131 deletions
diff --git a/usr.sbin/nsd/acx_nlnetlabs.m4 b/usr.sbin/nsd/acx_nlnetlabs.m4 index 3baa9d3bf13..bb7ac286722 100644 --- a/usr.sbin/nsd/acx_nlnetlabs.m4 +++ b/usr.sbin/nsd/acx_nlnetlabs.m4 @@ -2,10 +2,17 @@ # Copyright 2009, Wouter Wijngaards, NLnet Labs. # BSD licensed. # -# Version 2 -# 2009-07-03 -# Changelog -# - fixup LDFLAGS for empty ssl dir. +# Version 8 +# 2010-03-01 Fix RPATH using CONFIG_COMMANDS to run at the very end. +# 2010-02-18 WITH_SSL outputs the LIBSSL_LDFLAGS, LIBS, CPPFLAGS seperate, -ldl +# 2010-02-01 added ACX_CHECK_MEMCMP_SIGNED, AHX_MEMCMP_BROKEN +# 2010-01-20 added AHX_COONFIG_STRLCAT +# 2009-07-14 U_CHAR detection improved for windows crosscompile. +# added ACX_FUNC_MALLOC +# fixup some #if to #ifdef +# NONBLOCKING test for mingw crosscompile. +# 2009-07-13 added ACX_WITH_SSL_OPTIONAL +# 2009-07-03 fixup LDFLAGS for empty ssl dir. # # Automates some of the checking constructs. Aims at portability for POSIX. # Documentation for functions is below. @@ -30,6 +37,8 @@ # ACX_TYPE_IN_PORT_T - in_port_t type. # ACX_ARG_RPATH - add --disable-rpath option. # ACX_WITH_SSL - add --with-ssl option, link -lcrypto. +# ACX_WITH_SSL_OPTIONAL - add --with-ssl option, link -lcrypto, +# where --without-ssl is also accepted # ACX_LIB_SSL - setup to link -lssl. # ACX_SYS_LARGEFILE - improved sys_largefile, fseeko, >2G files. # ACX_CHECK_GETADDRINFO_WITH_INCLUDES - find getaddrinfo, portably. @@ -37,6 +46,7 @@ # ACX_CHECK_NONBLOCKING_BROKEN - see if nonblocking sockets really work. # ACX_MKDIR_ONE_ARG - determine mkdir(2) number of arguments. # ACX_FUNC_IOCTLSOCKET - find ioctlsocket, portably. +# ACX_FUNC_MALLOC - check malloc, define replacement . # AHX_CONFIG_FORMAT_ATTRIBUTE - config.h text for format. # AHX_CONFIG_UNUSED_ATTRIBUTE - config.h text for unused. # AHX_CONFIG_FSEEKO - define fseeko, ftello fallback. @@ -48,6 +58,7 @@ # AHX_CONFIG_INET_NTOP - inet_ntop compat prototype # AHX_CONFIG_INET_ATON - inet_aton compat prototype # AHX_CONFIG_MEMMOVE - memmove compat prototype +# AHX_CONFIG_STRLCAT - strlcat compat prototype # AHX_CONFIG_STRLCPY - strlcpy compat prototype # AHX_CONFIG_GMTIME_R - gmtime_r compat prototype # AHX_CONFIG_W32_SLEEP - w32 compat for sleep @@ -60,6 +71,8 @@ # AHX_CONFIG_FLAG_OMITTED - define omitted flag # AHX_CONFIG_FLAG_EXT - define omitted extension flag # AHX_CONFIG_EXT_FLAGS - define the stripped extension flags +# ACX_CHECK_MEMCMP_SIGNED - check if memcmp uses signed characters. +# AHX_MEMCMP_BROKEN - replace memcmp func for CHECK_MEMCMP_SIGNED. # dnl Escape backslashes as \\, for C:\ paths, for the C preprocessor defines. @@ -480,14 +493,20 @@ AC_PROG_LIBTOOL dnl Detect if u_char type is defined, otherwise define it. AC_DEFUN([ACX_TYPE_U_CHAR], - [AC_CHECK_TYPE(u_char, unsigned char)]) +[AC_CHECK_TYPE([u_char], , + [AC_DEFINE([u_char], [unsigned char], [Define to 'unsigned char if not defined])], [ +AC_INCLUDES_DEFAULT +#ifdef HAVE_WINSOCK2_H +# include <winsock2.h> +#endif +]) ]) dnl Detect if rlim_t type is defined, otherwise define it. AC_DEFUN([ACX_TYPE_RLIM_T], [AC_CHECK_TYPE(rlim_t, , [AC_DEFINE([rlim_t], [unsigned long], [Define to 'int' if not defined])], [ AC_INCLUDES_DEFAULT -#if HAVE_SYS_RESOURCE_H +#ifdef HAVE_SYS_RESOURCE_H # include <sys/resource.h> #endif ]) ]) @@ -498,31 +517,34 @@ AC_DEFUN([ACX_TYPE_SOCKLEN_T], AC_CHECK_TYPE(socklen_t, , [AC_DEFINE([socklen_t], [int], [Define to 'int' if not defined])], [ AC_INCLUDES_DEFAULT -#if HAVE_SYS_SOCKET_H +#ifdef HAVE_SYS_SOCKET_H # include <sys/socket.h> #endif +#ifdef HAVE_WS2TCPIP_H +# include <ws2tcpip.h> +#endif ]) ]) -dnl Detect if socklen_t type is defined, otherwise define it. +dnl Detect if in_addr_t type is defined, otherwise define it. AC_DEFUN([ACX_TYPE_IN_ADDR_T], [ AC_CHECK_TYPE(in_addr_t, [], [AC_DEFINE([in_addr_t], [uint32_t], [in_addr_t])], [ AC_INCLUDES_DEFAULT -#if HAVE_SYS_TYPES_H +#ifdef HAVE_SYS_TYPES_H # include <sys/types.h> #endif -#if HAVE_NETINET_IN_H +#ifdef HAVE_NETINET_IN_H # include <netinet/in.h> #endif ]) ]) -dnl Detect if socklen_t type is defined, otherwise define it. +dnl Detect if in_port_t type is defined, otherwise define it. AC_DEFUN([ACX_TYPE_IN_PORT_T], [ AC_CHECK_TYPE(in_port_t, [], [AC_DEFINE([in_port_t], [uint16_t], [in_port_t])], [ AC_INCLUDES_DEFAULT -#if HAVE_SYS_TYPES_H +#ifdef HAVE_SYS_TYPES_H # include <sys/types.h> #endif -#if HAVE_NETINET_IN_H +#ifdef HAVE_NETINET_IN_H # include <netinet/in.h> #endif ]) ]) @@ -535,12 +557,14 @@ AC_ARG_ENABLE(rpath, [ --disable-rpath disable hardcoded rpath (default=enabled)], enable_rpath=$enableval, enable_rpath=yes) if test "x$enable_rpath" = xno; then - AC_MSG_RESULT([Fixing libtool for -rpath problems.]) + dnl AC_MSG_RESULT([Fixing libtool for -rpath problems.]) + AC_CONFIG_COMMANDS([disable-rpath], [ sed < libtool > libtool-2 \ 's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=" -D__LIBTOOL_RPATH_SED__ "/' mv libtool-2 libtool chmod 755 libtool libtool="./libtool" + ]) fi ]) @@ -555,22 +579,11 @@ AC_DEFUN([ACX_RUNTIME_PATH_ADD], [ fi ]) -dnl Check for SSL. -dnl Adds --with-ssl option, searches for openssl and defines HAVE_SSL if found -dnl Setup of CPPFLAGS, CFLAGS. Adds -lcrypto to LIBS. -dnl Checks main header files of SSL. -dnl -AC_DEFUN([ACX_WITH_SSL], -[ -AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl=pathname], - [enable SSL (will check /usr/local/ssl - /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr)]),[ - ],[ - withval="yes" - ]) - if test x_$withval = x_no; then - AC_MSG_ERROR([Need SSL library to do digital signature cryptography]) - fi +dnl Common code for both ACX_WITH_SSL and ACX_WITH_SSL_OPTIONAL +dnl Takes one argument; the withval checked in those 2 functions +dnl sets up the environment for the given openssl path +AC_DEFUN([ACX_SSL_CHECKS], [ + withval=$1 if test x_$withval != x_no; then AC_MSG_CHECKING(for SSL) if test x_$withval = x_ -o x_$withval = x_yes; then @@ -581,10 +594,11 @@ AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl=pathname], if test -f "$dir/include/openssl/ssl.h"; then found_ssl="yes" AC_DEFINE_UNQUOTED([HAVE_SSL], [], [Define if you have the SSL libraries installed.]) - dnl assume /usr/include is already in the include-path. - if test "$ssldir" != "/usr"; then - CPPFLAGS="$CPPFLAGS -I$ssldir/include" - fi + dnl assume /usr/include is already in the include-path. + if test "$ssldir" != "/usr"; then + CPPFLAGS="$CPPFLAGS -I$ssldir/include" + LIBSSL_CPPFLAGS="$LIBSSL_CPPFLAGS -I$ssldir/include" + fi break; fi done @@ -593,61 +607,108 @@ AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl=pathname], else AC_MSG_RESULT(found in $ssldir) HAVE_SSL=yes - dnl assume /usr is already in the lib and dynlib paths. - if test "$ssldir" != "/usr" -a "$ssldir" != ""; then + dnl assume /usr is already in the lib and dynlib paths. + if test "$ssldir" != "/usr" -a "$ssldir" != ""; then LDFLAGS="$LDFLAGS -L$ssldir/lib" - ACX_RUNTIME_PATH_ADD([$ssldir/lib]) - fi - - AC_MSG_CHECKING([for HMAC_CTX_init in -lcrypto]) - LIBS="$LIBS -lcrypto" - AC_TRY_LINK(, [ - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); - ], [ - AC_MSG_RESULT(yes) - AC_DEFINE([HAVE_HMAC_CTX_INIT], 1, - [If you have HMAC_CTX_init]) - ], [ - AC_MSG_RESULT(no) - # check if -lwsock32 or -lgdi32 are needed. - BAKLIBS="$LIBS" - LIBS="$LIBS -lgdi32" - AC_MSG_CHECKING([if -lcrypto needs -lgdi32]) - AC_TRY_LINK([], [ - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); - ],[ - AC_DEFINE([HAVE_HMAC_CTX_INIT], 1, - [If you have HMAC_CTX_init]) - AC_MSG_RESULT(yes) - ],[ - AC_MSG_RESULT(no) - LIBS="$BAKLIBS" - LIBS="$LIBS -ldl" - AC_MSG_CHECKING([if -lcrypto needs -ldl]) - AC_TRY_LINK([], [ - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); - ],[ - AC_DEFINE([HAVE_HMAC_CTX_INIT], 1, - [If you have HMAC_CTX_init]) - AC_MSG_RESULT(yes) - ],[ - AC_MSG_RESULT(no) + LIBSSL_LDFLAGS="$LIBSSL_LDFLAGS -L$ssldir/lib" + ACX_RUNTIME_PATH_ADD([$ssldir/lib]) + fi + + AC_MSG_CHECKING([for HMAC_CTX_init in -lcrypto]) + LIBS="$LIBS -lcrypto" + LIBSSL_LIBS="$LIBSSL_LIBS -lcrypto" + AC_TRY_LINK(, [ + int HMAC_CTX_init(void); + (void)HMAC_CTX_init(); + ], [ + AC_MSG_RESULT(yes) + AC_DEFINE([HAVE_HMAC_CTX_INIT], 1, + [If you have HMAC_CTX_init]) + ], [ + AC_MSG_RESULT(no) + # check if -lwsock32 or -lgdi32 are needed. + BAKLIBS="$LIBS" + BAKSSLLIBS="$LIBSSL_LIBS" + LIBS="$LIBS -lgdi32" + LIBSSL_LIBS="$LIBSSL_LIBS -lgdi32" + AC_MSG_CHECKING([if -lcrypto needs -lgdi32]) + AC_TRY_LINK([], [ + int HMAC_CTX_init(void); + (void)HMAC_CTX_init(); + ],[ + AC_DEFINE([HAVE_HMAC_CTX_INIT], 1, + [If you have HMAC_CTX_init]) + AC_MSG_RESULT(yes) + ],[ + AC_MSG_RESULT(no) + LIBS="$BAKLIBS" + LIBSSL_LIBS="$BAKSSLLIBS" + LIBS="$LIBS -ldl" + LIBSSL_LIBS="$LIBSSL_LIBS -ldl" + AC_MSG_CHECKING([if -lcrypto needs -ldl]) + AC_TRY_LINK([], [ + int HMAC_CTX_init(void); + (void)HMAC_CTX_init(); + ],[ + AC_DEFINE([HAVE_HMAC_CTX_INIT], 1, + [If you have HMAC_CTX_init]) + AC_MSG_RESULT(yes) + ],[ + AC_MSG_RESULT(no) AC_MSG_ERROR([OpenSSL found in $ssldir, but version 0.9.7 or higher is required]) - ]) - ]) + ]) + ]) ]) fi AC_SUBST(HAVE_SSL) - AC_SUBST(RUNTIME_PATH) + AC_SUBST(RUNTIME_PATH) + # openssl engine functionality needs dlopen(). + BAKLIBS="$LIBS" + AC_SEARCH_LIBS([dlopen], [dl]) + if test "$LIBS" != "$BAKLIBS"; then + LIBSSL_LIBS="$LIBSSL_LIBS -ldl" + fi fi AC_CHECK_HEADERS([openssl/ssl.h],,, [AC_INCLUDES_DEFAULT]) AC_CHECK_HEADERS([openssl/err.h],,, [AC_INCLUDES_DEFAULT]) AC_CHECK_HEADERS([openssl/rand.h],,, [AC_INCLUDES_DEFAULT]) +])dnl End of ACX_SSL_CHECKS + +dnl Check for SSL, where SSL is mandatory +dnl Adds --with-ssl option, searches for openssl and defines HAVE_SSL if found +dnl Setup of CPPFLAGS, CFLAGS. Adds -lcrypto to LIBS. +dnl Checks main header files of SSL. +dnl +AC_DEFUN([ACX_WITH_SSL], +[ +AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl=pathname], + [enable SSL (will check /usr/local/ssl + /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr)]),[ + ],[ + withval="yes" + ]) + if test x_$withval = x_no; then + AC_MSG_ERROR([Need SSL library to do digital signature cryptography]) + fi + ACX_SSL_CHECKS($withval) ])dnl End of ACX_WITH_SSL +dnl Check for SSL, where ssl is optional (--without-ssl is allowed) +dnl Adds --with-ssl option, searches for openssl and defines HAVE_SSL if found +dnl Setup of CPPFLAGS, CFLAGS. Adds -lcrypto to LIBS. +dnl Checks main header files of SSL. +dnl +AC_DEFUN([ACX_WITH_SSL_OPTIONAL], +[ +AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl=pathname], + [enable SSL (will check /usr/local/ssl + /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr)]),[ + ],[ + withval="yes" + ]) + ACX_SSL_CHECKS($withval) +])dnl End of ACX_WITH_SSL_OPTIONAL + dnl Setup to use -lssl dnl To use -lcrypto, use the ACX_WITH_SSL setup (before this one). AC_DEFUN([ACX_LIB_SSL], @@ -779,6 +840,10 @@ dnl a nonblocking socket do not work, a new call to select is necessary. AC_DEFUN([ACX_CHECK_NONBLOCKING_BROKEN], [ AC_MSG_CHECKING([if nonblocking sockets work]) +if echo $target | grep mingw32 >/dev/null; then + AC_MSG_RESULT([no (windows)]) + AC_DEFINE([NONBLOCKING_IS_BROKEN], 1, [Define if the network stack does not fully support nonblocking io (causes lower performance).]) +else AC_RUN_IFELSE(AC_LANG_PROGRAM([ #include <stdio.h> #include <string.h> @@ -904,6 +969,7 @@ AC_RUN_IFELSE(AC_LANG_PROGRAM([ ], [ AC_MSG_RESULT([crosscompile(yes)]) ]) +fi ])dnl End of ACX_CHECK_NONBLOCKING_BROKEN dnl Check if mkdir has one or two arguments. @@ -947,6 +1013,16 @@ AC_DEFINE(HAVE_IOCTLSOCKET, 1, [if the function 'ioctlsocket' is available]) ],[AC_MSG_RESULT(no)]) ])dnl end of ACX_FUNC_IOCTLSOCKET +dnl detect malloc and provide malloc compat prototype. +dnl $1: unique name for compat code +AC_DEFUN([ACX_FUNC_MALLOC], +[ + AC_FUNC_MALLOC + if test "$ac_cv_func_malloc_0_nonnull" = no; then + AC_DEFINE_UNQUOTED([malloc], [rpl_malloc_$1], [Define if replacement function should be used.]) + fi +]) + dnl Define fallback for fseeko and ftello if needed. AC_DEFUN([AHX_CONFIG_FSEEKO], [ @@ -1033,6 +1109,16 @@ void *memmove(void *dest, const void *src, size_t n); #endif ]) +dnl provide strlcat compat prototype. +dnl $1: unique name for compat code +AC_DEFUN([AHX_CONFIG_STRLCAT], +[ +#ifndef HAVE_STRLCAT +#define strlcat strlcat_$1 +size_t strlcat(char *dst, const char *src, size_t siz); +#endif +]) + dnl provide strlcpy compat prototype. dnl $1: unique name for compat code AC_DEFUN([AHX_CONFIG_STRLCPY], @@ -1149,4 +1235,38 @@ AHX_CONFIG_FLAG_EXT(-D_ALL_SOURCE) AHX_CONFIG_FLAG_EXT(-D_LARGEFILE_SOURCE=1) ]) +dnl check if memcmp is using signed characters and replace if so. +AC_DEFUN([ACX_CHECK_MEMCMP_SIGNED], +[AC_MSG_CHECKING([if memcmp compares unsigned]) +AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +int main(void) +{ + char a = 255, b = 0; + if(memcmp(&a, &b, 1) < 0) + return 1; + return 0; +} +]])], [AC_MSG_RESULT([yes]) ], +[ AC_MSG_RESULT([no]) + AC_DEFINE([MEMCMP_IS_BROKEN], [1], [Define if memcmp() does not compare unsigned bytes]) + AC_LIBOBJ([memcmp]) +], [ AC_MSG_RESULT([cross-compile no]) + AC_DEFINE([MEMCMP_IS_BROKEN], [1], [Define if memcmp() does not compare unsigned bytes]) + AC_LIBOBJ([memcmp]) +]) ]) + +dnl define memcmp to its replacement, pass unique id for program as arg +AC_DEFUN([AHX_MEMCMP_BROKEN], [ +#ifdef MEMCMP_IS_BROKEN +# ifdef memcmp +# undef memcmp +# endif +#define memcmp memcmp_$1 +int memcmp(const void *x, const void *y, size_t n); +#endif +]) + dnl End of file diff --git a/usr.sbin/nsd/compat/b64_pton.c b/usr.sbin/nsd/compat/b64_pton.c index b69bb21bfe3..08506040b64 100644 --- a/usr.sbin/nsd/compat/b64_pton.c +++ b/usr.sbin/nsd/compat/b64_pton.c @@ -107,9 +107,9 @@ static const char Pad64 = '='; end of the data is performed using the '=' character. Since all base64 input is an integral number of octets, only the - ------------------------------------------------- + ------------------------------------------------- following cases can arise: - + (1) the final quantum of encoding input is an integral multiple of 24 bits; here, the final unit of encoded output will be an integral multiple of 4 characters @@ -128,65 +128,101 @@ static const char Pad64 = '='; it returns the number of data bytes stored at the target, or -1 on error. */ -int -b64_pton(char const *src, uint8_t *target, size_t targsize) +static int b64rmap_initialized = 0; +static uint8_t b64rmap[256]; + +static const uint8_t b64rmap_special = 0xf0; +static const uint8_t b64rmap_end = 0xfd; +static const uint8_t b64rmap_space = 0xfe; +static const uint8_t b64rmap_invalid = 0xff; + +/** + * Initializing the reverse map is not thread safe. + * Which is fine for NSD. For now... + **/ +static void +b64_initialize_rmap () +{ + int i; + char ch; + + /* Null: end of string, stop parsing */ + b64rmap[0] = b64rmap_end; + + for (i = 1; i < 256; ++i) { + ch = (char)i; + /* Whitespaces */ + if (isspace(ch)) + b64rmap[i] = b64rmap_space; + /* Padding: stop parsing */ + else if (ch == Pad64) + b64rmap[i] = b64rmap_end; + /* Non-base64 char */ + else + b64rmap[i] = b64rmap_invalid; + } + + /* Fill reverse mapping for base64 chars */ + for (i = 0; Base64[i] != '\0'; ++i) + b64rmap[(uint8_t)Base64[i]] = i; + + b64rmap_initialized = 1; +} + +static int +b64_pton_do(char const *src, uint8_t *target, size_t targsize) { int tarindex, state, ch; - char *pos; + uint8_t ofs; state = 0; tarindex = 0; - while ((ch = *src++) != '\0') { - if (isspace((unsigned char)ch)) /* Skip whitespace anywhere. */ - continue; + while (1) + { + ch = *src++; + ofs = b64rmap[ch]; - if (ch == Pad64) - break; - - pos = strchr(Base64, ch); - if (pos == 0) { + if (ofs >= b64rmap_special) { + /* Ignore whitespaces */ + if (ofs == b64rmap_space) + continue; + /* End of base64 characters */ + if (ofs == b64rmap_end) + break; /* A non-base64 character. */ return (-1); } switch (state) { case 0: - if (target) { - if ((size_t)tarindex >= targsize) - return (-1); - target[tarindex] = (pos - Base64) << 2; - } + if ((size_t)tarindex >= targsize) + return (-1); + target[tarindex] = ofs << 2; state = 1; break; case 1: - if (target) { - if ((size_t)tarindex + 1 >= targsize) - return (-1); - target[tarindex] |= (pos - Base64) >> 4; - target[tarindex+1] = ((pos - Base64) & 0x0f) - << 4 ; - } + if ((size_t)tarindex + 1 >= targsize) + return (-1); + target[tarindex] |= ofs >> 4; + target[tarindex+1] = (ofs & 0x0f) + << 4 ; tarindex++; state = 2; break; case 2: - if (target) { - if ((size_t)tarindex + 1 >= targsize) - return (-1); - target[tarindex] |= (pos - Base64) >> 2; - target[tarindex+1] = ((pos - Base64) & 0x03) - << 6; - } + if ((size_t)tarindex + 1 >= targsize) + return (-1); + target[tarindex] |= ofs >> 2; + target[tarindex+1] = (ofs & 0x03) + << 6; tarindex++; state = 3; break; case 3: - if (target) { - if ((size_t)tarindex >= targsize) - return (-1); - target[tarindex] |= (pos - Base64); - } + if ((size_t)tarindex >= targsize) + return (-1); + target[tarindex] |= ofs; tarindex++; state = 0; break; @@ -210,7 +246,7 @@ b64_pton(char const *src, uint8_t *target, size_t targsize) case 2: /* Valid, means one byte of info */ /* Skip any number of spaces. */ for ((void)NULL; ch != '\0'; ch = *src++) - if (!isspace((unsigned char)ch)) + if (b64rmap[ch] != b64rmap_space) break; /* Make sure there is another trailing = sign. */ if (ch != Pad64) @@ -225,7 +261,7 @@ b64_pton(char const *src, uint8_t *target, size_t targsize) * whitespace after it? */ for ((void)NULL; ch != '\0'; ch = *src++) - if (!isspace((unsigned char)ch)) + if (b64rmap[ch] != b64rmap_space) return (-1); /* @@ -234,7 +270,7 @@ b64_pton(char const *src, uint8_t *target, size_t targsize) * zeros. If we don't check them, they become a * subliminal channel. */ - if (target && target[tarindex] != 0) + if (target[tarindex] != 0) return (-1); } } else { @@ -248,3 +284,109 @@ b64_pton(char const *src, uint8_t *target, size_t targsize) return (tarindex); } + + +static int +b64_pton_len(char const *src) +{ + int tarindex, state, ch; + uint8_t ofs; + + state = 0; + tarindex = 0; + + while (1) + { + ch = *src++; + ofs = b64rmap[ch]; + + if (ofs >= b64rmap_special) { + /* Ignore whitespaces */ + if (ofs == b64rmap_space) + continue; + /* End of base64 characters */ + if (ofs == b64rmap_end) + break; + /* A non-base64 character. */ + return (-1); + } + + switch (state) { + case 0: + state = 1; + break; + case 1: + tarindex++; + state = 2; + break; + case 2: + tarindex++; + state = 3; + break; + case 3: + tarindex++; + state = 0; + break; + default: + abort(); + } + } + + /* + * We are done decoding Base-64 chars. Let's see if we ended + * on a byte boundary, and/or with erroneous trailing characters. + */ + + if (ch == Pad64) { /* We got a pad char. */ + ch = *src++; /* Skip it, get next. */ + switch (state) { + case 0: /* Invalid = in first position */ + case 1: /* Invalid = in second position */ + return (-1); + + case 2: /* Valid, means one byte of info */ + /* Skip any number of spaces. */ + for ((void)NULL; ch != '\0'; ch = *src++) + if (b64rmap[ch] != b64rmap_space) + break; + /* Make sure there is another trailing = sign. */ + if (ch != Pad64) + return (-1); + ch = *src++; /* Skip the = */ + /* Fall through to "single trailing =" case. */ + /* FALLTHROUGH */ + + case 3: /* Valid, means two bytes of info */ + /* + * We know this char is an =. Is there anything but + * whitespace after it? + */ + for ((void)NULL; ch != '\0'; ch = *src++) + if (b64rmap[ch] != b64rmap_space) + return (-1); + + } + } else { + /* + * We ended by seeing the end of the string. Make sure we + * have no partial bytes lying around. + */ + if (state != 0) + return (-1); + } + + return (tarindex); +} + + +int +b64_pton(char const *src, uint8_t *target, size_t targsize) +{ + if (!b64rmap_initialized) + b64_initialize_rmap (); + + if (target) + return b64_pton_do (src, target, targsize); + else + return b64_pton_len (src); +} diff --git a/usr.sbin/nsd/compat/memcmp.c b/usr.sbin/nsd/compat/memcmp.c new file mode 100644 index 00000000000..9446276f410 --- /dev/null +++ b/usr.sbin/nsd/compat/memcmp.c @@ -0,0 +1,25 @@ +/* + * memcmp.c: memcmp compat implementation. + * + * Copyright (c) 2010, NLnet Labs. All rights reserved. + * + * See LICENSE for the license. +*/ + +#include <config.h> + +int memcmp(const void *x, const void *y, size_t n); + +int memcmp(const void *x, const void *y, size_t n) +{ + const uint8_t* x8 = (const uint8_t*)x; + const uint8_t* y8 = (const uint8_t*)y; + size_t i; + for(i=0; i<n; i++) { + if(x8[i] < y8[i]) + return -1; + else if(x8[i] > y8[i]) + return 1; + } + return 0; +} diff --git a/usr.sbin/nsd/compat/snprintf.c b/usr.sbin/nsd/compat/snprintf.c index 674cc09c81d..52429edf06d 100644 --- a/usr.sbin/nsd/compat/snprintf.c +++ b/usr.sbin/nsd/compat/snprintf.c @@ -671,15 +671,15 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, */ dopr_outch (buffer, currlen, maxlen, '.'); - while (fplace > 0) - dopr_outch (buffer, currlen, maxlen, fconvert[--fplace]); - while (zpadlen > 0) { dopr_outch (buffer, currlen, maxlen, '0'); --zpadlen; } + while (fplace > 0) + dopr_outch (buffer, currlen, maxlen, fconvert[--fplace]); + while (padlen < 0) { dopr_outch (buffer, currlen, maxlen, ' '); diff --git a/usr.sbin/nsd/compat/strlcat.c b/usr.sbin/nsd/compat/strlcat.c new file mode 100644 index 00000000000..cc5a5918d2e --- /dev/null +++ b/usr.sbin/nsd/compat/strlcat.c @@ -0,0 +1,73 @@ +/* compat/strlcat.c */ + +/*- + * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* OPENBSD ORIGINAL: lib/libc/string/strlcat.c */ + +#include <config.h> +#ifndef HAVE_STRLCAT + +#include <sys/types.h> +#include <string.h> + +/* + * Appends src to string dst of size siz (unlike strncat, siz is the + * full size of dst, not space left). At most siz-1 characters + * will be copied. Always NUL terminates (unless siz <= strlen(dst)). + * Returns strlen(src) + MIN(siz, strlen(initial dst)). + * If retval >= siz, truncation occurred. + */ +size_t +strlcat(char *dst, const char *src, size_t siz) +{ + char *d = dst; + const char *s = src; + size_t n = siz; + size_t dlen; + + /* Find the end of dst and adjust bytes left but don't go past end */ + while (n-- != 0 && *d != '\0') + d++; + dlen = d - dst; + n = siz - dlen; + + if (n == 0) + return(dlen + strlen(s)); + while (*s != '\0') { + if (n != 1) { + *d++ = *s; + n--; + } + s++; + } + *d = '\0'; + + return(dlen + (s - src)); /* count does not include NUL */ +} + +#endif /* !HAVE_STRLCAT */ diff --git a/usr.sbin/nsd/configlexer.c b/usr.sbin/nsd/configlexer.c new file mode 100644 index 00000000000..bfd07fbcbf6 --- /dev/null +++ b/usr.sbin/nsd/configlexer.c @@ -0,0 +1,2572 @@ +#include "configyyrename.h" + +#line 3 "<stdout>" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include <inttypes.h> +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart(yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +extern int yyleng; + +extern FILE *yyin, *yyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart (FILE *input_file ); +void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); +void yy_delete_buffer (YY_BUFFER_STATE b ); +void yy_flush_buffer (YY_BUFFER_STATE b ); +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state (void ); + +static void yyensure_buffer_stack (void ); +static void yy_load_buffer_state (void ); +static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); + +#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); + +void *yyalloc (yy_size_t ); +void *yyrealloc (void *,yy_size_t ); +void yyfree (void * ); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +typedef unsigned char YY_CHAR; + +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; + +typedef int yy_state_type; + +extern int yylineno; + +int yylineno = 1; + +extern char *yytext; +#define yytext_ptr yytext + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ + (yytext_ptr) -= (yy_more_len); \ + yyleng = (size_t) (yy_cp - (yytext_ptr)); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; + +#define YY_NUM_RULES 58 +#define YY_END_OF_BUFFER 59 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[403] = + { 0, + 1, 1, 46, 46, 50, 50, 54, 54, 59, 57, + 1, 44, 45, 2, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 58, 46, 47, 58, 48, 58, 53, 50, 51, + 52, 58, 54, 55, 56, 58, 57, 0, 1, 2, + 2, 2, 2, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 46, 0, 53, 0, 50, 54, 0, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 43, 57, 57, 57, + 57, 57, 57, 42, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 39, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 4, + 57, 12, 57, 57, 21, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 30, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 23, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 34, + 57, 57, 57, 57, 41, 57, 3, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 49, 57, 57, 57, 57, + 57, 13, 57, 57, 20, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 10, 57, 26, 57, 11, 57, 8, 9, 57, + + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 24, 57, 57, 27, 31, 25, 40, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 15, 57, 57, 29, 57, 57, 57, 6, 57, 5, + 57, 57, 57, 57, 57, 57, 57, 22, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 36, 33, + 57, 57, 17, 57, 57, 32, 7, 57, 57, 35, + 57, 14, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 18, 19, 57, 57, 57, 57, 57, 16, 57, + 57, 57, 57, 57, 57, 57, 57, 37, 57, 38, + + 28, 0 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 5, 6, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 7, 1, 1, 1, 1, 1, + 1, 8, 1, 9, 1, 1, 1, 10, 1, 1, + 1, 1, 1, 1, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 1, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 1, 36, 1, 1, 1, 1, 37, 38, 39, 40, + + 41, 42, 43, 44, 45, 1, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[62] = + { 0, + 1, 2, 3, 4, 4, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1 + } ; + +static yyconst flex_int16_t yy_base[412] = + { 0, + 0, 0, 59, 62, 66, 70, 73, 76, 1106, 1069, + 80, 1139, 1139, 83, 63, 71, 89, 75, 78, 101, + 81, 112, 102, 120, 109, 128, 115, 127, 138, 136, + 135, 182, 1067, 1139, 1139, 1139, 86, 1065, 1098, 1139, + 1139, 186, 1063, 1139, 1139, 156, 1062, 190, 91, 0, + 194, 0, 0, 172, 161, 173, 146, 168, 186, 191, + 196, 197, 209, 178, 203, 199, 205, 206, 214, 234, + 222, 228, 227, 241, 245, 236, 237, 250, 240, 256, + 248, 1061, 219, 1060, 294, 1091, 1022, 285, 271, 276, + 274, 278, 293, 275, 297, 300, 283, 208, 306, 301, + + 309, 314, 249, 302, 310, 316, 320, 323, 331, 319, + 318, 327, 326, 333, 329, 361, 1010, 345, 358, 363, + 365, 349, 346, 929, 364, 374, 372, 371, 384, 380, + 375, 381, 394, 398, 416, 417, 915, 400, 415, 413, + 418, 414, 420, 422, 421, 426, 427, 444, 424, 448, + 447, 452, 465, 463, 459, 439, 453, 475, 483, 473, + 479, 478, 480, 492, 490, 498, 507, 509, 504, 912, + 493, 879, 516, 510, 878, 519, 502, 508, 522, 526, + 536, 534, 546, 530, 540, 542, 552, 868, 560, 563, + 545, 578, 573, 556, 571, 566, 570, 587, 589, 581, + + 597, 599, 607, 612, 609, 621, 613, 617, 623, 625, + 619, 630, 627, 635, 636, 638, 645, 649, 654, 652, + 662, 651, 661, 642, 668, 827, 674, 676, 687, 680, + 672, 693, 698, 683, 686, 688, 691, 711, 708, 794, + 713, 715, 605, 724, 774, 723, 769, 719, 718, 721, + 727, 730, 729, 749, 737, 754, 745, 753, 761, 747, + 743, 768, 770, 758, 777, 714, 763, 778, 782, 779, + 783, 648, 785, 786, 640, 787, 791, 792, 796, 800, + 804, 807, 815, 805, 820, 824, 835, 837, 838, 822, + 833, 603, 844, 586, 843, 562, 840, 537, 506, 846, + + 847, 848, 853, 845, 850, 860, 863, 857, 888, 870, + 462, 887, 891, 457, 435, 411, 401, 894, 889, 897, + 884, 899, 882, 883, 885, 906, 886, 905, 917, 933, + 397, 931, 916, 391, 932, 938, 913, 390, 927, 357, + 941, 942, 923, 946, 952, 954, 955, 356, 957, 969, + 949, 978, 982, 984, 960, 962, 989, 988, 335, 288, + 990, 972, 284, 975, 991, 267, 221, 998, 1001, 177, + 995, 171, 983, 1014, 1015, 999, 1007, 1024, 1016, 1019, + 1032, 140, 132, 1036, 1039, 1038, 1045, 1041, 110, 1033, + 1048, 1049, 1056, 1058, 1053, 1059, 1055, 99, 1066, 97, + + 85, 1139, 1114, 1118, 1122, 112, 1126, 1130, 82, 1132, + 1134 + } ; + +static yyconst flex_int16_t yy_def[412] = + { 0, + 402, 1, 403, 403, 404, 404, 405, 405, 402, 406, + 402, 402, 402, 407, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 408, 402, 402, 402, 408, 409, 402, 402, + 402, 409, 410, 402, 402, 410, 406, 406, 402, 411, + 407, 411, 407, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 408, 408, 409, 409, 402, 410, 410, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + 406, 406, 406, 406, 406, 406, 406, 406, 406, 406, + + 406, 0, 402, 402, 402, 402, 402, 402, 402, 402, + 402 + } ; + +static yyconst flex_int16_t yy_nxt[1201] = + { 0, + 10, 11, 12, 12, 13, 14, 10, 10, 10, 10, + 15, 10, 16, 17, 10, 10, 10, 18, 19, 20, + 21, 10, 22, 23, 24, 10, 25, 26, 27, 28, + 29, 10, 30, 10, 31, 32, 15, 10, 16, 17, + 10, 10, 10, 18, 19, 20, 21, 10, 22, 23, + 24, 10, 25, 26, 27, 28, 29, 10, 30, 10, + 31, 34, 35, 36, 34, 35, 36, 39, 40, 40, + 41, 39, 40, 40, 41, 44, 44, 45, 44, 44, + 45, 49, 84, 54, 52, 50, 52, 52, 56, 82, + 82, 61, 49, 60, 37, 55, 50, 37, 48, 57, + + 62, 42, 63, 58, 65, 42, 48, 59, 46, 54, + 48, 46, 47, 48, 56, 64, 48, 61, 53, 60, + 48, 55, 66, 73, 48, 57, 62, 76, 63, 58, + 65, 69, 48, 59, 48, 67, 48, 48, 70, 68, + 77, 64, 74, 71, 48, 48, 72, 48, 66, 73, + 48, 80, 79, 76, 78, 48, 75, 69, 81, 87, + 87, 67, 48, 48, 70, 68, 77, 48, 74, 71, + 48, 48, 72, 48, 93, 48, 91, 80, 79, 94, + 78, 48, 75, 47, 81, 47, 47, 84, 89, 84, + 84, 47, 90, 47, 47, 52, 48, 52, 52, 92, + + 93, 95, 91, 48, 96, 94, 48, 48, 48, 98, + 97, 103, 48, 48, 89, 99, 100, 101, 90, 104, + 105, 48, 82, 82, 107, 92, 48, 95, 131, 53, + 96, 48, 48, 106, 48, 98, 97, 103, 48, 102, + 48, 48, 108, 48, 48, 104, 105, 109, 110, 48, + 107, 111, 112, 113, 131, 115, 48, 48, 137, 106, + 116, 117, 48, 48, 118, 102, 119, 114, 108, 48, + 121, 48, 48, 109, 110, 48, 48, 111, 112, 113, + 48, 115, 120, 48, 48, 48, 116, 117, 87, 87, + 118, 48, 119, 114, 122, 84, 121, 84, 84, 123, + + 124, 125, 48, 126, 127, 130, 48, 133, 120, 48, + 48, 48, 128, 48, 129, 134, 132, 138, 48, 48, + 122, 135, 136, 48, 139, 123, 124, 125, 48, 126, + 127, 130, 48, 141, 140, 48, 48, 48, 128, 142, + 129, 48, 132, 138, 48, 48, 143, 144, 145, 48, + 139, 48, 147, 48, 48, 48, 146, 149, 48, 141, + 140, 48, 48, 148, 48, 142, 48, 150, 48, 152, + 48, 151, 143, 144, 145, 155, 153, 156, 147, 154, + 48, 48, 146, 149, 48, 158, 160, 157, 159, 148, + 161, 48, 48, 48, 164, 152, 48, 151, 48, 48, + + 48, 155, 153, 156, 163, 154, 48, 48, 162, 48, + 48, 158, 160, 157, 159, 48, 48, 165, 169, 48, + 164, 166, 167, 168, 170, 48, 48, 172, 171, 48, + 163, 175, 48, 48, 162, 48, 48, 173, 174, 176, + 177, 178, 180, 165, 169, 192, 48, 166, 48, 48, + 48, 48, 48, 48, 171, 48, 48, 48, 179, 48, + 181, 48, 48, 173, 174, 176, 177, 178, 180, 184, + 48, 186, 188, 182, 48, 185, 183, 191, 189, 48, + 187, 193, 48, 48, 179, 194, 181, 48, 48, 195, + 190, 196, 48, 199, 48, 184, 198, 48, 48, 182, + + 48, 185, 183, 191, 189, 200, 187, 193, 48, 197, + 48, 194, 201, 48, 48, 48, 190, 196, 48, 199, + 202, 203, 198, 204, 205, 48, 206, 48, 48, 210, + 208, 200, 209, 48, 207, 197, 211, 48, 201, 48, + 217, 48, 48, 48, 48, 48, 202, 203, 212, 204, + 205, 48, 206, 213, 48, 210, 208, 48, 209, 214, + 207, 48, 211, 215, 216, 48, 217, 218, 219, 48, + 220, 48, 48, 223, 212, 48, 222, 48, 221, 213, + 48, 48, 226, 227, 230, 214, 229, 48, 224, 215, + 216, 48, 228, 218, 219, 48, 220, 48, 48, 223, + + 225, 48, 222, 232, 221, 48, 48, 233, 48, 227, + 230, 276, 229, 48, 224, 231, 48, 234, 228, 235, + 236, 48, 48, 238, 48, 237, 225, 239, 245, 232, + 240, 242, 48, 233, 48, 241, 246, 243, 48, 247, + 48, 231, 48, 234, 48, 235, 236, 48, 48, 238, + 250, 237, 48, 244, 48, 248, 48, 242, 48, 251, + 48, 241, 48, 243, 249, 48, 252, 253, 254, 257, + 48, 48, 255, 48, 259, 48, 250, 48, 258, 244, + 48, 248, 256, 48, 48, 251, 48, 48, 261, 48, + 249, 260, 252, 253, 254, 257, 48, 48, 255, 262, + + 259, 263, 266, 48, 258, 265, 264, 48, 256, 48, + 270, 48, 267, 271, 261, 48, 268, 260, 48, 269, + 272, 48, 48, 48, 275, 262, 48, 263, 48, 274, + 277, 265, 264, 48, 273, 278, 270, 279, 267, 271, + 280, 282, 268, 48, 283, 269, 48, 281, 48, 48, + 48, 286, 292, 48, 48, 274, 48, 284, 48, 48, + 273, 278, 48, 279, 48, 48, 280, 282, 287, 285, + 283, 288, 48, 281, 289, 291, 290, 286, 48, 294, + 48, 293, 48, 284, 48, 295, 296, 298, 48, 48, + 297, 299, 303, 48, 287, 285, 48, 288, 48, 302, + + 289, 291, 290, 48, 48, 48, 300, 293, 307, 48, + 301, 295, 48, 48, 48, 306, 297, 48, 48, 304, + 48, 48, 48, 305, 311, 302, 48, 48, 308, 48, + 310, 48, 300, 314, 307, 48, 301, 309, 312, 48, + 48, 306, 48, 313, 315, 304, 316, 317, 318, 305, + 48, 319, 323, 324, 308, 48, 310, 48, 320, 48, + 327, 321, 48, 309, 312, 328, 331, 322, 48, 313, + 48, 326, 48, 48, 318, 48, 325, 319, 48, 48, + 48, 48, 48, 48, 320, 48, 327, 321, 48, 329, + 330, 328, 48, 322, 332, 48, 334, 326, 48, 333, + + 336, 335, 325, 48, 337, 48, 338, 339, 340, 341, + 342, 343, 345, 48, 48, 329, 330, 48, 48, 48, + 48, 48, 48, 48, 48, 333, 48, 335, 344, 48, + 337, 346, 48, 339, 48, 341, 342, 343, 345, 347, + 48, 48, 348, 349, 350, 351, 353, 48, 48, 354, + 48, 48, 48, 352, 344, 364, 357, 346, 48, 355, + 356, 359, 48, 360, 48, 347, 48, 48, 48, 349, + 350, 351, 353, 48, 358, 354, 48, 48, 363, 352, + 362, 48, 357, 361, 48, 355, 356, 48, 365, 48, + 48, 366, 48, 367, 368, 48, 369, 48, 370, 372, + + 358, 373, 371, 374, 48, 379, 362, 48, 382, 361, + 48, 375, 376, 48, 365, 377, 383, 48, 48, 48, + 368, 378, 369, 48, 48, 48, 48, 373, 371, 374, + 48, 379, 380, 48, 48, 381, 48, 375, 376, 384, + 386, 377, 48, 387, 385, 48, 388, 378, 389, 48, + 48, 48, 390, 392, 48, 391, 393, 88, 380, 48, + 394, 381, 398, 395, 400, 384, 386, 48, 48, 387, + 385, 48, 388, 48, 48, 401, 48, 397, 390, 392, + 48, 391, 393, 48, 48, 396, 394, 399, 48, 395, + 48, 48, 86, 48, 48, 85, 83, 48, 88, 86, + + 85, 48, 83, 397, 48, 402, 402, 402, 402, 402, + 402, 396, 402, 399, 33, 33, 33, 33, 38, 38, + 38, 38, 43, 43, 43, 43, 51, 51, 402, 51, + 82, 82, 87, 87, 52, 52, 402, 52, 9, 402, + 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, + 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, + 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, + 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, + 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, + 402, 402, 402, 402, 402, 402, 402, 402, 402, 402 + + } ; + +static yyconst flex_int16_t yy_chk[1201] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 3, 3, 3, 4, 4, 4, 5, 5, 5, + 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, + 8, 11, 409, 15, 14, 11, 14, 14, 16, 37, + 37, 19, 49, 18, 3, 15, 49, 4, 15, 17, + + 19, 5, 19, 17, 21, 6, 16, 17, 7, 15, + 18, 8, 406, 19, 16, 20, 21, 19, 14, 18, + 401, 15, 22, 25, 17, 17, 19, 27, 19, 17, + 21, 23, 400, 17, 398, 22, 20, 23, 24, 22, + 28, 20, 26, 24, 25, 389, 24, 22, 22, 25, + 27, 30, 29, 27, 28, 24, 26, 23, 31, 46, + 46, 22, 28, 26, 24, 22, 28, 383, 26, 24, + 31, 30, 24, 29, 57, 382, 55, 30, 29, 58, + 28, 57, 26, 32, 31, 32, 32, 42, 54, 42, + 42, 48, 54, 48, 48, 51, 55, 51, 51, 56, + + 57, 59, 55, 58, 60, 58, 372, 54, 56, 62, + 61, 64, 370, 64, 54, 63, 63, 63, 54, 65, + 66, 59, 83, 83, 68, 56, 60, 59, 98, 51, + 60, 61, 62, 67, 66, 62, 61, 64, 65, 63, + 67, 68, 69, 98, 63, 65, 66, 70, 71, 69, + 68, 72, 73, 74, 98, 75, 367, 71, 103, 67, + 76, 77, 73, 72, 78, 63, 79, 74, 69, 70, + 81, 76, 77, 70, 71, 79, 74, 72, 73, 74, + 75, 75, 80, 81, 103, 78, 76, 77, 88, 88, + 78, 80, 79, 74, 89, 85, 81, 85, 85, 90, + + 91, 92, 366, 93, 94, 97, 89, 100, 80, 91, + 94, 90, 95, 92, 96, 101, 99, 104, 97, 363, + 89, 102, 102, 360, 105, 90, 91, 92, 93, 93, + 94, 97, 95, 107, 106, 96, 100, 104, 95, 108, + 96, 99, 99, 104, 101, 105, 109, 110, 111, 102, + 105, 106, 113, 111, 110, 107, 112, 115, 108, 107, + 106, 113, 112, 114, 115, 108, 109, 116, 114, 119, + 359, 118, 109, 110, 111, 122, 120, 123, 113, 121, + 118, 123, 112, 115, 122, 126, 128, 125, 127, 114, + 129, 348, 340, 119, 132, 119, 116, 118, 120, 125, + + 121, 122, 120, 123, 131, 121, 128, 127, 130, 126, + 131, 126, 128, 125, 127, 130, 132, 133, 138, 129, + 132, 134, 135, 136, 139, 338, 334, 141, 140, 133, + 131, 144, 331, 134, 130, 138, 317, 142, 143, 145, + 146, 147, 149, 133, 138, 156, 316, 134, 140, 142, + 139, 135, 136, 141, 140, 143, 145, 144, 148, 149, + 150, 146, 147, 142, 143, 145, 146, 147, 149, 151, + 315, 153, 154, 150, 156, 152, 150, 155, 154, 148, + 153, 157, 151, 150, 148, 158, 150, 152, 157, 159, + 154, 160, 314, 163, 155, 151, 162, 311, 154, 150, + + 153, 152, 150, 155, 154, 164, 153, 157, 160, 161, + 158, 158, 165, 162, 161, 163, 154, 160, 159, 163, + 166, 167, 162, 168, 169, 165, 171, 164, 171, 177, + 174, 164, 176, 166, 173, 161, 178, 177, 165, 169, + 184, 299, 167, 178, 168, 174, 166, 167, 179, 168, + 169, 173, 171, 180, 176, 177, 174, 179, 176, 181, + 173, 180, 178, 182, 183, 184, 184, 185, 186, 182, + 187, 181, 298, 191, 179, 185, 190, 186, 189, 180, + 191, 183, 193, 194, 197, 181, 196, 187, 192, 182, + 183, 194, 195, 185, 186, 189, 187, 296, 190, 191, + + 192, 196, 190, 199, 189, 197, 195, 200, 193, 194, + 197, 243, 196, 192, 192, 198, 200, 201, 195, 202, + 203, 294, 198, 205, 199, 204, 192, 206, 211, 199, + 206, 208, 201, 200, 202, 207, 212, 209, 292, 212, + 243, 198, 203, 201, 205, 202, 203, 204, 207, 205, + 215, 204, 208, 210, 211, 213, 206, 208, 209, 216, + 210, 207, 213, 209, 214, 212, 217, 218, 219, 222, + 214, 215, 220, 216, 224, 275, 215, 224, 223, 210, + 217, 213, 221, 272, 218, 216, 222, 220, 227, 219, + 214, 225, 217, 218, 219, 222, 223, 221, 220, 228, + + 224, 229, 232, 225, 223, 231, 230, 231, 221, 227, + 236, 228, 233, 237, 227, 230, 234, 225, 234, 235, + 238, 235, 229, 236, 242, 228, 237, 229, 232, 241, + 244, 231, 230, 233, 239, 246, 236, 248, 233, 237, + 249, 251, 234, 239, 252, 235, 238, 250, 241, 266, + 242, 255, 261, 249, 248, 241, 250, 253, 246, 244, + 239, 246, 251, 248, 253, 252, 249, 251, 256, 254, + 252, 257, 255, 250, 258, 260, 259, 255, 261, 263, + 257, 262, 260, 253, 254, 264, 265, 268, 258, 256, + 267, 269, 274, 264, 256, 254, 259, 257, 267, 273, + + 258, 260, 259, 262, 247, 263, 270, 262, 279, 245, + 271, 264, 265, 268, 270, 278, 267, 269, 271, 276, + 273, 274, 276, 277, 283, 273, 277, 278, 280, 240, + 282, 279, 270, 286, 279, 280, 271, 281, 284, 281, + 284, 278, 282, 285, 287, 276, 288, 289, 290, 277, + 283, 291, 300, 301, 280, 285, 282, 290, 293, 286, + 304, 295, 226, 281, 284, 305, 308, 297, 291, 285, + 287, 303, 288, 289, 290, 297, 302, 291, 295, 293, + 304, 300, 301, 302, 293, 305, 304, 295, 303, 306, + 307, 305, 308, 297, 309, 306, 312, 303, 307, 310, + + 318, 313, 302, 188, 319, 310, 320, 321, 322, 323, + 324, 325, 327, 175, 172, 306, 307, 323, 324, 321, + 325, 327, 312, 309, 319, 310, 313, 313, 326, 318, + 319, 328, 320, 321, 322, 323, 324, 325, 327, 329, + 328, 326, 330, 332, 333, 335, 337, 170, 337, 339, + 137, 333, 329, 336, 326, 351, 343, 328, 343, 341, + 342, 345, 339, 346, 124, 329, 332, 335, 330, 332, + 333, 335, 337, 336, 344, 339, 341, 342, 350, 336, + 349, 344, 343, 347, 351, 341, 342, 345, 352, 346, + 347, 353, 349, 354, 355, 355, 356, 356, 357, 361, + + 344, 362, 358, 364, 350, 373, 349, 362, 376, 347, + 364, 365, 368, 352, 352, 369, 377, 353, 373, 354, + 355, 371, 356, 358, 357, 361, 365, 362, 358, 364, + 371, 373, 374, 368, 376, 375, 369, 365, 368, 378, + 380, 369, 377, 381, 379, 117, 384, 371, 385, 374, + 375, 379, 386, 388, 380, 387, 390, 87, 374, 378, + 391, 375, 395, 392, 397, 378, 380, 381, 390, 381, + 379, 384, 384, 386, 385, 399, 388, 394, 386, 388, + 387, 387, 390, 391, 392, 393, 391, 396, 395, 392, + 397, 393, 86, 394, 396, 84, 82, 47, 43, 39, + + 38, 399, 33, 394, 10, 9, 0, 0, 0, 0, + 0, 393, 0, 396, 403, 403, 403, 403, 404, 404, + 404, 404, 405, 405, 405, 405, 407, 407, 0, 407, + 408, 408, 410, 410, 411, 411, 0, 411, 402, 402, + 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, + 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, + 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, + 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, + 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, + 402, 402, 402, 402, 402, 402, 402, 402, 402, 402 + + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +extern int yy_flex_debug; +int yy_flex_debug = 0; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +static int yy_more_flag = 0; +static int yy_more_len = 0; +#define yymore() ((yy_more_flag) = 1) +#define YY_MORE_ADJ (yy_more_len) +#define YY_RESTORE_YY_MORE_OFFSET +char *yytext; +#line 1 "configlexer.lex" +#line 2 "configlexer.lex" +/* + * configlexer.lex - lexical analyzer for NSD config file + * + * Copyright (c) 2001-2006, NLnet Labs. All rights reserved + * + * See LICENSE for the license. + * + */ + +#include <config.h> + +#include <ctype.h> +#include <errno.h> +#include <string.h> +#include <strings.h> + +#include "options.h" +#include "configyyrename.h" +#include "configparser.h" +void c_error(const char *message); + +#define YY_NO_UNPUT + +#if 0 +#define LEXOUT(s) printf s /* used ONLY when debugging */ +#else +#define LEXOUT(s) +#endif + +struct inc_state { + const char* filename; + int line; +}; +static struct inc_state parse_stack[MAXINCLUDES]; +static YY_BUFFER_STATE include_stack[MAXINCLUDES]; +static int config_include_stack_ptr = 0; + +static void config_start_include(const char* filename) +{ + FILE *input; + if(strlen(filename) == 0) { + c_error_msg("empty include file name"); + return; + } + if(config_include_stack_ptr >= MAXINCLUDES) { + c_error_msg("includes nested too deeply, skipped (>%d)", MAXINCLUDES); + return; + } + input = fopen(filename, "r"); + if(!input) { + c_error_msg("cannot open include file '%s': %s", + filename, strerror(errno)); + return; + } + LEXOUT(("switch_to_include_file(%s) ", filename)); + parse_stack[config_include_stack_ptr].filename = cfg_parser->filename; + parse_stack[config_include_stack_ptr].line = cfg_parser->line; + include_stack[config_include_stack_ptr] = YY_CURRENT_BUFFER; + cfg_parser->filename = region_strdup(cfg_parser->opt->region, filename); + cfg_parser->line = 1; + yy_switch_to_buffer(yy_create_buffer(input,YY_BUF_SIZE)); + ++config_include_stack_ptr; +} + +static void config_end_include(void) +{ + --config_include_stack_ptr; + cfg_parser->filename = parse_stack[config_include_stack_ptr].filename; + cfg_parser->line = parse_stack[config_include_stack_ptr].line; + yy_delete_buffer(YY_CURRENT_BUFFER); + yy_switch_to_buffer(include_stack[config_include_stack_ptr]); +} + +#ifndef yy_set_bol /* compat definition, for flex 2.4.6 */ +#define yy_set_bol(at_bol) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer(yyin,YY_BUF_SIZE ); \ + yy_current_buffer->yy_ch_buf[0] = ((at_bol)?'\n':' '); \ + } +#endif + + +#line 947 "<stdout>" + +#define INITIAL 0 +#define quotedstring 1 +#define include 2 +#define include_quoted 3 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include <unistd.h> +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals (void ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy (void ); + +int yyget_debug (void ); + +void yyset_debug (int debug_flag ); + +YY_EXTRA_TYPE yyget_extra (void ); + +void yyset_extra (YY_EXTRA_TYPE user_defined ); + +FILE *yyget_in (void ); + +void yyset_in (FILE * in_str ); + +FILE *yyget_out (void ); + +void yyset_out (FILE * out_str ); + +int yyget_leng (void ); + +char *yyget_text (void ); + +int yyget_lineno (void ); + +void yyset_lineno (int line_number ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap (void ); +#else +extern int yywrap (void ); +#endif +#endif + + static void yyunput (int c,char *buf_ptr ); + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (void ); +#else +static int input (void ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex (void); + +#define YY_DECL int yylex (void) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +#line 96 "configlexer.lex" + +#line 1139 "<stdout>" + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } + + yy_load_buffer_state( ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + (yy_more_len) = 0; + if ( (yy_more_flag) ) + { + (yy_more_len) = (yy_c_buf_p) - (yytext_ptr); + (yy_more_flag) = 0; + } + yy_cp = (yy_c_buf_p); + + /* Support of yytext. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = (yy_start); +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 403 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 1139 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 97 "configlexer.lex" +{ LEXOUT(("SP ")); /* ignore */ } + YY_BREAK +case 2: +YY_RULE_SETUP +#line 98 "configlexer.lex" +{ LEXOUT(("comment(%s) ", yytext)); /* ignore */ } + YY_BREAK +case 3: +YY_RULE_SETUP +#line 99 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_SERVER;} + YY_BREAK +case 4: +YY_RULE_SETUP +#line 100 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_NAME;} + YY_BREAK +case 5: +YY_RULE_SETUP +#line 101 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_IP_ADDRESS;} + YY_BREAK +case 6: +YY_RULE_SETUP +#line 102 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_DEBUG_MODE;} + YY_BREAK +case 7: +YY_RULE_SETUP +#line 103 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_HIDE_VERSION;} + YY_BREAK +case 8: +YY_RULE_SETUP +#line 104 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_IP4_ONLY;} + YY_BREAK +case 9: +YY_RULE_SETUP +#line 105 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_IP6_ONLY;} + YY_BREAK +case 10: +YY_RULE_SETUP +#line 106 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_DATABASE;} + YY_BREAK +case 11: +YY_RULE_SETUP +#line 107 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_IDENTITY;} + YY_BREAK +case 12: +YY_RULE_SETUP +#line 108 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_NSID;} + YY_BREAK +case 13: +YY_RULE_SETUP +#line 109 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_LOGFILE;} + YY_BREAK +case 14: +YY_RULE_SETUP +#line 110 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_SERVER_COUNT;} + YY_BREAK +case 15: +YY_RULE_SETUP +#line 111 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_TCP_COUNT;} + YY_BREAK +case 16: +YY_RULE_SETUP +#line 112 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_TCP_QUERY_COUNT;} + YY_BREAK +case 17: +YY_RULE_SETUP +#line 113 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_TCP_TIMEOUT;} + YY_BREAK +case 18: +YY_RULE_SETUP +#line 114 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_IPV4_EDNS_SIZE;} + YY_BREAK +case 19: +YY_RULE_SETUP +#line 115 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_IPV6_EDNS_SIZE;} + YY_BREAK +case 20: +YY_RULE_SETUP +#line 116 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_PIDFILE;} + YY_BREAK +case 21: +YY_RULE_SETUP +#line 117 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_PORT;} + YY_BREAK +case 22: +YY_RULE_SETUP +#line 118 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_STATISTICS;} + YY_BREAK +case 23: +YY_RULE_SETUP +#line 119 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_CHROOT;} + YY_BREAK +case 24: +YY_RULE_SETUP +#line 120 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_USERNAME;} + YY_BREAK +case 25: +YY_RULE_SETUP +#line 121 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_ZONESDIR;} + YY_BREAK +case 26: +YY_RULE_SETUP +#line 122 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_DIFFFILE;} + YY_BREAK +case 27: +YY_RULE_SETUP +#line 123 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_XFRDFILE;} + YY_BREAK +case 28: +YY_RULE_SETUP +#line 124 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_XFRD_RELOAD_TIMEOUT;} + YY_BREAK +case 29: +YY_RULE_SETUP +#line 125 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_VERBOSITY;} + YY_BREAK +case 30: +YY_RULE_SETUP +#line 126 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_ZONE;} + YY_BREAK +case 31: +YY_RULE_SETUP +#line 127 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_ZONEFILE;} + YY_BREAK +case 32: +YY_RULE_SETUP +#line 128 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_ALLOW_NOTIFY;} + YY_BREAK +case 33: +YY_RULE_SETUP +#line 129 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_REQUEST_XFR;} + YY_BREAK +case 34: +YY_RULE_SETUP +#line 130 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_NOTIFY;} + YY_BREAK +case 35: +YY_RULE_SETUP +#line 131 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_NOTIFY_RETRY;} + YY_BREAK +case 36: +YY_RULE_SETUP +#line 132 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_PROVIDE_XFR;} + YY_BREAK +case 37: +YY_RULE_SETUP +#line 133 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_OUTGOING_INTERFACE;} + YY_BREAK +case 38: +YY_RULE_SETUP +#line 134 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_ALLOW_AXFR_FALLBACK;} + YY_BREAK +case 39: +YY_RULE_SETUP +#line 135 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_KEY;} + YY_BREAK +case 40: +YY_RULE_SETUP +#line 136 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_ALGORITHM;} + YY_BREAK +case 41: +YY_RULE_SETUP +#line 137 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_SECRET;} + YY_BREAK +case 42: +YY_RULE_SETUP +#line 138 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_AXFR;} + YY_BREAK +case 43: +YY_RULE_SETUP +#line 139 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); return VAR_UDP;} + YY_BREAK +case 44: +/* rule 44 can match eol */ +YY_RULE_SETUP +#line 140 "configlexer.lex" +{ LEXOUT(("NL\n")); cfg_parser->line++;} + YY_BREAK +/* Quoted strings. Strip leading and ending quotes */ +case 45: +YY_RULE_SETUP +#line 143 "configlexer.lex" +{ BEGIN(quotedstring); LEXOUT(("QS ")); } + YY_BREAK +case YY_STATE_EOF(quotedstring): +#line 144 "configlexer.lex" +{ + yyerror("EOF inside quoted string"); + BEGIN(INITIAL); +} + YY_BREAK +case 46: +YY_RULE_SETUP +#line 148 "configlexer.lex" +{ LEXOUT(("STR(%s) ", yytext)); yymore(); } + YY_BREAK +case 47: +/* rule 47 can match eol */ +YY_RULE_SETUP +#line 149 "configlexer.lex" +{ cfg_parser->line++; yymore(); } + YY_BREAK +case 48: +YY_RULE_SETUP +#line 150 "configlexer.lex" +{ + LEXOUT(("QE ")); + BEGIN(INITIAL); + yytext[yyleng - 1] = '\0'; + yylval.str = region_strdup(cfg_parser->opt->region, yytext); + return STRING; +} + YY_BREAK +/* include: directive */ +case 49: +YY_RULE_SETUP +#line 159 "configlexer.lex" +{ LEXOUT(("v(%s) ", yytext)); BEGIN(include); } + YY_BREAK +case YY_STATE_EOF(include): +#line 160 "configlexer.lex" +{ + yyerror("EOF inside include directive"); + BEGIN(INITIAL); +} + YY_BREAK +case 50: +YY_RULE_SETUP +#line 164 "configlexer.lex" +{ LEXOUT(("ISP ")); /* ignore */ } + YY_BREAK +case 51: +/* rule 51 can match eol */ +YY_RULE_SETUP +#line 165 "configlexer.lex" +{ LEXOUT(("NL\n")); cfg_parser->line++;} + YY_BREAK +case 52: +YY_RULE_SETUP +#line 166 "configlexer.lex" +{ LEXOUT(("IQS ")); BEGIN(include_quoted); } + YY_BREAK +case 53: +YY_RULE_SETUP +#line 167 "configlexer.lex" +{ + LEXOUT(("Iunquotedstr(%s) ", yytext)); + config_start_include(yytext); + BEGIN(INITIAL); +} + YY_BREAK +case YY_STATE_EOF(include_quoted): +#line 172 "configlexer.lex" +{ + yyerror("EOF inside quoted string"); + BEGIN(INITIAL); +} + YY_BREAK +case 54: +YY_RULE_SETUP +#line 176 "configlexer.lex" +{ LEXOUT(("ISTR(%s) ", yytext)); yymore(); } + YY_BREAK +case 55: +/* rule 55 can match eol */ +YY_RULE_SETUP +#line 177 "configlexer.lex" +{ cfg_parser->line++; yymore(); } + YY_BREAK +case 56: +YY_RULE_SETUP +#line 178 "configlexer.lex" +{ + LEXOUT(("IQE ")); + yytext[yyleng - 1] = '\0'; + config_start_include(yytext); + BEGIN(INITIAL); +} + YY_BREAK +case YY_STATE_EOF(INITIAL): +#line 184 "configlexer.lex" +{ + yy_set_bol(1); /* Set beginning of line, so "^" rules match. */ + if (config_include_stack_ptr == 0) { + yyterminate(); + } else { + fclose(yyin); + config_end_include(); + } +} + YY_BREAK +case 57: +YY_RULE_SETUP +#line 194 "configlexer.lex" +{ LEXOUT(("unquotedstr(%s) ", yytext)); + yylval.str = region_strdup(cfg_parser->opt->region, yytext); return STRING; } + YY_BREAK +case 58: +YY_RULE_SETUP +#line 197 "configlexer.lex" +ECHO; + YY_BREAK +#line 1573 "<stdout>" + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of yylex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (void) +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), (size_t) num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart(yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (void) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = (yy_start); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 403 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ + register int yy_is_jam; + register char *yy_cp = (yy_c_buf_p); + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 403 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 402); + + return yy_is_jam ? 0 : yy_current_state; +} + + static void yyunput (int c, register char * yy_bp ) +{ + register char *yy_cp; + + yy_cp = (yy_c_buf_p); + + /* undo effects of setting up yytext */ + *yy_cp = (yy_hold_char); + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = (yy_n_chars) + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + register char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart(yyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap( ) ) + return EOF; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ + (yy_hold_char) = *++(yy_c_buf_p); + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } + + yy_init_buffer(YY_CURRENT_BUFFER,input_file ); + yy_load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +static void yy_load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer(b,file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * + */ + void yy_delete_buffer (YY_BUFFER_STATE b ) +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree((void *) b->yy_ch_buf ); + + yyfree((void *) b ); +} + +#ifndef __cplusplus +extern int isatty (int ); +#endif /* __cplusplus */ + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) + +{ + int oerrno = errno; + + yy_flush_buffer(b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void yy_flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void yypop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (void) +{ + int num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer(b ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) +{ + + return yy_scan_bytes(yystr,strlen(yystr) ); +} + +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) yyalloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the current line number. + * + */ +int yyget_lineno (void) +{ + + return yylineno; +} + +/** Get the input stream. + * + */ +FILE *yyget_in (void) +{ + return yyin; +} + +/** Get the output stream. + * + */ +FILE *yyget_out (void) +{ + return yyout; +} + +/** Get the length of the current token. + * + */ +int yyget_leng (void) +{ + return yyleng; +} + +/** Get the current token. + * + */ + +char *yyget_text (void) +{ + return yytext; +} + +/** Set the current line number. + * @param line_number + * + */ +void yyset_lineno (int line_number ) +{ + + yylineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * in_str ) +{ + yyin = in_str ; +} + +void yyset_out (FILE * out_str ) +{ + yyout = out_str ; +} + +int yyget_debug (void) +{ + return yy_flex_debug; +} + +void yyset_debug (int bdebug ) +{ + yy_flex_debug = bdebug ; +} + +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} + +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } + + /* Destroy the stack itself. */ + yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( ); + + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s ) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size ) +{ + return (void *) malloc( size ); +} + +void *yyrealloc (void * ptr, yy_size_t size ) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void yyfree (void * ptr ) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 197 "configlexer.lex" + + + diff --git a/usr.sbin/nsd/configlexer.lex b/usr.sbin/nsd/configlexer.lex index 7b9a8a508a8..88a8c90f659 100644 --- a/usr.sbin/nsd/configlexer.lex +++ b/usr.sbin/nsd/configlexer.lex @@ -105,6 +105,7 @@ ip4-only{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_IP4_ONLY;} ip6-only{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_IP6_ONLY;} database{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_DATABASE;} identity{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_IDENTITY;} +nsid{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_NSID;} logfile{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_LOGFILE;} server-count{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_SERVER_COUNT;} tcp-count{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_TCP_COUNT;} diff --git a/usr.sbin/nsd/configparser.c b/usr.sbin/nsd/configparser.c new file mode 100644 index 00000000000..72704bb04d4 --- /dev/null +++ b/usr.sbin/nsd/configparser.c @@ -0,0 +1,2390 @@ + +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "2.4.1" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + + + +/* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ +#line 10 "configparser.y" + +#include <config.h> + +#include <stdarg.h> +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <assert.h> + +#include "options.h" +#include "util.h" +#include "configyyrename.h" +int c_lex(void); +void c_error(const char *message); + +#ifdef __cplusplus +extern "C" +#endif /* __cplusplus */ + +/* these need to be global, otherwise they cannot be used inside yacc */ +extern config_parser_state_t* cfg_parser; +static int server_settings_seen = 0; + +#if 0 +#define OUTYY(s) printf s /* used ONLY when debugging */ +#else +#define OUTYY(s) +#endif + + + +/* Line 189 of yacc.c */ +#line 105 "configparser.c" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + SPACE = 258, + LETTER = 259, + NEWLINE = 260, + COMMENT = 261, + COLON = 262, + ANY = 263, + ZONESTR = 264, + STRING = 265, + VAR_SERVER = 266, + VAR_NAME = 267, + VAR_IP_ADDRESS = 268, + VAR_DEBUG_MODE = 269, + VAR_IP4_ONLY = 270, + VAR_IP6_ONLY = 271, + VAR_DATABASE = 272, + VAR_IDENTITY = 273, + VAR_NSID = 274, + VAR_LOGFILE = 275, + VAR_SERVER_COUNT = 276, + VAR_TCP_COUNT = 277, + VAR_PIDFILE = 278, + VAR_PORT = 279, + VAR_STATISTICS = 280, + VAR_CHROOT = 281, + VAR_USERNAME = 282, + VAR_ZONESDIR = 283, + VAR_XFRDFILE = 284, + VAR_DIFFFILE = 285, + VAR_XFRD_RELOAD_TIMEOUT = 286, + VAR_TCP_QUERY_COUNT = 287, + VAR_TCP_TIMEOUT = 288, + VAR_IPV4_EDNS_SIZE = 289, + VAR_IPV6_EDNS_SIZE = 290, + VAR_ZONEFILE = 291, + VAR_ZONE = 292, + VAR_ALLOW_NOTIFY = 293, + VAR_REQUEST_XFR = 294, + VAR_NOTIFY = 295, + VAR_PROVIDE_XFR = 296, + VAR_NOTIFY_RETRY = 297, + VAR_OUTGOING_INTERFACE = 298, + VAR_ALLOW_AXFR_FALLBACK = 299, + VAR_KEY = 300, + VAR_ALGORITHM = 301, + VAR_SECRET = 302, + VAR_AXFR = 303, + VAR_UDP = 304, + VAR_VERBOSITY = 305, + VAR_HIDE_VERSION = 306 + }; +#endif +/* Tokens. */ +#define SPACE 258 +#define LETTER 259 +#define NEWLINE 260 +#define COMMENT 261 +#define COLON 262 +#define ANY 263 +#define ZONESTR 264 +#define STRING 265 +#define VAR_SERVER 266 +#define VAR_NAME 267 +#define VAR_IP_ADDRESS 268 +#define VAR_DEBUG_MODE 269 +#define VAR_IP4_ONLY 270 +#define VAR_IP6_ONLY 271 +#define VAR_DATABASE 272 +#define VAR_IDENTITY 273 +#define VAR_NSID 274 +#define VAR_LOGFILE 275 +#define VAR_SERVER_COUNT 276 +#define VAR_TCP_COUNT 277 +#define VAR_PIDFILE 278 +#define VAR_PORT 279 +#define VAR_STATISTICS 280 +#define VAR_CHROOT 281 +#define VAR_USERNAME 282 +#define VAR_ZONESDIR 283 +#define VAR_XFRDFILE 284 +#define VAR_DIFFFILE 285 +#define VAR_XFRD_RELOAD_TIMEOUT 286 +#define VAR_TCP_QUERY_COUNT 287 +#define VAR_TCP_TIMEOUT 288 +#define VAR_IPV4_EDNS_SIZE 289 +#define VAR_IPV6_EDNS_SIZE 290 +#define VAR_ZONEFILE 291 +#define VAR_ZONE 292 +#define VAR_ALLOW_NOTIFY 293 +#define VAR_REQUEST_XFR 294 +#define VAR_NOTIFY 295 +#define VAR_PROVIDE_XFR 296 +#define VAR_NOTIFY_RETRY 297 +#define VAR_OUTGOING_INTERFACE 298 +#define VAR_ALLOW_AXFR_FALLBACK 299 +#define VAR_KEY 300 +#define VAR_ALGORITHM 301 +#define VAR_SECRET 302 +#define VAR_AXFR 303 +#define VAR_UDP 304 +#define VAR_VERBOSITY 305 +#define VAR_HIDE_VERSION 306 + + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +{ + +/* Line 214 of yacc.c */ +#line 40 "configparser.y" + + char* str; + + + +/* Line 214 of yacc.c */ +#line 249 "configparser.c" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + + +/* Copy the second part of user declarations. */ + + +/* Line 264 of yacc.c */ +#line 261 "configparser.c" + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int yyi) +#else +static int +YYID (yyi) + int yyi; +#endif +{ + return yyi; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) + +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 2 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 90 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 52 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 50 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 92 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 140 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 306 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const yytype_uint8 yyprhs[] = +{ + 0, 0, 3, 4, 7, 10, 13, 16, 18, 21, + 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, + 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, + 62, 64, 66, 68, 70, 72, 75, 78, 81, 84, + 87, 90, 93, 96, 99, 102, 105, 108, 111, 114, + 117, 120, 123, 126, 129, 132, 135, 138, 141, 144, + 147, 149, 152, 154, 156, 158, 160, 162, 164, 166, + 168, 170, 172, 175, 178, 182, 185, 188, 192, 196, + 200, 203, 207, 210, 213, 215, 218, 220, 222, 224, + 226, 229, 232 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int8 yyrhs[] = +{ + 53, 0, -1, -1, 53, 54, -1, 55, 56, -1, + 83, 84, -1, 96, 97, -1, 11, -1, 56, 57, + -1, -1, 58, -1, 59, -1, 62, -1, 63, -1, + 64, -1, 65, -1, 66, -1, 67, -1, 68, -1, + 69, -1, 70, -1, 71, -1, 72, -1, 73, -1, + 74, -1, 75, -1, 76, -1, 77, -1, 78, -1, + 79, -1, 80, -1, 81, -1, 82, -1, 60, -1, + 61, -1, 13, 10, -1, 14, 10, -1, 50, 10, + -1, 51, 10, -1, 15, 10, -1, 16, 10, -1, + 17, 10, -1, 18, 10, -1, 19, 10, -1, 20, + 10, -1, 21, 10, -1, 22, 10, -1, 23, 10, + -1, 24, 10, -1, 25, 10, -1, 26, 10, -1, + 27, 10, -1, 28, 10, -1, 30, 10, -1, 29, + 10, -1, 31, 10, -1, 32, 10, -1, 33, 10, + -1, 34, 10, -1, 35, 10, -1, 37, -1, 84, + 85, -1, 85, -1, 86, -1, 87, -1, 88, -1, + 89, -1, 91, -1, 92, -1, 93, -1, 94, -1, + 95, -1, 12, 10, -1, 36, 10, -1, 38, 10, + 10, -1, 39, 90, -1, 10, 10, -1, 48, 10, + 10, -1, 49, 10, 10, -1, 40, 10, 10, -1, + 42, 10, -1, 41, 10, 10, -1, 43, 10, -1, + 44, 10, -1, 45, -1, 97, 98, -1, 98, -1, + 99, -1, 100, -1, 101, -1, 12, 10, -1, 46, + 10, -1, 47, 10, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 62, 62, 62, 63, 63, 64, 67, 75, 75, + 76, 76, 76, 77, 77, 77, 77, 77, 78, 78, + 78, 78, 79, 79, 79, 79, 80, 80, 80, 81, + 81, 81, 82, 82, 82, 83, 105, 113, 121, 129, + 137, 145, 151, 157, 177, 183, 191, 199, 205, 211, + 219, 225, 231, 237, 243, 249, 257, 265, 273, 281, + 291, 313, 313, 314, 314, 314, 315, 315, 315, 315, + 316, 316, 317, 326, 335, 346, 350, 362, 375, 389, + 402, 410, 421, 433, 443, 459, 459, 460, 460, 460, + 461, 470, 479 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "SPACE", "LETTER", "NEWLINE", "COMMENT", + "COLON", "ANY", "ZONESTR", "STRING", "VAR_SERVER", "VAR_NAME", + "VAR_IP_ADDRESS", "VAR_DEBUG_MODE", "VAR_IP4_ONLY", "VAR_IP6_ONLY", + "VAR_DATABASE", "VAR_IDENTITY", "VAR_NSID", "VAR_LOGFILE", + "VAR_SERVER_COUNT", "VAR_TCP_COUNT", "VAR_PIDFILE", "VAR_PORT", + "VAR_STATISTICS", "VAR_CHROOT", "VAR_USERNAME", "VAR_ZONESDIR", + "VAR_XFRDFILE", "VAR_DIFFFILE", "VAR_XFRD_RELOAD_TIMEOUT", + "VAR_TCP_QUERY_COUNT", "VAR_TCP_TIMEOUT", "VAR_IPV4_EDNS_SIZE", + "VAR_IPV6_EDNS_SIZE", "VAR_ZONEFILE", "VAR_ZONE", "VAR_ALLOW_NOTIFY", + "VAR_REQUEST_XFR", "VAR_NOTIFY", "VAR_PROVIDE_XFR", "VAR_NOTIFY_RETRY", + "VAR_OUTGOING_INTERFACE", "VAR_ALLOW_AXFR_FALLBACK", "VAR_KEY", + "VAR_ALGORITHM", "VAR_SECRET", "VAR_AXFR", "VAR_UDP", "VAR_VERBOSITY", + "VAR_HIDE_VERSION", "$accept", "toplevelvars", "toplevelvar", + "serverstart", "contents_server", "content_server", "server_ip_address", + "server_debug_mode", "server_verbosity", "server_hide_version", + "server_ip4_only", "server_ip6_only", "server_database", + "server_identity", "server_nsid", "server_logfile", + "server_server_count", "server_tcp_count", "server_pidfile", + "server_port", "server_statistics", "server_chroot", "server_username", + "server_zonesdir", "server_difffile", "server_xfrdfile", + "server_xfrd_reload_timeout", "server_tcp_query_count", + "server_tcp_timeout", "server_ipv4_edns_size", "server_ipv6_edns_size", + "zonestart", "contents_zone", "content_zone", "zone_name", + "zone_zonefile", "zone_allow_notify", "zone_request_xfr", + "zone_request_xfr_data", "zone_notify", "zone_notify_retry", + "zone_provide_xfr", "zone_outgoing_interface", + "zone_allow_axfr_fallback", "keystart", "contents_key", "content_key", + "key_name", "key_algorithm", "key_secret", 0 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, + 305, 306 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 52, 53, 53, 54, 54, 54, 55, 56, 56, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, + 57, 57, 57, 57, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 84, 85, 85, 85, 85, 85, 85, 85, + 85, 85, 86, 87, 88, 89, 90, 90, 90, 91, + 92, 93, 94, 95, 96, 97, 97, 98, 98, 98, + 99, 100, 101 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 0, 2, 2, 2, 2, 1, 2, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 2, 2, 3, 2, 2, 3, 3, 3, + 2, 3, 2, 2, 1, 2, 1, 1, 1, 1, + 2, 2, 2 +}; + +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 2, 0, 1, 7, 60, 84, 3, 9, 0, 0, + 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 5, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 0, 0, 0, 6, 86, 87, 88, 89, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 8, 10, 11, 33, 34, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 72, 73, 0, 0, 0, 0, 75, 0, 0, 80, + 82, 83, 61, 90, 91, 92, 85, 35, 36, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 54, 53, 55, 56, 57, 58, 59, + 37, 38, 74, 76, 0, 0, 79, 81, 77, 78 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = +{ + -1, 1, 6, 7, 10, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 8, 20, 21, 22, 23, 24, 25, 96, 26, + 27, 28, 29, 30, 9, 34, 35, 36, 37, 38 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -26 +static const yytype_int8 yypact[] = +{ + -26, 0, -26, -26, -26, -26, -26, -26, 23, -5, + -1, -8, -7, -6, -9, -4, -2, 26, 28, 33, + 23, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, 34, 36, 37, -5, -26, -26, -26, -26, 38, + 41, 42, 43, 44, 45, 46, 47, 48, 50, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, 73, 74, 75, 76, -26, 77, 78, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, 79, 80, -26, -26, -26, -26 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = +{ + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -15, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -25, -26, -26, -26 +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -1 +static const yytype_uint8 yytable[] = +{ + 2, 93, 90, 91, 92, 102, 97, 31, 98, 106, + 0, 3, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 11, 99, 4, 100, 94, + 95, 32, 33, 101, 103, 5, 104, 105, 107, 62, + 63, 108, 109, 110, 111, 112, 113, 114, 115, 12, + 116, 13, 14, 15, 16, 17, 18, 19, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, + 139 +}; + +static const yytype_int8 yycheck[] = +{ + 0, 10, 10, 10, 10, 20, 10, 12, 10, 34, + -1, 11, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 12, 10, 37, 10, 48, + 49, 46, 47, 10, 10, 45, 10, 10, 10, 50, + 51, 10, 10, 10, 10, 10, 10, 10, 10, 36, + 10, 38, 39, 40, 41, 42, 43, 44, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 53, 0, 11, 37, 45, 54, 55, 83, 96, + 56, 12, 36, 38, 39, 40, 41, 42, 43, 44, + 84, 85, 86, 87, 88, 89, 91, 92, 93, 94, + 95, 12, 46, 47, 97, 98, 99, 100, 101, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 50, 51, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 10, 10, 10, 10, 48, 49, 90, 10, 10, 10, + 10, 10, 85, 10, 10, 10, 98, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 +}; + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ + +#define YYFAIL goto yyerrlab + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (YYID (0)) + + +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) +#endif + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#ifdef YYLEX_PARAM +# define YYLEX yylex (YYLEX_PARAM) +#else +# define YYLEX yylex () +#endif + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +#else +static void +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (YYID (0)) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_reduce_print (YYSTYPE *yyvsp, int yyrule) +#else +static void +yy_reduce_print (yyvsp, yyrule) + YYSTYPE *yyvsp; + int yyrule; +#endif +{ + int yynrhs = yyr2[yyrule]; + int yyi; + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyvsp, Rule); \ +} while (YYID (0)) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static YYSIZE_T +yystrlen (const char *yystr) +#else +static YYSIZE_T +yystrlen (yystr) + const char *yystr; +#endif +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static char * +yystpcpy (char *yydest, const char *yysrc) +#else +static char * +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +#endif +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) +{ + int yyn = yypact[yystate]; + + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; + } +} +#endif /* YYERROR_VERBOSE */ + + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +#else +static void +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + YYUSE (yyvaluep); + + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { + + default: + break; + } +} + +/* Prevent warnings from -Wmissing-prototypes. */ +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (void); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + + +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; + +/* Number of syntax errors so far. */ +int yynerrs; + + + +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ + +#ifdef YYPARSE_PARAM +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif +#else /* ! YYPARSE_PARAM */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void) +#else +int +yyparse () + +#endif +#endif +{ + + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + yyssp = yyss; + yyvsp = yyvs; + + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + *++yyvsp = yylval; + + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 7: + +/* Line 1455 of yacc.c */ +#line 68 "configparser.y" + { OUTYY(("\nP(server:)\n")); + if(server_settings_seen) { + yyerror("duplicate server: element."); + } + server_settings_seen = 1; + } + break; + + case 35: + +/* Line 1455 of yacc.c */ +#line 84 "configparser.y" + { + OUTYY(("P(server_ip_address:%s)\n", (yyvsp[(2) - (2)].str))); + if(cfg_parser->current_ip_address_option) { + cfg_parser->current_ip_address_option->next = + (ip_address_option_t*)region_alloc( + cfg_parser->opt->region, sizeof(ip_address_option_t)); + cfg_parser->current_ip_address_option = + cfg_parser->current_ip_address_option->next; + cfg_parser->current_ip_address_option->next=0; + } else { + cfg_parser->current_ip_address_option = + (ip_address_option_t*)region_alloc( + cfg_parser->opt->region, sizeof(ip_address_option_t)); + cfg_parser->current_ip_address_option->next=0; + cfg_parser->opt->ip_addresses = cfg_parser->current_ip_address_option; + } + + cfg_parser->current_ip_address_option->address = + region_strdup(cfg_parser->opt->region, (yyvsp[(2) - (2)].str)); + } + break; + + case 36: + +/* Line 1455 of yacc.c */ +#line 106 "configparser.y" + { + OUTYY(("P(server_debug_mode:%s)\n", (yyvsp[(2) - (2)].str))); + if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0) + yyerror("expected yes or no."); + else cfg_parser->opt->debug_mode = (strcmp((yyvsp[(2) - (2)].str), "yes")==0); + } + break; + + case 37: + +/* Line 1455 of yacc.c */ +#line 114 "configparser.y" + { + OUTYY(("P(server_verbosity:%s)\n", (yyvsp[(2) - (2)].str))); + if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0) + yyerror("number expected"); + else cfg_parser->opt->verbosity = atoi((yyvsp[(2) - (2)].str)); + } + break; + + case 38: + +/* Line 1455 of yacc.c */ +#line 122 "configparser.y" + { + OUTYY(("P(server_hide_version:%s)\n", (yyvsp[(2) - (2)].str))); + if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0) + yyerror("expected yes or no."); + else cfg_parser->opt->hide_version = (strcmp((yyvsp[(2) - (2)].str), "yes")==0); + } + break; + + case 39: + +/* Line 1455 of yacc.c */ +#line 130 "configparser.y" + { + OUTYY(("P(server_ip4_only:%s)\n", (yyvsp[(2) - (2)].str))); + if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0) + yyerror("expected yes or no."); + else cfg_parser->opt->ip4_only = (strcmp((yyvsp[(2) - (2)].str), "yes")==0); + } + break; + + case 40: + +/* Line 1455 of yacc.c */ +#line 138 "configparser.y" + { + OUTYY(("P(server_ip6_only:%s)\n", (yyvsp[(2) - (2)].str))); + if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0) + yyerror("expected yes or no."); + else cfg_parser->opt->ip6_only = (strcmp((yyvsp[(2) - (2)].str), "yes")==0); + } + break; + + case 41: + +/* Line 1455 of yacc.c */ +#line 146 "configparser.y" + { + OUTYY(("P(server_database:%s)\n", (yyvsp[(2) - (2)].str))); + cfg_parser->opt->database = region_strdup(cfg_parser->opt->region, (yyvsp[(2) - (2)].str)); + } + break; + + case 42: + +/* Line 1455 of yacc.c */ +#line 152 "configparser.y" + { + OUTYY(("P(server_identity:%s)\n", (yyvsp[(2) - (2)].str))); + cfg_parser->opt->identity = region_strdup(cfg_parser->opt->region, (yyvsp[(2) - (2)].str)); + } + break; + + case 43: + +/* Line 1455 of yacc.c */ +#line 158 "configparser.y" + { + unsigned char* nsid = 0; + uint16_t nsid_len = 0; + + OUTYY(("P(server_nsid:%s)\n", (yyvsp[(2) - (2)].str))); + + if (strlen((yyvsp[(2) - (2)].str)) % 2 != 0) { + yyerror("the NSID must be a hex string of an even length."); + } else { + nsid_len = strlen((yyvsp[(2) - (2)].str)) / 2; + nsid = xalloc(nsid_len); + if (hex_pton((yyvsp[(2) - (2)].str), nsid, nsid_len) == -1) + yyerror("hex string cannot be parsed in NSID."); + else + cfg_parser->opt->nsid = region_strdup(cfg_parser->opt->region, (yyvsp[(2) - (2)].str)); + free(nsid); + } + } + break; + + case 44: + +/* Line 1455 of yacc.c */ +#line 178 "configparser.y" + { + OUTYY(("P(server_logfile:%s)\n", (yyvsp[(2) - (2)].str))); + cfg_parser->opt->logfile = region_strdup(cfg_parser->opt->region, (yyvsp[(2) - (2)].str)); + } + break; + + case 45: + +/* Line 1455 of yacc.c */ +#line 184 "configparser.y" + { + OUTYY(("P(server_server_count:%s)\n", (yyvsp[(2) - (2)].str))); + if(atoi((yyvsp[(2) - (2)].str)) <= 0) + yyerror("number greater than zero expected"); + else cfg_parser->opt->server_count = atoi((yyvsp[(2) - (2)].str)); + } + break; + + case 46: + +/* Line 1455 of yacc.c */ +#line 192 "configparser.y" + { + OUTYY(("P(server_tcp_count:%s)\n", (yyvsp[(2) - (2)].str))); + if(atoi((yyvsp[(2) - (2)].str)) <= 0) + yyerror("number greater than zero expected"); + else cfg_parser->opt->tcp_count = atoi((yyvsp[(2) - (2)].str)); + } + break; + + case 47: + +/* Line 1455 of yacc.c */ +#line 200 "configparser.y" + { + OUTYY(("P(server_pidfile:%s)\n", (yyvsp[(2) - (2)].str))); + cfg_parser->opt->pidfile = region_strdup(cfg_parser->opt->region, (yyvsp[(2) - (2)].str)); + } + break; + + case 48: + +/* Line 1455 of yacc.c */ +#line 206 "configparser.y" + { + OUTYY(("P(server_port:%s)\n", (yyvsp[(2) - (2)].str))); + cfg_parser->opt->port = region_strdup(cfg_parser->opt->region, (yyvsp[(2) - (2)].str)); + } + break; + + case 49: + +/* Line 1455 of yacc.c */ +#line 212 "configparser.y" + { + OUTYY(("P(server_statistics:%s)\n", (yyvsp[(2) - (2)].str))); + if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0) + yyerror("number expected"); + else cfg_parser->opt->statistics = atoi((yyvsp[(2) - (2)].str)); + } + break; + + case 50: + +/* Line 1455 of yacc.c */ +#line 220 "configparser.y" + { + OUTYY(("P(server_chroot:%s)\n", (yyvsp[(2) - (2)].str))); + cfg_parser->opt->chroot = region_strdup(cfg_parser->opt->region, (yyvsp[(2) - (2)].str)); + } + break; + + case 51: + +/* Line 1455 of yacc.c */ +#line 226 "configparser.y" + { + OUTYY(("P(server_username:%s)\n", (yyvsp[(2) - (2)].str))); + cfg_parser->opt->username = region_strdup(cfg_parser->opt->region, (yyvsp[(2) - (2)].str)); + } + break; + + case 52: + +/* Line 1455 of yacc.c */ +#line 232 "configparser.y" + { + OUTYY(("P(server_zonesdir:%s)\n", (yyvsp[(2) - (2)].str))); + cfg_parser->opt->zonesdir = region_strdup(cfg_parser->opt->region, (yyvsp[(2) - (2)].str)); + } + break; + + case 53: + +/* Line 1455 of yacc.c */ +#line 238 "configparser.y" + { + OUTYY(("P(server_difffile:%s)\n", (yyvsp[(2) - (2)].str))); + cfg_parser->opt->difffile = region_strdup(cfg_parser->opt->region, (yyvsp[(2) - (2)].str)); + } + break; + + case 54: + +/* Line 1455 of yacc.c */ +#line 244 "configparser.y" + { + OUTYY(("P(server_xfrdfile:%s)\n", (yyvsp[(2) - (2)].str))); + cfg_parser->opt->xfrdfile = region_strdup(cfg_parser->opt->region, (yyvsp[(2) - (2)].str)); + } + break; + + case 55: + +/* Line 1455 of yacc.c */ +#line 250 "configparser.y" + { + OUTYY(("P(server_xfrd_reload_timeout:%s)\n", (yyvsp[(2) - (2)].str))); + if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0) + yyerror("number expected"); + cfg_parser->opt->xfrd_reload_timeout = atoi((yyvsp[(2) - (2)].str)); + } + break; + + case 56: + +/* Line 1455 of yacc.c */ +#line 258 "configparser.y" + { + OUTYY(("P(server_tcp_query_count:%s)\n", (yyvsp[(2) - (2)].str))); + if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0) + yyerror("number expected"); + cfg_parser->opt->tcp_query_count = atoi((yyvsp[(2) - (2)].str)); + } + break; + + case 57: + +/* Line 1455 of yacc.c */ +#line 266 "configparser.y" + { + OUTYY(("P(server_tcp_timeout:%s)\n", (yyvsp[(2) - (2)].str))); + if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0) + yyerror("number expected"); + cfg_parser->opt->tcp_timeout = atoi((yyvsp[(2) - (2)].str)); + } + break; + + case 58: + +/* Line 1455 of yacc.c */ +#line 274 "configparser.y" + { + OUTYY(("P(server_ipv4_edns_size:%s)\n", (yyvsp[(2) - (2)].str))); + if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0) + yyerror("number expected"); + cfg_parser->opt->ipv4_edns_size = atoi((yyvsp[(2) - (2)].str)); + } + break; + + case 59: + +/* Line 1455 of yacc.c */ +#line 282 "configparser.y" + { + OUTYY(("P(server_ipv6_edns_size:%s)\n", (yyvsp[(2) - (2)].str))); + if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0) + yyerror("number expected"); + cfg_parser->opt->ipv6_edns_size = atoi((yyvsp[(2) - (2)].str)); + } + break; + + case 60: + +/* Line 1455 of yacc.c */ +#line 292 "configparser.y" + { + OUTYY(("\nP(zone:)\n")); + if(cfg_parser->current_zone) { + if(!cfg_parser->current_zone->name) + c_error("previous zone has no name"); + else { + if(!nsd_options_insert_zone(cfg_parser->opt, + cfg_parser->current_zone)) + c_error("duplicate zone"); + } + if(!cfg_parser->current_zone->zonefile) + c_error("previous zone has no zonefile"); + } + cfg_parser->current_zone = zone_options_create(cfg_parser->opt->region); + cfg_parser->current_allow_notify = 0; + cfg_parser->current_request_xfr = 0; + cfg_parser->current_notify = 0; + cfg_parser->current_provide_xfr = 0; + cfg_parser->current_outgoing_interface = 0; + } + break; + + case 72: + +/* Line 1455 of yacc.c */ +#line 318 "configparser.y" + { + OUTYY(("P(zone_name:%s)\n", (yyvsp[(2) - (2)].str))); +#ifndef NDEBUG + assert(cfg_parser->current_zone); +#endif + cfg_parser->current_zone->name = region_strdup(cfg_parser->opt->region, (yyvsp[(2) - (2)].str)); + } + break; + + case 73: + +/* Line 1455 of yacc.c */ +#line 327 "configparser.y" + { + OUTYY(("P(zone_zonefile:%s)\n", (yyvsp[(2) - (2)].str))); +#ifndef NDEBUG + assert(cfg_parser->current_zone); +#endif + cfg_parser->current_zone->zonefile = region_strdup(cfg_parser->opt->region, (yyvsp[(2) - (2)].str)); + } + break; + + case 74: + +/* Line 1455 of yacc.c */ +#line 336 "configparser.y" + { + acl_options_t* acl = parse_acl_info(cfg_parser->opt->region, (yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str)); + OUTYY(("P(zone_allow_notify:%s %s)\n", (yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str))); + if(cfg_parser->current_allow_notify) + cfg_parser->current_allow_notify->next = acl; + else + cfg_parser->current_zone->allow_notify = acl; + cfg_parser->current_allow_notify = acl; + } + break; + + case 75: + +/* Line 1455 of yacc.c */ +#line 347 "configparser.y" + { + } + break; + + case 76: + +/* Line 1455 of yacc.c */ +#line 351 "configparser.y" + { + acl_options_t* acl = parse_acl_info(cfg_parser->opt->region, (yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str)); + OUTYY(("P(zone_request_xfr:%s %s)\n", (yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str))); + if(acl->blocked) c_error("blocked address used for request-xfr"); + if(acl->rangetype!=acl_range_single) c_error("address range used for request-xfr"); + if(cfg_parser->current_request_xfr) + cfg_parser->current_request_xfr->next = acl; + else + cfg_parser->current_zone->request_xfr = acl; + cfg_parser->current_request_xfr = acl; + } + break; + + case 77: + +/* Line 1455 of yacc.c */ +#line 363 "configparser.y" + { + acl_options_t* acl = parse_acl_info(cfg_parser->opt->region, (yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str)); + acl->use_axfr_only = 1; + OUTYY(("P(zone_request_xfr:%s %s)\n", (yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str))); + if(acl->blocked) c_error("blocked address used for request-xfr"); + if(acl->rangetype!=acl_range_single) c_error("address range used for request-xfr"); + if(cfg_parser->current_request_xfr) + cfg_parser->current_request_xfr->next = acl; + else + cfg_parser->current_zone->request_xfr = acl; + cfg_parser->current_request_xfr = acl; + } + break; + + case 78: + +/* Line 1455 of yacc.c */ +#line 376 "configparser.y" + { + acl_options_t* acl = parse_acl_info(cfg_parser->opt->region, (yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str)); + acl->allow_udp = 1; + OUTYY(("P(zone_request_xfr:%s %s)\n", (yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str))); + if(acl->blocked) c_error("blocked address used for request-xfr"); + if(acl->rangetype!=acl_range_single) c_error("address range used for request-xfr"); + if(cfg_parser->current_request_xfr) + cfg_parser->current_request_xfr->next = acl; + else + cfg_parser->current_zone->request_xfr = acl; + cfg_parser->current_request_xfr = acl; + } + break; + + case 79: + +/* Line 1455 of yacc.c */ +#line 390 "configparser.y" + { + acl_options_t* acl = parse_acl_info(cfg_parser->opt->region, (yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str)); + OUTYY(("P(zone_notify:%s %s)\n", (yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str))); + if(acl->blocked) c_error("blocked address used for notify"); + if(acl->rangetype!=acl_range_single) c_error("address range used for notify"); + if(cfg_parser->current_notify) + cfg_parser->current_notify->next = acl; + else + cfg_parser->current_zone->notify = acl; + cfg_parser->current_notify = acl; + } + break; + + case 80: + +/* Line 1455 of yacc.c */ +#line 403 "configparser.y" + { + OUTYY(("P(zone_notify_retry:%s)\n", (yyvsp[(2) - (2)].str))); + if(atoi((yyvsp[(2) - (2)].str)) == 0 && strcmp((yyvsp[(2) - (2)].str), "0") != 0) + yyerror("number expected"); + else cfg_parser->current_zone->notify_retry = atoi((yyvsp[(2) - (2)].str)); + } + break; + + case 81: + +/* Line 1455 of yacc.c */ +#line 411 "configparser.y" + { + acl_options_t* acl = parse_acl_info(cfg_parser->opt->region, (yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str)); + OUTYY(("P(zone_provide_xfr:%s %s)\n", (yyvsp[(2) - (3)].str), (yyvsp[(3) - (3)].str))); + if(cfg_parser->current_provide_xfr) + cfg_parser->current_provide_xfr->next = acl; + else + cfg_parser->current_zone->provide_xfr = acl; + cfg_parser->current_provide_xfr = acl; + } + break; + + case 82: + +/* Line 1455 of yacc.c */ +#line 422 "configparser.y" + { + acl_options_t* acl = parse_acl_info(cfg_parser->opt->region, (yyvsp[(2) - (2)].str), "NOKEY"); + OUTYY(("P(zone_outgoing_interface:%s)\n", (yyvsp[(2) - (2)].str))); + + if(cfg_parser->current_outgoing_interface) + cfg_parser->current_outgoing_interface->next = acl; + else + cfg_parser->current_zone->outgoing_interface = acl; + cfg_parser->current_outgoing_interface = acl; + } + break; + + case 83: + +/* Line 1455 of yacc.c */ +#line 434 "configparser.y" + { + OUTYY(("P(zone_allow_axfr_fallback:%s)\n", (yyvsp[(2) - (2)].str))); + if(strcmp((yyvsp[(2) - (2)].str), "yes") != 0 && strcmp((yyvsp[(2) - (2)].str), "no") != 0) + yyerror("expected yes or no."); + else cfg_parser->current_zone->allow_axfr_fallback = (strcmp((yyvsp[(2) - (2)].str), "yes")==0); + } + break; + + case 84: + +/* Line 1455 of yacc.c */ +#line 444 "configparser.y" + { + OUTYY(("\nP(key:)\n")); + if(cfg_parser->current_key) { + if(!cfg_parser->current_key->name) c_error("previous key has no name"); + if(!cfg_parser->current_key->algorithm) c_error("previous key has no algorithm"); + if(!cfg_parser->current_key->secret) c_error("previous key has no secret blob"); + cfg_parser->current_key->next = key_options_create(cfg_parser->opt->region); + cfg_parser->current_key = cfg_parser->current_key->next; + } else { + cfg_parser->current_key = key_options_create(cfg_parser->opt->region); + cfg_parser->opt->keys = cfg_parser->current_key; + } + cfg_parser->opt->numkeys++; + } + break; + + case 90: + +/* Line 1455 of yacc.c */ +#line 462 "configparser.y" + { + OUTYY(("P(key_name:%s)\n", (yyvsp[(2) - (2)].str))); +#ifndef NDEBUG + assert(cfg_parser->current_key); +#endif + cfg_parser->current_key->name = region_strdup(cfg_parser->opt->region, (yyvsp[(2) - (2)].str)); + } + break; + + case 91: + +/* Line 1455 of yacc.c */ +#line 471 "configparser.y" + { + OUTYY(("P(key_algorithm:%s)\n", (yyvsp[(2) - (2)].str))); +#ifndef NDEBUG + assert(cfg_parser->current_key); +#endif + cfg_parser->current_key->algorithm = region_strdup(cfg_parser->opt->region, (yyvsp[(2) - (2)].str)); + } + break; + + case 92: + +/* Line 1455 of yacc.c */ +#line 480 "configparser.y" + { + OUTYY(("key_secret:%s)\n", (yyvsp[(2) - (2)].str))); +#ifndef NDEBUG + assert(cfg_parser->current_key); +#endif + cfg_parser->current_key->secret = region_strdup(cfg_parser->opt->region, (yyvsp[(2) - (2)].str)); + } + break; + + + +/* Line 1455 of yacc.c */ +#line 2175 "configparser.c" + default: break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (yymsg); + } + else + { + yyerror (YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } + } +#endif + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + *++yyvsp = yylval; + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined(yyoverflow) || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); +} + + + +/* Line 1675 of yacc.c */ +#line 489 "configparser.y" + + +/* parse helper routines could be here */ + diff --git a/usr.sbin/nsd/configparser.h b/usr.sbin/nsd/configparser.h new file mode 100644 index 00000000000..59c9d5e7674 --- /dev/null +++ b/usr.sbin/nsd/configparser.h @@ -0,0 +1,168 @@ + +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + SPACE = 258, + LETTER = 259, + NEWLINE = 260, + COMMENT = 261, + COLON = 262, + ANY = 263, + ZONESTR = 264, + STRING = 265, + VAR_SERVER = 266, + VAR_NAME = 267, + VAR_IP_ADDRESS = 268, + VAR_DEBUG_MODE = 269, + VAR_IP4_ONLY = 270, + VAR_IP6_ONLY = 271, + VAR_DATABASE = 272, + VAR_IDENTITY = 273, + VAR_NSID = 274, + VAR_LOGFILE = 275, + VAR_SERVER_COUNT = 276, + VAR_TCP_COUNT = 277, + VAR_PIDFILE = 278, + VAR_PORT = 279, + VAR_STATISTICS = 280, + VAR_CHROOT = 281, + VAR_USERNAME = 282, + VAR_ZONESDIR = 283, + VAR_XFRDFILE = 284, + VAR_DIFFFILE = 285, + VAR_XFRD_RELOAD_TIMEOUT = 286, + VAR_TCP_QUERY_COUNT = 287, + VAR_TCP_TIMEOUT = 288, + VAR_IPV4_EDNS_SIZE = 289, + VAR_IPV6_EDNS_SIZE = 290, + VAR_ZONEFILE = 291, + VAR_ZONE = 292, + VAR_ALLOW_NOTIFY = 293, + VAR_REQUEST_XFR = 294, + VAR_NOTIFY = 295, + VAR_PROVIDE_XFR = 296, + VAR_NOTIFY_RETRY = 297, + VAR_OUTGOING_INTERFACE = 298, + VAR_ALLOW_AXFR_FALLBACK = 299, + VAR_KEY = 300, + VAR_ALGORITHM = 301, + VAR_SECRET = 302, + VAR_AXFR = 303, + VAR_UDP = 304, + VAR_VERBOSITY = 305, + VAR_HIDE_VERSION = 306 + }; +#endif +/* Tokens. */ +#define SPACE 258 +#define LETTER 259 +#define NEWLINE 260 +#define COMMENT 261 +#define COLON 262 +#define ANY 263 +#define ZONESTR 264 +#define STRING 265 +#define VAR_SERVER 266 +#define VAR_NAME 267 +#define VAR_IP_ADDRESS 268 +#define VAR_DEBUG_MODE 269 +#define VAR_IP4_ONLY 270 +#define VAR_IP6_ONLY 271 +#define VAR_DATABASE 272 +#define VAR_IDENTITY 273 +#define VAR_NSID 274 +#define VAR_LOGFILE 275 +#define VAR_SERVER_COUNT 276 +#define VAR_TCP_COUNT 277 +#define VAR_PIDFILE 278 +#define VAR_PORT 279 +#define VAR_STATISTICS 280 +#define VAR_CHROOT 281 +#define VAR_USERNAME 282 +#define VAR_ZONESDIR 283 +#define VAR_XFRDFILE 284 +#define VAR_DIFFFILE 285 +#define VAR_XFRD_RELOAD_TIMEOUT 286 +#define VAR_TCP_QUERY_COUNT 287 +#define VAR_TCP_TIMEOUT 288 +#define VAR_IPV4_EDNS_SIZE 289 +#define VAR_IPV6_EDNS_SIZE 290 +#define VAR_ZONEFILE 291 +#define VAR_ZONE 292 +#define VAR_ALLOW_NOTIFY 293 +#define VAR_REQUEST_XFR 294 +#define VAR_NOTIFY 295 +#define VAR_PROVIDE_XFR 296 +#define VAR_NOTIFY_RETRY 297 +#define VAR_OUTGOING_INTERFACE 298 +#define VAR_ALLOW_AXFR_FALLBACK 299 +#define VAR_KEY 300 +#define VAR_ALGORITHM 301 +#define VAR_SECRET 302 +#define VAR_AXFR 303 +#define VAR_UDP 304 +#define VAR_VERBOSITY 305 +#define VAR_HIDE_VERSION 306 + + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +{ + +/* Line 1676 of yacc.c */ +#line 40 "configparser.y" + + char* str; + + + +/* Line 1676 of yacc.c */ +#line 160 "configparser.h" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + +extern YYSTYPE yylval; + + diff --git a/usr.sbin/nsd/dbaccess.c b/usr.sbin/nsd/dbaccess.c index 83cd5e2eb62..fccee760988 100644 --- a/usr.sbin/nsd/dbaccess.c +++ b/usr.sbin/nsd/dbaccess.c @@ -282,8 +282,13 @@ namedb_open (const char *filename, nsd_options_t* opt, size_t num_children) DEBUG(DEBUG_DBACCESS, 2, (LOG_INFO, "sizeof(rbnode_t) = %lu\n", (unsigned long) sizeof(rbnode_t))); +#ifdef USE_MMAP_ALLOC + db_region = region_create_custom(mmap_alloc, mmap_free, MMAP_ALLOC_CHUNK_SIZE, + MMAP_ALLOC_LARGE_OBJECT_SIZE, MMAP_ALLOC_INITIAL_CLEANUP_SIZE, 1); +#else /* !USE_MMAP_ALLOC */ db_region = region_create_custom(xalloc, free, DEFAULT_CHUNK_SIZE, DEFAULT_LARGE_OBJECT_SIZE, DEFAULT_INITIAL_CLEANUP_SIZE, 1); +#endif /* !USE_MMAP_ALLOC */ db = (namedb_type *) region_alloc(db_region, sizeof(struct namedb)); db->region = db_region; db->domains = domain_table_create(db->region); @@ -451,10 +456,17 @@ namedb_open (const char *filename, nsd_options_t* opt, size_t num_children) void namedb_close (struct namedb *db) { + namedb_fd_close(db); if (db) { - if (db->fd) { - fclose(db->fd); - } region_destroy(db->region); } } + +void +namedb_fd_close (struct namedb *db) +{ + if (db && db->fd) { + fclose(db->fd); + } +} + diff --git a/usr.sbin/nsd/dbcreate.c b/usr.sbin/nsd/dbcreate.c index bf55dbac813..17cce792860 100644 --- a/usr.sbin/nsd/dbcreate.c +++ b/usr.sbin/nsd/dbcreate.c @@ -25,9 +25,17 @@ struct namedb * namedb_new (const char *filename) { namedb_type *db; - region_type *region = region_create_custom(xalloc, free, + region_type *region; + +#ifdef USE_MMAP_ALLOC + region = region_create_custom(mmap_alloc, mmap_free, + MMAP_ALLOC_CHUNK_SIZE, MMAP_ALLOC_LARGE_OBJECT_SIZE, + MMAP_ALLOC_INITIAL_CLEANUP_SIZE, 1); +#else /* !USE_MMAP_ALLOC */ + region = region_create_custom(xalloc, free, DEFAULT_CHUNK_SIZE, DEFAULT_LARGE_OBJECT_SIZE, DEFAULT_INITIAL_CLEANUP_SIZE, 1); +#endif /* !USE_MMAP_ALLOC */ /* Make a new structure... */ db = (namedb_type *) region_alloc(region, sizeof(namedb_type)); diff --git a/usr.sbin/nsd/difffile.c b/usr.sbin/nsd/difffile.c index c11f5e7faaf..ccc993a5276 100644 --- a/usr.sbin/nsd/difffile.c +++ b/usr.sbin/nsd/difffile.c @@ -1062,7 +1062,7 @@ mark_and_exit(nsd_options_t* opt, FILE* f, off_t commitpos, const char* desc) fclose(f); } else { uint8_t c = 0; - fwrite(&c, sizeof(c), 1, f); + (void)write_data(f, &c, sizeof(c)); fclose(f); log_msg(LOG_ERR, "marked xfr as failed: %s", desc); log_msg(LOG_ERR, "marked xfr so that next reload can succeed"); diff --git a/usr.sbin/nsd/namedb.h b/usr.sbin/nsd/namedb.h index c22a69034c8..2b9fed955f3 100644 --- a/usr.sbin/nsd/namedb.h +++ b/usr.sbin/nsd/namedb.h @@ -289,6 +289,7 @@ int namedb_lookup (struct namedb *db, /* pass number of children (to alloc in dirty array */ struct namedb *namedb_open(const char *filename, struct nsd_options* opt, size_t num_children); +void namedb_fd_close(struct namedb *db); void namedb_close(struct namedb *db); static inline int diff --git a/usr.sbin/nsd/nsd.conf.sample.in b/usr.sbin/nsd/nsd.conf.sample.in index 442031b96fb..dc2b3b989ed 100644 --- a/usr.sbin/nsd/nsd.conf.sample.in +++ b/usr.sbin/nsd/nsd.conf.sample.in @@ -33,6 +33,9 @@ server: # identify the server (CH TXT ID.SERVER entry). # identity: "unidentified server" + # NSID identity (hex string). default disabled. + # nsid: "aabbccdd" + # log messages to file. Default to stderr and syslog. # logfile: "/var/log/nsd.log" diff --git a/usr.sbin/nsd/options.c b/usr.sbin/nsd/options.c index 9ce47f398bf..2e2720fe205 100644 --- a/usr.sbin/nsd/options.c +++ b/usr.sbin/nsd/options.c @@ -42,6 +42,7 @@ nsd_options_t* nsd_options_create(region_type* region) opt->ip6_only = 0; opt->database = DBFILE; opt->identity = 0; + opt->nsid = 0; opt->logfile = 0; opt->server_count = 1; opt->tcp_count = 10; diff --git a/usr.sbin/nsd/options.h b/usr.sbin/nsd/options.h index b676cd8ce9b..ce04e0779b3 100644 --- a/usr.sbin/nsd/options.h +++ b/usr.sbin/nsd/options.h @@ -60,6 +60,7 @@ struct nsd_options { const char* zonesdir; const char* difffile; const char* xfrdfile; + const char* nsid; int xfrd_reload_timeout; region_type* region; diff --git a/usr.sbin/nsd/region-allocator.h b/usr.sbin/nsd/region-allocator.h index 41891651f45..976b7875044 100644 --- a/usr.sbin/nsd/region-allocator.h +++ b/usr.sbin/nsd/region-allocator.h @@ -18,6 +18,23 @@ typedef struct region region_type; #define DEFAULT_LARGE_OBJECT_SIZE (DEFAULT_CHUNK_SIZE / 8) #define DEFAULT_INITIAL_CLEANUP_SIZE 16 + +/* + * mmap allocator constants + * + */ +#ifdef USE_MMAP_ALLOC + +/* header starts with size_t containing allocated size info and has at least 16 bytes to align the returned memory */ +#define MMAP_ALLOC_HEADER_SIZE (sizeof(size_t) >= 16 ? (sizeof(size_t)) : 16) + +/* mmap allocator uses chunks of 32 4kB pages */ +#define MMAP_ALLOC_CHUNK_SIZE ((32 * 4096) - MMAP_ALLOC_HEADER_SIZE) +#define MMAP_ALLOC_LARGE_OBJECT_SIZE (MMAP_ALLOC_CHUNK_SIZE / 8) +#define MMAP_ALLOC_INITIAL_CLEANUP_SIZE 16 + +#endif /* USE_MMAP_ALLOC */ + /* * Create a new region. */ diff --git a/usr.sbin/nsd/zlexer.c b/usr.sbin/nsd/zlexer.c new file mode 100644 index 00000000000..4c69bd1f6a0 --- /dev/null +++ b/usr.sbin/nsd/zlexer.c @@ -0,0 +1,2301 @@ +#include <config.h> + +#line 3 "<stdout>" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include <inttypes.h> +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart(yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +extern int yyleng; + +extern FILE *yyin, *yyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart (FILE *input_file ); +void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); +void yy_delete_buffer (YY_BUFFER_STATE b ); +void yy_flush_buffer (YY_BUFFER_STATE b ); +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state (void ); + +static void yyensure_buffer_stack (void ); +static void yy_load_buffer_state (void ); +static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); + +#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); + +void *yyalloc (yy_size_t ); +void *yyrealloc (void *,yy_size_t ); +void yyfree (void * ); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +typedef unsigned char YY_CHAR; + +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; + +typedef int yy_state_type; + +extern int yylineno; + +int yylineno = 1; + +extern char *yytext; +#define yytext_ptr yytext + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ + (yytext_ptr) -= (yy_more_len); \ + yyleng = (size_t) (yy_cp - (yytext_ptr)); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; + +#define YY_NUM_RULES 25 +#define YY_END_OF_BUFFER 26 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[67] = + { 0, + 0, 0, 0, 0, 16, 16, 20, 20, 26, 23, + 14, 11, 11, 19, 24, 12, 13, 8, 1, 9, + 23, 24, 6, 5, 16, 17, 16, 18, 20, 21, + 22, 25, 23, 23, 14, 1, 1, 23, 10, 15, + 23, 7, 7, 7, 7, 6, 16, 16, 16, 16, + 20, 0, 7, 7, 7, 7, 7, 2, 7, 7, + 7, 7, 7, 3, 4, 0 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 5, 6, 7, 1, 1, 1, 8, + 9, 1, 1, 1, 1, 10, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 11, 1, + 1, 1, 1, 12, 13, 13, 14, 15, 16, 13, + 17, 13, 18, 13, 13, 19, 13, 20, 21, 13, + 13, 22, 13, 23, 24, 13, 13, 13, 13, 13, + 25, 26, 27, 1, 1, 1, 13, 13, 28, 29, + + 30, 13, 31, 13, 32, 13, 13, 33, 13, 34, + 35, 13, 13, 36, 13, 37, 38, 13, 13, 13, + 13, 13, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[39] = + { 0, + 1, 2, 3, 2, 4, 1, 2, 2, 2, 2, + 2, 1, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 1, 1, 6, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5 + } ; + +static yyconst flex_int16_t yy_base[79] = + { 0, + 0, 25, 114, 113, 12, 14, 16, 17, 115, 88, + 12, 187, 187, 187, 187, 187, 187, 187, 0, 87, + 50, 59, 0, 187, 86, 187, 18, 187, 85, 187, + 187, 105, 82, 95, 14, 0, 0, 81, 75, 64, + 0, 0, 28, 27, 27, 0, 63, 20, 42, 39, + 5, 8, 53, 51, 51, 52, 55, 0, 49, 56, + 63, 59, 79, 0, 0, 187, 121, 127, 133, 139, + 145, 151, 157, 1, 163, 169, 174, 180 + } ; + +static yyconst flex_int16_t yy_def[79] = + { 0, + 67, 67, 68, 68, 69, 69, 70, 70, 66, 71, + 66, 66, 66, 66, 66, 66, 66, 66, 72, 71, + 73, 74, 75, 66, 76, 66, 77, 66, 78, 66, + 66, 78, 71, 73, 66, 72, 72, 71, 71, 71, + 34, 74, 74, 74, 74, 75, 76, 77, 76, 77, + 78, 78, 74, 74, 74, 74, 74, 74, 74, 74, + 74, 74, 74, 74, 74, 0, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66 + } ; + +static yyconst flex_int16_t yy_nxt[226] = + { 0, + 66, 11, 12, 13, 14, 42, 15, 16, 17, 18, + 19, 20, 51, 35, 26, 35, 26, 66, 30, 30, + 31, 31, 36, 66, 36, 21, 11, 12, 13, 14, + 52, 22, 16, 17, 18, 19, 20, 27, 28, 27, + 28, 32, 32, 50, 47, 50, 47, 53, 54, 55, + 21, 33, 33, 33, 33, 39, 33, 33, 33, 33, + 33, 53, 54, 55, 50, 47, 56, 48, 57, 58, + 59, 60, 61, 62, 40, 41, 43, 63, 64, 44, + 56, 45, 57, 58, 59, 60, 61, 62, 48, 34, + 43, 63, 64, 44, 65, 45, 33, 33, 33, 33, + + 34, 33, 33, 33, 33, 33, 34, 34, 65, 51, + 52, 48, 34, 34, 66, 24, 24, 66, 66, 66, + 41, 10, 10, 10, 10, 10, 10, 23, 23, 23, + 23, 23, 23, 25, 25, 25, 25, 25, 25, 29, + 29, 29, 29, 29, 29, 33, 66, 66, 66, 33, + 33, 37, 37, 66, 37, 37, 37, 38, 38, 38, + 38, 38, 38, 46, 46, 66, 46, 46, 46, 47, + 47, 66, 47, 47, 49, 49, 66, 49, 49, 49, + 51, 51, 66, 66, 51, 51, 9, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66 + } ; + +static yyconst flex_int16_t yy_chk[226] = + { 0, + 0, 1, 1, 1, 1, 74, 1, 1, 1, 1, + 1, 1, 52, 11, 5, 35, 6, 0, 7, 8, + 7, 8, 11, 0, 35, 1, 2, 2, 2, 2, + 51, 2, 2, 2, 2, 2, 2, 5, 5, 6, + 6, 7, 8, 27, 27, 48, 48, 43, 44, 45, + 2, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 43, 44, 45, 50, 50, 53, 49, 54, 55, + 56, 57, 59, 60, 21, 21, 22, 61, 62, 22, + 53, 22, 54, 55, 56, 57, 59, 60, 47, 40, + 22, 61, 62, 22, 63, 22, 34, 34, 34, 34, + + 39, 34, 34, 34, 34, 34, 38, 33, 63, 32, + 29, 25, 20, 10, 9, 4, 3, 0, 0, 0, + 34, 67, 67, 67, 67, 67, 67, 68, 68, 68, + 68, 68, 68, 69, 69, 69, 69, 69, 69, 70, + 70, 70, 70, 70, 70, 71, 0, 0, 0, 71, + 71, 72, 72, 0, 72, 72, 72, 73, 73, 73, + 73, 73, 73, 75, 75, 0, 75, 75, 75, 76, + 76, 0, 76, 76, 77, 77, 0, 77, 77, 77, + 78, 78, 0, 0, 78, 78, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, + 66, 66, 66, 66, 66 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +extern int yy_flex_debug; +int yy_flex_debug = 0; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +static int yy_more_flag = 0; +static int yy_more_len = 0; +#define yymore() ((yy_more_flag) = 1) +#define YY_MORE_ADJ (yy_more_len) +#define YY_RESTORE_YY_MORE_OFFSET +char *yytext; +#line 1 "zlexer.lex" +#line 2 "zlexer.lex" +/* + * zlexer.lex - lexical analyzer for (DNS) zone files + * + * Copyright (c) 2001-2006, NLnet Labs. All rights reserved + * + * See LICENSE for the license. + * + */ + +#include <config.h> + +#include <ctype.h> +#include <errno.h> +#include <string.h> +#include <strings.h> + +#include "zonec.h" +#include "dname.h" +#include "zparser.h" + +#define YY_NO_UNPUT + +#if 0 +#define LEXOUT(s) printf s /* used ONLY when debugging */ +#else +#define LEXOUT(s) +#endif + +enum lexer_state { + EXPECT_OWNER, + PARSING_OWNER, + PARSING_TTL_CLASS_TYPE, + PARSING_RDATA +}; + +static int parse_token(int token, char *yytext, enum lexer_state *lexer_state); + +static YY_BUFFER_STATE include_stack[MAXINCLUDES]; +static zparser_type zparser_stack[MAXINCLUDES]; +static int include_stack_ptr = 0; + +/* + * Saves the file specific variables on the include stack. + */ +static void +push_parser_state(FILE *input) +{ + zparser_stack[include_stack_ptr].filename = parser->filename; + zparser_stack[include_stack_ptr].line = parser->line; + zparser_stack[include_stack_ptr].origin = parser->origin; + include_stack[include_stack_ptr] = YY_CURRENT_BUFFER; + yy_switch_to_buffer(yy_create_buffer(input,YY_BUF_SIZE)); + ++include_stack_ptr; +} + +/* + * Restores the file specific variables from the include stack. + */ +static void +pop_parser_state(void) +{ + --include_stack_ptr; + parser->filename = zparser_stack[include_stack_ptr].filename; + parser->line = zparser_stack[include_stack_ptr].line; + parser->origin = zparser_stack[include_stack_ptr].origin; + yy_delete_buffer(YY_CURRENT_BUFFER); + yy_switch_to_buffer(include_stack[include_stack_ptr]); +} + +#ifndef yy_set_bol /* compat definition, for flex 2.4.6 */ +#define yy_set_bol(at_bol) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer(yyin,YY_BUF_SIZE ); \ + yy_current_buffer->yy_ch_buf[0] = ((at_bol)?'\n':' '); \ + } +#endif + + +#line 612 "<stdout>" + +#define INITIAL 0 +#define incl 1 +#define bitlabel 2 +#define quotedstring 3 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include <unistd.h> +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals (void ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy (void ); + +int yyget_debug (void ); + +void yyset_debug (int debug_flag ); + +YY_EXTRA_TYPE yyget_extra (void ); + +void yyset_extra (YY_EXTRA_TYPE user_defined ); + +FILE *yyget_in (void ); + +void yyset_in (FILE * in_str ); + +FILE *yyget_out (void ); + +void yyset_out (FILE * out_str ); + +int yyget_leng (void ); + +char *yyget_text (void ); + +int yyget_lineno (void ); + +void yyset_lineno (int line_number ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap (void ); +#else +extern int yywrap (void ); +#endif +#endif + + static void yyunput (int c,char *buf_ptr ); + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (void ); +#else +static int input (void ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex (void); + +#define YY_DECL int yylex (void) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + if ( yyleng > 0 ) \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ + (yytext[yyleng - 1] == '\n'); \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +#line 94 "zlexer.lex" + + static int paren_open = 0; + static enum lexer_state lexer_state = EXPECT_OWNER; +#line 809 "<stdout>" + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } + + yy_load_buffer_state( ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + (yy_more_len) = 0; + if ( (yy_more_flag) ) + { + (yy_more_len) = (yy_c_buf_p) - (yytext_ptr); + (yy_more_flag) = 0; + } + yy_cp = (yy_c_buf_p); + + /* Support of yytext. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = (yy_start); + yy_current_state += YY_AT_BOL(); +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 67 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 187 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 97 "zlexer.lex" +/* ignore */ + YY_BREAK +case 2: +YY_RULE_SETUP +#line 98 "zlexer.lex" +{ lexer_state = PARSING_RDATA; return DOLLAR_TTL; } + YY_BREAK +case 3: +YY_RULE_SETUP +#line 99 "zlexer.lex" +{ lexer_state = PARSING_RDATA; return DOLLAR_ORIGIN; } + YY_BREAK +/* + * Handle $INCLUDE directives. See + * http://dinosaur.compilertools.net/flex/flex_12.html#SEC12. + */ +case 4: +YY_RULE_SETUP +#line 105 "zlexer.lex" +{ + BEGIN(incl); +} + YY_BREAK +case 5: +/* rule 5 can match eol */ +#line 109 "zlexer.lex" +case YY_STATE_EOF(incl): +#line 109 "zlexer.lex" +{ + int error_occurred = parser->error_occurred; + BEGIN(INITIAL); + zc_error("missing file name in $INCLUDE directive"); + yy_set_bol(1); /* Set beginning of line, so "^" rules match. */ + ++parser->line; + parser->error_occurred = error_occurred; +} + YY_BREAK +case 6: +YY_RULE_SETUP +#line 117 "zlexer.lex" +{ + char *tmp; + domain_type *origin = parser->origin; + int error_occurred = parser->error_occurred; + + BEGIN(INITIAL); + if (include_stack_ptr >= MAXINCLUDES ) { + zc_error("includes nested too deeply, skipped (>%d)", + MAXINCLUDES); + } else { + FILE *input; + + /* Remove trailing comment. */ + tmp = strrchr(yytext, ';'); + if (tmp) { + *tmp = '\0'; + } + strip_string(yytext); + + /* Parse origin for include file. */ + tmp = strrchr(yytext, ' '); + if (!tmp) { + tmp = strrchr(yytext, '\t'); + } + if (tmp) { + const dname_type *dname; + + /* split the original yytext */ + *tmp = '\0'; + strip_string(yytext); + + dname = dname_parse(parser->region, tmp + 1); + if (!dname) { + zc_error("incorrect include origin '%s'", + tmp + 1); + } else { + origin = domain_table_insert( + parser->db->domains, dname); + } + } + + if (strlen(yytext) == 0) { + zc_error("missing file name in $INCLUDE directive"); + } else if (!(input = fopen(yytext, "r"))) { + zc_error("cannot open include file '%s': %s", + yytext, strerror(errno)); + } else { + /* Initialize parser for include file. */ + char *filename = region_strdup(parser->region, yytext); + push_parser_state(input); /* Destroys yytext. */ + parser->filename = filename; + parser->line = 1; + parser->origin = origin; + lexer_state = EXPECT_OWNER; + } + } + + parser->error_occurred = error_occurred; +} + YY_BREAK +case YY_STATE_EOF(INITIAL): +#line 176 "zlexer.lex" +{ + yy_set_bol(1); /* Set beginning of line, so "^" rules match. */ + if (include_stack_ptr == 0) { + yyterminate(); + } else { + fclose(yyin); + pop_parser_state(); + } +} + YY_BREAK +case 7: +YY_RULE_SETUP +#line 185 "zlexer.lex" +{ zc_warning("Unknown directive: %s", yytext); } + YY_BREAK +case 8: +YY_RULE_SETUP +#line 186 "zlexer.lex" +{ + LEXOUT((". ")); + return parse_token('.', yytext, &lexer_state); +} + YY_BREAK +case 9: +YY_RULE_SETUP +#line 190 "zlexer.lex" +{ + LEXOUT(("@ ")); + return parse_token('@', yytext, &lexer_state); +} + YY_BREAK +case 10: +YY_RULE_SETUP +#line 194 "zlexer.lex" +{ + LEXOUT(("\\# ")); + return parse_token(URR, yytext, &lexer_state); +} + YY_BREAK +case 11: +/* rule 11 can match eol */ +YY_RULE_SETUP +#line 198 "zlexer.lex" +{ + ++parser->line; + if (!paren_open) { + lexer_state = EXPECT_OWNER; + LEXOUT(("NL\n")); + return NL; + } else { + LEXOUT(("SP ")); + return SP; + } +} + YY_BREAK +case 12: +YY_RULE_SETUP +#line 209 "zlexer.lex" +{ + if (paren_open) { + zc_error("nested parentheses"); + yyterminate(); + } + LEXOUT(("( ")); + paren_open = 1; + return SP; +} + YY_BREAK +case 13: +YY_RULE_SETUP +#line 218 "zlexer.lex" +{ + if (!paren_open) { + zc_error("closing parentheses without opening parentheses"); + yyterminate(); + } + LEXOUT((") ")); + paren_open = 0; + return SP; +} + YY_BREAK +case 14: +YY_RULE_SETUP +#line 227 "zlexer.lex" +{ + if (!paren_open && lexer_state == EXPECT_OWNER) { + lexer_state = PARSING_TTL_CLASS_TYPE; + LEXOUT(("PREV ")); + return PREV; + } + if (lexer_state == PARSING_OWNER) { + lexer_state = PARSING_TTL_CLASS_TYPE; + } + LEXOUT(("SP ")); + return SP; +} + YY_BREAK +/* Bitlabels. Strip leading and ending brackets. */ +case 15: +YY_RULE_SETUP +#line 241 "zlexer.lex" +{ BEGIN(bitlabel); } + YY_BREAK +case YY_STATE_EOF(bitlabel): +#line 242 "zlexer.lex" +{ + zc_error("EOF inside bitlabel"); + BEGIN(INITIAL); +} + YY_BREAK +case 16: +YY_RULE_SETUP +#line 246 "zlexer.lex" +{ yymore(); } + YY_BREAK +case 17: +/* rule 17 can match eol */ +YY_RULE_SETUP +#line 247 "zlexer.lex" +{ ++parser->line; yymore(); } + YY_BREAK +case 18: +YY_RULE_SETUP +#line 248 "zlexer.lex" +{ + BEGIN(INITIAL); + yytext[yyleng - 1] = '\0'; + return parse_token(BITLAB, yytext, &lexer_state); +} + YY_BREAK +/* Quoted strings. Strip leading and ending quotes. */ +case 19: +YY_RULE_SETUP +#line 255 "zlexer.lex" +{ BEGIN(quotedstring); LEXOUT(("\" ")); } + YY_BREAK +case YY_STATE_EOF(quotedstring): +#line 256 "zlexer.lex" +{ + zc_error("EOF inside quoted string"); + BEGIN(INITIAL); +} + YY_BREAK +case 20: +YY_RULE_SETUP +#line 260 "zlexer.lex" +{ LEXOUT(("STR ")); yymore(); } + YY_BREAK +case 21: +/* rule 21 can match eol */ +YY_RULE_SETUP +#line 261 "zlexer.lex" +{ ++parser->line; yymore(); } + YY_BREAK +case 22: +YY_RULE_SETUP +#line 262 "zlexer.lex" +{ + LEXOUT(("\" ")); + BEGIN(INITIAL); + yytext[yyleng - 1] = '\0'; + return parse_token(STR, yytext, &lexer_state); +} + YY_BREAK +case 23: +/* rule 23 can match eol */ +YY_RULE_SETUP +#line 269 "zlexer.lex" +{ + /* Any allowed word. */ + return parse_token(STR, yytext, &lexer_state); +} + YY_BREAK +case 24: +YY_RULE_SETUP +#line 273 "zlexer.lex" +{ + zc_error("unknown character '%c' (\\%03d) seen - is this a zonefile?", + (int) yytext[0], (int) yytext[0]); +} + YY_BREAK +case 25: +YY_RULE_SETUP +#line 277 "zlexer.lex" +ECHO; + YY_BREAK +#line 1190 "<stdout>" + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of yylex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (void) +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), (size_t) num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart(yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (void) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = (yy_start); + yy_current_state += YY_AT_BOL(); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 67 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ + register int yy_is_jam; + register char *yy_cp = (yy_c_buf_p); + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 67 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 66); + + return yy_is_jam ? 0 : yy_current_state; +} + + static void yyunput (int c, register char * yy_bp ) +{ + register char *yy_cp; + + yy_cp = (yy_c_buf_p); + + /* undo effects of setting up yytext */ + *yy_cp = (yy_hold_char); + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = (yy_n_chars) + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + register char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart(yyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap( ) ) + return EOF; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ + (yy_hold_char) = *++(yy_c_buf_p); + + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } + + yy_init_buffer(YY_CURRENT_BUFFER,input_file ); + yy_load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +static void yy_load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer(b,file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * + */ + void yy_delete_buffer (YY_BUFFER_STATE b ) +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree((void *) b->yy_ch_buf ); + + yyfree((void *) b ); +} + +#ifndef __cplusplus +extern int isatty (int ); +#endif /* __cplusplus */ + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) + +{ + int oerrno = errno; + + yy_flush_buffer(b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void yy_flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void yypop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (void) +{ + int num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer(b ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) +{ + + return yy_scan_bytes(yystr,strlen(yystr) ); +} + +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) yyalloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the current line number. + * + */ +int yyget_lineno (void) +{ + + return yylineno; +} + +/** Get the input stream. + * + */ +FILE *yyget_in (void) +{ + return yyin; +} + +/** Get the output stream. + * + */ +FILE *yyget_out (void) +{ + return yyout; +} + +/** Get the length of the current token. + * + */ +int yyget_leng (void) +{ + return yyleng; +} + +/** Get the current token. + * + */ + +char *yyget_text (void) +{ + return yytext; +} + +/** Set the current line number. + * @param line_number + * + */ +void yyset_lineno (int line_number ) +{ + + yylineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * in_str ) +{ + yyin = in_str ; +} + +void yyset_out (FILE * out_str ) +{ + yyout = out_str ; +} + +int yyget_debug (void) +{ + return yy_flex_debug; +} + +void yyset_debug (int bdebug ) +{ + yy_flex_debug = bdebug ; +} + +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} + +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } + + /* Destroy the stack itself. */ + yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( ); + + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s ) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size ) +{ + return (void *) malloc( size ); +} + +void *yyrealloc (void * ptr, yy_size_t size ) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void yyfree (void * ptr ) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 277 "zlexer.lex" + + + +/* + * Analyze "word" to see if it matches an RR type, possibly by using + * the "TYPExxx" notation. If it matches, the corresponding token is + * returned and the TYPE parameter is set to the RR type value. + */ +static int +rrtype_to_token(const char *word, uint16_t *type) +{ + uint16_t t = rrtype_from_string(word); + if (t != 0) { + rrtype_descriptor_type *entry = rrtype_descriptor_by_type(t); + *type = t; + return entry->token; + } + + return 0; +} + + +/* + * Remove \DDD constructs from the input. See RFC 1035, section 5.1. + */ +static size_t +zoctet(char *text) +{ + /* + * s follows the string, p lags behind and rebuilds the new + * string + */ + char *s; + char *p; + + for (s = p = text; *s; ++s, ++p) { + assert(p <= s); + if (s[0] != '\\') { + /* Ordinary character. */ + *p = *s; + } else if (isdigit((int)s[1]) && isdigit((int)s[2]) && isdigit((int)s[3])) { + /* \DDD escape. */ + int val = (hexdigit_to_int(s[1]) * 100 + + hexdigit_to_int(s[2]) * 10 + + hexdigit_to_int(s[3])); + if (0 <= val && val <= 255) { + s += 3; + *p = val; + } else { + zc_warning("text escape \\DDD overflow"); + *p = *++s; + } + } else if (s[1] != '\0') { + /* \X where X is any character, keep X. */ + *p = *++s; + } else { + /* Trailing backslash, ignore it. */ + zc_warning("trailing backslash ignored"); + --p; + } + } + *p = '\0'; + return p - text; +} + +static int +parse_token(int token, char *yytext, enum lexer_state *lexer_state) +{ + size_t len; + char *str; + + if (*lexer_state == EXPECT_OWNER) { + *lexer_state = PARSING_OWNER; + } else if (*lexer_state == PARSING_TTL_CLASS_TYPE) { + const char *t; + int token; + uint16_t rrclass; + + /* type */ + token = rrtype_to_token(yytext, &yylval.type); + if (token != 0) { + *lexer_state = PARSING_RDATA; + LEXOUT(("%d[%s] ", token, yytext)); + return token; + } + + /* class */ + rrclass = rrclass_from_string(yytext); + if (rrclass != 0) { + yylval.klass = rrclass; + LEXOUT(("CLASS ")); + return T_RRCLASS; + } + + /* ttl */ + yylval.ttl = strtottl(yytext, &t); + if (*t == '\0') { + LEXOUT(("TTL ")); + return T_TTL; + } + } + + str = region_strdup(parser->rr_region, yytext); + len = zoctet(str); + + yylval.data.str = str; + yylval.data.len = len; + + LEXOUT(("%d[%s] ", token, yytext)); + return token; +} + diff --git a/usr.sbin/nsd/zlexer.lex b/usr.sbin/nsd/zlexer.lex index 0d5ac7e0c9e..0efe7865860 100644 --- a/usr.sbin/nsd/zlexer.lex +++ b/usr.sbin/nsd/zlexer.lex @@ -341,8 +341,8 @@ zoctet(char *text) static int parse_token(int token, char *yytext, enum lexer_state *lexer_state) { - char *str = region_strdup(parser->rr_region, yytext); - size_t len = zoctet(str); + size_t len; + char *str; if (*lexer_state == EXPECT_OWNER) { *lexer_state = PARSING_OWNER; @@ -352,7 +352,7 @@ parse_token(int token, char *yytext, enum lexer_state *lexer_state) uint16_t rrclass; /* type */ - token = rrtype_to_token(str, &yylval.type); + token = rrtype_to_token(yytext, &yylval.type); if (token != 0) { *lexer_state = PARSING_RDATA; LEXOUT(("%d[%s] ", token, yytext)); @@ -360,7 +360,7 @@ parse_token(int token, char *yytext, enum lexer_state *lexer_state) } /* class */ - rrclass = rrclass_from_string(str); + rrclass = rrclass_from_string(yytext); if (rrclass != 0) { yylval.klass = rrclass; LEXOUT(("CLASS ")); @@ -368,13 +368,16 @@ parse_token(int token, char *yytext, enum lexer_state *lexer_state) } /* ttl */ - yylval.ttl = strtottl(str, &t); + yylval.ttl = strtottl(yytext, &t); if (*t == '\0') { LEXOUT(("TTL ")); return T_TTL; } } + str = region_strdup(parser->rr_region, yytext); + len = zoctet(str); + yylval.data.str = str; yylval.data.len = len; diff --git a/usr.sbin/nsd/zparser.c b/usr.sbin/nsd/zparser.c new file mode 100644 index 00000000000..ebae851df1a --- /dev/null +++ b/usr.sbin/nsd/zparser.c @@ -0,0 +1,3689 @@ + +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "2.4.1" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + + + +/* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ +#line 1 "zparser.y" + +/* + * zyparser.y -- yacc grammar for (DNS) zone files + * + * Copyright (c) 2001-2006, NLnet Labs. All rights reserved. + * + * See LICENSE for the license. + * + */ + +#include <config.h> + +#include <stdarg.h> +#include <stdio.h> +#include <string.h> + +#include "dname.h" +#include "namedb.h" +#include "zonec.h" + +/* these need to be global, otherwise they cannot be used inside yacc */ +zparser_type *parser; + +#ifdef __cplusplus +extern "C" +#endif /* __cplusplus */ +int yywrap(void); + +/* this hold the nxt bits */ +static uint8_t nxtbits[16]; +static int dlv_warn = 1; + +/* 256 windows of 256 bits (32 bytes) */ +/* still need to reset the bastard somewhere */ +static uint8_t nsecbits[NSEC_WINDOW_COUNT][NSEC_WINDOW_BITS_SIZE]; + +/* hold the highest rcode seen in a NSEC rdata , BUG #106 */ +uint16_t nsec_highest_rcode; + +void yyerror(const char *message); + +#ifdef NSEC3 +/* parse nsec3 parameters and add the (first) rdata elements */ +static void +nsec3_add_params(const char* hash_algo_str, const char* flag_str, + const char* iter_str, const char* salt_str, int salt_len); +#endif /* NSEC3 */ + + + +/* Line 189 of yacc.c */ +#line 124 "zparser.c" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + T_A = 258, + T_NS = 259, + T_MX = 260, + T_TXT = 261, + T_CNAME = 262, + T_AAAA = 263, + T_PTR = 264, + T_NXT = 265, + T_KEY = 266, + T_SOA = 267, + T_SIG = 268, + T_SRV = 269, + T_CERT = 270, + T_LOC = 271, + T_MD = 272, + T_MF = 273, + T_MB = 274, + T_MG = 275, + T_MR = 276, + T_NULL = 277, + T_WKS = 278, + T_HINFO = 279, + T_MINFO = 280, + T_RP = 281, + T_AFSDB = 282, + T_X25 = 283, + T_ISDN = 284, + T_RT = 285, + T_NSAP = 286, + T_NSAP_PTR = 287, + T_PX = 288, + T_GPOS = 289, + T_EID = 290, + T_NIMLOC = 291, + T_ATMA = 292, + T_NAPTR = 293, + T_KX = 294, + T_A6 = 295, + T_DNAME = 296, + T_SINK = 297, + T_OPT = 298, + T_APL = 299, + T_UINFO = 300, + T_UID = 301, + T_GID = 302, + T_UNSPEC = 303, + T_TKEY = 304, + T_TSIG = 305, + T_IXFR = 306, + T_AXFR = 307, + T_MAILB = 308, + T_MAILA = 309, + T_DS = 310, + T_DLV = 311, + T_SSHFP = 312, + T_RRSIG = 313, + T_NSEC = 314, + T_DNSKEY = 315, + T_SPF = 316, + T_NSEC3 = 317, + T_IPSECKEY = 318, + T_DHCID = 319, + T_NSEC3PARAM = 320, + DOLLAR_TTL = 321, + DOLLAR_ORIGIN = 322, + NL = 323, + SP = 324, + STR = 325, + PREV = 326, + BITLAB = 327, + T_TTL = 328, + T_RRCLASS = 329, + URR = 330, + T_UTYPE = 331 + }; +#endif +/* Tokens. */ +#define T_A 258 +#define T_NS 259 +#define T_MX 260 +#define T_TXT 261 +#define T_CNAME 262 +#define T_AAAA 263 +#define T_PTR 264 +#define T_NXT 265 +#define T_KEY 266 +#define T_SOA 267 +#define T_SIG 268 +#define T_SRV 269 +#define T_CERT 270 +#define T_LOC 271 +#define T_MD 272 +#define T_MF 273 +#define T_MB 274 +#define T_MG 275 +#define T_MR 276 +#define T_NULL 277 +#define T_WKS 278 +#define T_HINFO 279 +#define T_MINFO 280 +#define T_RP 281 +#define T_AFSDB 282 +#define T_X25 283 +#define T_ISDN 284 +#define T_RT 285 +#define T_NSAP 286 +#define T_NSAP_PTR 287 +#define T_PX 288 +#define T_GPOS 289 +#define T_EID 290 +#define T_NIMLOC 291 +#define T_ATMA 292 +#define T_NAPTR 293 +#define T_KX 294 +#define T_A6 295 +#define T_DNAME 296 +#define T_SINK 297 +#define T_OPT 298 +#define T_APL 299 +#define T_UINFO 300 +#define T_UID 301 +#define T_GID 302 +#define T_UNSPEC 303 +#define T_TKEY 304 +#define T_TSIG 305 +#define T_IXFR 306 +#define T_AXFR 307 +#define T_MAILB 308 +#define T_MAILA 309 +#define T_DS 310 +#define T_DLV 311 +#define T_SSHFP 312 +#define T_RRSIG 313 +#define T_NSEC 314 +#define T_DNSKEY 315 +#define T_SPF 316 +#define T_NSEC3 317 +#define T_IPSECKEY 318 +#define T_DHCID 319 +#define T_NSEC3PARAM 320 +#define DOLLAR_TTL 321 +#define DOLLAR_ORIGIN 322 +#define NL 323 +#define SP 324 +#define STR 325 +#define PREV 326 +#define BITLAB 327 +#define T_TTL 328 +#define T_RRCLASS 329 +#define URR 330 +#define T_UTYPE 331 + + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +{ + +/* Line 214 of yacc.c */ +#line 50 "zparser.y" + + domain_type *domain; + const dname_type *dname; + struct lex_data data; + uint32_t ttl; + uint16_t klass; + uint16_t type; + uint16_t *unknown; + + + +/* Line 214 of yacc.c */ +#line 324 "zparser.c" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + + +/* Copy the second part of user declarations. */ + + +/* Line 264 of yacc.c */ +#line 336 "zparser.c" + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int yyi) +#else +static int +YYID (yyi) + int yyi; +#endif +{ + return yyi; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) + +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 2 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 771 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 79 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 63 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 194 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 472 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 331 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 77, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 78, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const yytype_uint16 yyprhs[] = +{ + 0, 0, 3, 4, 7, 9, 12, 15, 17, 19, + 21, 24, 26, 29, 31, 34, 39, 44, 49, 53, + 56, 58, 59, 62, 65, 70, 75, 77, 79, 81, + 83, 86, 88, 90, 92, 96, 98, 100, 102, 105, + 107, 109, 113, 115, 119, 121, 123, 127, 131, 133, + 137, 140, 142, 145, 147, 150, 152, 156, 158, 162, + 164, 166, 169, 173, 177, 181, 185, 189, 193, 197, + 201, 205, 209, 213, 217, 221, 225, 229, 233, 237, + 241, 245, 249, 253, 257, 261, 265, 269, 273, 277, + 281, 285, 289, 293, 297, 301, 305, 309, 313, 317, + 321, 325, 329, 333, 337, 341, 345, 349, 353, 357, + 361, 365, 369, 373, 377, 381, 385, 389, 393, 397, + 401, 405, 409, 413, 417, 421, 425, 429, 433, 437, + 441, 445, 449, 453, 456, 460, 464, 468, 472, 476, + 480, 484, 488, 492, 496, 500, 504, 508, 512, 516, + 520, 524, 528, 532, 536, 539, 542, 557, 564, 569, + 574, 579, 582, 587, 592, 595, 598, 603, 608, 611, + 618, 621, 624, 629, 638, 651, 656, 665, 668, 670, + 674, 683, 692, 699, 702, 721, 724, 735, 744, 753, + 761, 766, 769, 776, 781 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int16 yyrhs[] = +{ + 80, 0, -1, -1, 80, 81, -1, 68, -1, 82, + 68, -1, 71, 68, -1, 84, -1, 85, -1, 86, + -1, 1, 68, -1, 69, -1, 82, 69, -1, 68, + -1, 82, 68, -1, 66, 82, 70, 83, -1, 67, + 82, 90, 83, -1, 67, 82, 92, 83, -1, 87, + 88, 105, -1, 89, 82, -1, 71, -1, -1, 74, + 82, -1, 73, 82, -1, 73, 82, 74, 82, -1, + 74, 82, 73, 82, -1, 90, -1, 92, -1, 77, + -1, 78, -1, 92, 77, -1, 70, -1, 72, -1, + 91, -1, 92, 77, 91, -1, 94, -1, 96, -1, + 77, -1, 96, 77, -1, 70, -1, 95, -1, 96, + 77, 95, -1, 70, -1, 97, 82, 70, -1, 70, + -1, 77, -1, 98, 82, 70, -1, 98, 77, 70, + -1, 70, -1, 99, 82, 70, -1, 69, 100, -1, + 68, -1, 70, 101, -1, 68, -1, 69, 100, -1, + 70, -1, 102, 82, 70, -1, 70, -1, 103, 77, + 70, -1, 70, -1, 77, -1, 104, 77, -1, 104, + 77, 70, -1, 3, 82, 106, -1, 3, 82, 141, + -1, 4, 82, 107, -1, 4, 82, 141, -1, 17, + 82, 107, -1, 17, 82, 141, -1, 18, 82, 107, + -1, 18, 82, 141, -1, 7, 82, 107, -1, 7, + 82, 141, -1, 12, 82, 108, -1, 12, 82, 141, + -1, 19, 82, 107, -1, 19, 82, 141, -1, 20, + 82, 107, -1, 20, 82, 141, -1, 21, 82, 107, + -1, 21, 82, 141, -1, 23, 82, 109, -1, 23, + 82, 141, -1, 9, 82, 107, -1, 9, 82, 141, + -1, 24, 82, 110, -1, 24, 82, 141, -1, 25, + 82, 111, -1, 25, 82, 141, -1, 5, 82, 112, + -1, 5, 82, 141, -1, 6, 82, 113, -1, 6, + 82, 141, -1, 61, 82, 113, -1, 61, 82, 141, + -1, 26, 82, 114, -1, 26, 82, 141, -1, 27, + 82, 115, -1, 27, 82, 141, -1, 28, 82, 116, + -1, 28, 82, 141, -1, 29, 82, 117, -1, 29, + 82, 141, -1, 63, 82, 140, -1, 63, 82, 141, + -1, 64, 82, 133, -1, 64, 82, 141, -1, 30, + 82, 118, -1, 30, 82, 141, -1, 31, 82, 119, + -1, 31, 82, 141, -1, 13, 82, 134, -1, 13, + 82, 141, -1, 11, 82, 138, -1, 11, 82, 141, + -1, 33, 82, 120, -1, 33, 82, 141, -1, 8, + 82, 121, -1, 8, 82, 141, -1, 16, 82, 122, + -1, 16, 82, 141, -1, 10, 82, 123, -1, 10, + 82, 141, -1, 14, 82, 124, -1, 14, 82, 141, + -1, 38, 82, 125, -1, 38, 82, 141, -1, 39, + 82, 126, -1, 39, 82, 141, -1, 15, 82, 127, + -1, 15, 82, 141, -1, 41, 82, 107, -1, 41, + 82, 141, -1, 44, 83, -1, 44, 82, 128, -1, + 44, 82, 141, -1, 55, 82, 130, -1, 55, 82, + 141, -1, 56, 82, 131, -1, 56, 82, 141, -1, + 57, 82, 132, -1, 57, 82, 141, -1, 58, 82, + 134, -1, 58, 82, 141, -1, 59, 82, 135, -1, + 59, 82, 141, -1, 62, 82, 136, -1, 62, 82, + 141, -1, 65, 82, 137, -1, 65, 82, 141, -1, + 60, 82, 138, -1, 60, 82, 141, -1, 76, 82, + 141, -1, 70, 1, 68, -1, 104, 83, -1, 89, + 83, -1, 89, 82, 89, 82, 70, 82, 70, 82, + 70, 82, 70, 82, 70, 83, -1, 104, 82, 70, + 82, 98, 83, -1, 70, 82, 70, 83, -1, 89, + 82, 89, 83, -1, 70, 82, 89, 83, -1, 97, + 83, -1, 89, 82, 89, 83, -1, 70, 82, 89, + 83, -1, 70, 83, -1, 70, 83, -1, 70, 82, + 70, 83, -1, 70, 82, 89, 83, -1, 103, 83, + -1, 70, 82, 89, 82, 89, 83, -1, 104, 83, + -1, 98, 83, -1, 89, 82, 99, 83, -1, 70, + 82, 70, 82, 70, 82, 89, 83, -1, 70, 82, + 70, 82, 70, 82, 70, 82, 70, 82, 89, 83, + -1, 70, 82, 89, 83, -1, 70, 82, 70, 82, + 70, 82, 102, 83, -1, 129, 83, -1, 104, -1, + 129, 82, 104, -1, 70, 82, 70, 82, 70, 82, + 102, 83, -1, 70, 82, 70, 82, 70, 82, 102, + 83, -1, 70, 82, 70, 82, 102, 83, -1, 102, + 83, -1, 70, 82, 70, 82, 70, 82, 70, 82, + 70, 82, 70, 82, 70, 82, 93, 82, 102, 83, + -1, 93, 101, -1, 70, 82, 70, 82, 70, 82, + 70, 82, 70, 101, -1, 70, 82, 70, 82, 70, + 82, 70, 83, -1, 70, 82, 70, 82, 70, 82, + 102, 83, -1, 70, 82, 70, 82, 70, 82, 104, + -1, 139, 82, 102, 83, -1, 139, 83, -1, 75, + 82, 70, 82, 102, 83, -1, 75, 82, 70, 83, + -1, 75, 1, 68, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 90, 90, 91, 94, 95, 96, 97, 101, 105, + 125, 129, 130, 133, 134, 137, 147, 151, 157, 164, + 169, 176, 180, 185, 190, 195, 202, 203, 221, 225, + 229, 239, 250, 257, 258, 276, 277, 280, 288, 300, + 317, 318, 335, 339, 349, 350, 355, 364, 376, 385, + 396, 399, 402, 416, 417, 424, 425, 441, 442, 457, + 458, 463, 473, 491, 492, 493, 494, 495, 496, 501, + 502, 508, 509, 510, 511, 512, 513, 519, 520, 521, + 522, 524, 525, 526, 527, 528, 529, 530, 531, 532, + 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, + 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, + 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, + 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, + 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, + 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, + 593, 594, 595, 596, 608, 614, 621, 634, 641, 648, + 656, 663, 667, 675, 683, 690, 694, 702, 710, 722, + 730, 736, 742, 750, 760, 772, 780, 790, 793, 797, + 803, 812, 821, 829, 835, 850, 860, 875, 885, 894, + 928, 932, 935, 941, 945 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "T_A", "T_NS", "T_MX", "T_TXT", + "T_CNAME", "T_AAAA", "T_PTR", "T_NXT", "T_KEY", "T_SOA", "T_SIG", + "T_SRV", "T_CERT", "T_LOC", "T_MD", "T_MF", "T_MB", "T_MG", "T_MR", + "T_NULL", "T_WKS", "T_HINFO", "T_MINFO", "T_RP", "T_AFSDB", "T_X25", + "T_ISDN", "T_RT", "T_NSAP", "T_NSAP_PTR", "T_PX", "T_GPOS", "T_EID", + "T_NIMLOC", "T_ATMA", "T_NAPTR", "T_KX", "T_A6", "T_DNAME", "T_SINK", + "T_OPT", "T_APL", "T_UINFO", "T_UID", "T_GID", "T_UNSPEC", "T_TKEY", + "T_TSIG", "T_IXFR", "T_AXFR", "T_MAILB", "T_MAILA", "T_DS", "T_DLV", + "T_SSHFP", "T_RRSIG", "T_NSEC", "T_DNSKEY", "T_SPF", "T_NSEC3", + "T_IPSECKEY", "T_DHCID", "T_NSEC3PARAM", "DOLLAR_TTL", "DOLLAR_ORIGIN", + "NL", "SP", "STR", "PREV", "BITLAB", "T_TTL", "T_RRCLASS", "URR", + "T_UTYPE", "'.'", "'@'", "$accept", "lines", "line", "sp", "trail", + "ttl_directive", "origin_directive", "rr", "owner", "classttl", "dname", + "abs_dname", "label", "rel_dname", "wire_dname", "wire_abs_dname", + "wire_label", "wire_rel_dname", "str_seq", "concatenated_str_seq", + "nxt_seq", "nsec_more", "nsec_seq", "str_sp_seq", "str_dot_seq", + "dotted_str", "type_and_rdata", "rdata_a", "rdata_domain_name", + "rdata_soa", "rdata_wks", "rdata_hinfo", "rdata_minfo", "rdata_mx", + "rdata_txt", "rdata_rp", "rdata_afsdb", "rdata_x25", "rdata_isdn", + "rdata_rt", "rdata_nsap", "rdata_px", "rdata_aaaa", "rdata_loc", + "rdata_nxt", "rdata_srv", "rdata_naptr", "rdata_kx", "rdata_cert", + "rdata_apl", "rdata_apl_seq", "rdata_ds", "rdata_dlv", "rdata_sshfp", + "rdata_dhcid", "rdata_rrsig", "rdata_nsec", "rdata_nsec3", + "rdata_nsec3_param", "rdata_dnskey", "rdata_ipsec_base", + "rdata_ipseckey", "rdata_unknown", 0 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 330, 331, 46, 64 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 79, 80, 80, 81, 81, 81, 81, 81, 81, + 81, 82, 82, 83, 83, 84, 85, 85, 86, 87, + 87, 88, 88, 88, 88, 88, 89, 89, 90, 90, + 90, 91, 91, 92, 92, 93, 93, 94, 94, 95, + 96, 96, 97, 97, 98, 98, 98, 98, 99, 99, + 100, 100, 100, 101, 101, 102, 102, 103, 103, 104, + 104, 104, 104, 105, 105, 105, 105, 105, 105, 105, + 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, + 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, + 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, + 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, + 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, + 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, + 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, + 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, + 105, 105, 105, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 117, 118, 119, 120, + 121, 122, 123, 124, 125, 126, 127, 128, 129, 129, + 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 140, 141, 141, 141 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 0, 2, 1, 2, 2, 1, 1, 1, + 2, 1, 2, 1, 2, 4, 4, 4, 3, 2, + 1, 0, 2, 2, 4, 4, 1, 1, 1, 1, + 2, 1, 1, 1, 3, 1, 1, 1, 2, 1, + 1, 3, 1, 3, 1, 1, 3, 3, 1, 3, + 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, + 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 2, 2, 14, 6, 4, 4, + 4, 2, 4, 4, 2, 2, 4, 4, 2, 6, + 2, 2, 4, 8, 12, 4, 8, 2, 1, 3, + 8, 8, 6, 2, 18, 2, 10, 8, 8, 7, + 4, 2, 6, 4, 3 +}; + +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 2, 0, 1, 0, 0, 0, 4, 11, 31, 20, + 32, 28, 29, 3, 0, 7, 8, 9, 21, 0, + 26, 33, 27, 10, 0, 0, 6, 5, 12, 0, + 0, 0, 19, 30, 0, 0, 0, 23, 22, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 18, 34, 13, 0, 15, + 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 133, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 14, 24, 25, 59, 0, 60, 0, 63, 64, + 0, 65, 66, 0, 89, 90, 42, 0, 91, 92, + 71, 72, 0, 117, 118, 83, 84, 0, 121, 122, + 0, 113, 114, 0, 73, 74, 0, 111, 112, 0, + 123, 124, 0, 129, 130, 44, 45, 0, 119, 120, + 67, 68, 69, 70, 75, 76, 77, 78, 79, 80, + 0, 81, 82, 0, 85, 86, 0, 87, 88, 0, + 95, 96, 0, 97, 98, 0, 99, 100, 0, 101, + 102, 0, 107, 108, 57, 0, 109, 110, 0, 115, + 116, 0, 125, 126, 0, 127, 128, 131, 132, 178, + 134, 0, 135, 0, 136, 137, 0, 138, 139, 0, + 140, 141, 142, 143, 39, 37, 0, 35, 40, 36, + 144, 145, 150, 151, 93, 94, 0, 146, 147, 0, + 0, 103, 104, 55, 0, 105, 106, 0, 148, 149, + 153, 152, 0, 0, 61, 154, 155, 0, 0, 161, + 170, 0, 0, 0, 0, 0, 0, 0, 0, 171, + 0, 0, 0, 0, 0, 164, 0, 165, 0, 0, + 168, 0, 0, 0, 0, 177, 0, 0, 0, 53, + 0, 185, 38, 0, 0, 0, 191, 0, 183, 0, + 194, 0, 62, 0, 43, 48, 0, 0, 0, 0, + 0, 0, 47, 46, 0, 0, 0, 0, 0, 0, + 0, 58, 0, 0, 0, 179, 0, 0, 0, 51, + 0, 0, 54, 41, 0, 0, 0, 56, 0, 0, + 193, 160, 0, 172, 0, 0, 0, 0, 0, 0, + 158, 159, 162, 163, 166, 167, 0, 0, 175, 0, + 0, 0, 50, 52, 0, 0, 190, 0, 0, 49, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 192, 0, 0, 0, 0, 0, + 157, 169, 0, 0, 0, 182, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 189, 0, + 188, 0, 0, 173, 176, 0, 180, 181, 0, 187, + 0, 0, 0, 0, 0, 0, 0, 186, 0, 0, + 0, 0, 0, 174, 0, 0, 156, 0, 0, 0, + 0, 184 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 1, 13, 88, 89, 15, 16, 17, 18, 31, + 150, 20, 21, 22, 256, 257, 258, 259, 157, 187, + 336, 362, 321, 274, 225, 147, 85, 148, 151, 174, + 201, 204, 207, 154, 158, 210, 213, 216, 219, 222, + 226, 229, 163, 188, 168, 180, 232, 235, 183, 240, + 241, 244, 247, 250, 275, 177, 260, 267, 278, 171, + 270, 271, 149 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -360 +static const yytype_int16 yypact[] = +{ + -360, 189, -360, -31, -48, -48, -360, -360, -360, 18, + -360, -360, -360, -360, 20, -360, -360, -360, 111, -48, + -360, -360, 23, -360, 184, -47, -360, -360, -360, -48, + -48, 695, 45, -36, 228, 228, -42, 33, -64, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, 228, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, 127, -48, -360, -360, -360, 238, -360, + -360, -360, -48, -48, -58, -62, 88, 92, -62, -58, + -62, -62, 95, -62, 104, 107, 125, 55, -62, -62, + -62, -62, -62, -58, 128, -62, -62, 137, 140, 144, + 153, 156, 166, 169, 177, -62, 36, -360, 202, 205, + 209, 104, 64, 95, 92, 213, 216, 220, 230, 58, + 15, -360, 45, 45, -360, 13, -360, 50, -360, -360, + 228, -360, -360, -48, -360, -360, -360, 228, -360, -360, + -360, -360, 50, -360, -360, -360, -360, -48, -360, -360, + -48, -360, -360, -48, -360, -360, -48, -360, -360, -48, + -360, -360, -48, -360, -360, -360, -360, 52, -360, -360, + -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, + -45, -360, -360, -48, -360, -360, -48, -360, -360, -48, + -360, -360, -48, -360, -360, 228, -360, -360, 228, -360, + -360, -48, -360, -360, -360, 54, -360, -360, -48, -360, + -360, -48, -360, -360, -48, -360, -360, -360, -360, 61, + -360, 228, -360, -48, -360, -360, -48, -360, -360, -48, + -360, -360, -360, -360, -360, -360, 241, -360, -360, 63, + -360, -360, -360, -360, -360, -360, -48, -360, -360, -48, + 228, -360, -360, -360, 228, -360, -360, -48, -360, -360, + -360, -360, 74, 262, 84, -360, -360, -47, 81, -360, + -360, 272, 275, -47, 277, 279, 284, 90, 181, -360, + 289, 291, -47, -47, -47, -360, 246, -360, -47, 98, + -360, -47, 299, -47, 40, -360, 301, 303, 306, -360, + 249, -360, 101, 309, 311, 252, -360, 255, -360, 313, + -360, 228, -360, 228, -360, -360, 228, -48, -48, -48, + -48, -48, -360, -360, -48, 228, 228, 228, 228, 228, + 228, -360, -48, -48, 228, 61, -48, -48, -48, -360, + 249, 241, -360, -360, -48, -48, 228, -360, -48, 252, + -360, -360, 258, -360, 318, 321, 323, 325, 346, 66, + -360, -360, -360, -360, -360, -360, -47, 350, -360, 352, + 354, 356, -360, -360, 368, 370, -360, 374, 228, -360, + -48, -48, -48, -48, -48, 52, 228, -48, -48, -48, + 228, -48, -48, -48, -360, 356, 377, 384, -47, 356, + -360, -360, 390, 356, 356, -360, 392, 76, 396, 228, + -48, -48, 228, 228, -48, 228, 228, -48, 61, 228, + -360, 401, 403, -360, -360, 405, -360, -360, 408, -360, + -48, -48, -48, 241, 410, 412, -47, -360, -48, -48, + 228, 414, 416, -360, 228, -48, -360, 78, -48, 356, + 228, -360 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int16 yypgoto[] = +{ + -360, -360, -360, -1, 227, -360, -360, -360, -360, -360, + 0, 155, 160, 163, -271, -360, -121, -360, -360, -175, + -360, -144, -359, -232, -360, -93, -360, -360, -13, -360, + -360, -360, -360, -360, 100, -360, -360, -360, -360, -360, + -360, -360, -360, -360, -360, -360, -360, -360, -360, -360, + -360, -360, -360, -360, -360, 87, -360, -360, -360, 91, + -360, -360, 407 +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -1 +static const yytype_uint16 yytable[] = +{ + 14, 19, 393, 24, 25, 28, 162, 28, 8, 93, + 10, 28, 144, 145, 282, 11, 12, 145, 32, 146, + 200, 7, 28, 8, 7, 10, 87, 7, 37, 38, + 11, 12, 284, 239, 8, 33, 10, 23, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, + 126, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 7, 140, 28, 160, 26, 165, 27, 28, + 145, 142, 143, 366, 457, 190, 192, 194, 196, 198, + 33, 167, 28, 173, 141, 28, 144, 92, 141, 28, + 144, 145, 237, 146, 28, 206, 209, 146, 87, 7, + 87, 7, 87, 7, 28, 185, 280, 284, 139, 297, + 145, 309, 186, 28, 254, 28, 185, 398, 284, 145, + 322, 255, 330, 186, 283, 28, 144, 28, 254, 141, + 28, 334, 287, 146, 332, 255, 288, 28, 153, 410, + 342, 28, 156, 145, 28, 170, 291, 145, 351, 292, + 145, 254, 293, 28, 176, 294, 28, 179, 295, 145, + 35, 296, 145, 429, 29, 30, 298, 433, 36, 2, + 3, 435, 436, 86, 28, 182, 468, 28, 203, 300, + 145, 363, 301, 145, 405, 302, 28, 212, 303, 28, + 215, 304, 145, 28, 218, 145, 392, 306, 252, 145, + 308, 355, 28, 221, 262, 28, 224, 311, 145, 0, + 312, 145, 0, 313, 264, 28, 228, 470, 28, 231, + 314, 145, 316, 0, 145, 317, 28, 234, 318, 141, + 28, 343, 145, 28, 34, 4, 5, 6, 7, 8, + 9, 10, 90, 91, 0, 323, 11, 12, 324, 325, + 0, 28, 243, 327, 28, 246, 329, 145, 28, 249, + 145, 0, 28, 266, 145, 28, 269, 333, 145, 28, + 273, 145, 0, 338, 0, 145, 87, 7, 127, 28, + 277, 0, 346, 347, 348, 145, 141, 28, 350, 319, + 320, 352, 0, 354, 141, 28, 349, 359, 360, 361, + 141, 28, 273, 141, 28, 367, 141, 28, 399, 0, + 369, 28, 331, 0, 438, 372, 374, 375, 376, 377, + 378, 28, 335, 379, 28, 337, 28, 339, 28, 340, + 0, 386, 387, 28, 341, 389, 390, 391, 28, 344, + 28, 345, 0, 394, 395, 327, 0, 397, 28, 353, + 28, 356, 28, 357, 285, 28, 358, 286, 28, 364, + 28, 365, 28, 368, 289, 0, 406, 28, 400, 290, + 28, 401, 28, 402, 28, 403, 0, 327, 0, 415, + 416, 417, 418, 419, 298, 0, 422, 423, 424, 327, + 426, 427, 428, 0, 299, 28, 404, 0, 432, 28, + 407, 28, 408, 28, 409, 28, 273, 0, 327, 441, + 442, 0, 327, 445, 327, 327, 448, 28, 411, 28, + 412, 0, 305, 28, 413, 307, 28, 430, 0, 454, + 455, 456, 310, 28, 431, 0, 460, 461, 462, 28, + 434, 28, 437, 0, 467, 28, 439, 469, 315, 327, + 28, 450, 28, 451, 28, 452, 0, 28, 453, 28, + 458, 28, 459, 28, 464, 28, 465, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 326, 0, 0, + 0, 328, 152, 155, 159, 161, 164, 166, 169, 172, + 175, 178, 181, 184, 189, 191, 193, 195, 197, 199, + 202, 205, 208, 211, 214, 217, 220, 223, 227, 230, + 233, 236, 238, 242, 0, 245, 248, 251, 253, 261, + 263, 265, 268, 272, 276, 279, 0, 281, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 370, 0, + 371, 0, 0, 373, 0, 0, 0, 0, 0, 0, + 0, 0, 380, 381, 382, 383, 384, 385, 0, 0, + 0, 388, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 396, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 414, 0, 0, 0, 0, + 0, 0, 420, 421, 0, 0, 0, 425, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 440, 0, 0, 443, + 444, 0, 446, 447, 0, 0, 449, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 463, 0, 0, + 0, 466, 0, 0, 0, 0, 0, 471, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 0, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 0, 67, 0, + 0, 0, 0, 68, 69, 0, 70, 0, 0, 71, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 0, 0, 0, 0, 83, 0, 0, 0, 0, + 0, 84 +}; + +static const yytype_int16 yycheck[] = +{ + 1, 1, 361, 4, 5, 69, 99, 69, 70, 73, + 72, 69, 70, 75, 1, 77, 78, 75, 19, 77, + 113, 69, 69, 70, 69, 72, 68, 69, 29, 30, + 77, 78, 77, 126, 70, 77, 72, 68, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 69, 84, 69, 98, 68, 100, 68, 69, + 75, 92, 93, 325, 453, 108, 109, 110, 111, 112, + 77, 101, 69, 103, 68, 69, 70, 74, 68, 69, + 70, 75, 125, 77, 69, 115, 116, 77, 68, 69, + 68, 69, 68, 69, 69, 70, 68, 77, 1, 77, + 75, 77, 77, 69, 70, 69, 70, 369, 77, 75, + 77, 77, 68, 77, 145, 69, 70, 69, 70, 68, + 69, 70, 153, 77, 70, 77, 157, 69, 70, 391, + 70, 69, 70, 75, 69, 70, 167, 75, 70, 170, + 75, 70, 173, 69, 70, 176, 69, 70, 179, 75, + 25, 182, 75, 415, 73, 74, 187, 419, 25, 0, + 1, 423, 424, 33, 69, 70, 467, 69, 70, 200, + 75, 322, 203, 75, 379, 206, 69, 70, 209, 69, + 70, 212, 75, 69, 70, 75, 360, 218, 131, 75, + 221, 314, 69, 70, 133, 69, 70, 228, 75, -1, + 231, 75, -1, 234, 134, 69, 70, 469, 69, 70, + 241, 75, 243, -1, 75, 246, 69, 70, 249, 68, + 69, 70, 75, 69, 70, 66, 67, 68, 69, 70, + 71, 72, 35, 36, -1, 266, 77, 78, 269, 270, + -1, 69, 70, 274, 69, 70, 277, 75, 69, 70, + 75, -1, 69, 70, 75, 69, 70, 287, 75, 69, + 70, 75, -1, 293, -1, 75, 68, 69, 71, 69, + 70, -1, 302, 303, 304, 75, 68, 69, 308, 68, + 69, 311, -1, 313, 68, 69, 70, 68, 69, 70, + 68, 69, 70, 68, 69, 70, 68, 69, 70, -1, + 331, 69, 70, -1, 427, 336, 337, 338, 339, 340, + 341, 69, 70, 344, 69, 70, 69, 70, 69, 70, + -1, 352, 353, 69, 70, 356, 357, 358, 69, 70, + 69, 70, -1, 364, 365, 366, -1, 368, 69, 70, + 69, 70, 69, 70, 147, 69, 70, 150, 69, 70, + 69, 70, 69, 70, 157, -1, 386, 69, 70, 162, + 69, 70, 69, 70, 69, 70, -1, 398, -1, 400, + 401, 402, 403, 404, 405, -1, 407, 408, 409, 410, + 411, 412, 413, -1, 187, 69, 70, -1, 418, 69, + 70, 69, 70, 69, 70, 69, 70, -1, 429, 430, + 431, -1, 433, 434, 435, 436, 437, 69, 70, 69, + 70, -1, 215, 69, 70, 218, 69, 70, -1, 450, + 451, 452, 225, 69, 70, -1, 456, 458, 459, 69, + 70, 69, 70, -1, 465, 69, 70, 468, 241, 470, + 69, 70, 69, 70, 69, 70, -1, 69, 70, 69, + 70, 69, 70, 69, 70, 69, 70, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 270, -1, -1, + -1, 274, 95, 96, 97, 98, 99, 100, 101, 102, + 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, + 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, + 133, 134, 135, 136, 137, 138, -1, 140, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 331, -1, + 333, -1, -1, 336, -1, -1, -1, -1, -1, -1, + -1, -1, 345, 346, 347, 348, 349, 350, -1, -1, + -1, 354, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 366, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 398, -1, -1, -1, -1, + -1, -1, 405, 406, -1, -1, -1, 410, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 429, -1, -1, 432, + 433, -1, 435, 436, -1, -1, 439, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 460, -1, -1, + -1, 464, -1, -1, -1, -1, -1, 470, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, -1, 23, 24, + 25, 26, 27, 28, 29, 30, 31, -1, 33, -1, + -1, -1, -1, 38, 39, -1, 41, -1, -1, 44, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, -1, -1, -1, -1, 70, -1, -1, -1, -1, + -1, 76 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 80, 0, 1, 66, 67, 68, 69, 70, 71, + 72, 77, 78, 81, 82, 84, 85, 86, 87, 89, + 90, 91, 92, 68, 82, 82, 68, 68, 69, 73, + 74, 88, 82, 77, 70, 90, 92, 82, 82, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 33, 38, 39, + 41, 44, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 70, 76, 105, 91, 68, 82, 83, + 83, 83, 74, 73, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 83, 82, 82, + 82, 82, 82, 82, 82, 82, 82, 82, 82, 1, + 82, 68, 82, 82, 70, 75, 77, 104, 106, 141, + 89, 107, 141, 70, 112, 141, 70, 97, 113, 141, + 107, 141, 104, 121, 141, 107, 141, 89, 123, 141, + 70, 138, 141, 89, 108, 141, 70, 134, 141, 70, + 124, 141, 70, 127, 141, 70, 77, 98, 122, 141, + 107, 141, 107, 141, 107, 141, 107, 141, 107, 141, + 104, 109, 141, 70, 110, 141, 89, 111, 141, 89, + 114, 141, 70, 115, 141, 70, 116, 141, 70, 117, + 141, 70, 118, 141, 70, 103, 119, 141, 70, 120, + 141, 70, 125, 141, 70, 126, 141, 107, 141, 104, + 128, 129, 141, 70, 130, 141, 70, 131, 141, 70, + 132, 141, 134, 141, 70, 77, 93, 94, 95, 96, + 135, 141, 138, 141, 113, 141, 70, 136, 141, 70, + 139, 140, 141, 70, 102, 133, 141, 70, 137, 141, + 68, 141, 1, 82, 77, 83, 83, 82, 82, 83, + 83, 82, 82, 82, 82, 82, 82, 77, 82, 83, + 82, 82, 82, 82, 82, 83, 82, 83, 82, 77, + 83, 82, 82, 82, 82, 83, 82, 82, 82, 68, + 69, 101, 77, 82, 82, 82, 83, 82, 83, 82, + 68, 70, 70, 89, 70, 70, 99, 70, 89, 70, + 70, 70, 70, 70, 70, 70, 89, 89, 89, 70, + 89, 70, 89, 70, 89, 104, 70, 70, 70, 68, + 69, 70, 100, 95, 70, 70, 102, 70, 70, 82, + 83, 83, 82, 83, 82, 82, 82, 82, 82, 82, + 83, 83, 83, 83, 83, 83, 82, 82, 83, 82, + 82, 82, 100, 101, 82, 82, 83, 82, 102, 70, + 70, 70, 70, 70, 70, 98, 89, 70, 70, 70, + 102, 70, 70, 70, 83, 82, 82, 82, 82, 82, + 83, 83, 82, 82, 82, 83, 82, 82, 82, 102, + 70, 70, 89, 102, 70, 102, 102, 70, 104, 70, + 83, 82, 82, 83, 83, 82, 83, 83, 82, 83, + 70, 70, 70, 70, 82, 82, 82, 101, 70, 70, + 89, 82, 82, 83, 70, 70, 83, 82, 93, 82, + 102, 83 +}; + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ + +#define YYFAIL goto yyerrlab + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (YYID (0)) + + +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) +#endif + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#ifdef YYLEX_PARAM +# define YYLEX yylex (YYLEX_PARAM) +#else +# define YYLEX yylex () +#endif + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +#else +static void +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (YYID (0)) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_reduce_print (YYSTYPE *yyvsp, int yyrule) +#else +static void +yy_reduce_print (yyvsp, yyrule) + YYSTYPE *yyvsp; + int yyrule; +#endif +{ + int yynrhs = yyr2[yyrule]; + int yyi; + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyvsp, Rule); \ +} while (YYID (0)) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static YYSIZE_T +yystrlen (const char *yystr) +#else +static YYSIZE_T +yystrlen (yystr) + const char *yystr; +#endif +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static char * +yystpcpy (char *yydest, const char *yysrc) +#else +static char * +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +#endif +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) +{ + int yyn = yypact[yystate]; + + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; + } +} +#endif /* YYERROR_VERBOSE */ + + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +#else +static void +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + YYUSE (yyvaluep); + + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { + + default: + break; + } +} + +/* Prevent warnings from -Wmissing-prototypes. */ +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (void); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + + +/* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; + +/* Number of syntax errors so far. */ +int yynerrs; + + + +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ + +#ifdef YYPARSE_PARAM +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif +#else /* ! YYPARSE_PARAM */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void) +#else +int +yyparse () + +#endif +#endif +{ + + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + yyssp = yyss; + yyvsp = yyvs; + + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + + yystate = yyn; + *++yyvsp = yylval; + + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 6: + +/* Line 1455 of yacc.c */ +#line 96 "zparser.y" + {} + break; + + case 7: + +/* Line 1455 of yacc.c */ +#line 98 "zparser.y" + { + parser->error_occurred = 0; + } + break; + + case 8: + +/* Line 1455 of yacc.c */ +#line 102 "zparser.y" + { + parser->error_occurred = 0; + } + break; + + case 9: + +/* Line 1455 of yacc.c */ +#line 106 "zparser.y" + { /* rr should be fully parsed */ + if (!parser->error_occurred) { + parser->current_rr.rdatas + = (rdata_atom_type *) region_alloc_init( + parser->region, + parser->current_rr.rdatas, + (parser->current_rr.rdata_count + * sizeof(rdata_atom_type))); + + process_rr(); + } + + region_free_all(parser->rr_region); + + parser->current_rr.type = 0; + parser->current_rr.rdata_count = 0; + parser->current_rr.rdatas = parser->temporary_rdatas; + parser->error_occurred = 0; + } + break; + + case 15: + +/* Line 1455 of yacc.c */ +#line 138 "zparser.y" + { + parser->default_ttl = zparser_ttl2int((yyvsp[(3) - (4)].data).str, &(parser->error_occurred)); + if (parser->error_occurred == 1) { + parser->default_ttl = DEFAULT_TTL; + parser->error_occurred = 0; + } + } + break; + + case 16: + +/* Line 1455 of yacc.c */ +#line 148 "zparser.y" + { + parser->origin = (yyvsp[(3) - (4)].domain); + } + break; + + case 17: + +/* Line 1455 of yacc.c */ +#line 152 "zparser.y" + { + zc_error_prev_line("$ORIGIN directive requires absolute domain name"); + } + break; + + case 18: + +/* Line 1455 of yacc.c */ +#line 158 "zparser.y" + { + parser->current_rr.owner = (yyvsp[(1) - (3)].domain); + parser->current_rr.type = (yyvsp[(3) - (3)].type); + } + break; + + case 19: + +/* Line 1455 of yacc.c */ +#line 165 "zparser.y" + { + parser->prev_dname = (yyvsp[(1) - (2)].domain); + (yyval.domain) = (yyvsp[(1) - (2)].domain); + } + break; + + case 20: + +/* Line 1455 of yacc.c */ +#line 170 "zparser.y" + { + (yyval.domain) = parser->prev_dname; + } + break; + + case 21: + +/* Line 1455 of yacc.c */ +#line 176 "zparser.y" + { + parser->current_rr.ttl = parser->default_ttl; + parser->current_rr.klass = parser->default_class; + } + break; + + case 22: + +/* Line 1455 of yacc.c */ +#line 181 "zparser.y" + { + parser->current_rr.ttl = parser->default_ttl; + parser->current_rr.klass = (yyvsp[(1) - (2)].klass); + } + break; + + case 23: + +/* Line 1455 of yacc.c */ +#line 186 "zparser.y" + { + parser->current_rr.ttl = (yyvsp[(1) - (2)].ttl); + parser->current_rr.klass = parser->default_class; + } + break; + + case 24: + +/* Line 1455 of yacc.c */ +#line 191 "zparser.y" + { + parser->current_rr.ttl = (yyvsp[(1) - (4)].ttl); + parser->current_rr.klass = (yyvsp[(3) - (4)].klass); + } + break; + + case 25: + +/* Line 1455 of yacc.c */ +#line 196 "zparser.y" + { + parser->current_rr.ttl = (yyvsp[(3) - (4)].ttl); + parser->current_rr.klass = (yyvsp[(1) - (4)].klass); + } + break; + + case 27: + +/* Line 1455 of yacc.c */ +#line 204 "zparser.y" + { + if ((yyvsp[(1) - (1)].dname) == error_dname) { + (yyval.domain) = error_domain; + } else if ((yyvsp[(1) - (1)].dname)->name_size + domain_dname(parser->origin)->name_size - 1 > MAXDOMAINLEN) { + zc_error("domain name exceeds %d character limit", MAXDOMAINLEN); + (yyval.domain) = error_domain; + } else { + (yyval.domain) = domain_table_insert( + parser->db->domains, + dname_concatenate( + parser->rr_region, + (yyvsp[(1) - (1)].dname), + domain_dname(parser->origin))); + } + } + break; + + case 28: + +/* Line 1455 of yacc.c */ +#line 222 "zparser.y" + { + (yyval.domain) = parser->db->domains->root; + } + break; + + case 29: + +/* Line 1455 of yacc.c */ +#line 226 "zparser.y" + { + (yyval.domain) = parser->origin; + } + break; + + case 30: + +/* Line 1455 of yacc.c */ +#line 230 "zparser.y" + { + if ((yyvsp[(1) - (2)].dname) != error_dname) { + (yyval.domain) = domain_table_insert(parser->db->domains, (yyvsp[(1) - (2)].dname)); + } else { + (yyval.domain) = error_domain; + } + } + break; + + case 31: + +/* Line 1455 of yacc.c */ +#line 240 "zparser.y" + { + if ((yyvsp[(1) - (1)].data).len > MAXLABELLEN) { + zc_error("label exceeds %d character limit", MAXLABELLEN); + (yyval.dname) = error_dname; + } else { + (yyval.dname) = dname_make_from_label(parser->rr_region, + (uint8_t *) (yyvsp[(1) - (1)].data).str, + (yyvsp[(1) - (1)].data).len); + } + } + break; + + case 32: + +/* Line 1455 of yacc.c */ +#line 251 "zparser.y" + { + zc_error("bitlabels are not supported. RFC2673 has status experimental."); + (yyval.dname) = error_dname; + } + break; + + case 34: + +/* Line 1455 of yacc.c */ +#line 259 "zparser.y" + { + if ((yyvsp[(1) - (3)].dname) == error_dname || (yyvsp[(3) - (3)].dname) == error_dname) { + (yyval.dname) = error_dname; + } else if ((yyvsp[(1) - (3)].dname)->name_size + (yyvsp[(3) - (3)].dname)->name_size - 1 > MAXDOMAINLEN) { + zc_error("domain name exceeds %d character limit", + MAXDOMAINLEN); + (yyval.dname) = error_dname; + } else { + (yyval.dname) = dname_concatenate(parser->rr_region, (yyvsp[(1) - (3)].dname), (yyvsp[(3) - (3)].dname)); + } + } + break; + + case 37: + +/* Line 1455 of yacc.c */ +#line 281 "zparser.y" + { + char *result = (char *) region_alloc(parser->rr_region, 2); + result[0] = 0; + result[1] = '\0'; + (yyval.data).str = result; + (yyval.data).len = 1; + } + break; + + case 38: + +/* Line 1455 of yacc.c */ +#line 289 "zparser.y" + { + char *result = (char *) region_alloc(parser->rr_region, + (yyvsp[(1) - (2)].data).len + 2); + memcpy(result, (yyvsp[(1) - (2)].data).str, (yyvsp[(1) - (2)].data).len); + result[(yyvsp[(1) - (2)].data).len] = 0; + result[(yyvsp[(1) - (2)].data).len+1] = '\0'; + (yyval.data).str = result; + (yyval.data).len = (yyvsp[(1) - (2)].data).len + 1; + } + break; + + case 39: + +/* Line 1455 of yacc.c */ +#line 301 "zparser.y" + { + char *result = (char *) region_alloc(parser->rr_region, + (yyvsp[(1) - (1)].data).len + 1); + + if ((yyvsp[(1) - (1)].data).len > MAXLABELLEN) + zc_error("label exceeds %d character limit", MAXLABELLEN); + + /* make label anyway */ + result[0] = (yyvsp[(1) - (1)].data).len; + memcpy(result+1, (yyvsp[(1) - (1)].data).str, (yyvsp[(1) - (1)].data).len); + + (yyval.data).str = result; + (yyval.data).len = (yyvsp[(1) - (1)].data).len + 1; + } + break; + + case 41: + +/* Line 1455 of yacc.c */ +#line 319 "zparser.y" + { + if ((yyvsp[(1) - (3)].data).len + (yyvsp[(3) - (3)].data).len - 3 > MAXDOMAINLEN) + zc_error("domain name exceeds %d character limit", + MAXDOMAINLEN); + + /* make dname anyway */ + (yyval.data).len = (yyvsp[(1) - (3)].data).len + (yyvsp[(3) - (3)].data).len; + (yyval.data).str = (char *) region_alloc(parser->rr_region, (yyval.data).len + 1); + memcpy((yyval.data).str, (yyvsp[(1) - (3)].data).str, (yyvsp[(1) - (3)].data).len); + memcpy((yyval.data).str + (yyvsp[(1) - (3)].data).len, (yyvsp[(3) - (3)].data).str, (yyvsp[(3) - (3)].data).len); + (yyval.data).str[(yyval.data).len] = '\0'; + } + break; + + case 42: + +/* Line 1455 of yacc.c */ +#line 336 "zparser.y" + { + zadd_rdata_wireformat(zparser_conv_text(parser->region, (yyvsp[(1) - (1)].data).str, (yyvsp[(1) - (1)].data).len)); + } + break; + + case 43: + +/* Line 1455 of yacc.c */ +#line 340 "zparser.y" + { + zadd_rdata_wireformat(zparser_conv_text(parser->region, (yyvsp[(3) - (3)].data).str, (yyvsp[(3) - (3)].data).len)); + } + break; + + case 45: + +/* Line 1455 of yacc.c */ +#line 351 "zparser.y" + { + (yyval.data).len = 1; + (yyval.data).str = region_strdup(parser->rr_region, "."); + } + break; + + case 46: + +/* Line 1455 of yacc.c */ +#line 356 "zparser.y" + { + (yyval.data).len = (yyvsp[(1) - (3)].data).len + (yyvsp[(3) - (3)].data).len + 1; + (yyval.data).str = (char *) region_alloc(parser->rr_region, (yyval.data).len + 1); + memcpy((yyval.data).str, (yyvsp[(1) - (3)].data).str, (yyvsp[(1) - (3)].data).len); + memcpy((yyval.data).str + (yyvsp[(1) - (3)].data).len, " ", 1); + memcpy((yyval.data).str + (yyvsp[(1) - (3)].data).len + 1, (yyvsp[(3) - (3)].data).str, (yyvsp[(3) - (3)].data).len); + (yyval.data).str[(yyval.data).len] = '\0'; + } + break; + + case 47: + +/* Line 1455 of yacc.c */ +#line 365 "zparser.y" + { + (yyval.data).len = (yyvsp[(1) - (3)].data).len + (yyvsp[(3) - (3)].data).len + 1; + (yyval.data).str = (char *) region_alloc(parser->rr_region, (yyval.data).len + 1); + memcpy((yyval.data).str, (yyvsp[(1) - (3)].data).str, (yyvsp[(1) - (3)].data).len); + memcpy((yyval.data).str + (yyvsp[(1) - (3)].data).len, ".", 1); + memcpy((yyval.data).str + (yyvsp[(1) - (3)].data).len + 1, (yyvsp[(3) - (3)].data).str, (yyvsp[(3) - (3)].data).len); + (yyval.data).str[(yyval.data).len] = '\0'; + } + break; + + case 48: + +/* Line 1455 of yacc.c */ +#line 377 "zparser.y" + { + uint16_t type = rrtype_from_string((yyvsp[(1) - (1)].data).str); + if (type != 0 && type < 128) { + set_bit(nxtbits, type); + } else { + zc_error("bad type %d in NXT record", (int) type); + } + } + break; + + case 49: + +/* Line 1455 of yacc.c */ +#line 386 "zparser.y" + { + uint16_t type = rrtype_from_string((yyvsp[(3) - (3)].data).str); + if (type != 0 && type < 128) { + set_bit(nxtbits, type); + } else { + zc_error("bad type %d in NXT record", (int) type); + } + } + break; + + case 50: + +/* Line 1455 of yacc.c */ +#line 397 "zparser.y" + { + } + break; + + case 51: + +/* Line 1455 of yacc.c */ +#line 400 "zparser.y" + { + } + break; + + case 52: + +/* Line 1455 of yacc.c */ +#line 403 "zparser.y" + { + uint16_t type = rrtype_from_string((yyvsp[(1) - (2)].data).str); + if (type != 0) { + if (type > nsec_highest_rcode) { + nsec_highest_rcode = type; + } + set_bitnsec(nsecbits, type); + } else { + zc_error("bad type %d in NSEC record", (int) type); + } + } + break; + + case 56: + +/* Line 1455 of yacc.c */ +#line 426 "zparser.y" + { + char *result = (char *) region_alloc(parser->rr_region, + (yyvsp[(1) - (3)].data).len + (yyvsp[(3) - (3)].data).len + 1); + memcpy(result, (yyvsp[(1) - (3)].data).str, (yyvsp[(1) - (3)].data).len); + memcpy(result + (yyvsp[(1) - (3)].data).len, (yyvsp[(3) - (3)].data).str, (yyvsp[(3) - (3)].data).len); + (yyval.data).str = result; + (yyval.data).len = (yyvsp[(1) - (3)].data).len + (yyvsp[(3) - (3)].data).len; + (yyval.data).str[(yyval.data).len] = '\0'; + } + break; + + case 58: + +/* Line 1455 of yacc.c */ +#line 443 "zparser.y" + { + char *result = (char *) region_alloc(parser->rr_region, + (yyvsp[(1) - (3)].data).len + (yyvsp[(3) - (3)].data).len + 1); + memcpy(result, (yyvsp[(1) - (3)].data).str, (yyvsp[(1) - (3)].data).len); + memcpy(result + (yyvsp[(1) - (3)].data).len, (yyvsp[(3) - (3)].data).str, (yyvsp[(3) - (3)].data).len); + (yyval.data).str = result; + (yyval.data).len = (yyvsp[(1) - (3)].data).len + (yyvsp[(3) - (3)].data).len; + (yyval.data).str[(yyval.data).len] = '\0'; + } + break; + + case 60: + +/* Line 1455 of yacc.c */ +#line 459 "zparser.y" + { + (yyval.data).str = "."; + (yyval.data).len = 1; + } + break; + + case 61: + +/* Line 1455 of yacc.c */ +#line 464 "zparser.y" + { + char *result = (char *) region_alloc(parser->rr_region, + (yyvsp[(1) - (2)].data).len + 2); + memcpy(result, (yyvsp[(1) - (2)].data).str, (yyvsp[(1) - (2)].data).len); + result[(yyvsp[(1) - (2)].data).len] = '.'; + (yyval.data).str = result; + (yyval.data).len = (yyvsp[(1) - (2)].data).len + 1; + (yyval.data).str[(yyval.data).len] = '\0'; + } + break; + + case 62: + +/* Line 1455 of yacc.c */ +#line 474 "zparser.y" + { + char *result = (char *) region_alloc(parser->rr_region, + (yyvsp[(1) - (3)].data).len + (yyvsp[(3) - (3)].data).len + 2); + memcpy(result, (yyvsp[(1) - (3)].data).str, (yyvsp[(1) - (3)].data).len); + result[(yyvsp[(1) - (3)].data).len] = '.'; + memcpy(result + (yyvsp[(1) - (3)].data).len + 1, (yyvsp[(3) - (3)].data).str, (yyvsp[(3) - (3)].data).len); + (yyval.data).str = result; + (yyval.data).len = (yyvsp[(1) - (3)].data).len + (yyvsp[(3) - (3)].data).len + 1; + (yyval.data).str[(yyval.data).len] = '\0'; + } + break; + + case 64: + +/* Line 1455 of yacc.c */ +#line 492 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 66: + +/* Line 1455 of yacc.c */ +#line 494 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 67: + +/* Line 1455 of yacc.c */ +#line 495 "zparser.y" + { zc_warning_prev_line("MD is obsolete"); } + break; + + case 68: + +/* Line 1455 of yacc.c */ +#line 497 "zparser.y" + { + zc_warning_prev_line("MD is obsolete"); + (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); + } + break; + + case 69: + +/* Line 1455 of yacc.c */ +#line 501 "zparser.y" + { zc_warning_prev_line("MF is obsolete"); } + break; + + case 70: + +/* Line 1455 of yacc.c */ +#line 503 "zparser.y" + { + zc_warning_prev_line("MF is obsolete"); + (yyval.type) = (yyvsp[(1) - (3)].type); + parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); + } + break; + + case 72: + +/* Line 1455 of yacc.c */ +#line 509 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 74: + +/* Line 1455 of yacc.c */ +#line 511 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 75: + +/* Line 1455 of yacc.c */ +#line 512 "zparser.y" + { zc_warning_prev_line("MB is obsolete"); } + break; + + case 76: + +/* Line 1455 of yacc.c */ +#line 514 "zparser.y" + { + zc_warning_prev_line("MB is obsolete"); + (yyval.type) = (yyvsp[(1) - (3)].type); + parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); + } + break; + + case 78: + +/* Line 1455 of yacc.c */ +#line 520 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 80: + +/* Line 1455 of yacc.c */ +#line 522 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 82: + +/* Line 1455 of yacc.c */ +#line 525 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 84: + +/* Line 1455 of yacc.c */ +#line 527 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 86: + +/* Line 1455 of yacc.c */ +#line 529 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 88: + +/* Line 1455 of yacc.c */ +#line 531 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 90: + +/* Line 1455 of yacc.c */ +#line 533 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 92: + +/* Line 1455 of yacc.c */ +#line 535 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 94: + +/* Line 1455 of yacc.c */ +#line 537 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 96: + +/* Line 1455 of yacc.c */ +#line 539 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 98: + +/* Line 1455 of yacc.c */ +#line 541 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 100: + +/* Line 1455 of yacc.c */ +#line 543 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 102: + +/* Line 1455 of yacc.c */ +#line 545 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 104: + +/* Line 1455 of yacc.c */ +#line 547 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 106: + +/* Line 1455 of yacc.c */ +#line 549 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 108: + +/* Line 1455 of yacc.c */ +#line 551 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 110: + +/* Line 1455 of yacc.c */ +#line 553 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 112: + +/* Line 1455 of yacc.c */ +#line 555 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 114: + +/* Line 1455 of yacc.c */ +#line 557 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 116: + +/* Line 1455 of yacc.c */ +#line 559 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 118: + +/* Line 1455 of yacc.c */ +#line 561 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 120: + +/* Line 1455 of yacc.c */ +#line 563 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 122: + +/* Line 1455 of yacc.c */ +#line 565 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 124: + +/* Line 1455 of yacc.c */ +#line 567 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 126: + +/* Line 1455 of yacc.c */ +#line 569 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 128: + +/* Line 1455 of yacc.c */ +#line 571 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 130: + +/* Line 1455 of yacc.c */ +#line 573 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 132: + +/* Line 1455 of yacc.c */ +#line 575 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 135: + +/* Line 1455 of yacc.c */ +#line 578 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 137: + +/* Line 1455 of yacc.c */ +#line 580 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 138: + +/* Line 1455 of yacc.c */ +#line 581 "zparser.y" + { if (dlv_warn) { dlv_warn = 0; zc_warning_prev_line("DLV is experimental"); } } + break; + + case 139: + +/* Line 1455 of yacc.c */ +#line 582 "zparser.y" + { if (dlv_warn) { dlv_warn = 0; zc_warning_prev_line("DLV is experimental"); } (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 141: + +/* Line 1455 of yacc.c */ +#line 584 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 143: + +/* Line 1455 of yacc.c */ +#line 586 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 145: + +/* Line 1455 of yacc.c */ +#line 588 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 147: + +/* Line 1455 of yacc.c */ +#line 590 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 149: + +/* Line 1455 of yacc.c */ +#line 592 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 151: + +/* Line 1455 of yacc.c */ +#line 594 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 152: + +/* Line 1455 of yacc.c */ +#line 595 "zparser.y" + { (yyval.type) = (yyvsp[(1) - (3)].type); parse_unknown_rdata((yyvsp[(1) - (3)].type), (yyvsp[(3) - (3)].unknown)); } + break; + + case 153: + +/* Line 1455 of yacc.c */ +#line 597 "zparser.y" + { + zc_error_prev_line("unrecognized RR type '%s'", (yyvsp[(1) - (3)].data).str); + } + break; + + case 154: + +/* Line 1455 of yacc.c */ +#line 609 "zparser.y" + { + zadd_rdata_wireformat(zparser_conv_a(parser->region, (yyvsp[(1) - (2)].data).str)); + } + break; + + case 155: + +/* Line 1455 of yacc.c */ +#line 615 "zparser.y" + { + /* convert a single dname record */ + zadd_rdata_domain((yyvsp[(1) - (2)].domain)); + } + break; + + case 156: + +/* Line 1455 of yacc.c */ +#line 622 "zparser.y" + { + /* convert the soa data */ + zadd_rdata_domain((yyvsp[(1) - (14)].domain)); /* prim. ns */ + zadd_rdata_domain((yyvsp[(3) - (14)].domain)); /* email */ + zadd_rdata_wireformat(zparser_conv_serial(parser->region, (yyvsp[(5) - (14)].data).str)); /* serial */ + zadd_rdata_wireformat(zparser_conv_period(parser->region, (yyvsp[(7) - (14)].data).str)); /* refresh */ + zadd_rdata_wireformat(zparser_conv_period(parser->region, (yyvsp[(9) - (14)].data).str)); /* retry */ + zadd_rdata_wireformat(zparser_conv_period(parser->region, (yyvsp[(11) - (14)].data).str)); /* expire */ + zadd_rdata_wireformat(zparser_conv_period(parser->region, (yyvsp[(13) - (14)].data).str)); /* minimum */ + } + break; + + case 157: + +/* Line 1455 of yacc.c */ +#line 635 "zparser.y" + { + zadd_rdata_wireformat(zparser_conv_a(parser->region, (yyvsp[(1) - (6)].data).str)); /* address */ + zadd_rdata_wireformat(zparser_conv_services(parser->region, (yyvsp[(3) - (6)].data).str, (yyvsp[(5) - (6)].data).str)); /* protocol and services */ + } + break; + + case 158: + +/* Line 1455 of yacc.c */ +#line 642 "zparser.y" + { + zadd_rdata_wireformat(zparser_conv_text(parser->region, (yyvsp[(1) - (4)].data).str, (yyvsp[(1) - (4)].data).len)); /* CPU */ + zadd_rdata_wireformat(zparser_conv_text(parser->region, (yyvsp[(3) - (4)].data).str, (yyvsp[(3) - (4)].data).len)); /* OS*/ + } + break; + + case 159: + +/* Line 1455 of yacc.c */ +#line 649 "zparser.y" + { + /* convert a single dname record */ + zadd_rdata_domain((yyvsp[(1) - (4)].domain)); + zadd_rdata_domain((yyvsp[(3) - (4)].domain)); + } + break; + + case 160: + +/* Line 1455 of yacc.c */ +#line 657 "zparser.y" + { + zadd_rdata_wireformat(zparser_conv_short(parser->region, (yyvsp[(1) - (4)].data).str)); /* priority */ + zadd_rdata_domain((yyvsp[(3) - (4)].domain)); /* MX host */ + } + break; + + case 162: + +/* Line 1455 of yacc.c */ +#line 668 "zparser.y" + { + zadd_rdata_domain((yyvsp[(1) - (4)].domain)); /* mbox d-name */ + zadd_rdata_domain((yyvsp[(3) - (4)].domain)); /* txt d-name */ + } + break; + + case 163: + +/* Line 1455 of yacc.c */ +#line 676 "zparser.y" + { + zadd_rdata_wireformat(zparser_conv_short(parser->region, (yyvsp[(1) - (4)].data).str)); /* subtype */ + zadd_rdata_domain((yyvsp[(3) - (4)].domain)); /* domain name */ + } + break; + + case 164: + +/* Line 1455 of yacc.c */ +#line 684 "zparser.y" + { + zadd_rdata_wireformat(zparser_conv_text(parser->region, (yyvsp[(1) - (2)].data).str, (yyvsp[(1) - (2)].data).len)); /* X.25 address. */ + } + break; + + case 165: + +/* Line 1455 of yacc.c */ +#line 691 "zparser.y" + { + zadd_rdata_wireformat(zparser_conv_text(parser->region, (yyvsp[(1) - (2)].data).str, (yyvsp[(1) - (2)].data).len)); /* address */ + } + break; + + case 166: + +/* Line 1455 of yacc.c */ +#line 695 "zparser.y" + { + zadd_rdata_wireformat(zparser_conv_text(parser->region, (yyvsp[(1) - (4)].data).str, (yyvsp[(1) - (4)].data).len)); /* address */ + zadd_rdata_wireformat(zparser_conv_text(parser->region, (yyvsp[(3) - (4)].data).str, (yyvsp[(3) - (4)].data).len)); /* sub-address */ + } + break; + + case 167: + +/* Line 1455 of yacc.c */ +#line 703 "zparser.y" + { + zadd_rdata_wireformat(zparser_conv_short(parser->region, (yyvsp[(1) - (4)].data).str)); /* preference */ + zadd_rdata_domain((yyvsp[(3) - (4)].domain)); /* intermediate host */ + } + break; + + case 168: + +/* Line 1455 of yacc.c */ +#line 711 "zparser.y" + { + /* String must start with "0x" or "0X". */ + if (strncasecmp((yyvsp[(1) - (2)].data).str, "0x", 2) != 0) { + zc_error_prev_line("NSAP rdata must start with '0x'"); + } else { + zadd_rdata_wireformat(zparser_conv_hex(parser->region, (yyvsp[(1) - (2)].data).str + 2, (yyvsp[(1) - (2)].data).len - 2)); /* NSAP */ + } + } + break; + + case 169: + +/* Line 1455 of yacc.c */ +#line 723 "zparser.y" + { + zadd_rdata_wireformat(zparser_conv_short(parser->region, (yyvsp[(1) - (6)].data).str)); /* preference */ + zadd_rdata_domain((yyvsp[(3) - (6)].domain)); /* MAP822 */ + zadd_rdata_domain((yyvsp[(5) - (6)].domain)); /* MAPX400 */ + } + break; + + case 170: + +/* Line 1455 of yacc.c */ +#line 731 "zparser.y" + { + zadd_rdata_wireformat(zparser_conv_aaaa(parser->region, (yyvsp[(1) - (2)].data).str)); /* IPv6 address */ + } + break; + + case 171: + +/* Line 1455 of yacc.c */ +#line 737 "zparser.y" + { + zadd_rdata_wireformat(zparser_conv_loc(parser->region, (yyvsp[(1) - (2)].data).str)); /* Location */ + } + break; + + case 172: + +/* Line 1455 of yacc.c */ +#line 743 "zparser.y" + { + zadd_rdata_domain((yyvsp[(1) - (4)].domain)); /* nxt name */ + zadd_rdata_wireformat(zparser_conv_nxt(parser->region, nxtbits)); /* nxt bitlist */ + memset(nxtbits, 0, sizeof(nxtbits)); + } + break; + + case 173: + +/* Line 1455 of yacc.c */ +#line 751 "zparser.y" + { + zadd_rdata_wireformat(zparser_conv_short(parser->region, (yyvsp[(1) - (8)].data).str)); /* prio */ + zadd_rdata_wireformat(zparser_conv_short(parser->region, (yyvsp[(3) - (8)].data).str)); /* weight */ + zadd_rdata_wireformat(zparser_conv_short(parser->region, (yyvsp[(5) - (8)].data).str)); /* port */ + zadd_rdata_domain((yyvsp[(7) - (8)].domain)); /* target name */ + } + break; + + case 174: + +/* Line 1455 of yacc.c */ +#line 761 "zparser.y" + { + zadd_rdata_wireformat(zparser_conv_short(parser->region, (yyvsp[(1) - (12)].data).str)); /* order */ + zadd_rdata_wireformat(zparser_conv_short(parser->region, (yyvsp[(3) - (12)].data).str)); /* preference */ + zadd_rdata_wireformat(zparser_conv_text(parser->region, (yyvsp[(5) - (12)].data).str, (yyvsp[(5) - (12)].data).len)); /* flags */ + zadd_rdata_wireformat(zparser_conv_text(parser->region, (yyvsp[(7) - (12)].data).str, (yyvsp[(7) - (12)].data).len)); /* service */ + zadd_rdata_wireformat(zparser_conv_text(parser->region, (yyvsp[(9) - (12)].data).str, (yyvsp[(9) - (12)].data).len)); /* regexp */ + zadd_rdata_domain((yyvsp[(11) - (12)].domain)); /* target name */ + } + break; + + case 175: + +/* Line 1455 of yacc.c */ +#line 773 "zparser.y" + { + zadd_rdata_wireformat(zparser_conv_short(parser->region, (yyvsp[(1) - (4)].data).str)); /* preference */ + zadd_rdata_domain((yyvsp[(3) - (4)].domain)); /* exchanger */ + } + break; + + case 176: + +/* Line 1455 of yacc.c */ +#line 781 "zparser.y" + { + zadd_rdata_wireformat(zparser_conv_certificate_type(parser->region, (yyvsp[(1) - (8)].data).str)); /* type */ + zadd_rdata_wireformat(zparser_conv_short(parser->region, (yyvsp[(3) - (8)].data).str)); /* key tag */ + zadd_rdata_wireformat(zparser_conv_algorithm(parser->region, (yyvsp[(5) - (8)].data).str)); /* algorithm */ + zadd_rdata_wireformat(zparser_conv_b64(parser->region, (yyvsp[(7) - (8)].data).str)); /* certificate or CRL */ + } + break; + + case 178: + +/* Line 1455 of yacc.c */ +#line 794 "zparser.y" + { + zadd_rdata_wireformat(zparser_conv_apl_rdata(parser->region, (yyvsp[(1) - (1)].data).str)); + } + break; + + case 179: + +/* Line 1455 of yacc.c */ +#line 798 "zparser.y" + { + zadd_rdata_wireformat(zparser_conv_apl_rdata(parser->region, (yyvsp[(3) - (3)].data).str)); + } + break; + + case 180: + +/* Line 1455 of yacc.c */ +#line 804 "zparser.y" + { + zadd_rdata_wireformat(zparser_conv_short(parser->region, (yyvsp[(1) - (8)].data).str)); /* keytag */ + zadd_rdata_wireformat(zparser_conv_algorithm(parser->region, (yyvsp[(3) - (8)].data).str)); /* alg */ + zadd_rdata_wireformat(zparser_conv_byte(parser->region, (yyvsp[(5) - (8)].data).str)); /* type */ + zadd_rdata_wireformat(zparser_conv_hex(parser->region, (yyvsp[(7) - (8)].data).str, (yyvsp[(7) - (8)].data).len)); /* hash */ + } + break; + + case 181: + +/* Line 1455 of yacc.c */ +#line 813 "zparser.y" + { + zadd_rdata_wireformat(zparser_conv_short(parser->region, (yyvsp[(1) - (8)].data).str)); /* keytag */ + zadd_rdata_wireformat(zparser_conv_algorithm(parser->region, (yyvsp[(3) - (8)].data).str)); /* alg */ + zadd_rdata_wireformat(zparser_conv_byte(parser->region, (yyvsp[(5) - (8)].data).str)); /* type */ + zadd_rdata_wireformat(zparser_conv_hex(parser->region, (yyvsp[(7) - (8)].data).str, (yyvsp[(7) - (8)].data).len)); /* hash */ + } + break; + + case 182: + +/* Line 1455 of yacc.c */ +#line 822 "zparser.y" + { + zadd_rdata_wireformat(zparser_conv_byte(parser->region, (yyvsp[(1) - (6)].data).str)); /* alg */ + zadd_rdata_wireformat(zparser_conv_byte(parser->region, (yyvsp[(3) - (6)].data).str)); /* fp type */ + zadd_rdata_wireformat(zparser_conv_hex(parser->region, (yyvsp[(5) - (6)].data).str, (yyvsp[(5) - (6)].data).len)); /* hash */ + } + break; + + case 183: + +/* Line 1455 of yacc.c */ +#line 830 "zparser.y" + { + zadd_rdata_wireformat(zparser_conv_b64(parser->region, (yyvsp[(1) - (2)].data).str)); /* data blob */ + } + break; + + case 184: + +/* Line 1455 of yacc.c */ +#line 836 "zparser.y" + { + zadd_rdata_wireformat(zparser_conv_rrtype(parser->region, (yyvsp[(1) - (18)].data).str)); /* rr covered */ + zadd_rdata_wireformat(zparser_conv_algorithm(parser->region, (yyvsp[(3) - (18)].data).str)); /* alg */ + zadd_rdata_wireformat(zparser_conv_byte(parser->region, (yyvsp[(5) - (18)].data).str)); /* # labels */ + zadd_rdata_wireformat(zparser_conv_period(parser->region, (yyvsp[(7) - (18)].data).str)); /* # orig TTL */ + zadd_rdata_wireformat(zparser_conv_time(parser->region, (yyvsp[(9) - (18)].data).str)); /* sig exp */ + zadd_rdata_wireformat(zparser_conv_time(parser->region, (yyvsp[(11) - (18)].data).str)); /* sig inc */ + zadd_rdata_wireformat(zparser_conv_short(parser->region, (yyvsp[(13) - (18)].data).str)); /* key id */ + zadd_rdata_wireformat(zparser_conv_dns_name(parser->region, + (const uint8_t*) (yyvsp[(15) - (18)].data).str,(yyvsp[(15) - (18)].data).len)); /* sig name */ + zadd_rdata_wireformat(zparser_conv_b64(parser->region, (yyvsp[(17) - (18)].data).str)); /* sig data */ + } + break; + + case 185: + +/* Line 1455 of yacc.c */ +#line 851 "zparser.y" + { + zadd_rdata_wireformat(zparser_conv_dns_name(parser->region, + (const uint8_t*) (yyvsp[(1) - (2)].data).str, (yyvsp[(1) - (2)].data).len)); /* nsec name */ + zadd_rdata_wireformat(zparser_conv_nsec(parser->region, nsecbits)); /* nsec bitlist */ + memset(nsecbits, 0, sizeof(nsecbits)); + nsec_highest_rcode = 0; + } + break; + + case 186: + +/* Line 1455 of yacc.c */ +#line 861 "zparser.y" + { +#ifdef NSEC3 + nsec3_add_params((yyvsp[(1) - (10)].data).str, (yyvsp[(3) - (10)].data).str, (yyvsp[(5) - (10)].data).str, (yyvsp[(7) - (10)].data).str, (yyvsp[(7) - (10)].data).len); + + zadd_rdata_wireformat(zparser_conv_b32(parser->region, (yyvsp[(9) - (10)].data).str)); /* next hashed name */ + zadd_rdata_wireformat(zparser_conv_nsec(parser->region, nsecbits)); /* nsec bitlist */ + memset(nsecbits, 0, sizeof(nsecbits)); + nsec_highest_rcode = 0; +#else + zc_error_prev_line("nsec3 not supported"); +#endif /* NSEC3 */ + } + break; + + case 187: + +/* Line 1455 of yacc.c */ +#line 876 "zparser.y" + { +#ifdef NSEC3 + nsec3_add_params((yyvsp[(1) - (8)].data).str, (yyvsp[(3) - (8)].data).str, (yyvsp[(5) - (8)].data).str, (yyvsp[(7) - (8)].data).str, (yyvsp[(7) - (8)].data).len); +#else + zc_error_prev_line("nsec3 not supported"); +#endif /* NSEC3 */ + } + break; + + case 188: + +/* Line 1455 of yacc.c */ +#line 886 "zparser.y" + { + zadd_rdata_wireformat(zparser_conv_short(parser->region, (yyvsp[(1) - (8)].data).str)); /* flags */ + zadd_rdata_wireformat(zparser_conv_byte(parser->region, (yyvsp[(3) - (8)].data).str)); /* proto */ + zadd_rdata_wireformat(zparser_conv_algorithm(parser->region, (yyvsp[(5) - (8)].data).str)); /* alg */ + zadd_rdata_wireformat(zparser_conv_b64(parser->region, (yyvsp[(7) - (8)].data).str)); /* hash */ + } + break; + + case 189: + +/* Line 1455 of yacc.c */ +#line 895 "zparser.y" + { + const dname_type* name = 0; + zadd_rdata_wireformat(zparser_conv_byte(parser->region, (yyvsp[(1) - (7)].data).str)); /* precedence */ + zadd_rdata_wireformat(zparser_conv_byte(parser->region, (yyvsp[(3) - (7)].data).str)); /* gateway type */ + zadd_rdata_wireformat(zparser_conv_byte(parser->region, (yyvsp[(5) - (7)].data).str)); /* algorithm */ + switch(atoi((yyvsp[(3) - (7)].data).str)) { + case IPSECKEY_NOGATEWAY: + zadd_rdata_wireformat(alloc_rdata_init(parser->region, "", 0)); + break; + case IPSECKEY_IP4: + zadd_rdata_wireformat(zparser_conv_a(parser->region, (yyvsp[(7) - (7)].data).str)); + break; + case IPSECKEY_IP6: + zadd_rdata_wireformat(zparser_conv_aaaa(parser->region, (yyvsp[(7) - (7)].data).str)); + break; + case IPSECKEY_DNAME: + /* convert and insert the dname */ + if(strlen((yyvsp[(7) - (7)].data).str) == 0) + zc_error_prev_line("IPSECKEY must specify gateway name"); + if(!(name = dname_parse(parser->region, (yyvsp[(7) - (7)].data).str))) + zc_error_prev_line("IPSECKEY bad gateway dname %s", (yyvsp[(7) - (7)].data).str); + if((yyvsp[(7) - (7)].data).str[strlen((yyvsp[(7) - (7)].data).str)-1] != '.') + name = dname_concatenate(parser->rr_region, name, + domain_dname(parser->origin)); + zadd_rdata_wireformat(alloc_rdata_init(parser->region, + dname_name(name), name->name_size)); + break; + default: + zc_error_prev_line("unknown IPSECKEY gateway type"); + } + } + break; + + case 190: + +/* Line 1455 of yacc.c */ +#line 929 "zparser.y" + { + zadd_rdata_wireformat(zparser_conv_b64(parser->region, (yyvsp[(3) - (4)].data).str)); /* public key */ + } + break; + + case 192: + +/* Line 1455 of yacc.c */ +#line 936 "zparser.y" + { + /* $2 is the number of octects, currently ignored */ + (yyval.unknown) = zparser_conv_hex(parser->region, (yyvsp[(5) - (6)].data).str, (yyvsp[(5) - (6)].data).len); + + } + break; + + case 193: + +/* Line 1455 of yacc.c */ +#line 942 "zparser.y" + { + (yyval.unknown) = zparser_conv_hex(parser->region, "", 0); + } + break; + + case 194: + +/* Line 1455 of yacc.c */ +#line 946 "zparser.y" + { + (yyval.unknown) = zparser_conv_hex(parser->region, "", 0); + } + break; + + + +/* Line 1455 of yacc.c */ +#line 3331 "zparser.c" + default: break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (yymsg); + } + else + { + yyerror (YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } + } +#endif + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + *++yyvsp = yylval; + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined(yyoverflow) || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); +} + + + +/* Line 1675 of yacc.c */ +#line 950 "zparser.y" + + +int +yywrap(void) +{ + return 1; +} + +/* + * Create the parser. + */ +zparser_type * +zparser_create(region_type *region, region_type *rr_region, namedb_type *db) +{ + zparser_type *result; + + result = (zparser_type *) region_alloc(region, sizeof(zparser_type)); + result->region = region; + result->rr_region = rr_region; + result->db = db; + + result->filename = NULL; + result->current_zone = NULL; + result->origin = NULL; + result->prev_dname = NULL; + result->default_apex = NULL; + + result->temporary_rdatas = (rdata_atom_type *) region_alloc( + result->region, MAXRDATALEN * sizeof(rdata_atom_type)); + + return result; +} + +/* + * Initialize the parser for a new zone file. + */ +void +zparser_init(const char *filename, uint32_t ttl, uint16_t klass, + const dname_type *origin) +{ + memset(nxtbits, 0, sizeof(nxtbits)); + memset(nsecbits, 0, sizeof(nsecbits)); + nsec_highest_rcode = 0; + + parser->default_ttl = ttl; + parser->default_class = klass; + parser->current_zone = NULL; + parser->origin = domain_table_insert(parser->db->domains, origin); + parser->prev_dname = parser->origin; + parser->default_apex = parser->origin; + parser->error_occurred = 0; + parser->errors = 0; + parser->line = 1; + parser->filename = filename; + parser->current_rr.rdata_count = 0; + parser->current_rr.rdatas = parser->temporary_rdatas; +} + +void +yyerror(const char *message) +{ + zc_error("%s", message); +} + +static void +error_va_list(unsigned line, const char *fmt, va_list args) +{ + if (parser->filename) { + fprintf(stderr, "%s:%u: ", parser->filename, line); + } + fprintf(stderr, "error: "); + vfprintf(stderr, fmt, args); + fprintf(stderr, "\n"); + + ++parser->errors; + parser->error_occurred = 1; +} + +/* the line counting sux, to say the least + * with this grose hack we try do give sane + * numbers back */ +void +zc_error_prev_line(const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + error_va_list(parser->line - 1, fmt, args); + va_end(args); +} + +void +zc_error(const char *fmt, ...) +{ + /* send an error message to stderr */ + va_list args; + va_start(args, fmt); + error_va_list(parser->line, fmt, args); + va_end(args); +} + +static void +warning_va_list(unsigned line, const char *fmt, va_list args) +{ + if (parser->filename) { + fprintf(stderr, "%s:%u: ", parser->filename, line); + } + fprintf(stderr, "warning: "); + vfprintf(stderr, fmt, args); + fprintf(stderr, "\n"); +} + +void +zc_warning_prev_line(const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + warning_va_list(parser->line - 1, fmt, args); + va_end(args); +} + +void +zc_warning(const char *fmt, ... ) +{ + va_list args; + va_start(args, fmt); + warning_va_list(parser->line, fmt, args); + va_end(args); +} + +#ifdef NSEC3 +static void +nsec3_add_params(const char* hashalgo_str, const char* flag_str, + const char* iter_str, const char* salt_str, int salt_len) +{ + zadd_rdata_wireformat(zparser_conv_byte(parser->region, hashalgo_str)); + zadd_rdata_wireformat(zparser_conv_byte(parser->region, flag_str)); + zadd_rdata_wireformat(zparser_conv_short(parser->region, iter_str)); + + /* salt */ + if(strcmp(salt_str, "-") != 0) + zadd_rdata_wireformat(zparser_conv_hex_length(parser->region, + salt_str, salt_len)); + else + zadd_rdata_wireformat(alloc_rdata_init(parser->region, "", 1)); +} +#endif /* NSEC3 */ + diff --git a/usr.sbin/nsd/zparser.h b/usr.sbin/nsd/zparser.h new file mode 100644 index 00000000000..79d8cb784e5 --- /dev/null +++ b/usr.sbin/nsd/zparser.h @@ -0,0 +1,224 @@ + +/* A Bison parser, made by GNU Bison 2.4.1. */ + +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + T_A = 258, + T_NS = 259, + T_MX = 260, + T_TXT = 261, + T_CNAME = 262, + T_AAAA = 263, + T_PTR = 264, + T_NXT = 265, + T_KEY = 266, + T_SOA = 267, + T_SIG = 268, + T_SRV = 269, + T_CERT = 270, + T_LOC = 271, + T_MD = 272, + T_MF = 273, + T_MB = 274, + T_MG = 275, + T_MR = 276, + T_NULL = 277, + T_WKS = 278, + T_HINFO = 279, + T_MINFO = 280, + T_RP = 281, + T_AFSDB = 282, + T_X25 = 283, + T_ISDN = 284, + T_RT = 285, + T_NSAP = 286, + T_NSAP_PTR = 287, + T_PX = 288, + T_GPOS = 289, + T_EID = 290, + T_NIMLOC = 291, + T_ATMA = 292, + T_NAPTR = 293, + T_KX = 294, + T_A6 = 295, + T_DNAME = 296, + T_SINK = 297, + T_OPT = 298, + T_APL = 299, + T_UINFO = 300, + T_UID = 301, + T_GID = 302, + T_UNSPEC = 303, + T_TKEY = 304, + T_TSIG = 305, + T_IXFR = 306, + T_AXFR = 307, + T_MAILB = 308, + T_MAILA = 309, + T_DS = 310, + T_DLV = 311, + T_SSHFP = 312, + T_RRSIG = 313, + T_NSEC = 314, + T_DNSKEY = 315, + T_SPF = 316, + T_NSEC3 = 317, + T_IPSECKEY = 318, + T_DHCID = 319, + T_NSEC3PARAM = 320, + DOLLAR_TTL = 321, + DOLLAR_ORIGIN = 322, + NL = 323, + SP = 324, + STR = 325, + PREV = 326, + BITLAB = 327, + T_TTL = 328, + T_RRCLASS = 329, + URR = 330, + T_UTYPE = 331 + }; +#endif +/* Tokens. */ +#define T_A 258 +#define T_NS 259 +#define T_MX 260 +#define T_TXT 261 +#define T_CNAME 262 +#define T_AAAA 263 +#define T_PTR 264 +#define T_NXT 265 +#define T_KEY 266 +#define T_SOA 267 +#define T_SIG 268 +#define T_SRV 269 +#define T_CERT 270 +#define T_LOC 271 +#define T_MD 272 +#define T_MF 273 +#define T_MB 274 +#define T_MG 275 +#define T_MR 276 +#define T_NULL 277 +#define T_WKS 278 +#define T_HINFO 279 +#define T_MINFO 280 +#define T_RP 281 +#define T_AFSDB 282 +#define T_X25 283 +#define T_ISDN 284 +#define T_RT 285 +#define T_NSAP 286 +#define T_NSAP_PTR 287 +#define T_PX 288 +#define T_GPOS 289 +#define T_EID 290 +#define T_NIMLOC 291 +#define T_ATMA 292 +#define T_NAPTR 293 +#define T_KX 294 +#define T_A6 295 +#define T_DNAME 296 +#define T_SINK 297 +#define T_OPT 298 +#define T_APL 299 +#define T_UINFO 300 +#define T_UID 301 +#define T_GID 302 +#define T_UNSPEC 303 +#define T_TKEY 304 +#define T_TSIG 305 +#define T_IXFR 306 +#define T_AXFR 307 +#define T_MAILB 308 +#define T_MAILA 309 +#define T_DS 310 +#define T_DLV 311 +#define T_SSHFP 312 +#define T_RRSIG 313 +#define T_NSEC 314 +#define T_DNSKEY 315 +#define T_SPF 316 +#define T_NSEC3 317 +#define T_IPSECKEY 318 +#define T_DHCID 319 +#define T_NSEC3PARAM 320 +#define DOLLAR_TTL 321 +#define DOLLAR_ORIGIN 322 +#define NL 323 +#define SP 324 +#define STR 325 +#define PREV 326 +#define BITLAB 327 +#define T_TTL 328 +#define T_RRCLASS 329 +#define URR 330 +#define T_UTYPE 331 + + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +{ + +/* Line 1676 of yacc.c */ +#line 50 "zparser.y" + + domain_type *domain; + const dname_type *dname; + struct lex_data data; + uint32_t ttl; + uint16_t klass; + uint16_t type; + uint16_t *unknown; + + + +/* Line 1676 of yacc.c */ +#line 216 "zparser.h" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +#endif + +extern YYSTYPE yylval; + + |