#define YYSTYPE char *
-extern "C"
+extern "C"
{
int yyparse(void);
int yylex(void);
extern int linenumber;
static void yyerror(const char *str)
{
- extern char *current_filename;
+ extern char *current_filename;
throw PDNSException("Error in bind configuration '"+string(current_filename)+"' on line "+std::to_string(linenumber)+": "+str);
}
BindDomainInfo s_di;
void BindParser::parse(const string &fname)
-{
+{
yydebug=0;
yyin=fopen(fname.c_str(),"r");
yyrestart(yyin);
%%
root_commands:
- |
+ |
root_commands root_command SEMICOLON
;
;
command:
- terms
+ terms
;
global_zone_command:
parent->commit(s_di);
s_di.clear();
}
- |
+ |
ZONETOK quotedname AWORD zone_block
{
s_di.name=DNSName($2);
acl_command:
- ACLTOK quotedname acl_block | ACLTOK filename acl_block
+ ACLTOK quotedname acl_block
+ {
+ free($2);
+ }
+ | ACLTOK filename acl_block
;
acl_block: OBRACE acls EBRACE
;
-
-acls:
+
+acls:
|
acl SEMICOLON acls
;
acl:
AWORD
+ {
+ free($1);
+ }
;
options_commands:
}
;
-also_notify_command: ALSONOTIFYTOK OBRACE also_notify_list EBRACE
+also_notify_command: ALSONOTIFYTOK OBRACE also_notify_list EBRACE
;
-also_notify_list:
+also_notify_list:
|
also_notify SEMICOLON also_notify_list
;
terms term
;
-term: AWORD | block | quotedname
+term: AWORD
+ {
+ free($1);
+ }
+ | block | quotedname
+ {
+ free($1);
+ }
;
-block:
- OBRACE commands EBRACE
+block:
+ OBRACE commands EBRACE
;
zone_block:
;
primaries: /* empty */
- |
+ |
primaries primary SEMICOLON
;
zone_file_command:
FILETOK quotedname
{
- // printf("Found a filename: '%s'\n",$2);
s_di.filename=$2;
free($2);
}
;
filename: AWORD
+ {
+ free($1);
+ }
;
# this file is used by ../pdns/test-bindparser_cc.cc
# if you change it, please make check!
+acl bogusnets {
+ 0.0.0.0/8; 192.0.2.0/24; 224.0.0.0/3;
+ 10.0.0.0/8; 172.16.0.0/12; 192.168.0.0/16;
+};
+
+acl "not-these-ips" {
+ !192.168.0/24;!10.0/16;any;
+};
+
options {
directory "./zones/";
recursion no;