"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "configlexer.lex" between
nsd-4.3.5.tar.gz and nsd-4.3.6.tar.gz

About: NSD is an authoritative only, high performance, simple name server daemon.

configlexer.lex  (nsd-4.3.5):configlexer.lex  (nsd-4.3.6)
skipping to change at line 14 skipping to change at line 14
* *
* Copyright (c) 2001-2006, NLnet Labs. All rights reserved * Copyright (c) 2001-2006, NLnet Labs. All rights reserved
* *
* See LICENSE for the license. * See LICENSE for the license.
* *
*/ */
/* because flex keeps having sign-unsigned compare problems that are unfixed*/ /* because flex keeps having sign-unsigned compare problems that are unfixed*/
#if defined(__clang__)||(defined(__GNUC__)&&((__GNUC__ >4)||(defined(__GNUC_MINO R__)&&(__GNUC__ ==4)&&(__GNUC_MINOR__ >=2)))) #if defined(__clang__)||(defined(__GNUC__)&&((__GNUC__ >4)||(defined(__GNUC_MINO R__)&&(__GNUC__ ==4)&&(__GNUC_MINOR__ >=2))))
#pragma GCC diagnostic ignored "-Wsign-compare" #pragma GCC diagnostic ignored "-Wsign-compare"
#endif #endif
#include "config.h"
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#ifdef HAVE_GLOB_H #ifdef HAVE_GLOB_H
# include <glob.h> # include <glob.h>
#endif #endif
#include "options.h" #include "options.h"
#include "configyyrename.h"
#include "configparser.h" #include "configparser.h"
#if 0 #if 0
#define LEXOUT(s) printf s /* used ONLY when debugging */ #define LEXOUT(s) printf s /* used ONLY when debugging */
#else #else
#define LEXOUT(s) #define LEXOUT(s)
#endif #endif
struct inc_state { struct inc_state {
char* filename; char* filename;
skipping to change at line 50 skipping to change at line 46
}; };
static struct inc_state* config_include_stack = NULL; static struct inc_state* config_include_stack = NULL;
static int inc_depth = 0; static int inc_depth = 0;
static void config_start_include(const char* filename) static void config_start_include(const char* filename)
{ {
FILE *input; FILE *input;
struct inc_state* s; struct inc_state* s;
char* nm; char* nm;
if(inc_depth++ > 10000000) { if(inc_depth++ > 10000000) {
yyerror("too many include files"); c_error("too many include files");
return; return;
} }
if(strlen(filename) == 0) { if(strlen(filename) == 0) {
yyerror("empty include file name"); c_error("empty include file name");
return; return;
} }
s = (struct inc_state*)malloc(sizeof(*s)); s = (struct inc_state*)malloc(sizeof(*s));
if(!s) { if(!s) {
yyerror("include %s: malloc failure", filename); c_error("include %s: malloc failure", filename);
return; return;
} }
nm = strdup(filename); nm = strdup(filename);
if(!nm) { if(!nm) {
yyerror("include %s: strdup failure", filename); c_error("include %s: strdup failure", filename);
free(s); free(s);
return; return;
} }
input = fopen(filename, "r"); input = fopen(filename, "r");
if(!input) { if(!input) {
yyerror("cannot open include file '%s': %s", c_error("cannot open include file '%s': %s",
filename, strerror(errno)); filename, strerror(errno));
free(s); free(s);
free(nm); free(nm);
return; return;
} }
LEXOUT(("switch_to_include_file(%s) ", filename)); LEXOUT(("switch_to_include_file(%s) ", filename));
s->filename = cfg_parser->filename; s->filename = cfg_parser->filename;
s->line = cfg_parser->line; s->line = cfg_parser->line;
s->buffer = YY_CURRENT_BUFFER; s->buffer = YY_CURRENT_BUFFER;
s->next = config_include_stack; s->next = config_include_stack;
skipping to change at line 98 skipping to change at line 94
static void config_start_include_glob(const char* filename) static void config_start_include_glob(const char* filename)
{ {
/* check for wildcards */ /* check for wildcards */
#ifdef HAVE_GLOB #ifdef HAVE_GLOB
glob_t g; glob_t g;
int i, r, flags; int i, r, flags;
#endif /* HAVE_GLOB */ #endif /* HAVE_GLOB */
if (cfg_parser->chroot) { if (cfg_parser->chroot) {
int l = strlen(cfg_parser->chroot); /* chroot has trailing slash */ int l = strlen(cfg_parser->chroot); /* chroot has trailing slash */
if (strncmp(cfg_parser->chroot, filename, l) != 0) { if (strncmp(cfg_parser->chroot, filename, l) != 0) {
yyerror("include file '%s' is not relative to chroot '%s' ", c_error("include file '%s' is not relative to chroot '%s' ",
filename, cfg_parser->chroot); filename, cfg_parser->chroot);
return; return;
} }
filename += l - 1; /* strip chroot without trailing slash */ filename += l - 1; /* strip chroot without trailing slash */
} }
#ifdef HAVE_GLOB #ifdef HAVE_GLOB
if(!(!strchr(filename, '*') && !strchr(filename, '?') && if(!(!strchr(filename, '*') && !strchr(filename, '?') &&
!strchr(filename, '[') && !strchr(filename, '{') && !strchr(filename, '[') && !strchr(filename, '{') &&
!strchr(filename, '~'))) { !strchr(filename, '~'))) {
flags = 0 flags = 0
skipping to change at line 244 skipping to change at line 240
verbosity{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_VERBOSITY;} verbosity{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_VERBOSITY;}
zone{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_ZONE;} zone{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_ZONE;}
zonefile{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_ZONEFILE ;} zonefile{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_ZONEFILE ;}
zonestats{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_ZONESTATS;} zonestats{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_ZONESTATS;}
allow-notify{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_ALLOW_NOTIFY;} allow-notify{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_ALLOW_NOTIFY;}
size-limit-xfr{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_SIZE_LIMIT_XFR;} size-limit-xfr{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_SIZE_LIMIT_XFR;}
request-xfr{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_REQUEST_XFR;} request-xfr{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_REQUEST_XFR;}
notify{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_NOTIFY;} notify{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_NOTIFY;}
notify-retry{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_NOTIFY_RETRY;} notify-retry{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_NOTIFY_RETRY;}
provide-xfr{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_PROVIDE_XFR;} provide-xfr{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_PROVIDE_XFR;}
allow-query{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_ALLOW_QUERY;}
outgoing-interface{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_OUTGOING _INTERFACE;} outgoing-interface{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_OUTGOING _INTERFACE;}
allow-axfr-fallback{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_ALLOW_AX FR_FALLBACK;} allow-axfr-fallback{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_ALLOW_AX FR_FALLBACK;}
key{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_KEY;} key{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_KEY;}
algorithm{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_ALGORITHM;} algorithm{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_ALGORITHM;}
secret{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_SECRET;} secret{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_SECRET;}
pattern{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_PATTERN;} pattern{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_PATTERN;}
include-pattern{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_INCLUDE_PATTERN; } include-pattern{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_INCLUDE_PATTERN; }
remote-control{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_REMOTE_CONTROL;} remote-control{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_REMOTE_CONTROL;}
control-enable{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_CONTROL_ENABLE;} control-enable{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_CONTROL_ENABLE;}
control-interface{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_CONTROL_ INTERFACE;} control-interface{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_CONTROL_ INTERFACE;}
skipping to change at line 321 skipping to change at line 318
cpu-affinity{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_CPU_AFFINITY; } cpu-affinity{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_CPU_AFFINITY; }
xfrd-cpu-affinity{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_XFRD_CPU _AFFINITY; } xfrd-cpu-affinity{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_XFRD_CPU _AFFINITY; }
server-[1-9][0-9]*-cpu-affinity{COLON} { server-[1-9][0-9]*-cpu-affinity{COLON} {
char *str = yytext; char *str = yytext;
LEXOUT(("v(%s) ", yytext)); LEXOUT(("v(%s) ", yytext));
/* Skip server- */ /* Skip server- */
while (*str != '\0' && (*str < '0' || *str > '9')) { while (*str != '\0' && (*str < '0' || *str > '9')) {
str++; str++;
} }
yylval.llng = strtoll(str, NULL, 10); c_lval.llng = strtoll(str, NULL, 10);
return VAR_SERVER_CPU_AFFINITY; return VAR_SERVER_CPU_AFFINITY;
} }
/* Quoted strings. Strip leading and ending quotes */ /* Quoted strings. Strip leading and ending quotes */
\" { BEGIN(quotedstring); LEXOUT(("QS ")); } \" { BEGIN(quotedstring); LEXOUT(("QS ")); }
<quotedstring><<EOF>> { <quotedstring><<EOF>> {
yyerror("EOF inside quoted string"); c_error("EOF inside quoted string");
BEGIN(INITIAL); BEGIN(INITIAL);
} }
<quotedstring>{ANY}* { LEXOUT(("STR(%s) ", yytext)); yymore(); } <quotedstring>{ANY}* { LEXOUT(("STR(%s) ", yytext)); yymore(); }
<quotedstring>\n { cfg_parser->line++; yymore(); } <quotedstring>\n { cfg_parser->line++; yymore(); }
<quotedstring>\" { <quotedstring>\" {
LEXOUT(("QE ")); LEXOUT(("QE "));
BEGIN(INITIAL); BEGIN(INITIAL);
yytext[yyleng - 1] = '\0'; yytext[yyleng - 1] = '\0';
yylval.str = region_strdup(cfg_parser->opt->region, yytext); c_lval.str = region_strdup(cfg_parser->opt->region, yytext);
return STRING; return STRING;
} }
/* include: directive */ /* include: directive */
include{COLON} { LEXOUT(("v(%s) ", yytext)); BEGIN(include); } include{COLON} { LEXOUT(("v(%s) ", yytext)); BEGIN(include); }
<include><<EOF>> { <include><<EOF>> {
yyerror("EOF inside include directive"); c_error("EOF inside include directive");
BEGIN(INITIAL); BEGIN(INITIAL);
} }
<include>{SPACE}* { LEXOUT(("ISP ")); /* ignore */ } <include>{SPACE}* { LEXOUT(("ISP ")); /* ignore */ }
<include>{NEWLINE} { LEXOUT(("NL\n")); cfg_parser->line++;} <include>{NEWLINE} { LEXOUT(("NL\n")); cfg_parser->line++;}
<include>\" { LEXOUT(("IQS ")); BEGIN(include_quoted); } <include>\" { LEXOUT(("IQS ")); BEGIN(include_quoted); }
<include>{UNQUOTEDLETTER}* { <include>{UNQUOTEDLETTER}* {
LEXOUT(("Iunquotedstr(%s) ", yytext)); LEXOUT(("Iunquotedstr(%s) ", yytext));
config_start_include_glob(yytext); config_start_include_glob(yytext);
BEGIN(INITIAL); BEGIN(INITIAL);
} }
<include_quoted><<EOF>> { <include_quoted><<EOF>> {
yyerror("EOF inside quoted string"); c_error("EOF inside quoted string");
BEGIN(INITIAL); BEGIN(INITIAL);
} }
<include_quoted>{ANY}* { LEXOUT(("ISTR(%s) ", yytext)); yymore(); } <include_quoted>{ANY}* { LEXOUT(("ISTR(%s) ", yytext)); yymore(); }
<include_quoted>{NEWLINE} { cfg_parser->line++; yymore(); } <include_quoted>{NEWLINE} { cfg_parser->line++; yymore(); }
<include_quoted>\" { <include_quoted>\" {
LEXOUT(("IQE ")); LEXOUT(("IQE "));
yytext[yyleng - 1] = '\0'; yytext[yyleng - 1] = '\0';
config_start_include_glob(yytext); config_start_include_glob(yytext);
BEGIN(INITIAL); BEGIN(INITIAL);
} }
skipping to change at line 378 skipping to change at line 375
yy_set_bol(1); /* Set beginning of line, so "^" rules match. */ yy_set_bol(1); /* Set beginning of line, so "^" rules match. */
if (!config_include_stack) { if (!config_include_stack) {
yyterminate(); yyterminate();
} else { } else {
fclose(yyin); fclose(yyin);
config_end_include(); config_end_include();
} }
} }
{UNQUOTEDLETTER}* { LEXOUT(("unquotedstr(%s) ", yytext)); {UNQUOTEDLETTER}* { LEXOUT(("unquotedstr(%s) ", yytext));
yylval.str = region_strdup(cfg_parser->opt->region, yytex t); return STRING; } c_lval.str = region_strdup(cfg_parser->opt->region, yytex t); return STRING; }
%% %%
 End of changes. 15 change blocks. 
16 lines changed or deleted 13 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)