From 7357590beef5f671cfdd4ec4304e5210adfb0d8a Mon Sep 17 00:00:00 2001 From: Brian Wellington Date: Fri, 5 Jan 2001 01:02:26 +0000 Subject: [PATCH] 656. [func] Treat an unescaped newline in a quoted string as an error. This means that TXT records with missing close quotes should have meaningful errors printed. --- CHANGES | 4 ++++ lib/isc/include/isc/result.h | 5 +++-- lib/isc/lex.c | 6 +++++- lib/isc/result.c | 5 +++-- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index 30a6039ff8..8d534f123f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ + 656. [func] Treat an unescaped newline in a quoted string as + an error. This means that TXT records with missing + close quotes should have meaningful errors printed. + 655. [bug] Improve error reporting on unexpected eof when loading zones. [RT #611] diff --git a/lib/isc/include/isc/result.h b/lib/isc/include/isc/result.h index 3f2f7c7c12..e677802efb 100644 --- a/lib/isc/include/isc/result.h +++ b/lib/isc/include/isc/result.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: result.h,v 1.53 2000/12/27 00:11:25 bwelling Exp $ */ +/* $Id: result.h,v 1.54 2001/01/05 01:02:26 bwelling Exp $ */ #ifndef ISC_RESULT_H #define ISC_RESULT_H 1 @@ -75,10 +75,11 @@ #define ISC_R_BADHEX 49 /* bad hex encoding */ #define ISC_R_TOOMANYOPENFILES 50 /* too many open files */ #define ISC_R_NOTBLOCKING 51 /* not blocking */ +#define ISC_R_UNBALANCEDQUOTES 52 /* unbalanced quotes */ /* * Not a result code: the number of results. */ -#define ISC_R_NRESULTS 52 +#define ISC_R_NRESULTS 53 ISC_LANG_BEGINDECLS diff --git a/lib/isc/lex.c b/lib/isc/lex.c index b37eb274cf..a1d816e197 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.57 2000/12/09 03:20:05 marka Exp $ */ +/* $Id: lex.c,v 1.58 2001/01/05 01:02:24 bwelling Exp $ */ #include @@ -717,6 +717,10 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) { done = ISC_TRUE; } } else { + if (c == '\n' && !escaped) { + pushback(source, c); + return (ISC_R_UNBALANCEDQUOTES); + } if (c == '\\' && !escaped) escaped = ISC_TRUE; else diff --git a/lib/isc/result.c b/lib/isc/result.c index c0d116f4cd..0fe7953960 100644 --- a/lib/isc/result.c +++ b/lib/isc/result.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: result.c,v 1.52 2000/12/27 00:11:24 bwelling Exp $ */ +/* $Id: result.c,v 1.53 2001/01/05 01:02:23 bwelling Exp $ */ #include @@ -89,7 +89,8 @@ static const char *text[ISC_R_NRESULTS] = { "address family not supported", /* 48 */ "bad hex encoding", /* 49 */ "too many open files", /* 50 */ - "not blocking" /* 51 */ + "not blocking", /* 51 */ + "unbalanced quotes" /* 52 */ }; #define ISC_RESULT_RESULTSET 2