Mercurial > hg > freeDiameter
changeset 926:69d55a534aff
Improve configuration parser of acl_wl extension, to avoid errors sent on stdout/stderr
author | Sebastien Decugis <sdecugis@freediameter.net> |
---|---|
date | Sat, 02 Mar 2013 16:21:26 +0100 |
parents | e5a09fab5ef3 |
children | 8bb4d749ed37 |
files | extensions/acl_wl/aw_conf.l extensions/acl_wl/aw_conf.y |
diffstat | 2 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/extensions/acl_wl/aw_conf.l Sat Mar 02 14:03:04 2013 +0100 +++ b/extensions/acl_wl/aw_conf.l Sat Mar 02 16:21:26 2013 +0100 @@ -92,4 +92,11 @@ return FQDN; } + /* No match */ +<*>[[:alnum:]]+ | /* This rule is only useful to print a complete token in error messages */ +<*>. { + TRACE_DEBUG_ERROR("Unrecognized text on line %d col %d: '%s'.\n", yylloc->first_line, yylloc->first_column, yytext); + return LEX_ERROR; + } + %%
--- a/extensions/acl_wl/aw_conf.y Sat Mar 02 14:03:04 2013 +0100 +++ b/extensions/acl_wl/aw_conf.y Sat Mar 02 16:21:26 2013 +0100 @@ -126,5 +126,10 @@ { fqdn_added++; } + | conffile LEX_ERROR + { + yyerror(&yylloc, conffile, "An error occurred while parsing the configuration file"); + return EINVAL; + } ;