diff options
35 files changed, 939 insertions, 767 deletions
@@ -1,5 +1,15 @@ Knot DNS NEWS +v1.4.3 - Feb 13, 2014 +--------------------- +Bugfixes: + * Failure when expanding wildcard leading to apex and having DNSKEY records + * Failure for query to wildcard without wildcard expansion + * Bad cleanup when loading a faulty entry from a journal + * Zone file $ORIGIN and configuration comparison is case-insensitive +Features: + * Config "include" statement supports directory and includes all files within + v1.4.2 - Jan 27, 2014 --------------------- Bugfixes: @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for knot 1.4.2. +# Generated by GNU Autoconf 2.69 for knot 1.4.3. # # Report bugs to <knot-dns@labs.nic.cz>. # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='knot' PACKAGE_TARNAME='knot' -PACKAGE_VERSION='1.4.2' -PACKAGE_STRING='knot 1.4.2' +PACKAGE_VERSION='1.4.3' +PACKAGE_STRING='knot 1.4.3' PACKAGE_BUGREPORT='knot-dns@labs.nic.cz' PACKAGE_URL='' @@ -1359,7 +1359,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures knot 1.4.2 to adapt to many kinds of systems. +\`configure' configures knot 1.4.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1429,7 +1429,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of knot 1.4.2:";; + short | recursive ) echo "Configuration of knot 1.4.3:";; esac cat <<\_ACEOF @@ -1575,7 +1575,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -knot configure 1.4.2 +knot configure 1.4.3 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1998,7 +1998,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by knot $as_me 1.4.2, which was +It was created by knot $as_me 1.4.3, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2821,7 +2821,7 @@ fi # Define the identity of the package. PACKAGE='knot' - VERSION='1.4.2' + VERSION='1.4.3' cat >>confdefs.h <<_ACEOF @@ -14674,7 +14674,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by knot $as_me 1.4.2, which was +This file was extended by knot $as_me 1.4.3, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14740,7 +14740,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -knot config.status 1.4.2 +knot config.status 1.4.3 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index b81d7c6..bcae47a 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ # -*- Autoconf -*- AC_PREREQ([2.60]) -AC_INIT([knot], [1.4.2], [knot-dns@labs.nic.cz]) +AC_INIT([knot], [1.4.3], [knot-dns@labs.nic.cz]) AM_INIT_AUTOMAKE([gnits subdir-objects dist-xz -Wall -Werror]) AM_SILENT_RULES([yes]) AC_CONFIG_SRCDIR([src/knot/main.c]) diff --git a/doc/installation.texi b/doc/installation.texi index e89db1d..68f0a73 100644 --- a/doc/installation.texi +++ b/doc/installation.texi @@ -37,7 +37,7 @@ Knot DNS requires few libraries to be compiled: @itemize @item -OpenSSL, at least 0.9.8 +OpenSSL, at least 1.0.0 @item zlib @item diff --git a/doc/knot.info b/doc/knot.info index 483eb00..1618a81 100644 --- a/doc/knot.info +++ b/doc/knot.info @@ -1,6 +1,6 @@ This is knot.info, produced by makeinfo version 4.13 from knot.texi. -This manual is for Knot DNS (version 1.4.2, 6 January 2014), which is a +This manual is for Knot DNS (version 1.4.3, 6 January 2014), which is a high-performance authoritative-only DNS server. Copyright (C) 2012 CZ.NIC, z.s.p.o. @@ -30,7 +30,7 @@ File: knot.info, Node: Top, Next: Introduction, Prev: (dir), Up: (dir) Knot DNS ******** -This manual is for Knot DNS (version 1.4.2, 6 January 2014). +This manual is for Knot DNS (version 1.4.3, 6 January 2014). * Menu: @@ -399,7 +399,7 @@ File: knot.info, Node: Required libraries, Next: Installation from the sources Knot DNS requires few libraries to be compiled: - * OpenSSL, at least 0.9.8 + * OpenSSL, at least 1.0.0 * zlib @@ -1725,8 +1725,8 @@ A.1.3 system Example -------------------- system { - identity "Knot DNS 1.4.2"; - version "1.4.2"; + identity "Knot DNS 1.4.3"; + version "1.4.3"; nsid "amaterasu"; rundir "/var/run/knot"; workers 16; @@ -2720,8 +2720,8 @@ A.9 `include' Statement ======================= The `include' statement is a special statement which can be used almost -anywhere on any level in the configuration file. It makes inclusion of -another file possible. +anywhere on any level in the configuration file. It allows inclusion of +another file or all files in the given directory. The path of the included file can be either absolute or relative to a configuration file currently being processed. @@ -2738,6 +2738,7 @@ A.9.1 Syntax ------------ `include' "filename"`;' + `include' "dirname"`;' File: knot.info, Node: include Examples, Prev: include Syntax, Up: include @@ -2755,6 +2756,8 @@ A.9.2 Examples include "remotes.conf"; } + include "zones"; + File: knot.info, Node: Migration from other DNS servers, Prev: Knot DNS Configuration Reference, Up: Top @@ -2946,10 +2949,10 @@ Node: severity83815 Node: log_file84557 Node: log Example84812 Node: include85195 -Node: include Syntax85664 -Node: include Examples85802 -Node: Migration from other DNS servers86069 -Node: Knot DNS for BIND users86307 +Node: include Syntax85692 +Node: include Examples85858 +Node: Migration from other DNS servers86148 +Node: Knot DNS for BIND users86386 End Tag Table diff --git a/doc/reference.texi b/doc/reference.texi index 9adb4d1..85ef717 100644 --- a/doc/reference.texi +++ b/doc/reference.texi @@ -1132,8 +1132,8 @@ log @{ @stindex include The @code{include} statement is a special statement which can be used almost -anywhere on any level in the configuration file. It makes inclusion of another -file possible. +anywhere on any level in the configuration file. It allows inclusion of another +file or all files in the given directory. The path of the included file can be either absolute or relative to a configuration file currently being processed. @@ -1148,6 +1148,7 @@ configuration file currently being processed. @example @code{include} "filename"@code{;} +@code{include} "dirname"@code{;} @end example @node include Examples @@ -1163,4 +1164,6 @@ remotes @{ @} include "remotes.conf"; @} + +include "zones"; @end example diff --git a/doc/stamp-vti b/doc/stamp-vti index 2c0b32d..876ad8f 100644 --- a/doc/stamp-vti +++ b/doc/stamp-vti @@ -1,4 +1,4 @@ @set UPDATED 6 January 2014 @set UPDATED-MONTH January 2014 -@set EDITION 1.4.2 -@set VERSION 1.4.2 +@set EDITION 1.4.3 +@set VERSION 1.4.3 diff --git a/doc/version.texi b/doc/version.texi index 2c0b32d..876ad8f 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -1,4 +1,4 @@ @set UPDATED 6 January 2014 @set UPDATED-MONTH January 2014 -@set EDITION 1.4.2 -@set VERSION 1.4.2 +@set EDITION 1.4.3 +@set VERSION 1.4.3 @@ -1,4 +1,4 @@ -.TH "kdig" "1" "27 January 2014" "CZ.NIC Labs" "Knot DNS, version 1.4.2" +.TH "kdig" "1" "18 February 2014" "CZ.NIC Labs" "Knot DNS, version 1.4.3" .SH NAME .TP 5 .B kdig diff --git a/man/khost.1 b/man/khost.1 index cf65c74..aa9928a 100644 --- a/man/khost.1 +++ b/man/khost.1 @@ -1,4 +1,4 @@ -.TH "khost" "1" "27 January 2014" "CZ.NIC Labs" "Knot DNS, version 1.4.2" +.TH "khost" "1" "18 February 2014" "CZ.NIC Labs" "Knot DNS, version 1.4.3" .SH NAME .TP 6 .B khost diff --git a/man/knot.conf.5 b/man/knot.conf.5 index 88aea0c..6093872 100644 --- a/man/knot.conf.5 +++ b/man/knot.conf.5 @@ -1,4 +1,4 @@ -.TH "knot.conf" "5" "27 January 2014" "CZ.NIC Labs" "Knot DNS, version 1.4.2" +.TH "knot.conf" "5" "18 February 2014" "CZ.NIC Labs" "Knot DNS, version 1.4.3" .SH "NAME" .LP .B knot.conf diff --git a/man/knotc.8 b/man/knotc.8 index 51e9c29..3b4bda8 100644 --- a/man/knotc.8 +++ b/man/knotc.8 @@ -1,4 +1,4 @@ -.TH knotc "8" "27 January 2014" "CZ.NIC Labs" "Knot DNS, version 1.4.2" +.TH knotc "8" "18 February 2014" "CZ.NIC Labs" "Knot DNS, version 1.4.3" .SH NAME .B knotc \- Knot DNS control utility diff --git a/man/knotd.8 b/man/knotd.8 index a550bae..85448e8 100644 --- a/man/knotd.8 +++ b/man/knotd.8 @@ -1,4 +1,4 @@ -.TH "knotd" "8" "27 January 2014" "CZ.NIC Labs" "Knot DNS, version 1.4.2" +.TH "knotd" "8" "18 February 2014" "CZ.NIC Labs" "Knot DNS, version 1.4.3" .SH NAME .B knotd \- Knot DNS server daemon diff --git a/man/knsec3hash.1 b/man/knsec3hash.1 index 93db9b8..512ef0e 100644 --- a/man/knsec3hash.1 +++ b/man/knsec3hash.1 @@ -1,4 +1,4 @@ -.TH "knsec3hash" "1" "June 2013" "CZ.NIC Labs" "Knot DNS, version 1.4.2" +.TH "knsec3hash" "1" "June 2013" "CZ.NIC Labs" "Knot DNS, version 1.4.3" .SH NAME .B knsec3hash \- Simple utility to compute NSEC3 hash (libknot equivalent of ISC nsec3hash) diff --git a/man/knsupdate.1 b/man/knsupdate.1 index 4bff6f3..0ebb277 100644 --- a/man/knsupdate.1 +++ b/man/knsupdate.1 @@ -1,4 +1,4 @@ -.TH "knsupdate" "1" "27 January 2014" "CZ.NIC Labs" "Knot DNS, version 1.4.2" +.TH "knsupdate" "1" "18 February 2014" "CZ.NIC Labs" "Knot DNS, version 1.4.3" .SH NAME .TP 10 .B knsupdate diff --git a/src/knot/conf/cf-lex.l b/src/knot/conf/cf-lex.l index 7b35dc4..31cafe4 100644 --- a/src/knot/conf/cf-lex.l +++ b/src/knot/conf/cf-lex.l @@ -25,10 +25,13 @@ %{ #include <config.h> +#include <dirent.h> #include <errno.h> #include <stdlib.h> #include <stdarg.h> #include <stdbool.h> +#include <sys/stat.h> +#include <sys/types.h> #include "common/sockaddr.h" #include "knot/conf/conf.h" @@ -313,11 +316,7 @@ hmac-sha512 { lval.alg = KNOT_TSIG_ALG_HMAC_SHA512; return TSIG_ALGO_NAME; } : /* Optional : in assignments. */; <<EOF>> { - conf_include_t *inc = conf_includes_pop(yyextra->includes); - free(inc->filename); - if (inc->handle) { - fclose(inc->handle); - } + conf_includes_remove(yyextra->includes); yypop_buffer_state(yyscanner); @@ -345,7 +344,7 @@ hmac-sha512 { lval.alg = KNOT_TSIG_ALG_HMAC_SHA512; return TSIG_ALGO_NAME; } yytext[yyleng] = '\0'; if (!conf_includes_push(yyextra->includes, yytext)) { - cf_error(yyscanner, "includes nested too deeply"); + cf_error(yyscanner, "include loop"); return END; } @@ -355,16 +354,84 @@ hmac-sha512 { lval.alg = KNOT_TSIG_ALG_HMAC_SHA512; return TSIG_ALGO_NAME; } FILE *included = fopen(inc->filename, "r"); if (!included) { cf_error(yyscanner, "cannot open file '%s'", inc->filename); - conf_includes_pop(yyextra->includes); - free(inc->filename); + conf_includes_remove(yyextra->includes); return END; } - inc->handle = included; - YY_BUFFER_STATE bs = yy_create_buffer(included, YY_BUF_SIZE, yyscanner); - yypush_buffer_state(bs, yyscanner); -} + struct stat file_stat; + if (fstat(fileno(included), &file_stat) == -1) { + cf_error(yyscanner, "cannot stat file '%s'", yytext); + conf_includes_remove(yyextra->includes); + return END; + } + + if (S_ISDIR(file_stat.st_mode)) { + // Store dirname statically to reduce deallocation. + char dirname[256] = { 0 }; + int ret = snprintf(dirname, sizeof(dirname), "%s", + inc->filename); + if (ret <= 0 || ret >= sizeof(dirname)) { + cf_error(yyscanner, "dir name is too long '%s'", + inc->filename); + return END; + } + + // Remove include directory from the stack. + conf_includes_remove(yyextra->includes); + + DIR *dp = opendir(dirname); + if (dp == NULL) { + cf_error(yyscanner, "cannot open directory '%s'", + dirname); + return END; + } + + struct dirent *ep; + while ((ep = readdir(dp)) != NULL) { + // Skip names with leading dot. + if (*ep->d_name == '.') { + continue; + } + + char infile[256] = { 0 }; + int ret = snprintf(infile, sizeof(infile), "%s/%s", + dirname, ep->d_name); + if (ret <= 0 || ret >= sizeof(infile)) { + cf_error(yyscanner, "cannot open file '%s/%s'", + dirname, ep->d_name); + return END; + } + + if (!conf_includes_push(yyextra->includes, infile)) { + cf_error(yyscanner, "include loop"); + return END; + } + + // retrieved relative to previous config + conf_include_t *inc = conf_includes_top(yyextra->includes); + + FILE *included = fopen(inc->filename, "r"); + if (!included) { + cf_error(yyscanner, "cannot open file '%s'", + inc->filename); + conf_includes_remove(yyextra->includes); + return END; + } + inc->handle = included; + + YY_BUFFER_STATE bs = yy_create_buffer(included, + YY_BUF_SIZE, + yyscanner); + yypush_buffer_state(bs, yyscanner); + } + (void)closedir(dp); + } else { + YY_BUFFER_STATE bs = yy_create_buffer(included, YY_BUF_SIZE, + yyscanner); + yypush_buffer_state(bs, yyscanner); + } +} <include>["][^"\n]*\n cf_error(yyscanner, "Unterminated string."); %% diff --git a/src/knot/conf/cf-parse.y b/src/knot/conf/cf-parse.y index 79b8b88..d336dc0 100644 --- a/src/knot/conf/cf-parse.y +++ b/src/knot/conf/cf-parse.y @@ -23,6 +23,7 @@ %{ #include <config.h> +#include <ctype.h> #include <limits.h> #include <stdio.h> #include <string.h> @@ -346,6 +347,11 @@ static void conf_zone_start(void *scanner, char *name) { this_zone->name = name; /* Already FQDN */ } + // Convert zone name to lower-case. + for (size_t i = 0; this_zone->name[i]; i++) { + this_zone->name[i] = tolower(this_zone->name[i]); + } + // DNSSEC configuration this_zone->dnssec_enable = -1; diff --git a/src/knot/conf/conf.c b/src/knot/conf/conf.c index 8e0c0b2..5c881ab 100644 --- a/src/knot/conf/conf.c +++ b/src/knot/conf/conf.c @@ -40,9 +40,8 @@ static const char *DEFAULT_CONFIG[] = { CONFIG_DIR "/" "knot.conf", }; -#define DEFAULT_CONF_COUNT 1 /*!< \brief Number of default config paths. */ -#define ERROR_BUFFER_SIZE 512 /*!< \brief Error buffer size. */ -#define INCLUDES_MAX_DEPTH 8 /*!< \brief Max depth of config inclusion. */ +#define DEFAULT_CONF_COUNT 1 /*!< \brief Number of default config paths. */ +#define ERROR_BUFFER_SIZE 512 /*!< \brief Error buffer size. */ /* * Utilities. @@ -543,7 +542,7 @@ static int conf_fparser(conf_t *conf) _parser_res = KNOT_EOK; new_config->filename = conf->filename; void *sc = NULL; - conf_extra_t *extra = conf_extra_init(conf->filename, INCLUDES_MAX_DEPTH); + conf_extra_t *extra = conf_extra_init(conf->filename); cf_lex_init_extra(extra, &sc); cf_set_in(f, sc); cf_parse(sc); @@ -577,7 +576,7 @@ static int conf_strparser(conf_t *conf, const char *src) char *oldfn = new_config->filename; new_config->filename = "(stdin)"; void *sc = NULL; - conf_extra_t *extra = conf_extra_init("", INCLUDES_MAX_DEPTH); + conf_extra_t *extra = conf_extra_init(""); cf_lex_init_extra(extra, &sc); switch_input(src, sc); cf_parse(sc); diff --git a/src/knot/conf/extra.c b/src/knot/conf/extra.c index 52e661a..ec138ef 100644 --- a/src/knot/conf/extra.c +++ b/src/knot/conf/extra.c @@ -26,14 +26,14 @@ /*! * \brief Init structure with custom data for config parser. */ -conf_extra_t *conf_extra_init(const char *file, int includes_max_depth) +conf_extra_t *conf_extra_init(const char *file) { conf_extra_t *extra = calloc(1, sizeof(conf_extra_t)); if (!extra) { return NULL; } - conf_includes_t *includes = conf_includes_init(includes_max_depth); + conf_includes_t *includes = conf_includes_init(); if (!includes) { free(extra); return NULL; diff --git a/src/knot/conf/extra.h b/src/knot/conf/extra.h index bfd393c..c523453 100644 --- a/src/knot/conf/extra.h +++ b/src/knot/conf/extra.h @@ -43,11 +43,10 @@ typedef struct { * \brief Init structure with custom data for config parser. * * \param file Name of the main configuration file. - * \param includes_max_depth Max depth of file inclusions. * * \return Initialized stucture or NULL. */ -conf_extra_t *conf_extra_init(const char *file, int includes_max_depth); +conf_extra_t *conf_extra_init(const char *file); /*! * \brief Free structure with custom data for config parser. diff --git a/src/knot/conf/includes.c b/src/knot/conf/includes.c index be3e38a..abb2a87 100644 --- a/src/knot/conf/includes.c +++ b/src/knot/conf/includes.c @@ -23,33 +23,38 @@ #include "knot/conf/includes.h" +#define INCLUDES_CAPACITY_BLOCK 128 // Size of included files block. + /*! * \brief Structure to store names of files included into the config. */ struct conf_includes { int free_index; //!< First free index in 'names'. int capacity; //!< Maximal capacity. - conf_include_t files[0]; //!< Stored includes. + conf_include_t *files; //!< Stored includes. }; /*! * \brief Initialize structure for storing names of included files. */ -conf_includes_t *conf_includes_init(int capacity) +conf_includes_t *conf_includes_init() { - if (capacity <= 0) { + conf_includes_t *includes = calloc(1, sizeof(conf_includes_t)); + if (!includes) { return NULL; } - size_t size = sizeof(conf_includes_t) - + (capacity * sizeof(conf_include_t *)); - conf_includes_t *result = calloc(1, size); - if (!result) { + conf_include_t *files = calloc(INCLUDES_CAPACITY_BLOCK, + sizeof(conf_include_t)); + if (!files) { + free(includes); return NULL; } - result->capacity = capacity; - return result; + includes->capacity = INCLUDES_CAPACITY_BLOCK; + includes->files = files; + + return includes; } /*! @@ -61,26 +66,13 @@ void conf_includes_free(conf_includes_t *includes) return; } - for (int i = 0; i < includes->free_index; i++) { - free(includes->files[i].filename); - } + while (conf_includes_remove(includes)); + free(includes->files); free(includes); } /** - * \brief Check if there is a capacity to insert new file.. - */ -bool conf_includes_can_push(conf_includes_t *includes) -{ - if (!includes) { - return false; - } - - return includes->free_index < includes->capacity; -} - -/** * \brief Constructs a path relative to a reference file. * * e.g. path_relative_to("b.conf", "samples/a.conf") == "samples/b.conf" @@ -120,10 +112,6 @@ bool conf_includes_push(conf_includes_t *includes, const char *filename) return false; } - if (!conf_includes_can_push(includes)) { - return false; - } - char *store = NULL; if (includes->free_index == 0 || filename[0] == '/') { @@ -133,6 +121,27 @@ bool conf_includes_push(conf_includes_t *includes, const char *filename) store = path_relative_to(filename, previous->filename); } + for (int i = 0; i < includes->free_index; i++) { + // Check for include loop. + if (strcmp(includes->files[i].filename, store) == 0) { + free(store); + return false; + } + } + + // Extend the stack if full. + if (includes->free_index >= includes->capacity) { + size_t new_size = (includes->capacity + INCLUDES_CAPACITY_BLOCK) * + sizeof(conf_include_t); + conf_include_t *new_files = realloc(includes->files, new_size); + if (new_files == NULL) { + free(store); + return false; + } + includes->capacity = new_size; + includes->files = new_files; + } + conf_include_t new_include = { .filename = store, .handle = NULL @@ -152,7 +161,7 @@ conf_include_t *conf_includes_top(conf_includes_t *includes) return NULL; } - return &includes->files[includes->free_index - 1]; + return includes->files + includes->free_index - 1; } /** @@ -167,3 +176,25 @@ conf_include_t *conf_includes_pop(conf_includes_t *includes) return result; } + +/** + * \brief Returns an include on the top of the stack and removes it. + */ +bool conf_includes_remove(conf_includes_t *includes) +{ + conf_include_t *top = conf_includes_pop(includes); + if (top) { + if (top->filename) { + free(top->filename); + top->filename = NULL; + } + if (top->handle) { + fclose(top->handle); + top->handle = NULL; + } + + return true; + } + + return false; +} diff --git a/src/knot/conf/includes.h b/src/knot/conf/includes.h index 0a9b152..81dcc6c 100644 --- a/src/knot/conf/includes.h +++ b/src/knot/conf/includes.h @@ -46,10 +46,8 @@ typedef struct conf_includes conf_includes_t; /*! * \brief Initialize structure for storing names of included files. - * - * \param capacity Max depth of the inclusion. */ -conf_includes_t *conf_includes_init(int capacity); +conf_includes_t *conf_includes_init(); /*! * \brief Free structure for storing the names of included files. @@ -57,11 +55,6 @@ conf_includes_t *conf_includes_init(int capacity); void conf_includes_free(conf_includes_t *includes); /** - * \brief Check if there is a capacity to insert new file. - */ -bool conf_includes_can_push(conf_includes_t *includes); - -/** * \brief Pushes a file name onto the stack of files. * * If the file name is not absolute (or first inserted), the name is changed @@ -87,6 +80,13 @@ conf_include_t *conf_includes_top(conf_includes_t *includes); */ conf_include_t *conf_includes_pop(conf_includes_t *includes); +/** + * \brief Remove the include on the top. + * + * \return True if the include was removed. + */ +bool conf_includes_remove(conf_includes_t *includes); + #endif /* _KNOT_CONF_INCLUDES_H_ */ /*! @} */ diff --git a/src/knot/conf/libknotd_la-cf-lex.c b/src/knot/conf/libknotd_la-cf-lex.c index 5b9d640..ab493f5 100644 --- a/src/knot/conf/libknotd_la-cf-lex.c +++ b/src/knot/conf/libknotd_la-cf-lex.c @@ -836,10 +836,13 @@ static yyconst flex_int32_t yy_rule_can_match_eol[90] = #line 26 "cf-lex.l" #include <config.h> +#include <dirent.h> #include <errno.h> #include <stdlib.h> #include <stdarg.h> #include <stdbool.h> +#include <sys/stat.h> +#include <sys/types.h> #include "common/sockaddr.h" #include "knot/conf/conf.h" @@ -876,7 +879,7 @@ int hex2bin(const char* src, char *dst, size_t len) { #define YY_NO_INPUT 1 -#line 880 "knot/conf/libknotd_la-cf-lex.c" +#line 883 "knot/conf/libknotd_la-cf-lex.c" #define INITIAL 0 #define include 1 @@ -1115,9 +1118,9 @@ YY_DECL register int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 87 "cf-lex.l" +#line 90 "cf-lex.l" -#line 1121 "knot/conf/libknotd_la-cf-lex.c" +#line 1124 "knot/conf/libknotd_la-cf-lex.c" yylval = yylval_param; @@ -1217,328 +1220,328 @@ do_action: /* This label is used only to access EOF actions. */ case 1: /* rule 1 can match eol */ YY_RULE_SETUP -#line 88 "cf-lex.l" +#line 91 "cf-lex.l" /* Ignore comments */; YY_BREAK case 2: /* rule 2 can match eol */ YY_RULE_SETUP -#line 89 "cf-lex.l" +#line 92 "cf-lex.l" /* Ignore whitespace */; YY_BREAK case 3: YY_RULE_SETUP -#line 90 "cf-lex.l" +#line 93 "cf-lex.l" { return yytext[0]; } YY_BREAK case 4: YY_RULE_SETUP -#line 91 "cf-lex.l" +#line 94 "cf-lex.l" { lval.t = yytext; return SYSTEM; } YY_BREAK case 5: YY_RULE_SETUP -#line 92 "cf-lex.l" +#line 95 "cf-lex.l" { lval.t = yytext; return IDENTITY; } YY_BREAK case 6: YY_RULE_SETUP -#line 93 "cf-lex.l" +#line 96 "cf-lex.l" { lval.t = yytext; return HOSTNAME; } YY_BREAK case 7: YY_RULE_SETUP -#line 94 "cf-lex.l" +#line 97 "cf-lex.l" { lval.t = yytext; return SVERSION; } YY_BREAK case 8: YY_RULE_SETUP -#line 95 "cf-lex.l" +#line 98 "cf-lex.l" { lval.t = yytext; return NSID; } YY_BREAK case 9: YY_RULE_SETUP -#line 96 "cf-lex.l" +#line 99 "cf-lex.l" { lval.t = yytext; return MAX_UDP_PAYLOAD; } YY_BREAK case 10: YY_RULE_SETUP -#line 97 "cf-lex.l" +#line 100 "cf-lex.l" { lval.t = yytext; return STORAGE; } YY_BREAK case 11: YY_RULE_SETUP -#line 98 "cf-lex.l" +#line 101 "cf-lex.l" { lval.t = yytext; return KEY; } YY_BREAK case 12: YY_RULE_SETUP -#line 99 "cf-lex.l" +#line 102 "cf-lex.l" { lval.t = yytext; return KEYS; } YY_BREAK case 13: YY_RULE_SETUP -#line 100 "cf-lex.l" +#line 103 "cf-lex.l" { lval.t = yytext; return REMOTES; } YY_BREAK case 14: YY_RULE_SETUP -#line 101 "cf-lex.l" +#line 104 "cf-lex.l" { lval.t = yytext; return GROUPS; } YY_BREAK case 15: YY_RULE_SETUP -#line 103 "cf-lex.l" +#line 106 "cf-lex.l" { lval.t = yytext; return ZONES; } YY_BREAK case 16: YY_RULE_SETUP -#line 104 "cf-lex.l" +#line 107 "cf-lex.l" { lval.t = yytext; return FILENAME; } YY_BREAK case 17: YY_RULE_SETUP -#line 105 "cf-lex.l" +#line 108 "cf-lex.l" { lval.t = yytext; return DISABLE_ANY; } YY_BREAK case 18: YY_RULE_SETUP -#line 106 "cf-lex.l" +#line 109 "cf-lex.l" { lval.t = yytext; return SEMANTIC_CHECKS; } YY_BREAK case 19: YY_RULE_SETUP -#line 107 "cf-lex.l" +#line 110 "cf-lex.l" { lval.t = yytext; return NOTIFY_RETRIES; } YY_BREAK case 20: YY_RULE_SETUP -#line 108 "cf-lex.l" +#line 111 "cf-lex.l" { lval.t = yytext; return NOTIFY_TIMEOUT; } YY_BREAK case 21: YY_RULE_SETUP -#line 109 "cf-lex.l" +#line 112 "cf-lex.l" { lval.t = yytext; return DBSYNC_TIMEOUT; } YY_BREAK case 22: YY_RULE_SETUP -#line 110 "cf-lex.l" +#line 113 "cf-lex.l" { lval.t = yytext; return IXFR_FSLIMIT; } YY_BREAK case 23: YY_RULE_SETUP -#line 111 "cf-lex.l" +#line 114 "cf-lex.l" { lval.t = yytext; return XFR_IN; } YY_BREAK case 24: YY_RULE_SETUP -#line 112 "cf-lex.l" +#line 115 "cf-lex.l" { lval.t = yytext; return XFR_OUT; } YY_BREAK case 25: YY_RULE_SETUP -#line 113 "cf-lex.l" +#line 116 "cf-lex.l" { lval.t = yytext; return UPDATE_IN; } YY_BREAK case 26: YY_RULE_SETUP -#line 114 "cf-lex.l" +#line 117 "cf-lex.l" { lval.t = yytext; return NOTIFY_IN; } YY_BREAK case 27: YY_RULE_SETUP -#line 115 "cf-lex.l" +#line 118 "cf-lex.l" { lval.t = yytext; return NOTIFY_OUT; } YY_BREAK case 28: YY_RULE_SETUP -#line 116 "cf-lex.l" +#line 119 "cf-lex.l" { lval.t = yytext; return WORKERS; } YY_BREAK case 29: YY_RULE_SETUP -#line 117 "cf-lex.l" +#line 120 "cf-lex.l" { lval.t = yytext; return USER; } YY_BREAK case 30: YY_RULE_SETUP -#line 118 "cf-lex.l" +#line 121 "cf-lex.l" { lval.t = yytext; return PIDFILE; } YY_BREAK case 31: YY_RULE_SETUP -#line 119 "cf-lex.l" +#line 122 "cf-lex.l" { lval.t = yytext; return RUNDIR; } YY_BREAK case 32: YY_RULE_SETUP -#line 120 "cf-lex.l" +#line 123 "cf-lex.l" { lval.t = yytext; return BUILD_DIFFS; } YY_BREAK case 33: YY_RULE_SETUP -#line 121 "cf-lex.l" +#line 124 "cf-lex.l" { lval.t = yytext; return SERIAL_POLICY; } YY_BREAK case 34: YY_RULE_SETUP -#line 122 "cf-lex.l" +#line 125 "cf-lex.l" { lval.t = yytext; return MAX_CONN_IDLE; } YY_BREAK case 35: YY_RULE_SETUP -#line 123 "cf-lex.l" +#line 126 "cf-lex.l" { lval.t = yytext; return MAX_CONN_HS; } YY_BREAK case 36: YY_RULE_SETUP -#line 124 "cf-lex.l" +#line 127 "cf-lex.l" { lval.t = yytext; return MAX_CONN_REPLY; } YY_BREAK case 37: YY_RULE_SETUP -#line 125 "cf-lex.l" +#line 128 "cf-lex.l" { lval.t = yytext; return RATE_LIMIT; } YY_BREAK case 38: YY_RULE_SETUP -#line 126 "cf-lex.l" +#line 129 "cf-lex.l" { lval.t = yytext; return RATE_LIMIT_SIZE; } YY_BREAK case 39: YY_RULE_SETUP -#line 127 "cf-lex.l" +#line 130 "cf-lex.l" { lval.t = yytext; return RATE_LIMIT_SLIP; } YY_BREAK case 40: YY_RULE_SETUP -#line 128 "cf-lex.l" +#line 131 "cf-lex.l" { lval.t = yytext; return TRANSFERS; } YY_BREAK case 41: YY_RULE_SETUP -#line 129 "cf-lex.l" +#line 132 "cf-lex.l" { lval.t = yytext; return DNSSEC_ENABLE; } YY_BREAK case 42: YY_RULE_SETUP -#line 130 "cf-lex.l" +#line 133 "cf-lex.l" { lval.t = yytext; return DNSSEC_KEYDIR; } YY_BREAK case 43: YY_RULE_SETUP -#line 131 "cf-lex.l" +#line 134 "cf-lex.l" { lval.t = yytext; return SIGNATURE_LIFETIME; } YY_BREAK case 44: YY_RULE_SETUP -#line 133 "cf-lex.l" +#line 136 "cf-lex.l" { lval.t = yytext; return INTERFACES; } YY_BREAK case 45: YY_RULE_SETUP -#line 134 "cf-lex.l" +#line 137 "cf-lex.l" { lval.t = yytext; return ADDRESS; } YY_BREAK case 46: YY_RULE_SETUP -#line 135 "cf-lex.l" +#line 138 "cf-lex.l" { lval.t = yytext; return PORT; } YY_BREAK case 47: YY_RULE_SETUP -#line 136 "cf-lex.l" +#line 139 "cf-lex.l" { lval.t = yytext; return VIA; } YY_BREAK case 48: YY_RULE_SETUP -#line 138 "cf-lex.l" +#line 141 "cf-lex.l" { lval.t = yytext; return CONTROL; } YY_BREAK case 49: YY_RULE_SETUP -#line 139 "cf-lex.l" +#line 142 "cf-lex.l" { lval.t = yytext; return ALLOW; } YY_BREAK case 50: YY_RULE_SETUP -#line 140 "cf-lex.l" +#line 143 "cf-lex.l" { lval.t = yytext; return LISTEN_ON; } YY_BREAK case 51: YY_RULE_SETUP -#line 142 "cf-lex.l" +#line 145 "cf-lex.l" { lval.t = yytext; return LOG; } YY_BREAK case 52: YY_RULE_SETUP -#line 144 "cf-lex.l" +#line 147 "cf-lex.l" { lval.t = yytext; lval.i = LOG_ANY; return LOG_SRC; } YY_BREAK case 53: YY_RULE_SETUP -#line 145 "cf-lex.l" +#line 148 "cf-lex.l" { lval.t = yytext; lval.i = LOG_SERVER; return LOG_SRC; } YY_BREAK case 54: YY_RULE_SETUP -#line 146 "cf-lex.l" +#line 149 "cf-lex.l" { lval.t = yytext; lval.i = LOG_ANSWER; return LOG_SRC; } YY_BREAK case 55: YY_RULE_SETUP -#line 147 "cf-lex.l" +#line 150 "cf-lex.l" { lval.t = yytext; lval.i = LOG_ZONE; return LOG_SRC; } YY_BREAK case 56: YY_RULE_SETUP -#line 148 "cf-lex.l" +#line 151 "cf-lex.l" { lval.t = yytext; lval.i = LOGT_STDOUT; return LOG_DEST; } YY_BREAK case 57: YY_RULE_SETUP -#line 149 "cf-lex.l" +#line 152 "cf-lex.l" { lval.t = yytext; lval.i = LOGT_STDERR; return LOG_DEST; } YY_BREAK case 58: YY_RULE_SETUP -#line 150 "cf-lex.l" +#line 153 "cf-lex.l" { lval.t = yytext; lval.i = LOGT_SYSLOG; return LOG_DEST; } YY_BREAK case 59: YY_RULE_SETUP -#line 151 "cf-lex.l" +#line 154 "cf-lex.l" { lval.t = yytext; lval.i = LOG_UPTO(LOG_DEBUG); return LOG_LEVEL; } YY_BREAK case 60: YY_RULE_SETUP -#line 152 "cf-lex.l" +#line 155 "cf-lex.l" { lval.t = yytext; lval.i = LOG_MASK(LOG_DEBUG); return LOG_LEVEL; } YY_BREAK case 61: YY_RULE_SETUP -#line 153 "cf-lex.l" +#line 156 "cf-lex.l" { lval.t = yytext; lval.i = LOG_MASK(LOG_INFO); return LOG_LEVEL; } YY_BREAK case 62: YY_RULE_SETUP -#line 154 "cf-lex.l" +#line 157 "cf-lex.l" { lval.t = yytext; lval.i = LOG_MASK(LOG_NOTICE); return LOG_LEVEL; } YY_BREAK case 63: YY_RULE_SETUP -#line 155 "cf-lex.l" +#line 158 "cf-lex.l" { lval.t = yytext; lval.i = LOG_MASK(LOG_WARNING); return LOG_LEVEL; } YY_BREAK case 64: YY_RULE_SETUP -#line 156 "cf-lex.l" +#line 159 "cf-lex.l" { lval.t = yytext; lval.i = LOG_MASK(LOG_ERR); return LOG_LEVEL; } YY_BREAK case 65: YY_RULE_SETUP -#line 158 "cf-lex.l" +#line 161 "cf-lex.l" { lval.t = yytext; if (strcmp(yytext, "increment") == 0) { @@ -1551,7 +1554,7 @@ YY_RULE_SETUP YY_BREAK case 66: YY_RULE_SETUP -#line 168 "cf-lex.l" +#line 171 "cf-lex.l" { lval.t = yytext; lval.i = 0; @@ -1563,12 +1566,12 @@ YY_RULE_SETUP YY_BREAK case 67: YY_RULE_SETUP -#line 177 "cf-lex.l" +#line 180 "cf-lex.l" BEGIN(include); YY_BREAK case 68: YY_RULE_SETUP -#line 179 "cf-lex.l" +#line 182 "cf-lex.l" { size_t mpos = strlen(yytext) - 1; char multiplier = yytext[mpos]; @@ -1593,7 +1596,7 @@ YY_RULE_SETUP YY_BREAK case 69: YY_RULE_SETUP -#line 201 "cf-lex.l" +#line 204 "cf-lex.l" { size_t mpos = strlen(yytext) - 1; char multiplier = yytext[mpos]; @@ -1617,7 +1620,7 @@ YY_RULE_SETUP YY_BREAK case 70: YY_RULE_SETUP -#line 222 "cf-lex.l" +#line 225 "cf-lex.l" { lval.i = atol(yytext); return NUM; @@ -1625,7 +1628,7 @@ YY_RULE_SETUP YY_BREAK case 71: YY_RULE_SETUP -#line 227 "cf-lex.l" +#line 230 "cf-lex.l" { unsigned char buf[sizeof(struct in_addr)]; if (inet_pton(AF_INET, yytext, buf)) { @@ -1637,7 +1640,7 @@ YY_RULE_SETUP YY_BREAK case 72: YY_RULE_SETUP -#line 236 "cf-lex.l" +#line 239 "cf-lex.l" { #ifdef DISABLE_IPV6 lval.t = strdup(yytext); @@ -1656,7 +1659,7 @@ YY_RULE_SETUP YY_BREAK case 73: YY_RULE_SETUP -#line 252 "cf-lex.l" +#line 255 "cf-lex.l" { #ifdef DISABLE_IPV6 lval.t = strdup(yytext); @@ -1674,7 +1677,7 @@ YY_RULE_SETUP YY_BREAK case 74: YY_RULE_SETUP -#line 267 "cf-lex.l" +#line 270 "cf-lex.l" { lval.t = NULL; lval.l = 0; @@ -1702,42 +1705,42 @@ YY_RULE_SETUP YY_BREAK case 75: YY_RULE_SETUP -#line 292 "cf-lex.l" +#line 295 "cf-lex.l" { lval.alg = KNOT_TSIG_ALG_GSS_TSIG; return TSIG_ALGO_NAME; } YY_BREAK case 76: YY_RULE_SETUP -#line 293 "cf-lex.l" +#line 296 "cf-lex.l" { lval.alg = KNOT_TSIG_ALG_HMAC_MD5; return TSIG_ALGO_NAME; } YY_BREAK case 77: YY_RULE_SETUP -#line 294 "cf-lex.l" +#line 297 "cf-lex.l" { lval.alg = KNOT_TSIG_ALG_HMAC_SHA1; return TSIG_ALGO_NAME; } YY_BREAK case 78: YY_RULE_SETUP -#line 295 "cf-lex.l" +#line 298 "cf-lex.l" { lval.alg = KNOT_TSIG_ALG_HMAC_SHA224; return TSIG_ALGO_NAME; } YY_BREAK case 79: YY_RULE_SETUP -#line 296 "cf-lex.l" +#line 299 "cf-lex.l" { lval.alg = KNOT_TSIG_ALG_HMAC_SHA256; return TSIG_ALGO_NAME; } YY_BREAK case 80: YY_RULE_SETUP -#line 297 "cf-lex.l" +#line 300 "cf-lex.l" { lval.alg = KNOT_TSIG_ALG_HMAC_SHA384; return TSIG_ALGO_NAME; } YY_BREAK case 81: YY_RULE_SETUP -#line 298 "cf-lex.l" +#line 301 "cf-lex.l" { lval.alg = KNOT_TSIG_ALG_HMAC_SHA512; return TSIG_ALGO_NAME; } YY_BREAK case 82: YY_RULE_SETUP -#line 300 "cf-lex.l" +#line 303 "cf-lex.l" { yytext[yyleng-1] = 0; lval.t = strdup(yytext + 1); @@ -1747,12 +1750,12 @@ YY_RULE_SETUP case 83: /* rule 83 can match eol */ YY_RULE_SETUP -#line 306 "cf-lex.l" +#line 309 "cf-lex.l" cf_error(yyscanner, "Unterminated string."); YY_BREAK case 84: YY_RULE_SETUP -#line 308 "cf-lex.l" +#line 311 "cf-lex.l" { lval.t = strdup(yytext); return TEXT /* Last resort, alphanumeric word. */; @@ -1760,18 +1763,14 @@ YY_RULE_SETUP YY_BREAK case 85: YY_RULE_SETUP -#line 313 "cf-lex.l" +#line 316 "cf-lex.l" /* Optional : in assignments. */; YY_BREAK case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(include): -#line 315 "cf-lex.l" +#line 318 "cf-lex.l" { - conf_include_t *inc = conf_includes_pop(yyextra->includes); - free(inc->filename); - if (inc->handle) { - fclose(inc->handle); - } + conf_includes_remove(yyextra->includes); cf_pop_buffer_state(yyscanner); @@ -1783,12 +1782,12 @@ case YY_STATE_EOF(include): case 86: /* rule 86 can match eol */ YY_RULE_SETUP -#line 329 "cf-lex.l" +#line 328 "cf-lex.l" YY_BREAK case 87: YY_RULE_SETUP -#line 330 "cf-lex.l" +#line 329 "cf-lex.l" { BEGIN(INITIAL); @@ -1807,7 +1806,7 @@ YY_RULE_SETUP yytext[yyleng] = '\0'; if (!conf_includes_push(yyextra->includes, yytext)) { - cf_error(yyscanner, "includes nested too deeply"); + cf_error(yyscanner, "include loop"); return END; } @@ -1817,28 +1816,94 @@ YY_RULE_SETUP FILE *included = fopen(inc->filename, "r"); if (!included) { cf_error(yyscanner, "cannot open file '%s'", inc->filename); - conf_includes_pop(yyextra->includes); - free(inc->filename); + conf_includes_remove(yyextra->includes); return END; } - inc->handle = included; - YY_BUFFER_STATE bs = cf__create_buffer(included,YY_BUF_SIZE,yyscanner); - cf_push_buffer_state(bs,yyscanner); + + struct stat file_stat; + if (fstat(fileno(included), &file_stat) == -1) { + cf_error(yyscanner, "cannot stat file '%s'", yytext); + conf_includes_remove(yyextra->includes); + return END; + } + + if (S_ISDIR(file_stat.st_mode)) { + // Store dirname statically to reduce deallocation. + char dirname[256] = { 0 }; + int ret = snprintf(dirname, sizeof(dirname), "%s", + inc->filename); + if (ret <= 0 || ret >= sizeof(dirname)) { + cf_error(yyscanner, "dir name is too long '%s'", + inc->filename); + return END; + } + + // Remove include directory from the stack. + conf_includes_remove(yyextra->includes); + + DIR *dp = opendir(dirname); + if (dp == NULL) { + cf_error(yyscanner, "cannot open directory '%s'", + dirname); + return END; + } + + struct dirent *ep; + while ((ep = readdir(dp)) != NULL) { + // Skip names with leading dot. + if (*ep->d_name == '.') { + continue; + } + + char infile[256] = { 0 }; + int ret = snprintf(infile, sizeof(infile), "%s/%s", + dirname, ep->d_name); + if (ret <= 0 || ret >= sizeof(infile)) { + cf_error(yyscanner, "cannot open file '%s/%s'", + dirname, ep->d_name); + return END; + } + + if (!conf_includes_push(yyextra->includes, infile)) { + cf_error(yyscanner, "include loop"); + return END; + } + + // retrieved relative to previous config + conf_include_t *inc = conf_includes_top(yyextra->includes); + + FILE *included = fopen(inc->filename, "r"); + if (!included) { + cf_error(yyscanner, "cannot open file '%s'", + inc->filename); + conf_includes_remove(yyextra->includes); + return END; + } + inc->handle = included; + + YY_BUFFER_STATE bs = cf__create_buffer(included,YY_BUF_SIZE,yyscanner); + cf_push_buffer_state(bs,yyscanner); + } + (void)closedir(dp); + } else { + YY_BUFFER_STATE bs = cf__create_buffer(included,YY_BUF_SIZE,yyscanner); + cf_push_buffer_state(bs,yyscanner); + } } YY_BREAK case 88: /* rule 88 can match eol */ YY_RULE_SETUP -#line 368 "cf-lex.l" +#line 435 "cf-lex.l" cf_error(yyscanner, "Unterminated string."); YY_BREAK case 89: YY_RULE_SETUP -#line 370 "cf-lex.l" +#line 437 "cf-lex.l" ECHO; YY_BREAK -#line 1842 "knot/conf/libknotd_la-cf-lex.c" +#line 1907 "knot/conf/libknotd_la-cf-lex.c" case YY_END_OF_BUFFER: { @@ -2972,7 +3037,7 @@ void cf_free (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 370 "cf-lex.l" +#line 437 "cf-lex.l" diff --git a/src/knot/conf/libknotd_la-cf-parse.c b/src/knot/conf/libknotd_la-cf-parse.c index c969ab5..56a2580 100644 --- a/src/knot/conf/libknotd_la-cf-parse.c +++ b/src/knot/conf/libknotd_la-cf-parse.c @@ -78,6 +78,7 @@ #include <config.h> +#include <ctype.h> #include <limits.h> #include <stdio.h> #include <string.h> @@ -401,6 +402,11 @@ static void conf_zone_start(void *scanner, char *name) { this_zone->name = name; /* Already FQDN */ } + // Convert zone name to lower-case. + for (size_t i = 0; this_zone->name[i]; i++) { + this_zone->name[i] = tolower(this_zone->name[i]); + } + // DNSSEC configuration this_zone->dnssec_enable = -1; @@ -484,7 +490,7 @@ static void ident_auto(int tok, conf_t *conf, bool val) /* Line 268 of yacc.c */ -#line 488 "knot/conf/libknotd_la-cf-parse.c" +#line 494 "knot/conf/libknotd_la-cf-parse.c" /* Enabling traces. */ #ifndef YYDEBUG @@ -649,7 +655,7 @@ typedef union YYSTYPE { /* Line 293 of yacc.c */ -#line 436 "cf-parse.y" +#line 442 "cf-parse.y" struct { char *t; @@ -661,7 +667,7 @@ typedef union YYSTYPE /* Line 293 of yacc.c */ -#line 665 "knot/conf/libknotd_la-cf-parse.c" +#line 671 "knot/conf/libknotd_la-cf-parse.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -673,7 +679,7 @@ typedef union YYSTYPE /* Line 343 of yacc.c */ -#line 677 "knot/conf/libknotd_la-cf-parse.c" +#line 683 "knot/conf/libknotd_la-cf-parse.c" #ifdef short # undef short @@ -1042,23 +1048,23 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 505, 505, 507, 509, 512, 513, 514, 515, 516, - 517, 518, 521, 522, 529, 537, 550, 558, 574, 575, - 583, 584, 585, 586, 587, 588, 593, 594, 595, 596, - 600, 605, 606, 607, 612, 615, 636, 639, 642, 645, - 648, 651, 654, 657, 663, 664, 716, 717, 718, 719, - 720, 721, 724, 725, 732, 741, 750, 764, 773, 782, - 796, 804, 808, 812, 819, 820, 828, 831, 833, 834, - 838, 842, 843, 847, 850, 853, 856, 859, 864, 865, - 866, 867, 868, 869, 872, 873, 874, 877, 878, 906, - 907, 908, 909, 910, 911, 912, 913, 929, 933, 934, - 935, 936, 937, 938, 939, 940, 941, 942, 945, 948, - 951, 954, 957, 960, 961, 964, 967, 973, 974, 975, - 976, 977, 978, 981, 984, 987, 990, 993, 996, 997, - 998, 999, 1002, 1005, 1010, 1019, 1020, 1021, 1024, 1025, - 1031, 1054, 1081, 1085, 1086, 1087, 1090, 1090, 1094, 1098, - 1104, 1105, 1112, 1118, 1119, 1122, 1122, 1122, 1122, 1122, - 1122, 1122, 1122, 1122 + 0, 511, 511, 513, 515, 518, 519, 520, 521, 522, + 523, 524, 527, 528, 535, 543, 556, 564, 580, 581, + 589, 590, 591, 592, 593, 594, 599, 600, 601, 602, + 606, 611, 612, 613, 618, 621, 642, 645, 648, 651, + 654, 657, 660, 663, 669, 670, 722, 723, 724, 725, + 726, 727, 730, 731, 738, 747, 756, 770, 779, 788, + 802, 810, 814, 818, 825, 826, 834, 837, 839, 840, + 844, 848, 849, 853, 856, 859, 862, 865, 870, 871, + 872, 873, 874, 875, 878, 879, 880, 883, 884, 912, + 913, 914, 915, 916, 917, 918, 919, 935, 939, 940, + 941, 942, 943, 944, 945, 946, 947, 948, 951, 954, + 957, 960, 963, 966, 967, 970, 973, 979, 980, 981, + 982, 983, 984, 987, 990, 993, 996, 999, 1002, 1003, + 1004, 1005, 1008, 1011, 1016, 1025, 1026, 1027, 1030, 1031, + 1037, 1060, 1087, 1091, 1092, 1093, 1096, 1096, 1100, 1104, + 1110, 1111, 1118, 1124, 1125, 1128, 1128, 1128, 1128, 1128, + 1128, 1128, 1128, 1128 }; #endif @@ -2211,56 +2217,56 @@ yyreduce: case 2: /* Line 1806 of yacc.c */ -#line 505 "cf-parse.y" +#line 511 "cf-parse.y" { return 0; } break; case 6: /* Line 1806 of yacc.c */ -#line 513 "cf-parse.y" +#line 519 "cf-parse.y" { conf_start_iface(scanner, (yyvsp[(1) - (1)].tok).t); } break; case 7: /* Line 1806 of yacc.c */ -#line 514 "cf-parse.y" +#line 520 "cf-parse.y" { conf_start_iface(scanner, strdup((yyvsp[(1) - (1)].tok).t)); } break; case 8: /* Line 1806 of yacc.c */ -#line 515 "cf-parse.y" +#line 521 "cf-parse.y" { conf_start_iface(scanner, strdup((yyvsp[(1) - (1)].tok).t)); } break; case 9: /* Line 1806 of yacc.c */ -#line 516 "cf-parse.y" +#line 522 "cf-parse.y" { conf_start_iface(scanner, strdup((yyvsp[(1) - (1)].tok).t)); } break; case 10: /* Line 1806 of yacc.c */ -#line 517 "cf-parse.y" +#line 523 "cf-parse.y" { conf_start_iface(scanner, strdup((yyvsp[(1) - (1)].tok).t)); } break; case 11: /* Line 1806 of yacc.c */ -#line 518 "cf-parse.y" +#line 524 "cf-parse.y" { conf_start_iface(scanner, strdup((yyvsp[(1) - (1)].tok).t)); } break; case 13: /* Line 1806 of yacc.c */ -#line 522 "cf-parse.y" +#line 528 "cf-parse.y" { if (this_iface->port > 0) { cf_error(scanner, "only one port definition is allowed in interface section\n"); @@ -2273,7 +2279,7 @@ yyreduce: case 14: /* Line 1806 of yacc.c */ -#line 529 "cf-parse.y" +#line 535 "cf-parse.y" { if (this_iface->address != 0) { cf_error(scanner, "only one address is allowed in interface section\n"); @@ -2287,7 +2293,7 @@ yyreduce: case 15: /* Line 1806 of yacc.c */ -#line 537 "cf-parse.y" +#line 543 "cf-parse.y" { if (this_iface->address != 0) { cf_error(scanner, "only one address is allowed in interface section\n"); @@ -2306,7 +2312,7 @@ yyreduce: case 16: /* Line 1806 of yacc.c */ -#line 550 "cf-parse.y" +#line 556 "cf-parse.y" { if (this_iface->address != 0) { cf_error(scanner, "only one address is allowed in interface section\n"); @@ -2320,7 +2326,7 @@ yyreduce: case 17: /* Line 1806 of yacc.c */ -#line 558 "cf-parse.y" +#line 564 "cf-parse.y" { if (this_iface->address != 0) { cf_error(scanner, "only one address is allowed in interface section\n"); @@ -2339,7 +2345,7 @@ yyreduce: case 19: /* Line 1806 of yacc.c */ -#line 575 "cf-parse.y" +#line 581 "cf-parse.y" { if (this_iface->address == 0) { cf_error(scanner, "interface '%s' has no defined address", this_iface->name); @@ -2350,35 +2356,35 @@ yyreduce: case 21: /* Line 1806 of yacc.c */ -#line 584 "cf-parse.y" +#line 590 "cf-parse.y" { new_config->version = (yyvsp[(3) - (4)].tok).t; } break; case 22: /* Line 1806 of yacc.c */ -#line 585 "cf-parse.y" +#line 591 "cf-parse.y" { ident_auto(SVERSION, new_config, (yyvsp[(3) - (4)].tok).i); } break; case 23: /* Line 1806 of yacc.c */ -#line 586 "cf-parse.y" +#line 592 "cf-parse.y" { new_config->identity = (yyvsp[(3) - (4)].tok).t; } break; case 24: /* Line 1806 of yacc.c */ -#line 587 "cf-parse.y" +#line 593 "cf-parse.y" { ident_auto(IDENTITY, new_config, (yyvsp[(3) - (4)].tok).i); } break; case 25: /* Line 1806 of yacc.c */ -#line 588 "cf-parse.y" +#line 594 "cf-parse.y" { fprintf(stderr, "warning: Config option 'system.hostname' is deprecated. " "Use 'system.identity' instead.\n"); @@ -2389,28 +2395,28 @@ yyreduce: case 26: /* Line 1806 of yacc.c */ -#line 593 "cf-parse.y" +#line 599 "cf-parse.y" { new_config->nsid = (yyvsp[(3) - (4)].tok).t; new_config->nsid_len = (yyvsp[(3) - (4)].tok).l; } break; case 27: /* Line 1806 of yacc.c */ -#line 594 "cf-parse.y" +#line 600 "cf-parse.y" { new_config->nsid = (yyvsp[(3) - (4)].tok).t; new_config->nsid_len = strlen(new_config->nsid); } break; case 28: /* Line 1806 of yacc.c */ -#line 595 "cf-parse.y" +#line 601 "cf-parse.y" { ident_auto(NSID, new_config, (yyvsp[(3) - (4)].tok).i); } break; case 29: /* Line 1806 of yacc.c */ -#line 596 "cf-parse.y" +#line 602 "cf-parse.y" { SET_NUM(new_config->max_udp_payload, (yyvsp[(3) - (4)].tok).i, EDNS_MIN_UDP_PAYLOAD, EDNS_MAX_UDP_PAYLOAD, "max-udp-payload"); @@ -2420,7 +2426,7 @@ yyreduce: case 30: /* Line 1806 of yacc.c */ -#line 600 "cf-parse.y" +#line 606 "cf-parse.y" { fprintf(stderr, "warning: Config option 'system.storage' was relocated. " "Use 'zones.storage' instead.\n"); @@ -2431,21 +2437,21 @@ yyreduce: case 31: /* Line 1806 of yacc.c */ -#line 605 "cf-parse.y" +#line 611 "cf-parse.y" { new_config->rundir = (yyvsp[(3) - (4)].tok).t; } break; case 32: /* Line 1806 of yacc.c */ -#line 606 "cf-parse.y" +#line 612 "cf-parse.y" { new_config->pidfile = (yyvsp[(3) - (4)].tok).t; } break; case 33: /* Line 1806 of yacc.c */ -#line 607 "cf-parse.y" +#line 613 "cf-parse.y" { fprintf(stderr, "warning: Config option 'system.key' is deprecated " "and has no effect.\n"); @@ -2456,7 +2462,7 @@ yyreduce: case 34: /* Line 1806 of yacc.c */ -#line 612 "cf-parse.y" +#line 618 "cf-parse.y" { SET_NUM(new_config->workers, (yyvsp[(3) - (4)].tok).i, 1, 255, "workers"); } @@ -2465,7 +2471,7 @@ yyreduce: case 35: /* Line 1806 of yacc.c */ -#line 615 "cf-parse.y" +#line 621 "cf-parse.y" { new_config->uid = new_config->gid = -1; // Invalidate char* dpos = strchr((yyvsp[(3) - (4)].tok).t, '.'); // Find uid.gid format @@ -2492,7 +2498,7 @@ yyreduce: case 36: /* Line 1806 of yacc.c */ -#line 636 "cf-parse.y" +#line 642 "cf-parse.y" { SET_INT(new_config->max_conn_idle, (yyvsp[(3) - (4)].tok).i, "max-conn-idle"); } @@ -2501,7 +2507,7 @@ yyreduce: case 37: /* Line 1806 of yacc.c */ -#line 639 "cf-parse.y" +#line 645 "cf-parse.y" { SET_INT(new_config->max_conn_hs, (yyvsp[(3) - (4)].tok).i, "max-conn-handshake"); } @@ -2510,7 +2516,7 @@ yyreduce: case 38: /* Line 1806 of yacc.c */ -#line 642 "cf-parse.y" +#line 648 "cf-parse.y" { SET_INT(new_config->max_conn_reply, (yyvsp[(3) - (4)].tok).i, "max-conn-reply"); } @@ -2519,7 +2525,7 @@ yyreduce: case 39: /* Line 1806 of yacc.c */ -#line 645 "cf-parse.y" +#line 651 "cf-parse.y" { SET_INT(new_config->rrl, (yyvsp[(3) - (4)].tok).i, "rate-limit"); } @@ -2528,7 +2534,7 @@ yyreduce: case 40: /* Line 1806 of yacc.c */ -#line 648 "cf-parse.y" +#line 654 "cf-parse.y" { SET_SIZE(new_config->rrl_size, (yyvsp[(3) - (4)].tok).l, "rate-limit-size"); } @@ -2537,7 +2543,7 @@ yyreduce: case 41: /* Line 1806 of yacc.c */ -#line 651 "cf-parse.y" +#line 657 "cf-parse.y" { SET_SIZE(new_config->rrl_size, (yyvsp[(3) - (4)].tok).i, "rate-limit-size"); } @@ -2546,7 +2552,7 @@ yyreduce: case 42: /* Line 1806 of yacc.c */ -#line 654 "cf-parse.y" +#line 660 "cf-parse.y" { SET_INT(new_config->rrl_slip, (yyvsp[(3) - (4)].tok).i, "rate-limit-slip"); } @@ -2555,7 +2561,7 @@ yyreduce: case 43: /* Line 1806 of yacc.c */ -#line 657 "cf-parse.y" +#line 663 "cf-parse.y" { SET_INT(new_config->xfers, (yyvsp[(3) - (4)].tok).i, "transfers"); } @@ -2564,7 +2570,7 @@ yyreduce: case 45: /* Line 1806 of yacc.c */ -#line 664 "cf-parse.y" +#line 670 "cf-parse.y" { /* Check algorithm length. */ if (knot_tsig_digest_length((yyvsp[(3) - (5)].tok).alg) == 0) { @@ -2621,42 +2627,42 @@ yyreduce: case 47: /* Line 1806 of yacc.c */ -#line 717 "cf-parse.y" +#line 723 "cf-parse.y" { conf_start_remote(scanner, (yyvsp[(1) - (1)].tok).t); } break; case 48: /* Line 1806 of yacc.c */ -#line 718 "cf-parse.y" +#line 724 "cf-parse.y" { conf_start_remote(scanner, strdup((yyvsp[(1) - (1)].tok).t)); } break; case 49: /* Line 1806 of yacc.c */ -#line 719 "cf-parse.y" +#line 725 "cf-parse.y" { conf_start_remote(scanner, strdup((yyvsp[(1) - (1)].tok).t)); } break; case 50: /* Line 1806 of yacc.c */ -#line 720 "cf-parse.y" +#line 726 "cf-parse.y" { conf_start_remote(scanner, strdup((yyvsp[(1) - (1)].tok).t)); } break; case 51: /* Line 1806 of yacc.c */ -#line 721 "cf-parse.y" +#line 727 "cf-parse.y" { conf_start_remote(scanner, strdup((yyvsp[(1) - (1)].tok).t)); } break; case 53: /* Line 1806 of yacc.c */ -#line 725 "cf-parse.y" +#line 731 "cf-parse.y" { if (this_remote->port != 0) { cf_error(scanner, "only one port definition is allowed in remote section\n"); @@ -2669,7 +2675,7 @@ yyreduce: case 54: /* Line 1806 of yacc.c */ -#line 732 "cf-parse.y" +#line 738 "cf-parse.y" { if (this_remote->address != 0) { cf_error(scanner, "only one address is allowed in remote section\n"); @@ -2684,7 +2690,7 @@ yyreduce: case 55: /* Line 1806 of yacc.c */ -#line 741 "cf-parse.y" +#line 747 "cf-parse.y" { if (this_remote->address != 0) { cf_error(scanner, "only one address is allowed in remote section\n"); @@ -2699,7 +2705,7 @@ yyreduce: case 56: /* Line 1806 of yacc.c */ -#line 750 "cf-parse.y" +#line 756 "cf-parse.y" { if (this_remote->address != 0) { cf_error(scanner, "only one address is allowed in remote section\n"); @@ -2719,7 +2725,7 @@ yyreduce: case 57: /* Line 1806 of yacc.c */ -#line 764 "cf-parse.y" +#line 770 "cf-parse.y" { if (this_remote->address != 0) { cf_error(scanner, "only one address is allowed in remote section\n"); @@ -2734,7 +2740,7 @@ yyreduce: case 58: /* Line 1806 of yacc.c */ -#line 773 "cf-parse.y" +#line 779 "cf-parse.y" { if (this_remote->address != 0) { cf_error(scanner, "only one address is allowed in remote section\n"); @@ -2749,7 +2755,7 @@ yyreduce: case 59: /* Line 1806 of yacc.c */ -#line 782 "cf-parse.y" +#line 788 "cf-parse.y" { if (this_remote->address != 0) { cf_error(scanner, "only one address is allowed in remote section\n"); @@ -2769,7 +2775,7 @@ yyreduce: case 60: /* Line 1806 of yacc.c */ -#line 796 "cf-parse.y" +#line 802 "cf-parse.y" { if (this_remote->key != 0) { cf_error(scanner, "only one TSIG key definition is allowed in remote section\n"); @@ -2783,7 +2789,7 @@ yyreduce: case 61: /* Line 1806 of yacc.c */ -#line 804 "cf-parse.y" +#line 810 "cf-parse.y" { sockaddr_set(&this_remote->via, AF_INET, (yyvsp[(3) - (4)].tok).t, 0); free((yyvsp[(3) - (4)].tok).t); @@ -2793,7 +2799,7 @@ yyreduce: case 62: /* Line 1806 of yacc.c */ -#line 808 "cf-parse.y" +#line 814 "cf-parse.y" { sockaddr_set(&this_remote->via, AF_INET6, (yyvsp[(3) - (4)].tok).t, 0); free((yyvsp[(3) - (4)].tok).t); @@ -2803,7 +2809,7 @@ yyreduce: case 63: /* Line 1806 of yacc.c */ -#line 812 "cf-parse.y" +#line 818 "cf-parse.y" { conf_remote_set_via(scanner, (yyvsp[(3) - (4)].tok).t); free((yyvsp[(3) - (4)].tok).t); @@ -2813,7 +2819,7 @@ yyreduce: case 65: /* Line 1806 of yacc.c */ -#line 820 "cf-parse.y" +#line 826 "cf-parse.y" { if (this_remote->address == 0) { cf_error(scanner, "remote '%s' has no defined address", this_remote->name); @@ -2824,21 +2830,21 @@ yyreduce: case 66: /* Line 1806 of yacc.c */ -#line 828 "cf-parse.y" +#line 834 "cf-parse.y" { conf_add_member_into_group(scanner, (yyvsp[(1) - (1)].tok).t); } break; case 70: /* Line 1806 of yacc.c */ -#line 838 "cf-parse.y" +#line 844 "cf-parse.y" { conf_start_group(scanner, (yyvsp[(1) - (1)].tok).t); } break; case 73: /* Line 1806 of yacc.c */ -#line 847 "cf-parse.y" +#line 853 "cf-parse.y" { this_list = &this_zone->acl.xfr_in; } @@ -2847,7 +2853,7 @@ yyreduce: case 74: /* Line 1806 of yacc.c */ -#line 850 "cf-parse.y" +#line 856 "cf-parse.y" { this_list = &this_zone->acl.xfr_out; } @@ -2856,7 +2862,7 @@ yyreduce: case 75: /* Line 1806 of yacc.c */ -#line 853 "cf-parse.y" +#line 859 "cf-parse.y" { this_list = &this_zone->acl.notify_in; } @@ -2865,7 +2871,7 @@ yyreduce: case 76: /* Line 1806 of yacc.c */ -#line 856 "cf-parse.y" +#line 862 "cf-parse.y" { this_list = &this_zone->acl.notify_out; } @@ -2874,7 +2880,7 @@ yyreduce: case 77: /* Line 1806 of yacc.c */ -#line 859 "cf-parse.y" +#line 865 "cf-parse.y" { this_list = &this_zone->acl.update_in; } @@ -2883,42 +2889,42 @@ yyreduce: case 79: /* Line 1806 of yacc.c */ -#line 865 "cf-parse.y" +#line 871 "cf-parse.y" { conf_acl_item(scanner, (yyvsp[(1) - (1)].tok).t); } break; case 80: /* Line 1806 of yacc.c */ -#line 866 "cf-parse.y" +#line 872 "cf-parse.y" { conf_acl_item(scanner, strdup((yyvsp[(1) - (1)].tok).t)); } break; case 81: /* Line 1806 of yacc.c */ -#line 867 "cf-parse.y" +#line 873 "cf-parse.y" { conf_acl_item(scanner, strdup((yyvsp[(1) - (1)].tok).t)); } break; case 82: /* Line 1806 of yacc.c */ -#line 868 "cf-parse.y" +#line 874 "cf-parse.y" { conf_acl_item(scanner, strdup((yyvsp[(1) - (1)].tok).t)); } break; case 83: /* Line 1806 of yacc.c */ -#line 869 "cf-parse.y" +#line 875 "cf-parse.y" { conf_acl_item(scanner, strdup((yyvsp[(1) - (1)].tok).t)); } break; case 88: /* Line 1806 of yacc.c */ -#line 878 "cf-parse.y" +#line 884 "cf-parse.y" { /* Find existing node in remotes. */ node_t* r = 0; conf_iface_t* found = 0; @@ -2950,49 +2956,49 @@ yyreduce: case 90: /* Line 1806 of yacc.c */ -#line 907 "cf-parse.y" +#line 913 "cf-parse.y" { conf_zone_start(scanner, strdup((yyvsp[(1) - (1)].tok).t)); } break; case 91: /* Line 1806 of yacc.c */ -#line 908 "cf-parse.y" +#line 914 "cf-parse.y" { conf_zone_start(scanner, strdup((yyvsp[(1) - (1)].tok).t)); } break; case 92: /* Line 1806 of yacc.c */ -#line 909 "cf-parse.y" +#line 915 "cf-parse.y" { conf_zone_start(scanner, strdup((yyvsp[(1) - (1)].tok).t)); } break; case 93: /* Line 1806 of yacc.c */ -#line 910 "cf-parse.y" +#line 916 "cf-parse.y" { conf_zone_start(scanner, strdup((yyvsp[(1) - (1)].tok).t)); } break; case 94: /* Line 1806 of yacc.c */ -#line 911 "cf-parse.y" +#line 917 "cf-parse.y" { conf_zone_start(scanner, strdup((yyvsp[(1) - (1)].tok).t)); } break; case 95: /* Line 1806 of yacc.c */ -#line 912 "cf-parse.y" +#line 918 "cf-parse.y" { conf_zone_start(scanner, strdup((yyvsp[(1) - (1)].tok).t)); } break; case 96: /* Line 1806 of yacc.c */ -#line 913 "cf-parse.y" +#line 919 "cf-parse.y" { unsigned prefix_len = 0; SET_NUM(prefix_len, (yyvsp[(1) - (3)].tok).i, 0, 255, "origin prefix length"); @@ -3014,56 +3020,56 @@ yyreduce: case 97: /* Line 1806 of yacc.c */ -#line 929 "cf-parse.y" +#line 935 "cf-parse.y" { conf_zone_start(scanner, (yyvsp[(1) - (1)].tok).t); } break; case 101: /* Line 1806 of yacc.c */ -#line 936 "cf-parse.y" +#line 942 "cf-parse.y" { this_zone->file = (yyvsp[(3) - (4)].tok).t; } break; case 102: /* Line 1806 of yacc.c */ -#line 937 "cf-parse.y" +#line 943 "cf-parse.y" { this_zone->build_diffs = (yyvsp[(3) - (4)].tok).i; } break; case 103: /* Line 1806 of yacc.c */ -#line 938 "cf-parse.y" +#line 944 "cf-parse.y" { this_zone->enable_checks = (yyvsp[(3) - (4)].tok).i; } break; case 104: /* Line 1806 of yacc.c */ -#line 939 "cf-parse.y" +#line 945 "cf-parse.y" { this_zone->storage = (yyvsp[(3) - (4)].tok).t; } break; case 105: /* Line 1806 of yacc.c */ -#line 940 "cf-parse.y" +#line 946 "cf-parse.y" { this_zone->dnssec_keydir = (yyvsp[(3) - (4)].tok).t; } break; case 106: /* Line 1806 of yacc.c */ -#line 941 "cf-parse.y" +#line 947 "cf-parse.y" { this_zone->disable_any = (yyvsp[(3) - (4)].tok).i; } break; case 107: /* Line 1806 of yacc.c */ -#line 942 "cf-parse.y" +#line 948 "cf-parse.y" { SET_INT(this_zone->dbsync_timeout, (yyvsp[(3) - (4)].tok).i, "zonefile-sync"); } @@ -3072,7 +3078,7 @@ yyreduce: case 108: /* Line 1806 of yacc.c */ -#line 945 "cf-parse.y" +#line 951 "cf-parse.y" { SET_INT(this_zone->dbsync_timeout, (yyvsp[(3) - (4)].tok).i, "zonefile-sync"); } @@ -3081,7 +3087,7 @@ yyreduce: case 109: /* Line 1806 of yacc.c */ -#line 948 "cf-parse.y" +#line 954 "cf-parse.y" { SET_SIZE(new_config->ixfr_fslimit, (yyvsp[(3) - (4)].tok).l, "ixfr-fslimit"); } @@ -3090,7 +3096,7 @@ yyreduce: case 110: /* Line 1806 of yacc.c */ -#line 951 "cf-parse.y" +#line 957 "cf-parse.y" { SET_SIZE(this_zone->ixfr_fslimit, (yyvsp[(3) - (4)].tok).i, "ixfr-fslimit"); } @@ -3099,7 +3105,7 @@ yyreduce: case 111: /* Line 1806 of yacc.c */ -#line 954 "cf-parse.y" +#line 960 "cf-parse.y" { SET_NUM(this_zone->notify_retries, (yyvsp[(3) - (4)].tok).i, 1, INT_MAX, "notify-retries"); } @@ -3108,7 +3114,7 @@ yyreduce: case 112: /* Line 1806 of yacc.c */ -#line 957 "cf-parse.y" +#line 963 "cf-parse.y" { SET_NUM(this_zone->notify_timeout, (yyvsp[(3) - (4)].tok).i, 1, INT_MAX, "notify-timeout"); } @@ -3117,14 +3123,14 @@ yyreduce: case 113: /* Line 1806 of yacc.c */ -#line 960 "cf-parse.y" +#line 966 "cf-parse.y" { this_zone->dnssec_enable = (yyvsp[(3) - (4)].tok).i; } break; case 114: /* Line 1806 of yacc.c */ -#line 961 "cf-parse.y" +#line 967 "cf-parse.y" { SET_NUM(this_zone->sig_lifetime, (yyvsp[(3) - (4)].tok).i, 10800, INT_MAX, "signature-lifetime"); } @@ -3133,7 +3139,7 @@ yyreduce: case 115: /* Line 1806 of yacc.c */ -#line 964 "cf-parse.y" +#line 970 "cf-parse.y" { SET_NUM(this_zone->sig_lifetime, (yyvsp[(3) - (4)].tok).i, 10800, INT_MAX, "signature-lifetime"); } @@ -3142,7 +3148,7 @@ yyreduce: case 116: /* Line 1806 of yacc.c */ -#line 967 "cf-parse.y" +#line 973 "cf-parse.y" { this_zone->serial_policy = (yyvsp[(3) - (4)].tok).i; } @@ -3151,28 +3157,28 @@ yyreduce: case 119: /* Line 1806 of yacc.c */ -#line 975 "cf-parse.y" +#line 981 "cf-parse.y" { new_config->disable_any = (yyvsp[(3) - (4)].tok).i; } break; case 120: /* Line 1806 of yacc.c */ -#line 976 "cf-parse.y" +#line 982 "cf-parse.y" { new_config->build_diffs = (yyvsp[(3) - (4)].tok).i; } break; case 121: /* Line 1806 of yacc.c */ -#line 977 "cf-parse.y" +#line 983 "cf-parse.y" { new_config->zone_checks = (yyvsp[(3) - (4)].tok).i; } break; case 122: /* Line 1806 of yacc.c */ -#line 978 "cf-parse.y" +#line 984 "cf-parse.y" { SET_SIZE(new_config->ixfr_fslimit, (yyvsp[(3) - (4)].tok).l, "ixfr-fslimit"); } @@ -3181,7 +3187,7 @@ yyreduce: case 123: /* Line 1806 of yacc.c */ -#line 981 "cf-parse.y" +#line 987 "cf-parse.y" { SET_SIZE(new_config->ixfr_fslimit, (yyvsp[(3) - (4)].tok).i, "ixfr-fslimit"); } @@ -3190,7 +3196,7 @@ yyreduce: case 124: /* Line 1806 of yacc.c */ -#line 984 "cf-parse.y" +#line 990 "cf-parse.y" { SET_NUM(new_config->notify_retries, (yyvsp[(3) - (4)].tok).i, 1, INT_MAX, "notify-retries"); } @@ -3199,7 +3205,7 @@ yyreduce: case 125: /* Line 1806 of yacc.c */ -#line 987 "cf-parse.y" +#line 993 "cf-parse.y" { SET_NUM(new_config->notify_timeout, (yyvsp[(3) - (4)].tok).i, 1, INT_MAX, "notify-timeout"); } @@ -3208,7 +3214,7 @@ yyreduce: case 126: /* Line 1806 of yacc.c */ -#line 990 "cf-parse.y" +#line 996 "cf-parse.y" { SET_NUM(new_config->dbsync_timeout, (yyvsp[(3) - (4)].tok).i, 0, INT_MAX, "zonefile-sync"); } @@ -3217,7 +3223,7 @@ yyreduce: case 127: /* Line 1806 of yacc.c */ -#line 993 "cf-parse.y" +#line 999 "cf-parse.y" { SET_NUM(new_config->dbsync_timeout, (yyvsp[(3) - (4)].tok).i, 0, INT_MAX, "zonefile-sync"); } @@ -3226,28 +3232,28 @@ yyreduce: case 128: /* Line 1806 of yacc.c */ -#line 996 "cf-parse.y" +#line 1002 "cf-parse.y" { new_config->storage = (yyvsp[(3) - (4)].tok).t; } break; case 129: /* Line 1806 of yacc.c */ -#line 997 "cf-parse.y" +#line 1003 "cf-parse.y" { new_config->dnssec_enable = (yyvsp[(3) - (4)].tok).i; } break; case 130: /* Line 1806 of yacc.c */ -#line 998 "cf-parse.y" +#line 1004 "cf-parse.y" { new_config->dnssec_keydir = (yyvsp[(3) - (4)].tok).t; } break; case 131: /* Line 1806 of yacc.c */ -#line 999 "cf-parse.y" +#line 1005 "cf-parse.y" { SET_NUM(new_config->sig_lifetime, (yyvsp[(3) - (4)].tok).i, 10800, INT_MAX, "signature-lifetime"); } @@ -3256,7 +3262,7 @@ yyreduce: case 132: /* Line 1806 of yacc.c */ -#line 1002 "cf-parse.y" +#line 1008 "cf-parse.y" { SET_NUM(new_config->sig_lifetime, (yyvsp[(3) - (4)].tok).i, 10800, INT_MAX, "signature-lifetime"); } @@ -3265,7 +3271,7 @@ yyreduce: case 133: /* Line 1806 of yacc.c */ -#line 1005 "cf-parse.y" +#line 1011 "cf-parse.y" { new_config->serial_policy = (yyvsp[(3) - (4)].tok).i; } @@ -3274,7 +3280,7 @@ yyreduce: case 134: /* Line 1806 of yacc.c */ -#line 1010 "cf-parse.y" +#line 1016 "cf-parse.y" { this_logmap = malloc(sizeof(conf_log_map_t)); this_logmap->source = 0; @@ -3286,21 +3292,21 @@ yyreduce: case 136: /* Line 1806 of yacc.c */ -#line 1020 "cf-parse.y" +#line 1026 "cf-parse.y" { this_logmap->prios |= (yyvsp[(2) - (3)].tok).i; } break; case 137: /* Line 1806 of yacc.c */ -#line 1021 "cf-parse.y" +#line 1027 "cf-parse.y" { this_logmap->prios |= (yyvsp[(2) - (3)].tok).i; } break; case 139: /* Line 1806 of yacc.c */ -#line 1025 "cf-parse.y" +#line 1031 "cf-parse.y" { this_logmap->source = (yyvsp[(2) - (3)].tok).i; this_logmap = 0; @@ -3310,7 +3316,7 @@ yyreduce: case 140: /* Line 1806 of yacc.c */ -#line 1031 "cf-parse.y" +#line 1037 "cf-parse.y" { /* Find already existing rule. */ this_log = 0; @@ -3337,7 +3343,7 @@ yyreduce: case 141: /* Line 1806 of yacc.c */ -#line 1054 "cf-parse.y" +#line 1060 "cf-parse.y" { /* Find already existing rule. */ this_log = 0; @@ -3368,7 +3374,7 @@ yyreduce: case 142: /* Line 1806 of yacc.c */ -#line 1081 "cf-parse.y" +#line 1087 "cf-parse.y" { } break; @@ -3376,21 +3382,21 @@ yyreduce: case 146: /* Line 1806 of yacc.c */ -#line 1090 "cf-parse.y" +#line 1096 "cf-parse.y" { new_config->logs_count = 0; } break; case 148: /* Line 1806 of yacc.c */ -#line 1094 "cf-parse.y" +#line 1100 "cf-parse.y" { conf_init_iface(scanner, NULL, -1); } break; case 149: /* Line 1806 of yacc.c */ -#line 1098 "cf-parse.y" +#line 1104 "cf-parse.y" { this_list = &new_config->ctl.allow; } @@ -3399,14 +3405,14 @@ yyreduce: case 150: /* Line 1806 of yacc.c */ -#line 1104 "cf-parse.y" +#line 1110 "cf-parse.y" { new_config->ctl.have = true; } break; case 151: /* Line 1806 of yacc.c */ -#line 1105 "cf-parse.y" +#line 1111 "cf-parse.y" { if (this_iface->address == 0) { cf_error(scanner, "control interface has no defined address"); @@ -3419,7 +3425,7 @@ yyreduce: case 152: /* Line 1806 of yacc.c */ -#line 1112 "cf-parse.y" +#line 1118 "cf-parse.y" { this_iface->address = (yyvsp[(3) - (4)].tok).t; this_iface->family = AF_UNIX; @@ -3431,7 +3437,7 @@ yyreduce: /* Line 1806 of yacc.c */ -#line 3435 "knot/conf/libknotd_la-cf-parse.c" +#line 3441 "knot/conf/libknotd_la-cf-parse.c" default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -3662,6 +3668,6 @@ yyreturn: /* Line 2067 of yacc.c */ -#line 1124 "cf-parse.y" +#line 1130 "cf-parse.y" diff --git a/src/knot/conf/libknotd_la-cf-parse.h b/src/knot/conf/libknotd_la-cf-parse.h index c082821..48c5c2f 100644 --- a/src/knot/conf/libknotd_la-cf-parse.h +++ b/src/knot/conf/libknotd_la-cf-parse.h @@ -175,7 +175,7 @@ typedef union YYSTYPE { /* Line 2068 of yacc.c */ -#line 436 "cf-parse.y" +#line 442 "cf-parse.y" struct { char *t; diff --git a/src/knot/server/zones.c b/src/knot/server/zones.c index eb87d3d..79c7f93 100644 --- a/src/knot/server/zones.c +++ b/src/knot/server/zones.c @@ -689,7 +689,6 @@ static int zones_load_changesets(const knot_zone_t *zone, ret = journal_read_node(zd->ixfr_db, n, (char*)chs->data); if (ret != KNOT_EOK) { dbg_xfr("xfr: failed to read data from journal\n"); - free(chs->data); journal_release(zd->ixfr_db); return KNOT_ERROR; } diff --git a/src/libknot/nameserver/name-server.c b/src/libknot/nameserver/name-server.c index a67feb4..1029889 100644 --- a/src/libknot/nameserver/name-server.c +++ b/src/libknot/nameserver/name-server.c @@ -927,8 +927,6 @@ static knot_dname_t *ns_next_closer(const knot_dname_t *closest_encloser, int ce_labels = knot_dname_labels(closest_encloser, NULL); int qname_labels = knot_dname_labels(name, NULL); - assert(ce_labels < qname_labels); - // the common labels should match assert(knot_dname_matched_labels(closest_encloser, name) == ce_labels); @@ -970,7 +968,7 @@ static int ns_put_nsec3_from_node(const knot_node_t *node, // add RRSIG for the RRSet if (res == KNOT_EOK && (rrset = knot_rrset_get_rrsigs(rrset)) != NULL && knot_rrset_rdata_rr_count(rrset)) { - res = knot_response_add_rrset_authority(resp, rrset, 0); + res = knot_response_add_rrset_authority(resp, rrset, KNOT_PF_CHECKDUP); } /*! \note TC bit is already set, if something went wrong. */ @@ -1909,7 +1907,8 @@ static int ns_answer_from_node(const knot_node_t *node, return ret; } - if (knot_dname_is_wildcard(node->owner)) { + /* Query for wildcard is not a RFC5155 7.2.6 'Wildcard Answer Response' */ + if (!knot_dname_is_wildcard(qname) && knot_dname_is_wildcard(node->owner)) { dbg_ns_verb("Putting NSEC/NSEC3 for wildcard" " NODATA\n"); ret = ns_put_nsec_nsec3_wildcard_nodata(node, @@ -2090,31 +2089,6 @@ dbg_ns_exec_verb( /*----------------------------------------------------------------------------*/ /*! - * \brief Adds DNSKEY RRSet from the apex of a zone to the response. - * - * \param apex Zone apex node. - * \param resp Response. - */ -static int ns_add_dnskey(const knot_node_t *apex, knot_packet_t *resp) -{ - knot_rrset_t *rrset = - knot_node_get_rrset(apex, KNOT_RRTYPE_DNSKEY); - - int ret = KNOT_EOK; - - if (rrset != NULL) { - ret = knot_response_add_rrset_additional(resp, rrset, KNOT_PF_NOTRUNC); - if (ret == KNOT_EOK) { - ret = ns_add_rrsigs(rrset, resp, apex->owner, - knot_response_add_rrset_additional, KNOT_PF_NOTRUNC); - } - } - - return ret; -} - -/*----------------------------------------------------------------------------*/ -/*! * \brief Answers the query from the given zone. * * This function performs the actual answering logic. @@ -2327,16 +2301,6 @@ dbg_ns_exec_verb( knot_response_set_aa(resp); knot_response_set_rcode(resp, KNOT_RCODE_NOERROR); - // this is the only case when the servers answers from - // particular node, i.e. the only case when it may return SOA - // or NS records in Answer section - if (knot_packet_tc(resp) == 0 && DNSSEC_ENABLED - && knot_query_dnssec_requested(knot_packet_query(resp)) - && node == knot_zone_contents_apex(zone) - && (qtype == KNOT_RRTYPE_SOA || qtype == KNOT_RRTYPE_NS)) { - ret = ns_add_dnskey(node, resp); - } - finalize: if (ret == KNOT_EOK && knot_packet_tc(resp) == 0 && auth_soa) { ret = ns_put_authority_soa(zone, resp); diff --git a/src/libknot/rrset-dump.c b/src/libknot/rrset-dump.c index 4e214f7..263df9f 100644 --- a/src/libknot/rrset-dump.c +++ b/src/libknot/rrset-dump.c @@ -1989,9 +1989,8 @@ int knot_rrset_txt_dump(const knot_rrset_t *rrset, int ret; if (dump_rdata) { - // APL RR may have empty RDATA, in this case, dump only header. - if (rrset->rdata_count == 0 - && knot_rrset_type(rrset) == KNOT_RRTYPE_APL) { + // APL RR or UPDATE delete may have empty RDATA => dump header. + if (rrset->rdata_count == 0) { // Dump rdata owner, class, ttl and type. ret = knot_rrset_txt_dump_header(rrset, dst + len, maxlen - len, style); diff --git a/src/utils/nsupdate/nsupdate_exec.c b/src/utils/nsupdate/nsupdate_exec.c index bbdaafa..35695e6 100644 --- a/src/utils/nsupdate/nsupdate_exec.c +++ b/src/utils/nsupdate/nsupdate_exec.c @@ -164,7 +164,9 @@ static int parse_partial_rr(scanner_t *s, const char *lp, unsigned flags) { /* Extract owner. */ size_t len = strcspn(lp, SEP_CHARS); - knot_dname_t *owner = knot_dname_from_str(lp); + char *owner_str = strndup(lp, len); + knot_dname_t *owner = knot_dname_from_str(owner_str); + free(owner_str); if (owner == NULL) { return KNOT_EPARSEFAIL; } @@ -447,11 +449,6 @@ static int nsupdate_process(nsupdate_params_t *params, FILE *fp) /* Process lines. */ int ret = tok_process_lines(fp, nsupdate_process_line, params); - /* Check for longing query. */ - if (params->pkt && ret == KNOT_EOK) { - cmd_send("", params); - } - /* Free last answer. */ if (params->resp) { knot_packet_free(¶ms->resp); @@ -829,6 +826,7 @@ int cmd_show(const char* lp, nsupdate_params_t *params) printf("Outgoing update query:\n"); size_t len = knot_packet_size(params->pkt); print_packet(params->pkt, len, NULL, -1, false, ¶ms->style); + printf("\n"); return KNOT_EOK; } diff --git a/src/zscanner/error.c b/src/zscanner/error.c index 4317529..28c2c20 100644 --- a/src/zscanner/error.c +++ b/src/zscanner/error.c @@ -45,6 +45,8 @@ const err_table_t err_msgs[] = { "Zone processing error." ), /* Zone scanner errors. */ + ERR_ITEM( ZSCANNER_DOS_NEWLINE, + "Unsupported CRLF newline. Please, remove CR bytes." ), ERR_ITEM( ZSCANNER_UNCOVERED_STATE, "General scanner error." ), ERR_ITEM( ZSCANNER_UNCLOSED_MULTILINE, @@ -58,7 +60,7 @@ const err_table_t err_msgs[] = { ERR_ITEM( ZSCANNER_EBAD_PREVIOUS_OWNER, "Previous owner is invalid." ), ERR_ITEM( ZSCANNER_EBAD_DNAME_CHAR, - "Bad domain name character." ), + "Invalid domain name character." ), ERR_ITEM( ZSCANNER_EBAD_OWNER, "Owner is invalid." ), ERR_ITEM( ZSCANNER_ELABEL_OVERFLOW, @@ -66,7 +68,7 @@ const err_table_t err_msgs[] = { ERR_ITEM( ZSCANNER_EDNAME_OVERFLOW, "Maximal domain name length has exceeded." ), ERR_ITEM( ZSCANNER_EBAD_NUMBER, - "Bad number." ), + "Invalid number." ), ERR_ITEM( ZSCANNER_ENUMBER64_OVERFLOW, "Number is too big." ), ERR_ITEM( ZSCANNER_ENUMBER32_OVERFLOW, @@ -82,59 +84,59 @@ const err_table_t err_msgs[] = { ERR_ITEM( ZSCANNER_EITEM_OVERFLOW, "Maximal item length has exceeded." ), ERR_ITEM( ZSCANNER_EBAD_ADDRESS_CHAR, - "Bad address character." ), + "Invalid address character." ), ERR_ITEM( ZSCANNER_EBAD_IPV4, - "Bad IPv4 address." ), + "Invalid IPv4 address." ), ERR_ITEM( ZSCANNER_EBAD_IPV6, - "Bad IPv6 address." ), + "Invalid IPv6 address." ), ERR_ITEM( ZSCANNER_EBAD_GATEWAY, - "Bad gateway." ), + "Invalid gateway." ), ERR_ITEM( ZSCANNER_EBAD_GATEWAY_KEY, - "Bad gateway key." ), + "Invalid gateway key." ), ERR_ITEM( ZSCANNER_EBAD_APL, - "Bad address prefix list." ), + "Invalid address prefix list." ), ERR_ITEM( ZSCANNER_EBAD_RDATA, - "Bad record data." ), + "Invalid record data." ), ERR_ITEM( ZSCANNER_EBAD_HEX_RDATA, - "Bad record data in hex format." ), + "Invalid record data in hex format." ), ERR_ITEM( ZSCANNER_EBAD_HEX_CHAR, - "Bad hexadecimal character." ), + "Invalid hexadecimal character." ), ERR_ITEM( ZSCANNER_EBAD_BASE64_CHAR, - "Bad Base64 character." ), + "Invalid Base64 character." ), ERR_ITEM( ZSCANNER_EBAD_BASE32HEX_CHAR, - "Bad Base32hex character." ), + "Invalid Base32hex character." ), ERR_ITEM( ZSCANNER_EBAD_REST, "Unexpected data." ), ERR_ITEM( ZSCANNER_EBAD_TIMESTAMP_CHAR, - "Bad timestamp character." ), + "Invalid timestamp character." ), ERR_ITEM( ZSCANNER_EBAD_TIMESTAMP_LENGTH, - "Bad timestamp length." ), + "Invalid timestamp length." ), ERR_ITEM( ZSCANNER_EBAD_TIMESTAMP, - "Bad timestamp." ), + "Invalid timestamp." ), ERR_ITEM( ZSCANNER_EBAD_DATE, - "Bad date." ), + "Invalid date." ), ERR_ITEM( ZSCANNER_EBAD_TIME, - "Bad time." ), + "Invalid time." ), ERR_ITEM( ZSCANNER_EBAD_TIME_UNIT, - "Bad time unit." ), + "Invalid time unit." ), ERR_ITEM( ZSCANNER_EBAD_BITMAP, - "Bad bitmap." ), + "Invalid bitmap." ), ERR_ITEM( ZSCANNER_ETEXT_OVERFLOW, "Text is too long." ), ERR_ITEM( ZSCANNER_EBAD_TEXT_CHAR, - "Bad text character." ), + "Invalid text character." ), ERR_ITEM( ZSCANNER_EBAD_TEXT, - "Bad text string." ), + "Invalid text string." ), ERR_ITEM( ZSCANNER_EBAD_DIRECTIVE, - "Bad directive." ), + "Invalid directive." ), ERR_ITEM( ZSCANNER_EBAD_TTL, - "Bad zone TTL." ), + "Invalid zone TTL." ), ERR_ITEM( ZSCANNER_EBAD_ORIGIN, - "Bad zone origin." ), + "Invalid FQDN zone origin." ), ERR_ITEM( ZSCANNER_EBAD_INCLUDE_FILENAME, - "Bad filename in include directive." ), + "Invalid filename in include directive." ), ERR_ITEM( ZSCANNER_EBAD_INCLUDE_ORIGIN, - "Bad origin in include directive." ), + "Invalid origin in include directive." ), ERR_ITEM( ZSCANNER_EUNPROCESSED_INCLUDE, "Include file processing error." ), ERR_ITEM( ZSCANNER_EUNOPENED_INCLUDE, @@ -144,17 +146,17 @@ const err_table_t err_msgs[] = { ERR_ITEM( ZSCANNER_ECANNOT_TEXT_DATA, "Unable to process text form for this type." ), ERR_ITEM( ZSCANNER_EBAD_LOC_DATA, - "Bad zone location data." ), + "Invalid zone location data." ), ERR_ITEM( ZSCANNER_EUNKNOWN_BLOCK, "Unknown rdata block." ), ERR_ITEM( ZSCANNER_EBAD_ALGORITHM, - "Bad algorithm." ), + "Invalid algorithm." ), ERR_ITEM( ZSCANNER_EBAD_CERT_TYPE, - "Bad certificate type." ), + "Invalid certificate type." ), ERR_ITEM( ZSCANNER_EBAD_EUI_LENGTH, - "Bad EUI length." ), + "Invalid EUI length." ), ERR_ITEM( ZSCANNER_EBAD_L64_LENGTH, - "Bad 64-bit locator." ), + "Invalid 64-bit locator." ), ERR_ITEM( ZSCANNER_EBAD_CHAR_COLON, "Missing colon character." ), ERR_ITEM( ZSCANNER_EBAD_CHAR_DASH, diff --git a/src/zscanner/error.h b/src/zscanner/error.h index 6c7766b..b860ba6 100644 --- a/src/zscanner/error.h +++ b/src/zscanner/error.h @@ -35,6 +35,7 @@ enum err_codes { FLOADER_EMUNMAP, FLOADER_ESCANNER, + ZSCANNER_DOS_NEWLINE, ZSCANNER_UNCOVERED_STATE, ZSCANNER_UNCLOSED_MULTILINE, ZSCANNER_ELEFT_PARENTHESIS, diff --git a/src/zscanner/scanner.c b/src/zscanner/scanner.c index 8441b31..36b76ba 100644 --- a/src/zscanner/scanner.c +++ b/src/zscanner/scanner.c @@ -5087,21 +5087,21 @@ _resume: case 2: { _widec = (short)(128 + ((*p) - -128)); if ( -#line 551 "./scanner_body.rl" +#line 555 "./scanner_body.rl" s->multiline ) _widec += 256; break; } case 3: { _widec = (short)(2688 + ((*p) - -128)); if ( -#line 1170 "./scanner_body.rl" +#line 1174 "./scanner_body.rl" s->number64 != 0 ) _widec += 256; break; } case 4: { _widec = (short)(4224 + ((*p) - -128)); if ( -#line 1171 "./scanner_body.rl" +#line 1175 "./scanner_body.rl" s->number64 == 0 ) _widec += 256; break; } @@ -5121,7 +5121,7 @@ _resume: #line 54 "./scanner_body.rl" s->multiline ) _widec += 256; if ( -#line 1170 "./scanner_body.rl" +#line 1174 "./scanner_body.rl" s->number64 != 0 ) _widec += 512; break; } @@ -5131,17 +5131,17 @@ _resume: #line 54 "./scanner_body.rl" s->multiline ) _widec += 256; if ( -#line 1171 "./scanner_body.rl" +#line 1175 "./scanner_body.rl" s->number64 == 0 ) _widec += 512; break; } case 8: { _widec = (short)(5760 + ((*p) - -128)); if ( -#line 1170 "./scanner_body.rl" +#line 1174 "./scanner_body.rl" s->number64 != 0 ) _widec += 256; if ( -#line 1171 "./scanner_body.rl" +#line 1175 "./scanner_body.rl" s->number64 == 0 ) _widec += 512; break; } @@ -5154,7 +5154,7 @@ _resume: #line 63 "./scanner_body.rl" !s->multiline ) _widec += 512; if ( -#line 1171 "./scanner_body.rl" +#line 1175 "./scanner_body.rl" s->number64 == 0 ) _widec += 1024; break; } @@ -5164,10 +5164,10 @@ _resume: #line 54 "./scanner_body.rl" s->multiline ) _widec += 256; if ( -#line 1170 "./scanner_body.rl" +#line 1174 "./scanner_body.rl" s->number64 != 0 ) _widec += 512; if ( -#line 1171 "./scanner_body.rl" +#line 1175 "./scanner_body.rl" s->number64 == 0 ) _widec += 1024; break; } @@ -5180,10 +5180,10 @@ _resume: #line 63 "./scanner_body.rl" !s->multiline ) _widec += 512; if ( -#line 1170 "./scanner_body.rl" +#line 1174 "./scanner_body.rl" s->number64 != 0 ) _widec += 1024; if ( -#line 1171 "./scanner_body.rl" +#line 1175 "./scanner_body.rl" s->number64 == 0 ) _widec += 2048; break; } @@ -5302,13 +5302,17 @@ _match: case 6: #line 70 "./scanner_body.rl" { + if ((*p) == '\r') { + ERR(ZSCANNER_DOS_NEWLINE); + } + if (s->buffer_length < sizeof(s->buffer) - 1) { s->buffer[s->buffer_length++] = (*p); } } break; case 7: -#line 75 "./scanner_body.rl" +#line 79 "./scanner_body.rl" { // Ending string in buffer. s->buffer[s->buffer_length++] = 0; @@ -5333,18 +5337,18 @@ _match: } break; case 8: -#line 100 "./scanner_body.rl" +#line 104 "./scanner_body.rl" { {cs = 1059; goto _again;} } break; case 9: -#line 104 "./scanner_body.rl" +#line 108 "./scanner_body.rl" { s->item_length = 0; s->item_length_position = s->dname_tmp_length++; } break; case 10: -#line 108 "./scanner_body.rl" +#line 112 "./scanner_body.rl" { if (s->item_length < MAX_LABEL_LENGTH) { (s->dname)[s->dname_tmp_length++] = (*p); @@ -5356,7 +5360,7 @@ _match: } break; case 11: -#line 117 "./scanner_body.rl" +#line 121 "./scanner_body.rl" { if (s->dname_tmp_length < MAX_DNAME_LENGTH) { (s->dname)[s->item_length_position] = @@ -5368,7 +5372,7 @@ _match: } break; case 12: -#line 127 "./scanner_body.rl" +#line 131 "./scanner_body.rl" { if (s->item_length < MAX_LABEL_LENGTH) { (s->dname)[s->dname_tmp_length] = 0; @@ -5380,33 +5384,33 @@ _match: } break; case 13: -#line 136 "./scanner_body.rl" +#line 140 "./scanner_body.rl" { (s->dname)[s->dname_tmp_length] *= 10; (s->dname)[s->dname_tmp_length] += digit_to_num[(uint8_t)(*p)]; } break; case 14: -#line 140 "./scanner_body.rl" +#line 144 "./scanner_body.rl" { s->dname_tmp_length++; } break; case 15: -#line 143 "./scanner_body.rl" +#line 147 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_NUMBER); p--; {cs = 246; goto _again;} } break; case 16: -#line 162 "./scanner_body.rl" +#line 166 "./scanner_body.rl" { (s->dname)[s->dname_tmp_length++] = 0; } break; case 17: -#line 165 "./scanner_body.rl" +#line 169 "./scanner_body.rl" { memcpy(s->dname + s->dname_tmp_length, s->zone_origin, @@ -5421,7 +5425,7 @@ _match: } break; case 18: -#line 177 "./scanner_body.rl" +#line 181 "./scanner_body.rl" { memcpy(s->dname, s->zone_origin, @@ -5431,31 +5435,31 @@ _match: } break; case 19: -#line 185 "./scanner_body.rl" +#line 189 "./scanner_body.rl" { s->item_length_position = 0; s->dname_tmp_length = 0; } break; case 20: -#line 189 "./scanner_body.rl" +#line 193 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_DNAME_CHAR); p--; {cs = 246; goto _again;} } break; case 21: -#line 201 "./scanner_body.rl" +#line 205 "./scanner_body.rl" { p--; {stack[top++] = cs; cs = 248; goto _again;} } break; case 22: -#line 205 "./scanner_body.rl" +#line 209 "./scanner_body.rl" { s->item_length_location = rdata_tail++; } break; case 23: -#line 208 "./scanner_body.rl" +#line 212 "./scanner_body.rl" { s->item_length = rdata_tail - s->item_length_location - 1; @@ -5468,20 +5472,20 @@ _match: } break; case 24: -#line 221 "./scanner_body.rl" +#line 225 "./scanner_body.rl" { s->dname = s->r_owner; s->r_owner_length = 0; } break; case 25: -#line 225 "./scanner_body.rl" +#line 229 "./scanner_body.rl" { s->r_owner_length = s->dname_tmp_length; } break; case 26: -#line 228 "./scanner_body.rl" +#line 232 "./scanner_body.rl" { if (s->r_owner_length == 0) { WARN(ZSCANNER_EBAD_PREVIOUS_OWNER); @@ -5490,7 +5494,7 @@ _match: } break; case 27: -#line 234 "./scanner_body.rl" +#line 238 "./scanner_body.rl" { s->r_owner_length = 0; WARN(ZSCANNER_EBAD_OWNER); @@ -5498,19 +5502,19 @@ _match: } break; case 28: -#line 246 "./scanner_body.rl" +#line 250 "./scanner_body.rl" { s->dname = rdata_tail; } break; case 29: -#line 249 "./scanner_body.rl" +#line 253 "./scanner_body.rl" { rdata_tail += s->dname_tmp_length; } break; case 30: -#line 257 "./scanner_body.rl" +#line 261 "./scanner_body.rl" { // Overflow check: 10*(s->number64) + fc - ASCII_0 <= UINT64_MAX if ((s->number64 < (UINT64_MAX / 10)) || // Dominant fast check. @@ -5527,38 +5531,38 @@ _match: } break; case 31: -#line 274 "./scanner_body.rl" +#line 278 "./scanner_body.rl" { s->number64 = 0; } break; case 32: -#line 277 "./scanner_body.rl" +#line 281 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_NUMBER); p--; {cs = 246; goto _again;} } break; case 33: -#line 285 "./scanner_body.rl" +#line 289 "./scanner_body.rl" { s->decimal_counter = 0; } break; case 34: -#line 288 "./scanner_body.rl" +#line 292 "./scanner_body.rl" { s->number64_tmp = s->number64; } break; case 35: -#line 291 "./scanner_body.rl" +#line 295 "./scanner_body.rl" { s->decimal_counter++; } break; case 36: -#line 295 "./scanner_body.rl" +#line 299 "./scanner_body.rl" { if (s->decimal_counter == 0 && s->number64 < UINT32_MAX) { s->number64 *= pow(10, s->decimals); @@ -5573,19 +5577,19 @@ _match: } break; case 37: -#line 312 "./scanner_body.rl" +#line 316 "./scanner_body.rl" { s->decimals = 2; } break; case 38: -#line 315 "./scanner_body.rl" +#line 319 "./scanner_body.rl" { s->decimals = 3; } break; case 39: -#line 324 "./scanner_body.rl" +#line 328 "./scanner_body.rl" { if (s->number64 <= UINT8_MAX) { *rdata_tail = (uint8_t)(s->number64); @@ -5597,7 +5601,7 @@ _match: } break; case 40: -#line 333 "./scanner_body.rl" +#line 337 "./scanner_body.rl" { if (s->number64 <= UINT16_MAX) { *((uint16_t *)rdata_tail) = htons((uint16_t)(s->number64)); @@ -5609,7 +5613,7 @@ _match: } break; case 41: -#line 342 "./scanner_body.rl" +#line 346 "./scanner_body.rl" { if (s->number64 <= UINT32_MAX) { *((uint32_t *)rdata_tail) = htonl((uint32_t)(s->number64)); @@ -5621,7 +5625,7 @@ _match: } break; case 42: -#line 352 "./scanner_body.rl" +#line 356 "./scanner_body.rl" { if (s->number64 <= UINT16_MAX) { s->r_type = (uint16_t)(s->number64); @@ -5632,7 +5636,7 @@ _match: } break; case 43: -#line 361 "./scanner_body.rl" +#line 365 "./scanner_body.rl" { if (s->number64 <= UINT16_MAX) { s->r_data_length = (uint16_t)(s->number64); @@ -5643,14 +5647,14 @@ _match: } break; case 44: -#line 378 "./scanner_body.rl" +#line 382 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_TIME_UNIT); p--; {cs = 246; goto _again;} } break; case 45: -#line 385 "./scanner_body.rl" +#line 389 "./scanner_body.rl" { if (s->number64 <= (UINT32_MAX / 60)) { s->number64 *= 60; } else { @@ -5660,7 +5664,7 @@ _match: } break; case 46: -#line 392 "./scanner_body.rl" +#line 396 "./scanner_body.rl" { if (s->number64 <= (UINT32_MAX / 3600)) { s->number64 *= 3600; } else { @@ -5670,7 +5674,7 @@ _match: } break; case 47: -#line 399 "./scanner_body.rl" +#line 403 "./scanner_body.rl" { if (s->number64 <= (UINT32_MAX / 86400)) { s->number64 *= 86400; } else { @@ -5680,7 +5684,7 @@ _match: } break; case 48: -#line 406 "./scanner_body.rl" +#line 410 "./scanner_body.rl" { if (s->number64 <= (UINT32_MAX / 604800)) { s->number64 *= 604800; } else { @@ -5690,13 +5694,13 @@ _match: } break; case 49: -#line 416 "./scanner_body.rl" +#line 420 "./scanner_body.rl" { s->number64_tmp = s->number64; } break; case 50: -#line 419 "./scanner_body.rl" +#line 423 "./scanner_body.rl" { if (s->number64 + s->number64_tmp < UINT32_MAX) { s->number64 += s->number64_tmp; @@ -5707,13 +5711,13 @@ _match: } break; case 51: -#line 437 "./scanner_body.rl" +#line 441 "./scanner_body.rl" { s->buffer_length = 0; } break; case 52: -#line 440 "./scanner_body.rl" +#line 444 "./scanner_body.rl" { if (s->buffer_length < MAX_RDATA_LENGTH) { s->buffer[s->buffer_length++] = (*p); @@ -5724,7 +5728,7 @@ _match: } break; case 53: -#line 448 "./scanner_body.rl" +#line 452 "./scanner_body.rl" { s->buffer[s->buffer_length] = 0; @@ -5762,14 +5766,14 @@ _match: } break; case 54: -#line 483 "./scanner_body.rl" +#line 487 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_TIMESTAMP_CHAR); p--; {cs = 246; goto _again;} } break; case 55: -#line 493 "./scanner_body.rl" +#line 497 "./scanner_body.rl" { if (rdata_tail <= rdata_stop) { *(rdata_tail++) = (*p); @@ -5780,21 +5784,21 @@ _match: } break; case 56: -#line 501 "./scanner_body.rl" +#line 505 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_TEXT_CHAR); p--; {cs = 246; goto _again;} } break; case 57: -#line 505 "./scanner_body.rl" +#line 509 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_TEXT); p--; {cs = 246; goto _again;} } break; case 58: -#line 510 "./scanner_body.rl" +#line 514 "./scanner_body.rl" { if (rdata_tail <= rdata_stop) { *rdata_tail = 0; @@ -5806,7 +5810,7 @@ _match: } break; case 59: -#line 519 "./scanner_body.rl" +#line 523 "./scanner_body.rl" { if ((*rdata_tail < (UINT8_MAX / 10)) || // Dominant fast check. ((*rdata_tail == (UINT8_MAX / 10)) && // Marginal case. @@ -5822,24 +5826,24 @@ _match: } break; case 60: -#line 532 "./scanner_body.rl" +#line 536 "./scanner_body.rl" { rdata_tail++; } break; case 61: -#line 535 "./scanner_body.rl" +#line 539 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_NUMBER); p--; {cs = 246; goto _again;} } break; case 62: -#line 557 "./scanner_body.rl" +#line 561 "./scanner_body.rl" { p--; {stack[top++] = cs; cs = 258; goto _again;} } break; case 63: -#line 567 "./scanner_body.rl" +#line 571 "./scanner_body.rl" { if (s->number64 <= UINT32_MAX) { s->default_ttl = (uint32_t)(s->number64); @@ -5850,47 +5854,47 @@ _match: } break; case 64: -#line 575 "./scanner_body.rl" +#line 579 "./scanner_body.rl" { ERR(ZSCANNER_EBAD_TTL); p--; {cs = 246; goto _again;} } break; case 65: -#line 582 "./scanner_body.rl" +#line 586 "./scanner_body.rl" { p--; {stack[top++] = cs; cs = 270; goto _again;} } break; case 66: -#line 586 "./scanner_body.rl" +#line 590 "./scanner_body.rl" { s->dname = s->zone_origin; } break; case 67: -#line 589 "./scanner_body.rl" +#line 593 "./scanner_body.rl" { s->zone_origin_length = s->dname_tmp_length; } break; case 68: -#line 592 "./scanner_body.rl" +#line 596 "./scanner_body.rl" { ERR(ZSCANNER_EBAD_ORIGIN); p--; {cs = 246; goto _again;} } break; case 69: -#line 599 "./scanner_body.rl" +#line 603 "./scanner_body.rl" { p--; {stack[top++] = cs; cs = 279; goto _again;} } break; case 70: -#line 603 "./scanner_body.rl" +#line 607 "./scanner_body.rl" { rdata_tail = s->r_data; } break; case 71: -#line 606 "./scanner_body.rl" +#line 610 "./scanner_body.rl" { *rdata_tail = 0; // Ending filename string. strncpy((char*)(s->include_filename), (char*)(s->r_data), @@ -5908,33 +5912,33 @@ _match: } break; case 72: -#line 621 "./scanner_body.rl" +#line 625 "./scanner_body.rl" { ERR(ZSCANNER_EBAD_INCLUDE_FILENAME); p--; {cs = 246; goto _again;} } break; case 73: -#line 626 "./scanner_body.rl" +#line 630 "./scanner_body.rl" { s->dname = s->r_data; } break; case 74: -#line 629 "./scanner_body.rl" +#line 633 "./scanner_body.rl" { s->r_data_length = s->dname_tmp_length; } break; case 75: -#line 632 "./scanner_body.rl" +#line 636 "./scanner_body.rl" { ERR(ZSCANNER_EBAD_INCLUDE_ORIGIN); p--; {cs = 246; goto _again;} } break; case 76: -#line 637 "./scanner_body.rl" +#line 641 "./scanner_body.rl" { char text_origin[4 * MAX_DNAME_LENGTH]; // Each char as \DDD. @@ -5982,48 +5986,48 @@ _match: } break; case 77: -#line 690 "./scanner_body.rl" +#line 694 "./scanner_body.rl" { p--; {stack[top++] = cs; cs = 292; goto _again;} } break; case 78: -#line 696 "./scanner_body.rl" +#line 700 "./scanner_body.rl" { s->stop = true; } break; case 79: -#line 700 "./scanner_body.rl" +#line 704 "./scanner_body.rl" { s->stop = false; } break; case 80: -#line 703 "./scanner_body.rl" +#line 707 "./scanner_body.rl" { ERR(ZSCANNER_EBAD_DIRECTIVE); p--; {cs = 246; goto _again;} } break; case 81: -#line 715 "./scanner_body.rl" +#line 719 "./scanner_body.rl" { s->r_class = s->default_class; } break; case 82: -#line 719 "./scanner_body.rl" +#line 723 "./scanner_body.rl" { s->r_ttl = s->default_ttl; } break; case 83: -#line 723 "./scanner_body.rl" +#line 727 "./scanner_body.rl" { s->r_class = KNOT_CLASS_IN; } break; case 84: -#line 727 "./scanner_body.rl" +#line 731 "./scanner_body.rl" { if (s->number64 <= UINT32_MAX) { s->r_ttl = (uint32_t)(s->number64); @@ -6034,13 +6038,13 @@ _match: } break; case 85: -#line 742 "./scanner_body.rl" +#line 746 "./scanner_body.rl" { s->buffer_length = 0; } break; case 86: -#line 745 "./scanner_body.rl" +#line 749 "./scanner_body.rl" { if (s->buffer_length < MAX_RDATA_LENGTH) { s->buffer[s->buffer_length++] = (*p); @@ -6052,14 +6056,14 @@ _match: } break; case 87: -#line 754 "./scanner_body.rl" +#line 758 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_ADDRESS_CHAR); p--; {cs = 246; goto _again;} } break; case 88: -#line 759 "./scanner_body.rl" +#line 763 "./scanner_body.rl" { s->buffer[s->buffer_length] = 0; @@ -6070,14 +6074,14 @@ _match: } break; case 89: -#line 767 "./scanner_body.rl" +#line 771 "./scanner_body.rl" { memcpy(rdata_tail, &(addr4.s_addr), INET4_ADDR_LENGTH); rdata_tail += INET4_ADDR_LENGTH; } break; case 90: -#line 772 "./scanner_body.rl" +#line 776 "./scanner_body.rl" { s->buffer[s->buffer_length] = 0; @@ -6088,38 +6092,38 @@ _match: } break; case 91: -#line 780 "./scanner_body.rl" +#line 784 "./scanner_body.rl" { memcpy(rdata_tail, &(addr6.s6_addr), INET6_ADDR_LENGTH); rdata_tail += INET6_ADDR_LENGTH; } break; case 92: -#line 797 "./scanner_body.rl" +#line 801 "./scanner_body.rl" { memset(&(s->apl), 0, sizeof(s->apl)); } break; case 93: -#line 800 "./scanner_body.rl" +#line 804 "./scanner_body.rl" { s->apl.excl_flag = 128; // dec 128 = bin 10000000. } break; case 94: -#line 803 "./scanner_body.rl" +#line 807 "./scanner_body.rl" { s->apl.addr_family = 1; } break; case 95: -#line 806 "./scanner_body.rl" +#line 810 "./scanner_body.rl" { s->apl.addr_family = 2; } break; case 96: -#line 809 "./scanner_body.rl" +#line 813 "./scanner_body.rl" { if ((s->apl.addr_family == 1 && s->number64 <= 32) || (s->apl.addr_family == 2 && s->number64 <= 128)) { @@ -6131,7 +6135,7 @@ _match: } break; case 97: -#line 818 "./scanner_body.rl" +#line 822 "./scanner_body.rl" { // Write address family. *((uint16_t *)rdata_tail) = htons(s->apl.addr_family); @@ -6170,14 +6174,14 @@ _match: } break; case 98: -#line 854 "./scanner_body.rl" +#line 858 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_APL); p--; {cs = 246; goto _again;} } break; case 99: -#line 872 "./scanner_body.rl" +#line 876 "./scanner_body.rl" { if (rdata_tail <= rdata_stop) { *rdata_tail = first_hex_to_num[(uint8_t)(*p)]; @@ -6188,21 +6192,21 @@ _match: } break; case 100: -#line 880 "./scanner_body.rl" +#line 884 "./scanner_body.rl" { *rdata_tail += second_hex_to_num[(uint8_t)(*p)]; rdata_tail++; } break; case 101: -#line 884 "./scanner_body.rl" +#line 888 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_HEX_CHAR); p--; {cs = 246; goto _again;} } break; case 102: -#line 898 "./scanner_body.rl" +#line 902 "./scanner_body.rl" { if ((rdata_tail - s->r_data) != s->r_data_length) { WARN(ZSCANNER_EBAD_RDATA_LENGTH); @@ -6211,14 +6215,14 @@ _match: } break; case 103: -#line 905 "./scanner_body.rl" +#line 909 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_HEX_RDATA); p--; {cs = 246; goto _again;} } break; case 104: -#line 915 "./scanner_body.rl" +#line 919 "./scanner_body.rl" { if (rdata_tail <= rdata_stop) { *rdata_tail = first_base64_to_num[(uint8_t)(*p)]; @@ -6229,7 +6233,7 @@ _match: } break; case 105: -#line 923 "./scanner_body.rl" +#line 927 "./scanner_body.rl" { *(rdata_tail++) += second_left_base64_to_num[(uint8_t)(*p)]; @@ -6242,7 +6246,7 @@ _match: } break; case 106: -#line 933 "./scanner_body.rl" +#line 937 "./scanner_body.rl" { *(rdata_tail++) += third_left_base64_to_num[(uint8_t)(*p)]; @@ -6255,24 +6259,24 @@ _match: } break; case 107: -#line 943 "./scanner_body.rl" +#line 947 "./scanner_body.rl" { *(rdata_tail++) += fourth_base64_to_num[(uint8_t)(*p)]; } break; case 108: -#line 947 "./scanner_body.rl" +#line 951 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_BASE64_CHAR); p--; {cs = 246; goto _again;} } break; case 109: -#line 969 "./scanner_body.rl" +#line 973 "./scanner_body.rl" { p--; {stack[top++] = cs; cs = 310; goto _again;} } break; case 110: -#line 973 "./scanner_body.rl" +#line 977 "./scanner_body.rl" { if (rdata_tail <= rdata_stop) { *rdata_tail = first_base32hex_to_num[(uint8_t)(*p)]; @@ -6283,7 +6287,7 @@ _match: } break; case 111: -#line 981 "./scanner_body.rl" +#line 985 "./scanner_body.rl" { *(rdata_tail++) += second_left_base32hex_to_num[(uint8_t)(*p)]; @@ -6296,13 +6300,13 @@ _match: } break; case 112: -#line 991 "./scanner_body.rl" +#line 995 "./scanner_body.rl" { *rdata_tail += third_base32hex_to_num[(uint8_t)(*p)]; } break; case 113: -#line 994 "./scanner_body.rl" +#line 998 "./scanner_body.rl" { *(rdata_tail++) += fourth_left_base32hex_to_num[(uint8_t)(*p)]; @@ -6315,7 +6319,7 @@ _match: } break; case 114: -#line 1004 "./scanner_body.rl" +#line 1008 "./scanner_body.rl" { *(rdata_tail++) += fifth_left_base32hex_to_num[(uint8_t)(*p)]; @@ -6328,13 +6332,13 @@ _match: } break; case 115: -#line 1014 "./scanner_body.rl" +#line 1018 "./scanner_body.rl" { *rdata_tail += sixth_base32hex_to_num[(uint8_t)(*p)]; } break; case 116: -#line 1017 "./scanner_body.rl" +#line 1021 "./scanner_body.rl" { *(rdata_tail++) += seventh_left_base32hex_to_num[(uint8_t)(*p)]; @@ -6347,353 +6351,353 @@ _match: } break; case 117: -#line 1027 "./scanner_body.rl" +#line 1031 "./scanner_body.rl" { *(rdata_tail++) += eighth_base32hex_to_num[(uint8_t)(*p)]; } break; case 118: -#line 1031 "./scanner_body.rl" +#line 1035 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_BASE32HEX_CHAR); p--; {cs = 246; goto _again;} } break; case 119: -#line 1066 "./scanner_body.rl" +#line 1070 "./scanner_body.rl" { *(rdata_tail++) = 0; } break; case 120: -#line 1069 "./scanner_body.rl" +#line 1073 "./scanner_body.rl" { *(rdata_tail++) = 1; } break; case 121: -#line 1072 "./scanner_body.rl" +#line 1076 "./scanner_body.rl" { *(rdata_tail++) = 2; } break; case 122: -#line 1075 "./scanner_body.rl" +#line 1079 "./scanner_body.rl" { *(rdata_tail++) = 3; } break; case 123: -#line 1078 "./scanner_body.rl" +#line 1082 "./scanner_body.rl" { *(rdata_tail++) = 5; } break; case 124: -#line 1081 "./scanner_body.rl" +#line 1085 "./scanner_body.rl" { *(rdata_tail++) = 6; } break; case 125: -#line 1084 "./scanner_body.rl" +#line 1088 "./scanner_body.rl" { *(rdata_tail++) = 7; } break; case 126: -#line 1087 "./scanner_body.rl" +#line 1091 "./scanner_body.rl" { *(rdata_tail++) = 8; } break; case 127: -#line 1090 "./scanner_body.rl" +#line 1094 "./scanner_body.rl" { *(rdata_tail++) = 10; } break; case 128: -#line 1093 "./scanner_body.rl" +#line 1097 "./scanner_body.rl" { *(rdata_tail++) = 12; } break; case 129: -#line 1096 "./scanner_body.rl" +#line 1100 "./scanner_body.rl" { *(rdata_tail++) = 13; } break; case 130: -#line 1099 "./scanner_body.rl" +#line 1103 "./scanner_body.rl" { *(rdata_tail++) = 14; } break; case 131: -#line 1102 "./scanner_body.rl" +#line 1106 "./scanner_body.rl" { *(rdata_tail++) = 252; } break; case 132: -#line 1105 "./scanner_body.rl" +#line 1109 "./scanner_body.rl" { *(rdata_tail++) = 253; } break; case 133: -#line 1108 "./scanner_body.rl" +#line 1112 "./scanner_body.rl" { *(rdata_tail++) = 254; } break; case 134: -#line 1112 "./scanner_body.rl" +#line 1116 "./scanner_body.rl" { *((uint16_t *)rdata_tail) = htons(1); rdata_tail += 2; } break; case 135: -#line 1116 "./scanner_body.rl" +#line 1120 "./scanner_body.rl" { *((uint16_t *)rdata_tail) = htons(2); rdata_tail += 2; } break; case 136: -#line 1120 "./scanner_body.rl" +#line 1124 "./scanner_body.rl" { *((uint16_t *)rdata_tail) = htons(3); rdata_tail += 2; } break; case 137: -#line 1124 "./scanner_body.rl" +#line 1128 "./scanner_body.rl" { *((uint16_t *)rdata_tail) = htons(4); rdata_tail += 2; } break; case 138: -#line 1128 "./scanner_body.rl" +#line 1132 "./scanner_body.rl" { *((uint16_t *)rdata_tail) = htons(5); rdata_tail += 2; } break; case 139: -#line 1132 "./scanner_body.rl" +#line 1136 "./scanner_body.rl" { *((uint16_t *)rdata_tail) = htons(6); rdata_tail += 2; } break; case 140: -#line 1136 "./scanner_body.rl" +#line 1140 "./scanner_body.rl" { *((uint16_t *)rdata_tail) = htons(7); rdata_tail += 2; } break; case 141: -#line 1140 "./scanner_body.rl" +#line 1144 "./scanner_body.rl" { *((uint16_t *)rdata_tail) = htons(8); rdata_tail += 2; } break; case 142: -#line 1144 "./scanner_body.rl" +#line 1148 "./scanner_body.rl" { *((uint16_t *)rdata_tail) = htons(253); rdata_tail += 2; } break; case 143: -#line 1148 "./scanner_body.rl" +#line 1152 "./scanner_body.rl" { *((uint16_t *)rdata_tail) = htons(254); rdata_tail += 2; } break; case 144: -#line 1155 "./scanner_body.rl" +#line 1159 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_GATEWAY); p--; {cs = 246; goto _again;} } break; case 145: -#line 1159 "./scanner_body.rl" +#line 1163 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_GATEWAY_KEY); p--; {cs = 246; goto _again;} } break; case 146: -#line 1177 "./scanner_body.rl" +#line 1181 "./scanner_body.rl" { WARN(ZSCANNER_EUNSUPPORTED_TYPE); p--; {cs = 246; goto _again;} } break; case 147: -#line 1183 "./scanner_body.rl" +#line 1187 "./scanner_body.rl" { type_num(KNOT_RRTYPE_A, &rdata_tail); } break; case 148: -#line 1184 "./scanner_body.rl" +#line 1188 "./scanner_body.rl" { type_num(KNOT_RRTYPE_NS, &rdata_tail); } break; case 149: -#line 1185 "./scanner_body.rl" +#line 1189 "./scanner_body.rl" { type_num(KNOT_RRTYPE_CNAME, &rdata_tail); } break; case 150: -#line 1186 "./scanner_body.rl" +#line 1190 "./scanner_body.rl" { type_num(KNOT_RRTYPE_SOA, &rdata_tail); } break; case 151: -#line 1187 "./scanner_body.rl" +#line 1191 "./scanner_body.rl" { type_num(KNOT_RRTYPE_PTR, &rdata_tail); } break; case 152: -#line 1188 "./scanner_body.rl" +#line 1192 "./scanner_body.rl" { type_num(KNOT_RRTYPE_HINFO, &rdata_tail); } break; case 153: -#line 1189 "./scanner_body.rl" +#line 1193 "./scanner_body.rl" { type_num(KNOT_RRTYPE_MINFO, &rdata_tail); } break; case 154: -#line 1190 "./scanner_body.rl" +#line 1194 "./scanner_body.rl" { type_num(KNOT_RRTYPE_MX, &rdata_tail); } break; case 155: -#line 1191 "./scanner_body.rl" +#line 1195 "./scanner_body.rl" { type_num(KNOT_RRTYPE_TXT, &rdata_tail); } break; case 156: -#line 1192 "./scanner_body.rl" +#line 1196 "./scanner_body.rl" { type_num(KNOT_RRTYPE_RP, &rdata_tail); } break; case 157: -#line 1193 "./scanner_body.rl" +#line 1197 "./scanner_body.rl" { type_num(KNOT_RRTYPE_AFSDB, &rdata_tail); } break; case 158: -#line 1194 "./scanner_body.rl" +#line 1198 "./scanner_body.rl" { type_num(KNOT_RRTYPE_RT, &rdata_tail); } break; case 159: -#line 1195 "./scanner_body.rl" +#line 1199 "./scanner_body.rl" { type_num(KNOT_RRTYPE_KEY, &rdata_tail); } break; case 160: -#line 1196 "./scanner_body.rl" +#line 1200 "./scanner_body.rl" { type_num(KNOT_RRTYPE_AAAA, &rdata_tail); } break; case 161: -#line 1197 "./scanner_body.rl" +#line 1201 "./scanner_body.rl" { type_num(KNOT_RRTYPE_LOC, &rdata_tail); } break; case 162: -#line 1198 "./scanner_body.rl" +#line 1202 "./scanner_body.rl" { type_num(KNOT_RRTYPE_SRV, &rdata_tail); } break; case 163: -#line 1199 "./scanner_body.rl" +#line 1203 "./scanner_body.rl" { type_num(KNOT_RRTYPE_NAPTR, &rdata_tail); } break; case 164: -#line 1200 "./scanner_body.rl" +#line 1204 "./scanner_body.rl" { type_num(KNOT_RRTYPE_KX, &rdata_tail); } break; case 165: -#line 1201 "./scanner_body.rl" +#line 1205 "./scanner_body.rl" { type_num(KNOT_RRTYPE_CERT, &rdata_tail); } break; case 166: -#line 1202 "./scanner_body.rl" +#line 1206 "./scanner_body.rl" { type_num(KNOT_RRTYPE_DNAME, &rdata_tail); } break; case 167: -#line 1203 "./scanner_body.rl" +#line 1207 "./scanner_body.rl" { type_num(KNOT_RRTYPE_APL, &rdata_tail); } break; case 168: -#line 1204 "./scanner_body.rl" +#line 1208 "./scanner_body.rl" { type_num(KNOT_RRTYPE_DS, &rdata_tail); } break; case 169: -#line 1205 "./scanner_body.rl" +#line 1209 "./scanner_body.rl" { type_num(KNOT_RRTYPE_SSHFP, &rdata_tail); } break; case 170: -#line 1206 "./scanner_body.rl" +#line 1210 "./scanner_body.rl" { type_num(KNOT_RRTYPE_IPSECKEY, &rdata_tail); } break; case 171: -#line 1207 "./scanner_body.rl" +#line 1211 "./scanner_body.rl" { type_num(KNOT_RRTYPE_RRSIG, &rdata_tail); } break; case 172: -#line 1208 "./scanner_body.rl" +#line 1212 "./scanner_body.rl" { type_num(KNOT_RRTYPE_NSEC, &rdata_tail); } break; case 173: -#line 1209 "./scanner_body.rl" +#line 1213 "./scanner_body.rl" { type_num(KNOT_RRTYPE_DNSKEY, &rdata_tail); } break; case 174: -#line 1210 "./scanner_body.rl" +#line 1214 "./scanner_body.rl" { type_num(KNOT_RRTYPE_DHCID, &rdata_tail); } break; case 175: -#line 1211 "./scanner_body.rl" +#line 1215 "./scanner_body.rl" { type_num(KNOT_RRTYPE_NSEC3, &rdata_tail); } break; case 176: -#line 1212 "./scanner_body.rl" +#line 1216 "./scanner_body.rl" { type_num(KNOT_RRTYPE_NSEC3PARAM, &rdata_tail); } break; case 177: -#line 1213 "./scanner_body.rl" +#line 1217 "./scanner_body.rl" { type_num(KNOT_RRTYPE_TLSA, &rdata_tail); } break; case 178: -#line 1214 "./scanner_body.rl" +#line 1218 "./scanner_body.rl" { type_num(KNOT_RRTYPE_SPF, &rdata_tail); } break; case 179: -#line 1215 "./scanner_body.rl" +#line 1219 "./scanner_body.rl" { type_num(KNOT_RRTYPE_NID, &rdata_tail); } break; case 180: -#line 1216 "./scanner_body.rl" +#line 1220 "./scanner_body.rl" { type_num(KNOT_RRTYPE_L32, &rdata_tail); } break; case 181: -#line 1217 "./scanner_body.rl" +#line 1221 "./scanner_body.rl" { type_num(KNOT_RRTYPE_L64, &rdata_tail); } break; case 182: -#line 1218 "./scanner_body.rl" +#line 1222 "./scanner_body.rl" { type_num(KNOT_RRTYPE_LP, &rdata_tail); } break; case 183: -#line 1219 "./scanner_body.rl" +#line 1223 "./scanner_body.rl" { type_num(KNOT_RRTYPE_EUI48, &rdata_tail); } break; case 184: -#line 1220 "./scanner_body.rl" +#line 1224 "./scanner_body.rl" { type_num(KNOT_RRTYPE_EUI64, &rdata_tail); } break; case 185: -#line 1226 "./scanner_body.rl" +#line 1230 "./scanner_body.rl" { if (s->number64 <= UINT16_MAX) { window_add_bit(s->number64, s); @@ -6704,166 +6708,166 @@ _match: } break; case 186: -#line 1239 "./scanner_body.rl" +#line 1243 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_A, s); } break; case 187: -#line 1240 "./scanner_body.rl" +#line 1244 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_NS, s); } break; case 188: -#line 1241 "./scanner_body.rl" +#line 1245 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_CNAME, s); } break; case 189: -#line 1242 "./scanner_body.rl" +#line 1246 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_SOA, s); } break; case 190: -#line 1243 "./scanner_body.rl" +#line 1247 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_PTR, s); } break; case 191: -#line 1244 "./scanner_body.rl" +#line 1248 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_HINFO, s); } break; case 192: -#line 1245 "./scanner_body.rl" +#line 1249 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_MINFO, s); } break; case 193: -#line 1246 "./scanner_body.rl" +#line 1250 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_MX, s); } break; case 194: -#line 1247 "./scanner_body.rl" +#line 1251 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_TXT, s); } break; case 195: -#line 1248 "./scanner_body.rl" +#line 1252 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_RP, s); } break; case 196: -#line 1249 "./scanner_body.rl" +#line 1253 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_AFSDB, s); } break; case 197: -#line 1250 "./scanner_body.rl" +#line 1254 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_RT, s); } break; case 198: -#line 1251 "./scanner_body.rl" +#line 1255 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_KEY, s); } break; case 199: -#line 1252 "./scanner_body.rl" +#line 1256 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_AAAA, s); } break; case 200: -#line 1253 "./scanner_body.rl" +#line 1257 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_LOC, s); } break; case 201: -#line 1254 "./scanner_body.rl" +#line 1258 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_SRV, s); } break; case 202: -#line 1255 "./scanner_body.rl" +#line 1259 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_NAPTR, s); } break; case 203: -#line 1256 "./scanner_body.rl" +#line 1260 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_KX, s); } break; case 204: -#line 1257 "./scanner_body.rl" +#line 1261 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_CERT, s); } break; case 205: -#line 1258 "./scanner_body.rl" +#line 1262 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_DNAME, s); } break; case 206: -#line 1259 "./scanner_body.rl" +#line 1263 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_APL, s); } break; case 207: -#line 1260 "./scanner_body.rl" +#line 1264 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_DS, s); } break; case 208: -#line 1261 "./scanner_body.rl" +#line 1265 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_SSHFP, s); } break; case 209: -#line 1262 "./scanner_body.rl" +#line 1266 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_IPSECKEY, s); } break; case 210: -#line 1263 "./scanner_body.rl" +#line 1267 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_RRSIG, s); } break; case 211: -#line 1264 "./scanner_body.rl" +#line 1268 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_NSEC, s); } break; case 212: -#line 1265 "./scanner_body.rl" +#line 1269 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_DNSKEY, s); } break; case 213: -#line 1266 "./scanner_body.rl" +#line 1270 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_DHCID, s); } break; case 214: -#line 1267 "./scanner_body.rl" +#line 1271 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_NSEC3, s); } break; case 215: -#line 1268 "./scanner_body.rl" +#line 1272 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_NSEC3PARAM, s); } break; case 216: -#line 1269 "./scanner_body.rl" +#line 1273 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_TLSA, s); } break; case 217: -#line 1270 "./scanner_body.rl" +#line 1274 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_SPF, s); } break; case 218: -#line 1271 "./scanner_body.rl" +#line 1275 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_NID, s); } break; case 219: -#line 1272 "./scanner_body.rl" +#line 1276 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_L32, s); } break; case 220: -#line 1273 "./scanner_body.rl" +#line 1277 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_L64, s); } break; case 221: -#line 1274 "./scanner_body.rl" +#line 1278 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_LP, s); } break; case 222: -#line 1275 "./scanner_body.rl" +#line 1279 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_EUI48, s); } break; case 223: -#line 1276 "./scanner_body.rl" +#line 1280 "./scanner_body.rl" { window_add_bit(KNOT_RRTYPE_EUI64, s); } break; case 224: -#line 1280 "./scanner_body.rl" +#line 1284 "./scanner_body.rl" { memset(s->windows, 0, sizeof(s->windows)); s->last_window = -1; } break; case 225: -#line 1284 "./scanner_body.rl" +#line 1288 "./scanner_body.rl" { for (window = 0; window <= s->last_window; window++) { if ((s->windows[window]).length > 0) { @@ -6889,18 +6893,18 @@ _match: } break; case 226: -#line 1307 "./scanner_body.rl" +#line 1311 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_BITMAP); p--; {cs = 246; goto _again;} } break; case 227: -#line 1315 "./scanner_body.rl" +#line 1319 "./scanner_body.rl" { p--; {stack[top++] = cs; cs = 317; goto _again;} } break; case 228: -#line 1319 "./scanner_body.rl" +#line 1323 "./scanner_body.rl" { if (s->number64 <= 90) { s->loc.d1 = (uint32_t)(s->number64); @@ -6911,7 +6915,7 @@ _match: } break; case 229: -#line 1327 "./scanner_body.rl" +#line 1331 "./scanner_body.rl" { if (s->number64 <= 180) { s->loc.d2 = (uint32_t)(s->number64); @@ -6922,7 +6926,7 @@ _match: } break; case 230: -#line 1335 "./scanner_body.rl" +#line 1339 "./scanner_body.rl" { if (s->number64 <= 59) { s->loc.m1 = (uint32_t)(s->number64); @@ -6933,7 +6937,7 @@ _match: } break; case 231: -#line 1343 "./scanner_body.rl" +#line 1347 "./scanner_body.rl" { if (s->number64 <= 59) { s->loc.m2 = (uint32_t)(s->number64); @@ -6944,7 +6948,7 @@ _match: } break; case 232: -#line 1351 "./scanner_body.rl" +#line 1355 "./scanner_body.rl" { if (s->number64 <= 59999) { s->loc.s1 = (uint32_t)(s->number64); @@ -6955,7 +6959,7 @@ _match: } break; case 233: -#line 1359 "./scanner_body.rl" +#line 1363 "./scanner_body.rl" { if (s->number64 <= 59999) { s->loc.s2 = (uint32_t)(s->number64); @@ -6966,7 +6970,7 @@ _match: } break; case 234: -#line 1367 "./scanner_body.rl" +#line 1371 "./scanner_body.rl" { if ((s->loc.alt_sign == 1 && s->number64 <= 4284967295) || (s->loc.alt_sign == -1 && s->number64 <= 10000000)) @@ -6979,7 +6983,7 @@ _match: } break; case 235: -#line 1377 "./scanner_body.rl" +#line 1381 "./scanner_body.rl" { if (s->number64 <= 9000000000ULL) { s->loc.siz = s->number64; @@ -6990,7 +6994,7 @@ _match: } break; case 236: -#line 1385 "./scanner_body.rl" +#line 1389 "./scanner_body.rl" { if (s->number64 <= 9000000000ULL) { s->loc.hp = s->number64; @@ -7001,7 +7005,7 @@ _match: } break; case 237: -#line 1393 "./scanner_body.rl" +#line 1397 "./scanner_body.rl" { if (s->number64 <= 9000000000ULL) { s->loc.vp = s->number64; @@ -7012,25 +7016,25 @@ _match: } break; case 238: -#line 1401 "./scanner_body.rl" +#line 1405 "./scanner_body.rl" { s->loc.lat_sign = -1; } break; case 239: -#line 1404 "./scanner_body.rl" +#line 1408 "./scanner_body.rl" { s->loc.long_sign = -1; } break; case 240: -#line 1407 "./scanner_body.rl" +#line 1411 "./scanner_body.rl" { s->loc.alt_sign = -1; } break; case 241: -#line 1424 "./scanner_body.rl" +#line 1428 "./scanner_body.rl" { memset(&(s->loc), 0, sizeof(s->loc)); // Defaults. @@ -7043,7 +7047,7 @@ _match: } break; case 242: -#line 1434 "./scanner_body.rl" +#line 1438 "./scanner_body.rl" { // Write version. *(rdata_tail) = 0; @@ -7072,33 +7076,33 @@ _match: } break; case 243: -#line 1460 "./scanner_body.rl" +#line 1464 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_LOC_DATA); p--; {cs = 246; goto _again;} } break; case 244: -#line 1473 "./scanner_body.rl" +#line 1477 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_HEX_RDATA); p--; {cs = 246; goto _again;} } break; case 245: -#line 1491 "./scanner_body.rl" +#line 1495 "./scanner_body.rl" { s->item_length = 0; } break; case 246: -#line 1494 "./scanner_body.rl" +#line 1498 "./scanner_body.rl" { s->item_length++; } break; case 247: -#line 1497 "./scanner_body.rl" +#line 1501 "./scanner_body.rl" { if (s->item_length != 6) { WARN(ZSCANNER_EBAD_EUI_LENGTH); @@ -7107,7 +7111,7 @@ _match: } break; case 248: -#line 1503 "./scanner_body.rl" +#line 1507 "./scanner_body.rl" { if (s->item_length != 8) { WARN(ZSCANNER_EBAD_EUI_LENGTH); @@ -7116,26 +7120,26 @@ _match: } break; case 249: -#line 1509 "./scanner_body.rl" +#line 1513 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_CHAR_DASH); p--; {cs = 246; goto _again;} } break; case 250: -#line 1524 "./scanner_body.rl" +#line 1528 "./scanner_body.rl" { s->item_length = 0; } break; case 251: -#line 1527 "./scanner_body.rl" +#line 1531 "./scanner_body.rl" { s->item_length++; } break; case 252: -#line 1530 "./scanner_body.rl" +#line 1534 "./scanner_body.rl" { if (s->item_length != 4) { WARN(ZSCANNER_EBAD_L64_LENGTH); @@ -7144,49 +7148,49 @@ _match: } break; case 253: -#line 1536 "./scanner_body.rl" +#line 1540 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_CHAR_COLON); p--; {cs = 246; goto _again;} } break; case 254: -#line 1549 "./scanner_body.rl" +#line 1553 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_ALGORITHM); p--; {cs = 246; goto _again;} } break; case 255: -#line 1553 "./scanner_body.rl" +#line 1557 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_CERT_TYPE); p--; {cs = 246; goto _again;} } break; case 256: -#line 1575 "./scanner_body.rl" +#line 1579 "./scanner_body.rl" { p--; {stack[top++] = cs; cs = 456; goto _again;} } break; case 257: -#line 1590 "./scanner_body.rl" +#line 1594 "./scanner_body.rl" { p--; {stack[top++] = cs; cs = 551; goto _again;} } break; case 258: -#line 1594 "./scanner_body.rl" +#line 1598 "./scanner_body.rl" { rdata_tail = s->r_data; } break; case 259: -#line 1597 "./scanner_body.rl" +#line 1601 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_RDATA); p--; {cs = 246; goto _again;} } break; case 260: -#line 1715 "./scanner_body.rl" +#line 1719 "./scanner_body.rl" { p--; switch (s->r_type) { @@ -7262,7 +7266,7 @@ _match: } break; case 261: -#line 1788 "./scanner_body.rl" +#line 1792 "./scanner_body.rl" { switch (s->r_type) { // Next types must not have empty rdata. @@ -7312,170 +7316,170 @@ _match: } break; case 262: -#line 1839 "./scanner_body.rl" +#line 1843 "./scanner_body.rl" { p--; } break; case 263: -#line 1846 "./scanner_body.rl" +#line 1850 "./scanner_body.rl" { WARN(ZSCANNER_EUNSUPPORTED_TYPE); p--; {cs = 246; goto _again;} } break; case 264: -#line 1852 "./scanner_body.rl" +#line 1856 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_A; } break; case 265: -#line 1853 "./scanner_body.rl" +#line 1857 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_NS; } break; case 266: -#line 1854 "./scanner_body.rl" +#line 1858 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_CNAME; } break; case 267: -#line 1855 "./scanner_body.rl" +#line 1859 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_SOA; } break; case 268: -#line 1856 "./scanner_body.rl" +#line 1860 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_PTR; } break; case 269: -#line 1857 "./scanner_body.rl" +#line 1861 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_HINFO; } break; case 270: -#line 1858 "./scanner_body.rl" +#line 1862 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_MINFO; } break; case 271: -#line 1859 "./scanner_body.rl" +#line 1863 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_MX; } break; case 272: -#line 1860 "./scanner_body.rl" +#line 1864 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_TXT; } break; case 273: -#line 1861 "./scanner_body.rl" +#line 1865 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_RP; } break; case 274: -#line 1862 "./scanner_body.rl" +#line 1866 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_AFSDB; } break; case 275: -#line 1863 "./scanner_body.rl" +#line 1867 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_RT; } break; case 276: -#line 1864 "./scanner_body.rl" +#line 1868 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_KEY; } break; case 277: -#line 1865 "./scanner_body.rl" +#line 1869 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_AAAA; } break; case 278: -#line 1866 "./scanner_body.rl" +#line 1870 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_LOC; } break; case 279: -#line 1867 "./scanner_body.rl" +#line 1871 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_SRV; } break; case 280: -#line 1868 "./scanner_body.rl" +#line 1872 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_NAPTR; } break; case 281: -#line 1869 "./scanner_body.rl" +#line 1873 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_KX; } break; case 282: -#line 1870 "./scanner_body.rl" +#line 1874 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_CERT; } break; case 283: -#line 1871 "./scanner_body.rl" +#line 1875 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_DNAME; } break; case 284: -#line 1872 "./scanner_body.rl" +#line 1876 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_APL; } break; case 285: -#line 1873 "./scanner_body.rl" +#line 1877 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_DS; } break; case 286: -#line 1874 "./scanner_body.rl" +#line 1878 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_SSHFP; } break; case 287: -#line 1875 "./scanner_body.rl" +#line 1879 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_IPSECKEY; } break; case 288: -#line 1876 "./scanner_body.rl" +#line 1880 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_RRSIG; } break; case 289: -#line 1877 "./scanner_body.rl" +#line 1881 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_NSEC; } break; case 290: -#line 1878 "./scanner_body.rl" +#line 1882 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_DNSKEY; } break; case 291: -#line 1879 "./scanner_body.rl" +#line 1883 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_DHCID; } break; case 292: -#line 1880 "./scanner_body.rl" +#line 1884 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_NSEC3; } break; case 293: -#line 1881 "./scanner_body.rl" +#line 1885 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_NSEC3PARAM; } break; case 294: -#line 1882 "./scanner_body.rl" +#line 1886 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_TLSA; } break; case 295: -#line 1883 "./scanner_body.rl" +#line 1887 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_SPF; } break; case 296: -#line 1884 "./scanner_body.rl" +#line 1888 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_NID; } break; case 297: -#line 1885 "./scanner_body.rl" +#line 1889 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_L32; } break; case 298: -#line 1886 "./scanner_body.rl" +#line 1890 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_L64; } break; case 299: -#line 1887 "./scanner_body.rl" +#line 1891 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_LP; } break; case 300: -#line 1888 "./scanner_body.rl" +#line 1892 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_EUI48; } break; case 301: -#line 1889 "./scanner_body.rl" +#line 1893 "./scanner_body.rl" { s->r_type = KNOT_RRTYPE_EUI64; } break; case 302: -#line 1895 "./scanner_body.rl" +#line 1899 "./scanner_body.rl" { if (rdata_tail - s->r_data > UINT16_MAX) { WARN(ZSCANNER_ERDATA_OVERFLOW); @@ -7486,7 +7490,7 @@ _match: s->process_record(s); } break; -#line 7490 "scanner.c" +#line 7494 "scanner.c" } } @@ -7510,21 +7514,21 @@ _again: } break; case 15: -#line 143 "./scanner_body.rl" +#line 147 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_NUMBER); p--; {cs = 246; goto _again;} } break; case 20: -#line 189 "./scanner_body.rl" +#line 193 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_DNAME_CHAR); p--; {cs = 246; goto _again;} } break; case 27: -#line 234 "./scanner_body.rl" +#line 238 "./scanner_body.rl" { s->r_owner_length = 0; WARN(ZSCANNER_EBAD_OWNER); @@ -7532,215 +7536,215 @@ _again: } break; case 32: -#line 277 "./scanner_body.rl" +#line 281 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_NUMBER); p--; {cs = 246; goto _again;} } break; case 44: -#line 378 "./scanner_body.rl" +#line 382 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_TIME_UNIT); p--; {cs = 246; goto _again;} } break; case 54: -#line 483 "./scanner_body.rl" +#line 487 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_TIMESTAMP_CHAR); p--; {cs = 246; goto _again;} } break; case 56: -#line 501 "./scanner_body.rl" +#line 505 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_TEXT_CHAR); p--; {cs = 246; goto _again;} } break; case 57: -#line 505 "./scanner_body.rl" +#line 509 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_TEXT); p--; {cs = 246; goto _again;} } break; case 61: -#line 535 "./scanner_body.rl" +#line 539 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_NUMBER); p--; {cs = 246; goto _again;} } break; case 64: -#line 575 "./scanner_body.rl" +#line 579 "./scanner_body.rl" { ERR(ZSCANNER_EBAD_TTL); p--; {cs = 246; goto _again;} } break; case 68: -#line 592 "./scanner_body.rl" +#line 596 "./scanner_body.rl" { ERR(ZSCANNER_EBAD_ORIGIN); p--; {cs = 246; goto _again;} } break; case 72: -#line 621 "./scanner_body.rl" +#line 625 "./scanner_body.rl" { ERR(ZSCANNER_EBAD_INCLUDE_FILENAME); p--; {cs = 246; goto _again;} } break; case 75: -#line 632 "./scanner_body.rl" +#line 636 "./scanner_body.rl" { ERR(ZSCANNER_EBAD_INCLUDE_ORIGIN); p--; {cs = 246; goto _again;} } break; case 79: -#line 700 "./scanner_body.rl" +#line 704 "./scanner_body.rl" { s->stop = false; } break; case 80: -#line 703 "./scanner_body.rl" +#line 707 "./scanner_body.rl" { ERR(ZSCANNER_EBAD_DIRECTIVE); p--; {cs = 246; goto _again;} } break; case 87: -#line 754 "./scanner_body.rl" +#line 758 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_ADDRESS_CHAR); p--; {cs = 246; goto _again;} } break; case 98: -#line 854 "./scanner_body.rl" +#line 858 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_APL); p--; {cs = 246; goto _again;} } break; case 101: -#line 884 "./scanner_body.rl" +#line 888 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_HEX_CHAR); p--; {cs = 246; goto _again;} } break; case 103: -#line 905 "./scanner_body.rl" +#line 909 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_HEX_RDATA); p--; {cs = 246; goto _again;} } break; case 108: -#line 947 "./scanner_body.rl" +#line 951 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_BASE64_CHAR); p--; {cs = 246; goto _again;} } break; case 118: -#line 1031 "./scanner_body.rl" +#line 1035 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_BASE32HEX_CHAR); p--; {cs = 246; goto _again;} } break; case 144: -#line 1155 "./scanner_body.rl" +#line 1159 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_GATEWAY); p--; {cs = 246; goto _again;} } break; case 145: -#line 1159 "./scanner_body.rl" +#line 1163 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_GATEWAY_KEY); p--; {cs = 246; goto _again;} } break; case 146: -#line 1177 "./scanner_body.rl" +#line 1181 "./scanner_body.rl" { WARN(ZSCANNER_EUNSUPPORTED_TYPE); p--; {cs = 246; goto _again;} } break; case 226: -#line 1307 "./scanner_body.rl" +#line 1311 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_BITMAP); p--; {cs = 246; goto _again;} } break; case 243: -#line 1460 "./scanner_body.rl" +#line 1464 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_LOC_DATA); p--; {cs = 246; goto _again;} } break; case 244: -#line 1473 "./scanner_body.rl" +#line 1477 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_HEX_RDATA); p--; {cs = 246; goto _again;} } break; case 249: -#line 1509 "./scanner_body.rl" +#line 1513 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_CHAR_DASH); p--; {cs = 246; goto _again;} } break; case 253: -#line 1536 "./scanner_body.rl" +#line 1540 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_CHAR_COLON); p--; {cs = 246; goto _again;} } break; case 254: -#line 1549 "./scanner_body.rl" +#line 1553 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_ALGORITHM); p--; {cs = 246; goto _again;} } break; case 255: -#line 1553 "./scanner_body.rl" +#line 1557 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_CERT_TYPE); p--; {cs = 246; goto _again;} } break; case 259: -#line 1597 "./scanner_body.rl" +#line 1601 "./scanner_body.rl" { WARN(ZSCANNER_EBAD_RDATA); p--; {cs = 246; goto _again;} } break; case 263: -#line 1846 "./scanner_body.rl" +#line 1850 "./scanner_body.rl" { WARN(ZSCANNER_EUNSUPPORTED_TYPE); p--; {cs = 246; goto _again;} } break; -#line 7744 "scanner.c" +#line 7748 "scanner.c" } } } diff --git a/src/zscanner/scanner.c.g2 b/src/zscanner/scanner.c.g2 index 1d41812..496aaba 100644 --- a/src/zscanner/scanner.c.g2 +++ b/src/zscanner/scanner.c.g2 @@ -28658,6 +28658,10 @@ tr775: s->buffer_length = 0; } { + if ((*p) == '\r') { + ERR(ZSCANNER_DOS_NEWLINE); + } + if (s->buffer_length < sizeof(s->buffer) - 1) { s->buffer[s->buffer_length++] = (*p); } @@ -28665,6 +28669,10 @@ tr775: goto st247; tr777: { + if ((*p) == '\r') { + ERR(ZSCANNER_DOS_NEWLINE); + } + if (s->buffer_length < sizeof(s->buffer) - 1) { s->buffer[s->buffer_length++] = (*p); } diff --git a/src/zscanner/scanner.c.t0 b/src/zscanner/scanner.c.t0 index 5485ca6..becce94 100644 --- a/src/zscanner/scanner.c.t0 +++ b/src/zscanner/scanner.c.t0 @@ -5268,6 +5268,10 @@ _match: break; case 6: { + if ((*p) == '\r') { + ERR(ZSCANNER_DOS_NEWLINE); + } + if (s->buffer_length < sizeof(s->buffer) - 1) { s->buffer[s->buffer_length++] = (*p); } diff --git a/src/zscanner/scanner_body.rl b/src/zscanner/scanner_body.rl index d10e33a..f62a4c2 100644 --- a/src/zscanner/scanner_body.rl +++ b/src/zscanner/scanner_body.rl @@ -68,6 +68,10 @@ s->buffer_length = 0; } action _err_line { + if (fc == '\r') { + ERR(ZSCANNER_DOS_NEWLINE); + } + if (s->buffer_length < sizeof(s->buffer) - 1) { s->buffer[s->buffer_length++] = fc; } |