From 96ed62425310854fd6f6f06bfb7651b3e4c17ee7 Mon Sep 17 00:00:00 2001 From: Andreas Gustafsson Date: Fri, 6 Jul 2001 20:34:12 +0000 Subject: [PATCH] 923. [bug] Multiline TSIG secrets (and other multiline strings) were not accepted in named.conf. [RT #1469] --- CHANGES | 6 ++++++ lib/isc/include/isc/lex.h | 4 ++-- lib/isc/lex.c | 5 +++-- lib/isccfg/parser.c | 14 ++++++++------ 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/CHANGES b/CHANGES index abbc6adc84..73beb1ad70 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,10 @@ + 923. [bug] Multiline TSIG secrets (and other multiline strings) + were not accepted in named.conf. [RT #1469] + + 922. [func] Added two new lwres_getrrsetbyname() result codes, + ERR_NONAME and ERR_NODATA. + 921. [bug] lwres returned an incorrect error code if it received a truncated message. diff --git a/lib/isc/include/isc/lex.h b/lib/isc/include/isc/lex.h index 1c391b75ed..8205b1e3b5 100644 --- a/lib/isc/include/isc/lex.h +++ b/lib/isc/include/isc/lex.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: lex.h,v 1.25 2001/01/09 21:57:04 bwelling Exp $ */ +/* $Id: lex.h,v 1.26 2001/07/06 20:34:11 gson Exp $ */ #ifndef ISC_LEX_H #define ISC_LEX_H 1 @@ -87,7 +87,7 @@ ISC_LANG_BEGINDECLS #define ISC_LEXOPT_CNUMBER 0x80 /* Regognise octal and hex */ #define ISC_LEXOPT_ESCAPE 0x100 /* Recognize escapes. */ - +#define ISC_LEXOPT_QSTRINGMULTILINE 0x200 /* Allow multiline "" strings */ /* * Various commenting styles, which may be changed at any time with diff --git a/lib/isc/lex.c b/lib/isc/lex.c index c6a8aed82d..bc354154a9 100644 --- a/lib/isc/lex.c +++ b/lib/isc/lex.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: lex.c,v 1.64 2001/07/04 00:34:44 bwelling Exp $ */ +/* $Id: lex.c,v 1.65 2001/07/06 20:34:09 gson Exp $ */ #include @@ -721,7 +721,8 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) { done = ISC_TRUE; } } else { - if (c == '\n' && !escaped) { + if (c == '\n' && !escaped && + (options & ISC_LEXOPT_QSTRINGMULTILINE) == 0) { pushback(source, c); return (ISC_R_UNBALANCEDQUOTES); } diff --git a/lib/isccfg/parser.c b/lib/isccfg/parser.c index ff7c0f0c94..c7f56dcc35 100644 --- a/lib/isccfg/parser.c +++ b/lib/isccfg/parser.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: parser.c,v 1.61 2001/07/03 17:12:19 gson Exp $ */ +/* $Id: parser.c,v 1.62 2001/07/06 20:34:12 gson Exp $ */ #include @@ -40,6 +40,8 @@ #define CAT CFG_LOGCATEGORY_CONFIG #define MOD CFG_LOGMODULE_PARSER +#define QSTRING (ISC_LEXOPT_QSTRING | ISC_LEXOPT_QSTRINGMULTILINE) + /* * Pass one of these flags to parser_error() to include the * token text in log message. @@ -1767,7 +1769,7 @@ parse_qstring(cfg_parser_t *pctx, cfg_type_t *type, cfg_obj_t **ret) { isc_result_t result; UNUSED(type); - CHECK(cfg_gettoken(pctx, ISC_LEXOPT_QSTRING)); + CHECK(cfg_gettoken(pctx, QSTRING)); if (pctx->token.type != isc_tokentype_qstring) { parser_error(pctx, LOG_NEAR, "expected quoted string"); return (ISC_R_UNEXPECTEDTOKEN); @@ -2570,7 +2572,7 @@ parse_token(cfg_parser_t *pctx, cfg_type_t *type, cfg_obj_t **ret) { UNUSED(type); CHECK(create_cfgobj(pctx, &cfg_type_token, &obj)); - CHECK(cfg_gettoken(pctx, ISC_LEXOPT_QSTRING)); + CHECK(cfg_gettoken(pctx, QSTRING)); if (pctx->token.type == isc_tokentype_eof) { cfg_ungettoken(pctx); result = ISC_R_EOF; @@ -3014,7 +3016,7 @@ parse_addrmatchelt(cfg_parser_t *pctx, cfg_type_t *type, cfg_obj_t **ret) { isc_result_t result; UNUSED(type); - CHECK(cfg_peektoken(pctx, ISC_LEXOPT_QSTRING)); + CHECK(cfg_peektoken(pctx, QSTRING)); if (pctx->token.type == isc_tokentype_string || pctx->token.type == isc_tokentype_qstring) { @@ -3230,7 +3232,7 @@ parse_optional_facility(cfg_parser_t *pctx, cfg_type_t *type, cfg_obj_t **ret) isc_result_t result; UNUSED(type); - CHECK(cfg_peektoken(pctx, ISC_LEXOPT_QSTRING)); + CHECK(cfg_peektoken(pctx, QSTRING)); if (pctx->token.type == isc_tokentype_string || pctx->token.type == isc_tokentype_qstring) { CHECK(parse(pctx, &cfg_type_astring, ret)); @@ -3549,7 +3551,7 @@ static isc_result_t cfg_getstringtoken(cfg_parser_t *pctx) { isc_result_t result; - result = cfg_gettoken(pctx, ISC_LEXOPT_QSTRING); + result = cfg_gettoken(pctx, QSTRING); if (result != ISC_R_SUCCESS) return (result);