diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cfg_parser.rl | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/cfg_parser.rl b/src/cfg_parser.rl index 31104bf..ad11b08 100644 --- a/src/cfg_parser.rl +++ b/src/cfg_parser.rl @@ -112,17 +112,17 @@ static int owrt_string(char** dest, char* start, char* end) } newline = '\n' @{cur_line++;}; - ws = ( " " | "\t" ); + ws = [ \t]; comment = '#' [^\n]* newline; - ign = ( ws | comment | newline ); + ign = ( ws | comment | newline | [\v\f\r] ); number = [0-9]+; ipv4_addr = [0-9.]+; ipv6_addr = [0-9a-fA-F:]+; name = [a-zA-Z0-9\-]+; host_name = [a-zA-Z0-9\-.]+; - tok_ipv4 = "ipv4"; - tok_ipv6 = "ipv6"; + tok_ipv4 = "ipv4"i; + tok_ipv6 = "ipv6"i; host_or_addr = ( host_name | ipv4_addr | ipv6_addr ); service = ( number | name ); @@ -160,6 +160,7 @@ int parse_listener(char* p, char* pe, listeners_t* listener) struct listener lst; init_listener_struct(&lst); + char* eof = pe; %% write exec; if(cs == cfg_parser_error) { @@ -167,6 +168,12 @@ int parse_listener(char* p, char* pe, listeners_t* listener) ret = 1; } + // we only have one file so if we aren't there something is wrong + if(cs != cfg_parser_first_final) { + log_printf(ERROR, "config file syntax error: unexpected end of file"); + ret = 1; + } + clear_listener_struct(&lst); return ret; |