From dd17267afed4acf881df2f688edce0aadafbab1c Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Fri, 8 Sep 2017 19:42:18 +0200 Subject: [PATCH] Start working on IPv6 support. --- parse.c | 517 +++++++++++++++++++++++++++++------------------------- parse.peg | 4 +- rinetd.c | 15 +- 3 files changed, 289 insertions(+), 247 deletions(-) diff --git a/parse.c b/parse.c index 1562a9c..a4f2201 100644 --- a/parse.c +++ b/parse.c @@ -3,7 +3,7 @@ #include #include #include -#define YYRULECOUNT 36 +#define YYRULECOUNT 38 #line 9 "parse.peg" #if HAVE_CONFIG_H @@ -309,9 +309,11 @@ YY_LOCAL(void) yySet(yycontext *yy, char *text, int count) { yy->__val[count]= #define YYACCEPT yyAccept(yy, yythunkpos0) -YY_RULE(int) yy_eof(yycontext *yy); /* 36 */ -YY_RULE(int) yy_digit(yycontext *yy); /* 35 */ -YY_RULE(int) yy_hostname(yycontext *yy); /* 34 */ +YY_RULE(int) yy_eof(yycontext *yy); /* 38 */ +YY_RULE(int) yy_hexdigit(yycontext *yy); /* 37 */ +YY_RULE(int) yy_digit(yycontext *yy); /* 36 */ +YY_RULE(int) yy_hostname(yycontext *yy); /* 35 */ +YY_RULE(int) yy_ipv6(yycontext *yy); /* 34 */ YY_RULE(int) yy_ipv4(yycontext *yy); /* 33 */ YY_RULE(int) yy_name(yycontext *yy); /* 32 */ YY_RULE(int) yy_filename(yycontext *yy); /* 31 */ @@ -353,7 +355,7 @@ YY_ACTION(void) yy_1_sol(yycontext *yy, char *yytext, int yyleng) #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_1_sol\n")); { -#line 156 +#line 158 ++yy->currentLine; ; } #undef yythunkpos @@ -673,121 +675,155 @@ YY_RULE(int) yy_eof(yycontext *yy) yyprintf((stderr, " fail %s @ %s\n", "eof", yy->__buf+yy->__pos)); return 0; } -YY_RULE(int) yy_digit(yycontext *yy) +YY_RULE(int) yy_hexdigit(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; - yyprintf((stderr, "%s\n", "digit")); if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\003\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l2; - yyprintf((stderr, " ok %s @ %s\n", "digit", yy->__buf+yy->__pos)); + yyprintf((stderr, "%s\n", "hexdigit")); if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\003\176\000\000\000\176\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l2; + yyprintf((stderr, " ok %s @ %s\n", "hexdigit", yy->__buf+yy->__pos)); return 1; l2:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + yyprintf((stderr, " fail %s @ %s\n", "hexdigit", yy->__buf+yy->__pos)); + return 0; +} +YY_RULE(int) yy_digit(yycontext *yy) +{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; + yyprintf((stderr, "%s\n", "digit")); if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\003\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l3; + yyprintf((stderr, " ok %s @ %s\n", "digit", yy->__buf+yy->__pos)); + return 1; + l3:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "digit", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_hostname(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "hostname")); - l4:; - { int yypos5= yy->__pos, yythunkpos5= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\040\377\003\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l5; - l6:; - { int yypos7= yy->__pos, yythunkpos7= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\040\377\003\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l7; goto l6; - l7:; yy->__pos= yypos7; yy->__thunkpos= yythunkpos7; - } if (!yymatchChar(yy, '.')) goto l5; goto l4; - l5:; yy->__pos= yypos5; yy->__thunkpos= yythunkpos5; - } if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\000\000\376\377\377\007\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l3; - l8:; - { int yypos9= yy->__pos, yythunkpos9= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\040\377\003\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l9; goto l8; - l9:; yy->__pos= yypos9; yy->__thunkpos= yythunkpos9; - } - { int yypos10= yy->__pos, yythunkpos10= yy->__thunkpos; if (!yymatchChar(yy, '.')) goto l10; goto l11; + l5:; + { int yypos6= yy->__pos, yythunkpos6= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\040\377\003\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l6; + l7:; + { int yypos8= yy->__pos, yythunkpos8= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\040\377\003\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l8; goto l7; + l8:; yy->__pos= yypos8; yy->__thunkpos= yythunkpos8; + } if (!yymatchChar(yy, '.')) goto l6; goto l5; + l6:; yy->__pos= yypos6; yy->__thunkpos= yythunkpos6; + } if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\000\000\376\377\377\007\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l4; + l9:; + { int yypos10= yy->__pos, yythunkpos10= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\040\377\003\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l10; goto l9; l10:; yy->__pos= yypos10; yy->__thunkpos= yythunkpos10; } - l11:; + { int yypos11= yy->__pos, yythunkpos11= yy->__thunkpos; if (!yymatchChar(yy, '.')) goto l11; goto l12; + l11:; yy->__pos= yypos11; yy->__thunkpos= yythunkpos11; + } + l12:; yyprintf((stderr, " ok %s @ %s\n", "hostname", yy->__buf+yy->__pos)); return 1; - l3:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l4:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "hostname", yy->__buf+yy->__pos)); return 0; } +YY_RULE(int) yy_ipv6(yycontext *yy) +{ int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; + yyprintf((stderr, "%s\n", "ipv6")); + { int yypos14= yy->__pos, yythunkpos14= yy->__thunkpos; + { int yypos18= yy->__pos, yythunkpos18= yy->__thunkpos; if (!yy_hexdigit(yy)) goto l19; goto l18; + l19:; yy->__pos= yypos18; yy->__thunkpos= yythunkpos18; if (!yymatchChar(yy, ':')) goto l15; + } + l18:; + l16:; + { int yypos17= yy->__pos, yythunkpos17= yy->__thunkpos; + { int yypos20= yy->__pos, yythunkpos20= yy->__thunkpos; if (!yy_hexdigit(yy)) goto l21; goto l20; + l21:; yy->__pos= yypos20; yy->__thunkpos= yythunkpos20; if (!yymatchChar(yy, ':')) goto l17; + } + l20:; goto l16; + l17:; yy->__pos= yypos17; yy->__thunkpos= yythunkpos17; + } goto l14; + l15:; yy->__pos= yypos14; yy->__thunkpos= yythunkpos14; if (!yymatchChar(yy, '[')) goto l13; if (!yy_ipv6(yy)) goto l13; if (!yymatchChar(yy, ']')) goto l13; + } + l14:; + yyprintf((stderr, " ok %s @ %s\n", "ipv6", yy->__buf+yy->__pos)); + return 1; + l13:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + yyprintf((stderr, " fail %s @ %s\n", "ipv6", yy->__buf+yy->__pos)); + return 0; +} YY_RULE(int) yy_ipv4(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "ipv4")); - { int yypos13= yy->__pos, yythunkpos13= yy->__thunkpos; if (!yy_number(yy)) goto l14; if (!yymatchChar(yy, '.')) goto l14; if (!yy_number(yy)) goto l14; if (!yymatchChar(yy, '.')) goto l14; if (!yy_number(yy)) goto l14; if (!yymatchChar(yy, '.')) goto l14; if (!yy_number(yy)) goto l14; goto l13; - l14:; yy->__pos= yypos13; yy->__thunkpos= yythunkpos13; if (!yymatchChar(yy, '0')) goto l12; + { int yypos23= yy->__pos, yythunkpos23= yy->__thunkpos; if (!yy_number(yy)) goto l24; if (!yymatchChar(yy, '.')) goto l24; if (!yy_number(yy)) goto l24; if (!yymatchChar(yy, '.')) goto l24; if (!yy_number(yy)) goto l24; if (!yymatchChar(yy, '.')) goto l24; if (!yy_number(yy)) goto l24; goto l23; + l24:; yy->__pos= yypos23; yy->__thunkpos= yythunkpos23; if (!yymatchChar(yy, '0')) goto l22; } - l13:; + l23:; yyprintf((stderr, " ok %s @ %s\n", "ipv4", yy->__buf+yy->__pos)); return 1; - l12:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l22:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "ipv4", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_name(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; - yyprintf((stderr, "%s\n", "name")); if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\000\000\376\377\377\007\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l15; - l16:; - { int yypos17= yy->__pos, yythunkpos17= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\003\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l17; goto l16; - l17:; yy->__pos= yypos17; yy->__thunkpos= yythunkpos17; + yyprintf((stderr, "%s\n", "name")); if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\000\000\376\377\377\007\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l25; + l26:; + { int yypos27= yy->__pos, yythunkpos27= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\003\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l27; goto l26; + l27:; yy->__pos= yypos27; yy->__thunkpos= yythunkpos27; } yyprintf((stderr, " ok %s @ %s\n", "name", yy->__buf+yy->__pos)); return 1; - l15:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l25:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "name", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_filename(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "filename")); - { int yypos19= yy->__pos, yythunkpos19= yy->__thunkpos; if (!yymatchChar(yy, '"')) goto l20; if (!yymatchClass(yy, (unsigned char *)"\377\377\377\377\373\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377")) goto l20; - l21:; - { int yypos22= yy->__pos, yythunkpos22= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\377\377\377\377\373\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377")) goto l22; goto l21; - l22:; yy->__pos= yypos22; yy->__thunkpos= yythunkpos22; - } if (!yymatchChar(yy, '"')) goto l20; goto l19; - l20:; yy->__pos= yypos19; yy->__thunkpos= yythunkpos19; if (!yymatchClass(yy, (unsigned char *)"\377\331\377\377\376\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377")) goto l18; - l23:; - { int yypos24= yy->__pos, yythunkpos24= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\377\331\377\377\376\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377")) goto l24; goto l23; - l24:; yy->__pos= yypos24; yy->__thunkpos= yythunkpos24; + { int yypos29= yy->__pos, yythunkpos29= yy->__thunkpos; if (!yymatchChar(yy, '"')) goto l30; if (!yymatchClass(yy, (unsigned char *)"\377\377\377\377\373\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377")) goto l30; + l31:; + { int yypos32= yy->__pos, yythunkpos32= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\377\377\377\377\373\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377")) goto l32; goto l31; + l32:; yy->__pos= yypos32; yy->__thunkpos= yythunkpos32; + } if (!yymatchChar(yy, '"')) goto l30; goto l29; + l30:; yy->__pos= yypos29; yy->__thunkpos= yythunkpos29; if (!yymatchClass(yy, (unsigned char *)"\377\331\377\377\376\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377")) goto l28; + l33:; + { int yypos34= yy->__pos, yythunkpos34= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\377\331\377\377\376\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377")) goto l34; goto l33; + l34:; yy->__pos= yypos34; yy->__thunkpos= yythunkpos34; } } - l19:; + l29:; yyprintf((stderr, " ok %s @ %s\n", "filename", yy->__buf+yy->__pos)); return 1; - l18:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l28:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "filename", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_pattern(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; - yyprintf((stderr, "%s\n", "pattern")); if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\004\377\203\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l25; - l26:; - { int yypos27= yy->__pos, yythunkpos27= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\004\377\203\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l27; goto l26; - l27:; yy->__pos= yypos27; yy->__thunkpos= yythunkpos27; + yyprintf((stderr, "%s\n", "pattern")); if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\004\377\203\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l35; + l36:; + { int yypos37= yy->__pos, yythunkpos37= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\004\377\203\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l37; goto l36; + l37:; yy->__pos= yypos37; yy->__thunkpos= yythunkpos37; } - { int yypos28= yy->__pos, yythunkpos28= yy->__thunkpos; if (!yymatchChar(yy, '.')) goto l28; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\004\377\203\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l28; - l30:; - { int yypos31= yy->__pos, yythunkpos31= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\004\377\203\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l31; goto l30; - l31:; yy->__pos= yypos31; yy->__thunkpos= yythunkpos31; + { int yypos38= yy->__pos, yythunkpos38= yy->__thunkpos; if (!yymatchChar(yy, '.')) goto l38; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\004\377\203\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l38; + l40:; + { int yypos41= yy->__pos, yythunkpos41= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\004\377\203\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l41; goto l40; + l41:; yy->__pos= yypos41; yy->__thunkpos= yythunkpos41; } - { int yypos32= yy->__pos, yythunkpos32= yy->__thunkpos; if (!yymatchChar(yy, '.')) goto l32; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\004\377\203\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l32; - l34:; - { int yypos35= yy->__pos, yythunkpos35= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\004\377\203\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l35; goto l34; - l35:; yy->__pos= yypos35; yy->__thunkpos= yythunkpos35; + { int yypos42= yy->__pos, yythunkpos42= yy->__thunkpos; if (!yymatchChar(yy, '.')) goto l42; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\004\377\203\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l42; + l44:; + { int yypos45= yy->__pos, yythunkpos45= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\004\377\203\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l45; goto l44; + l45:; yy->__pos= yypos45; yy->__thunkpos= yythunkpos45; } - { int yypos36= yy->__pos, yythunkpos36= yy->__thunkpos; if (!yymatchChar(yy, '.')) goto l36; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\004\377\203\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l36; - l38:; - { int yypos39= yy->__pos, yythunkpos39= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\004\377\203\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l39; goto l38; - l39:; yy->__pos= yypos39; yy->__thunkpos= yythunkpos39; - } goto l37; - l36:; yy->__pos= yypos36; yy->__thunkpos= yythunkpos36; + { int yypos46= yy->__pos, yythunkpos46= yy->__thunkpos; if (!yymatchChar(yy, '.')) goto l46; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\004\377\203\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l46; + l48:; + { int yypos49= yy->__pos, yythunkpos49= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\004\377\203\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l49; goto l48; + l49:; yy->__pos= yypos49; yy->__thunkpos= yythunkpos49; + } goto l47; + l46:; yy->__pos= yypos46; yy->__thunkpos= yythunkpos46; } - l37:; goto l33; - l32:; yy->__pos= yypos32; yy->__thunkpos= yythunkpos32; + l47:; goto l43; + l42:; yy->__pos= yypos42; yy->__thunkpos= yythunkpos42; } - l33:; goto l29; - l28:; yy->__pos= yypos28; yy->__thunkpos= yythunkpos28; + l43:; goto l39; + l38:; yy->__pos= yypos38; yy->__thunkpos= yythunkpos38; } - l29:; + l39:; yyprintf((stderr, " ok %s @ %s\n", "pattern", yy->__buf+yy->__pos)); return 1; - l25:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l35:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "pattern", yy->__buf+yy->__pos)); return 0; } @@ -796,46 +832,46 @@ YY_RULE(int) yy_auth_key(yycontext *yy) yyprintf((stderr, "%s\n", "auth_key")); yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen -if (!(YY_BEGIN)) goto l40; +if (!(YY_BEGIN)) goto l50; #undef yytext #undef yyleng } - { int yypos41= yy->__pos, yythunkpos41= yy->__thunkpos; if (!yymatchString(yy, "allow")) goto l42; goto l41; - l42:; yy->__pos= yypos41; yy->__thunkpos= yythunkpos41; if (!yymatchString(yy, "deny")) goto l40; + { int yypos51= yy->__pos, yythunkpos51= yy->__thunkpos; if (!yymatchString(yy, "allow")) goto l52; goto l51; + l52:; yy->__pos= yypos51; yy->__thunkpos= yythunkpos51; if (!yymatchString(yy, "deny")) goto l50; } - l41:; yyText(yy, yy->__begin, yy->__end); { + l51:; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen -if (!(YY_END)) goto l40; +if (!(YY_END)) goto l50; #undef yytext #undef yyleng } yyDo(yy, yy_1_auth_key, yy->__begin, yy->__end); yyprintf((stderr, " ok %s @ %s\n", "auth_key", yy->__buf+yy->__pos)); return 1; - l40:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l50:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "auth_key", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_service(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; - yyprintf((stderr, "%s\n", "service")); if (!yy_name(yy)) goto l43; + yyprintf((stderr, "%s\n", "service")); if (!yy_name(yy)) goto l53; yyprintf((stderr, " ok %s @ %s\n", "service", yy->__buf+yy->__pos)); return 1; - l43:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l53:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "service", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_proto(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "proto")); - { int yypos45= yy->__pos, yythunkpos45= yy->__thunkpos; if (!yymatchString(yy, "/tcp")) goto l46; yyDo(yy, yy_1_proto, yy->__begin, yy->__end); goto l45; - l46:; yy->__pos= yypos45; yy->__thunkpos= yythunkpos45; if (!yymatchString(yy, "/udp")) goto l47; yyDo(yy, yy_2_proto, yy->__begin, yy->__end); goto l45; - l47:; yy->__pos= yypos45; yy->__thunkpos= yythunkpos45; if (!yymatchString(yy, "")) goto l44; yyDo(yy, yy_3_proto, yy->__begin, yy->__end); + { int yypos55= yy->__pos, yythunkpos55= yy->__thunkpos; if (!yymatchString(yy, "/tcp")) goto l56; yyDo(yy, yy_1_proto, yy->__begin, yy->__end); goto l55; + l56:; yy->__pos= yypos55; yy->__thunkpos= yythunkpos55; if (!yymatchString(yy, "/udp")) goto l57; yyDo(yy, yy_2_proto, yy->__begin, yy->__end); goto l55; + l57:; yy->__pos= yypos55; yy->__thunkpos= yythunkpos55; if (!yymatchString(yy, "")) goto l54; yyDo(yy, yy_3_proto, yy->__begin, yy->__end); } - l45:; + l55:; yyprintf((stderr, " ok %s @ %s\n", "proto", yy->__buf+yy->__pos)); return 1; - l44:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l54:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "proto", yy->__buf+yy->__pos)); return 0; } @@ -844,176 +880,177 @@ YY_RULE(int) yy_port(yycontext *yy) yyprintf((stderr, "%s\n", "port")); yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen -if (!(YY_BEGIN)) goto l48; +if (!(YY_BEGIN)) goto l58; #undef yytext #undef yyleng } - { int yypos49= yy->__pos, yythunkpos49= yy->__thunkpos; if (!yy_number(yy)) goto l50; goto l49; - l50:; yy->__pos= yypos49; yy->__thunkpos= yythunkpos49; if (!yy_service(yy)) goto l48; + { int yypos59= yy->__pos, yythunkpos59= yy->__thunkpos; if (!yy_number(yy)) goto l60; goto l59; + l60:; yy->__pos= yypos59; yy->__thunkpos= yythunkpos59; if (!yy_service(yy)) goto l58; } - l49:; yyText(yy, yy->__begin, yy->__end); { + l59:; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen -if (!(YY_END)) goto l48; +if (!(YY_END)) goto l58; #undef yytext #undef yyleng } yyDo(yy, yy_1_port, yy->__begin, yy->__end); yyprintf((stderr, " ok %s @ %s\n", "port", yy->__buf+yy->__pos)); return 1; - l48:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l58:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "port", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_number(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; - yyprintf((stderr, "%s\n", "number")); if (!yy_digit(yy)) goto l51; - l52:; - { int yypos53= yy->__pos, yythunkpos53= yy->__thunkpos; if (!yy_digit(yy)) goto l53; goto l52; - l53:; yy->__pos= yypos53; yy->__thunkpos= yythunkpos53; + yyprintf((stderr, "%s\n", "number")); if (!yy_digit(yy)) goto l61; + l62:; + { int yypos63= yy->__pos, yythunkpos63= yy->__thunkpos; if (!yy_digit(yy)) goto l63; goto l62; + l63:; yy->__pos= yypos63; yy->__thunkpos= yythunkpos63; } yyprintf((stderr, " ok %s @ %s\n", "number", yy->__buf+yy->__pos)); return 1; - l51:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l61:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "number", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_option_source(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; - yyprintf((stderr, "%s\n", "option_source")); if (!yymatchString(yy, "src")) goto l54; - { int yypos55= yy->__pos, yythunkpos55= yy->__thunkpos; if (!yy__(yy)) goto l55; goto l56; - l55:; yy->__pos= yypos55; yy->__thunkpos= yythunkpos55; + yyprintf((stderr, "%s\n", "option_source")); if (!yymatchString(yy, "src")) goto l64; + { int yypos65= yy->__pos, yythunkpos65= yy->__thunkpos; if (!yy__(yy)) goto l65; goto l66; + l65:; yy->__pos= yypos65; yy->__thunkpos= yythunkpos65; } - l56:; if (!yymatchChar(yy, '=')) goto l54; - { int yypos57= yy->__pos, yythunkpos57= yy->__thunkpos; if (!yy__(yy)) goto l57; goto l58; - l57:; yy->__pos= yypos57; yy->__thunkpos= yythunkpos57; + l66:; if (!yymatchChar(yy, '=')) goto l64; + { int yypos67= yy->__pos, yythunkpos67= yy->__thunkpos; if (!yy__(yy)) goto l67; goto l68; + l67:; yy->__pos= yypos67; yy->__thunkpos= yythunkpos67; } - l58:; yyText(yy, yy->__begin, yy->__end); { + l68:; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen -if (!(YY_BEGIN)) goto l54; +if (!(YY_BEGIN)) goto l64; #undef yytext #undef yyleng - } if (!yy_address(yy)) goto l54; yyText(yy, yy->__begin, yy->__end); { + } if (!yy_address(yy)) goto l64; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen -if (!(YY_END)) goto l54; +if (!(YY_END)) goto l64; #undef yytext #undef yyleng } yyDo(yy, yy_1_option_source, yy->__begin, yy->__end); yyprintf((stderr, " ok %s @ %s\n", "option_source", yy->__buf+yy->__pos)); return 1; - l54:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l64:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "option_source", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_option_timeout(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; - yyprintf((stderr, "%s\n", "option_timeout")); if (!yymatchString(yy, "timeout")) goto l59; - { int yypos60= yy->__pos, yythunkpos60= yy->__thunkpos; if (!yy__(yy)) goto l60; goto l61; - l60:; yy->__pos= yypos60; yy->__thunkpos= yythunkpos60; + yyprintf((stderr, "%s\n", "option_timeout")); if (!yymatchString(yy, "timeout")) goto l69; + { int yypos70= yy->__pos, yythunkpos70= yy->__thunkpos; if (!yy__(yy)) goto l70; goto l71; + l70:; yy->__pos= yypos70; yy->__thunkpos= yythunkpos70; } - l61:; if (!yymatchChar(yy, '=')) goto l59; - { int yypos62= yy->__pos, yythunkpos62= yy->__thunkpos; if (!yy__(yy)) goto l62; goto l63; - l62:; yy->__pos= yypos62; yy->__thunkpos= yythunkpos62; + l71:; if (!yymatchChar(yy, '=')) goto l69; + { int yypos72= yy->__pos, yythunkpos72= yy->__thunkpos; if (!yy__(yy)) goto l72; goto l73; + l72:; yy->__pos= yypos72; yy->__thunkpos= yythunkpos72; } - l63:; yyText(yy, yy->__begin, yy->__end); { + l73:; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen -if (!(YY_BEGIN)) goto l59; +if (!(YY_BEGIN)) goto l69; #undef yytext #undef yyleng - } if (!yy_number(yy)) goto l59; yyText(yy, yy->__begin, yy->__end); { + } if (!yy_number(yy)) goto l69; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen -if (!(YY_END)) goto l59; +if (!(YY_END)) goto l69; #undef yytext #undef yyleng } yyDo(yy, yy_1_option_timeout, yy->__begin, yy->__end); yyprintf((stderr, " ok %s @ %s\n", "option_timeout", yy->__buf+yy->__pos)); return 1; - l59:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l69:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "option_timeout", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_option(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "option")); - { int yypos65= yy->__pos, yythunkpos65= yy->__thunkpos; if (!yy_option_timeout(yy)) goto l66; goto l65; - l66:; yy->__pos= yypos65; yy->__thunkpos= yythunkpos65; if (!yy_option_source(yy)) goto l64; + { int yypos75= yy->__pos, yythunkpos75= yy->__thunkpos; if (!yy_option_timeout(yy)) goto l76; goto l75; + l76:; yy->__pos= yypos75; yy->__thunkpos= yythunkpos75; if (!yy_option_source(yy)) goto l74; } - l65:; + l75:; yyprintf((stderr, " ok %s @ %s\n", "option", yy->__buf+yy->__pos)); return 1; - l64:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l74:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "option", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_option_list(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; - yyprintf((stderr, "%s\n", "option_list")); if (!yy_option(yy)) goto l67; - { int yypos68= yy->__pos, yythunkpos68= yy->__thunkpos; - { int yypos70= yy->__pos, yythunkpos70= yy->__thunkpos; if (!yy__(yy)) goto l70; goto l71; - l70:; yy->__pos= yypos70; yy->__thunkpos= yythunkpos70; + yyprintf((stderr, "%s\n", "option_list")); if (!yy_option(yy)) goto l77; + { int yypos78= yy->__pos, yythunkpos78= yy->__thunkpos; + { int yypos80= yy->__pos, yythunkpos80= yy->__thunkpos; if (!yy__(yy)) goto l80; goto l81; + l80:; yy->__pos= yypos80; yy->__thunkpos= yythunkpos80; } - l71:; if (!yymatchChar(yy, ',')) goto l68; - { int yypos72= yy->__pos, yythunkpos72= yy->__thunkpos; if (!yy__(yy)) goto l72; goto l73; - l72:; yy->__pos= yypos72; yy->__thunkpos= yythunkpos72; + l81:; if (!yymatchChar(yy, ',')) goto l78; + { int yypos82= yy->__pos, yythunkpos82= yy->__thunkpos; if (!yy__(yy)) goto l82; goto l83; + l82:; yy->__pos= yypos82; yy->__thunkpos= yythunkpos82; } - l73:; if (!yy_option_list(yy)) goto l68; goto l69; - l68:; yy->__pos= yypos68; yy->__thunkpos= yythunkpos68; + l83:; if (!yy_option_list(yy)) goto l78; goto l79; + l78:; yy->__pos= yypos78; yy->__thunkpos= yythunkpos78; } - l69:; + l79:; yyprintf((stderr, " ok %s @ %s\n", "option_list", yy->__buf+yy->__pos)); return 1; - l67:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l77:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "option_list", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_full_port(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; - yyprintf((stderr, "%s\n", "full_port")); if (!yy_port(yy)) goto l74; if (!yy_proto(yy)) goto l74; yyDo(yy, yy_1_full_port, yy->__begin, yy->__end); + yyprintf((stderr, "%s\n", "full_port")); if (!yy_port(yy)) goto l84; if (!yy_proto(yy)) goto l84; yyDo(yy, yy_1_full_port, yy->__begin, yy->__end); yyprintf((stderr, " ok %s @ %s\n", "full_port", yy->__buf+yy->__pos)); return 1; - l74:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l84:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "full_port", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_address(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "address")); - { int yypos76= yy->__pos, yythunkpos76= yy->__thunkpos; if (!yy_ipv4(yy)) goto l77; goto l76; - l77:; yy->__pos= yypos76; yy->__thunkpos= yythunkpos76; if (!yy_hostname(yy)) goto l75; + { int yypos86= yy->__pos, yythunkpos86= yy->__thunkpos; if (!yy_ipv4(yy)) goto l87; goto l86; + l87:; yy->__pos= yypos86; yy->__thunkpos= yythunkpos86; if (!yy_ipv6(yy)) goto l88; goto l86; + l88:; yy->__pos= yypos86; yy->__thunkpos= yythunkpos86; if (!yy_hostname(yy)) goto l85; } - l76:; + l86:; yyprintf((stderr, " ok %s @ %s\n", "address", yy->__buf+yy->__pos)); return 1; - l75:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l85:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "address", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_server_options(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; - yyprintf((stderr, "%s\n", "server_options")); if (!yymatchChar(yy, '[')) goto l78; - { int yypos79= yy->__pos, yythunkpos79= yy->__thunkpos; if (!yy__(yy)) goto l79; goto l80; - l79:; yy->__pos= yypos79; yy->__thunkpos= yythunkpos79; + yyprintf((stderr, "%s\n", "server_options")); if (!yymatchChar(yy, '[')) goto l89; + { int yypos90= yy->__pos, yythunkpos90= yy->__thunkpos; if (!yy__(yy)) goto l90; goto l91; + l90:; yy->__pos= yypos90; yy->__thunkpos= yythunkpos90; } - l80:; if (!yy_option_list(yy)) goto l78; - { int yypos81= yy->__pos, yythunkpos81= yy->__thunkpos; if (!yy__(yy)) goto l81; goto l82; - l81:; yy->__pos= yypos81; yy->__thunkpos= yythunkpos81; + l91:; if (!yy_option_list(yy)) goto l89; + { int yypos92= yy->__pos, yythunkpos92= yy->__thunkpos; if (!yy__(yy)) goto l92; goto l93; + l92:; yy->__pos= yypos92; yy->__thunkpos= yythunkpos92; } - l82:; if (!yymatchChar(yy, ']')) goto l78; + l93:; if (!yymatchChar(yy, ']')) goto l89; yyprintf((stderr, " ok %s @ %s\n", "server_options", yy->__buf+yy->__pos)); return 1; - l78:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l89:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "server_options", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_connect_port(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; - yyprintf((stderr, "%s\n", "connect_port")); if (!yy_full_port(yy)) goto l83; yyDo(yy, yy_1_connect_port, yy->__begin, yy->__end); + yyprintf((stderr, "%s\n", "connect_port")); if (!yy_full_port(yy)) goto l94; yyDo(yy, yy_1_connect_port, yy->__begin, yy->__end); yyprintf((stderr, " ok %s @ %s\n", "connect_port", yy->__buf+yy->__pos)); return 1; - l83:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l94:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "connect_port", yy->__buf+yy->__pos)); return 0; } @@ -1022,28 +1059,28 @@ YY_RULE(int) yy_connect_address(yycontext *yy) yyprintf((stderr, "%s\n", "connect_address")); yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen -if (!(YY_BEGIN)) goto l84; +if (!(YY_BEGIN)) goto l95; #undef yytext #undef yyleng - } if (!yy_address(yy)) goto l84; yyText(yy, yy->__begin, yy->__end); { + } if (!yy_address(yy)) goto l95; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen -if (!(YY_END)) goto l84; +if (!(YY_END)) goto l95; #undef yytext #undef yyleng } yyDo(yy, yy_1_connect_address, yy->__begin, yy->__end); yyprintf((stderr, " ok %s @ %s\n", "connect_address", yy->__buf+yy->__pos)); return 1; - l84:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l95:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "connect_address", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_bind_port(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; - yyprintf((stderr, "%s\n", "bind_port")); if (!yy_full_port(yy)) goto l85; yyDo(yy, yy_1_bind_port, yy->__begin, yy->__end); + yyprintf((stderr, "%s\n", "bind_port")); if (!yy_full_port(yy)) goto l96; yyDo(yy, yy_1_bind_port, yy->__begin, yy->__end); yyprintf((stderr, " ok %s @ %s\n", "bind_port", yy->__buf+yy->__pos)); return 1; - l85:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l96:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "bind_port", yy->__buf+yy->__pos)); return 0; } @@ -1052,153 +1089,153 @@ YY_RULE(int) yy_bind_address(yycontext *yy) yyprintf((stderr, "%s\n", "bind_address")); yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen -if (!(YY_BEGIN)) goto l86; +if (!(YY_BEGIN)) goto l97; #undef yytext #undef yyleng - } if (!yy_address(yy)) goto l86; yyText(yy, yy->__begin, yy->__end); { + } if (!yy_address(yy)) goto l97; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen -if (!(YY_END)) goto l86; +if (!(YY_END)) goto l97; #undef yytext #undef yyleng } yyDo(yy, yy_1_bind_address, yy->__begin, yy->__end); yyprintf((stderr, " ok %s @ %s\n", "bind_address", yy->__buf+yy->__pos)); return 1; - l86:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l97:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "bind_address", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_logcommon(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; - yyprintf((stderr, "%s\n", "logcommon")); if (!yymatchString(yy, "logcommon")) goto l87; yyDo(yy, yy_1_logcommon, yy->__begin, yy->__end); + yyprintf((stderr, "%s\n", "logcommon")); if (!yymatchString(yy, "logcommon")) goto l98; yyDo(yy, yy_1_logcommon, yy->__begin, yy->__end); yyprintf((stderr, " ok %s @ %s\n", "logcommon", yy->__buf+yy->__pos)); return 1; - l87:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l98:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "logcommon", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_pidlogfile(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; - yyprintf((stderr, "%s\n", "pidlogfile")); if (!yymatchString(yy, "pidlogfile")) goto l88; if (!yy__(yy)) goto l88; yyText(yy, yy->__begin, yy->__end); { + yyprintf((stderr, "%s\n", "pidlogfile")); if (!yymatchString(yy, "pidlogfile")) goto l99; if (!yy__(yy)) goto l99; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen -if (!(YY_BEGIN)) goto l88; +if (!(YY_BEGIN)) goto l99; #undef yytext #undef yyleng - } if (!yy_filename(yy)) goto l88; yyText(yy, yy->__begin, yy->__end); { + } if (!yy_filename(yy)) goto l99; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen -if (!(YY_END)) goto l88; +if (!(YY_END)) goto l99; #undef yytext #undef yyleng } yyDo(yy, yy_1_pidlogfile, yy->__begin, yy->__end); yyprintf((stderr, " ok %s @ %s\n", "pidlogfile", yy->__buf+yy->__pos)); return 1; - l88:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l99:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "pidlogfile", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_logfile(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; - yyprintf((stderr, "%s\n", "logfile")); if (!yymatchString(yy, "logfile")) goto l89; if (!yy__(yy)) goto l89; yyText(yy, yy->__begin, yy->__end); { + yyprintf((stderr, "%s\n", "logfile")); if (!yymatchString(yy, "logfile")) goto l100; if (!yy__(yy)) goto l100; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen -if (!(YY_BEGIN)) goto l89; +if (!(YY_BEGIN)) goto l100; #undef yytext #undef yyleng - } if (!yy_filename(yy)) goto l89; yyText(yy, yy->__begin, yy->__end); { + } if (!yy_filename(yy)) goto l100; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen -if (!(YY_END)) goto l89; +if (!(YY_END)) goto l100; #undef yytext #undef yyleng } yyDo(yy, yy_1_logfile, yy->__begin, yy->__end); yyprintf((stderr, " ok %s @ %s\n", "logfile", yy->__buf+yy->__pos)); return 1; - l89:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l100:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "logfile", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_auth_rule(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; - yyprintf((stderr, "%s\n", "auth_rule")); if (!yy_auth_key(yy)) goto l90; if (!yy__(yy)) goto l90; yyText(yy, yy->__begin, yy->__end); { + yyprintf((stderr, "%s\n", "auth_rule")); if (!yy_auth_key(yy)) goto l101; if (!yy__(yy)) goto l101; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen -if (!(YY_BEGIN)) goto l90; +if (!(YY_BEGIN)) goto l101; #undef yytext #undef yyleng - } if (!yy_pattern(yy)) goto l90; yyText(yy, yy->__begin, yy->__end); { + } if (!yy_pattern(yy)) goto l101; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen -if (!(YY_END)) goto l90; +if (!(YY_END)) goto l101; #undef yytext #undef yyleng } yyDo(yy, yy_1_auth_rule, yy->__begin, yy->__end); yyprintf((stderr, " ok %s @ %s\n", "auth_rule", yy->__buf+yy->__pos)); return 1; - l90:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l101:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "auth_rule", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_server_rule(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; - yyprintf((stderr, "%s\n", "server_rule")); if (!yy_bind_address(yy)) goto l91; if (!yy__(yy)) goto l91; if (!yy_bind_port(yy)) goto l91; if (!yy__(yy)) goto l91; if (!yy_connect_address(yy)) goto l91; if (!yy__(yy)) goto l91; if (!yy_connect_port(yy)) goto l91; - { int yypos92= yy->__pos, yythunkpos92= yy->__thunkpos; - { int yypos94= yy->__pos, yythunkpos94= yy->__thunkpos; if (!yy__(yy)) goto l94; goto l95; - l94:; yy->__pos= yypos94; yy->__thunkpos= yythunkpos94; + yyprintf((stderr, "%s\n", "server_rule")); if (!yy_bind_address(yy)) goto l102; if (!yy__(yy)) goto l102; if (!yy_bind_port(yy)) goto l102; if (!yy__(yy)) goto l102; if (!yy_connect_address(yy)) goto l102; if (!yy__(yy)) goto l102; if (!yy_connect_port(yy)) goto l102; + { int yypos103= yy->__pos, yythunkpos103= yy->__thunkpos; + { int yypos105= yy->__pos, yythunkpos105= yy->__thunkpos; if (!yy__(yy)) goto l105; goto l106; + l105:; yy->__pos= yypos105; yy->__thunkpos= yythunkpos105; } - l95:; if (!yy_server_options(yy)) goto l92; goto l93; - l92:; yy->__pos= yypos92; yy->__thunkpos= yythunkpos92; + l106:; if (!yy_server_options(yy)) goto l103; goto l104; + l103:; yy->__pos= yypos103; yy->__thunkpos= yythunkpos103; } - l93:; yyDo(yy, yy_1_server_rule, yy->__begin, yy->__end); + l104:; yyDo(yy, yy_1_server_rule, yy->__begin, yy->__end); yyprintf((stderr, " ok %s @ %s\n", "server_rule", yy->__buf+yy->__pos)); return 1; - l91:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l102:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "server_rule", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_comment(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; - yyprintf((stderr, "%s\n", "comment")); if (!yymatchChar(yy, '#')) goto l96; - l97:; - { int yypos98= yy->__pos, yythunkpos98= yy->__thunkpos; - { int yypos99= yy->__pos, yythunkpos99= yy->__thunkpos; if (!yy_eol(yy)) goto l99; goto l98; - l99:; yy->__pos= yypos99; yy->__thunkpos= yythunkpos99; - } if (!yymatchDot(yy)) goto l98; goto l97; - l98:; yy->__pos= yypos98; yy->__thunkpos= yythunkpos98; + yyprintf((stderr, "%s\n", "comment")); if (!yymatchChar(yy, '#')) goto l107; + l108:; + { int yypos109= yy->__pos, yythunkpos109= yy->__thunkpos; + { int yypos110= yy->__pos, yythunkpos110= yy->__thunkpos; if (!yy_eol(yy)) goto l110; goto l109; + l110:; yy->__pos= yypos110; yy->__thunkpos= yythunkpos110; + } if (!yymatchDot(yy)) goto l109; goto l108; + l109:; yy->__pos= yypos109; yy->__thunkpos= yythunkpos109; } yyprintf((stderr, " ok %s @ %s\n", "comment", yy->__buf+yy->__pos)); return 1; - l96:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l107:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "comment", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_command(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "command")); - { int yypos101= yy->__pos, yythunkpos101= yy->__thunkpos; if (!yy_server_rule(yy)) goto l102; goto l101; - l102:; yy->__pos= yypos101; yy->__thunkpos= yythunkpos101; if (!yy_auth_rule(yy)) goto l103; goto l101; - l103:; yy->__pos= yypos101; yy->__thunkpos= yythunkpos101; if (!yy_logfile(yy)) goto l104; goto l101; - l104:; yy->__pos= yypos101; yy->__thunkpos= yythunkpos101; if (!yy_pidlogfile(yy)) goto l105; goto l101; - l105:; yy->__pos= yypos101; yy->__thunkpos= yythunkpos101; if (!yy_logcommon(yy)) goto l100; + { int yypos112= yy->__pos, yythunkpos112= yy->__thunkpos; if (!yy_server_rule(yy)) goto l113; goto l112; + l113:; yy->__pos= yypos112; yy->__thunkpos= yythunkpos112; if (!yy_auth_rule(yy)) goto l114; goto l112; + l114:; yy->__pos= yypos112; yy->__thunkpos= yythunkpos112; if (!yy_logfile(yy)) goto l115; goto l112; + l115:; yy->__pos= yypos112; yy->__thunkpos= yythunkpos112; if (!yy_pidlogfile(yy)) goto l116; goto l112; + l116:; yy->__pos= yypos112; yy->__thunkpos= yythunkpos112; if (!yy_logcommon(yy)) goto l111; } - l101:; + l112:; yyprintf((stderr, " ok %s @ %s\n", "command", yy->__buf+yy->__pos)); return 1; - l100:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l111:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "command", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy__(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; - yyprintf((stderr, "%s\n", "_")); if (!yymatchClass(yy, (unsigned char *)"\000\002\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l106; - l107:; - { int yypos108= yy->__pos, yythunkpos108= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\002\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l108; goto l107; - l108:; yy->__pos= yypos108; yy->__thunkpos= yythunkpos108; + yyprintf((stderr, "%s\n", "_")); if (!yymatchClass(yy, (unsigned char *)"\000\002\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l117; + l118:; + { int yypos119= yy->__pos, yythunkpos119= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\002\000\000\001\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l119; goto l118; + l119:; yy->__pos= yypos119; yy->__thunkpos= yythunkpos119; } yyprintf((stderr, " ok %s @ %s\n", "_", yy->__buf+yy->__pos)); return 1; - l106:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l117:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "_", yy->__buf+yy->__pos)); return 0; } @@ -1207,71 +1244,71 @@ YY_RULE(int) yy_invalid_syntax(yycontext *yy) yyprintf((stderr, "%s\n", "invalid_syntax")); yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen -if (!(YY_BEGIN)) goto l109; +if (!(YY_BEGIN)) goto l120; #undef yytext #undef yyleng } - { int yypos112= yy->__pos, yythunkpos112= yy->__thunkpos; if (!yy_eol(yy)) goto l112; goto l109; - l112:; yy->__pos= yypos112; yy->__thunkpos= yythunkpos112; - } if (!yymatchDot(yy)) goto l109; - l110:; - { int yypos111= yy->__pos, yythunkpos111= yy->__thunkpos; - { int yypos113= yy->__pos, yythunkpos113= yy->__thunkpos; if (!yy_eol(yy)) goto l113; goto l111; - l113:; yy->__pos= yypos113; yy->__thunkpos= yythunkpos113; - } if (!yymatchDot(yy)) goto l111; goto l110; - l111:; yy->__pos= yypos111; yy->__thunkpos= yythunkpos111; + { int yypos123= yy->__pos, yythunkpos123= yy->__thunkpos; if (!yy_eol(yy)) goto l123; goto l120; + l123:; yy->__pos= yypos123; yy->__thunkpos= yythunkpos123; + } if (!yymatchDot(yy)) goto l120; + l121:; + { int yypos122= yy->__pos, yythunkpos122= yy->__thunkpos; + { int yypos124= yy->__pos, yythunkpos124= yy->__thunkpos; if (!yy_eol(yy)) goto l124; goto l122; + l124:; yy->__pos= yypos124; yy->__thunkpos= yythunkpos124; + } if (!yymatchDot(yy)) goto l122; goto l121; + l122:; yy->__pos= yypos122; yy->__thunkpos= yythunkpos122; } yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen -if (!(YY_END)) goto l109; +if (!(YY_END)) goto l120; #undef yytext #undef yyleng - } if (!yy_eol(yy)) goto l109; yyDo(yy, yy_1_invalid_syntax, yy->__begin, yy->__end); + } if (!yy_eol(yy)) goto l120; yyDo(yy, yy_1_invalid_syntax, yy->__begin, yy->__end); yyprintf((stderr, " ok %s @ %s\n", "invalid_syntax", yy->__buf+yy->__pos)); return 1; - l109:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l120:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "invalid_syntax", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_eol(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "eol")); - { int yypos115= yy->__pos, yythunkpos115= yy->__thunkpos; - { int yypos117= yy->__pos, yythunkpos117= yy->__thunkpos; if (!yymatchChar(yy, '\r')) goto l117; goto l118; - l117:; yy->__pos= yypos117; yy->__thunkpos= yythunkpos117; + { int yypos126= yy->__pos, yythunkpos126= yy->__thunkpos; + { int yypos128= yy->__pos, yythunkpos128= yy->__thunkpos; if (!yymatchChar(yy, '\r')) goto l128; goto l129; + l128:; yy->__pos= yypos128; yy->__thunkpos= yythunkpos128; } - l118:; if (!yymatchChar(yy, '\n')) goto l116; goto l115; - l116:; yy->__pos= yypos115; yy->__thunkpos= yythunkpos115; if (!yy_eof(yy)) goto l114; + l129:; if (!yymatchChar(yy, '\n')) goto l127; goto l126; + l127:; yy->__pos= yypos126; yy->__thunkpos= yythunkpos126; if (!yy_eof(yy)) goto l125; } - l115:; + l126:; yyprintf((stderr, " ok %s @ %s\n", "eol", yy->__buf+yy->__pos)); return 1; - l114:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l125:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "eol", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_line(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "line")); - { int yypos120= yy->__pos, yythunkpos120= yy->__thunkpos; if (!yy__(yy)) goto l120; goto l121; - l120:; yy->__pos= yypos120; yy->__thunkpos= yythunkpos120; + { int yypos131= yy->__pos, yythunkpos131= yy->__thunkpos; if (!yy__(yy)) goto l131; goto l132; + l131:; yy->__pos= yypos131; yy->__thunkpos= yythunkpos131; } - l121:; - { int yypos122= yy->__pos, yythunkpos122= yy->__thunkpos; if (!yy_command(yy)) goto l122; - { int yypos124= yy->__pos, yythunkpos124= yy->__thunkpos; if (!yy__(yy)) goto l124; goto l125; - l124:; yy->__pos= yypos124; yy->__thunkpos= yythunkpos124; + l132:; + { int yypos133= yy->__pos, yythunkpos133= yy->__thunkpos; if (!yy_command(yy)) goto l133; + { int yypos135= yy->__pos, yythunkpos135= yy->__thunkpos; if (!yy__(yy)) goto l135; goto l136; + l135:; yy->__pos= yypos135; yy->__thunkpos= yythunkpos135; } - l125:; goto l123; - l122:; yy->__pos= yypos122; yy->__thunkpos= yythunkpos122; + l136:; goto l134; + l133:; yy->__pos= yypos133; yy->__thunkpos= yythunkpos133; } - l123:; - { int yypos126= yy->__pos, yythunkpos126= yy->__thunkpos; if (!yy_comment(yy)) goto l126; goto l127; - l126:; yy->__pos= yypos126; yy->__thunkpos= yythunkpos126; + l134:; + { int yypos137= yy->__pos, yythunkpos137= yy->__thunkpos; if (!yy_comment(yy)) goto l137; goto l138; + l137:; yy->__pos= yypos137; yy->__thunkpos= yythunkpos137; } - l127:; + l138:; yyprintf((stderr, " ok %s @ %s\n", "line", yy->__buf+yy->__pos)); return 1; - l119:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l130:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "line", yy->__buf+yy->__pos)); return 0; } @@ -1280,20 +1317,20 @@ YY_RULE(int) yy_sol(yycontext *yy) yyprintf((stderr, "%s\n", "sol")); yyDo(yy, yy_1_sol, yy->__begin, yy->__end); yyprintf((stderr, " ok %s @ %s\n", "sol", yy->__buf+yy->__pos)); return 1; - l128:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; + l139:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "sol", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_file(yycontext *yy) { yyprintf((stderr, "%s\n", "file")); - l130:; - { int yypos131= yy->__pos, yythunkpos131= yy->__thunkpos; if (!yy_sol(yy)) goto l131; - { int yypos132= yy->__pos, yythunkpos132= yy->__thunkpos; if (!yy_line(yy)) goto l133; if (!yy_eol(yy)) goto l133; goto l132; - l133:; yy->__pos= yypos132; yy->__thunkpos= yythunkpos132; if (!yy_invalid_syntax(yy)) goto l131; + l141:; + { int yypos142= yy->__pos, yythunkpos142= yy->__thunkpos; if (!yy_sol(yy)) goto l142; + { int yypos143= yy->__pos, yythunkpos143= yy->__thunkpos; if (!yy_line(yy)) goto l144; if (!yy_eol(yy)) goto l144; goto l143; + l144:; yy->__pos= yypos143; yy->__thunkpos= yythunkpos143; if (!yy_invalid_syntax(yy)) goto l142; } - l132:; goto l130; - l131:; yy->__pos= yypos131; yy->__thunkpos= yythunkpos131; + l143:; goto l141; + l142:; yy->__pos= yypos142; yy->__thunkpos= yythunkpos142; } yyprintf((stderr, " ok %s @ %s\n", "file", yy->__buf+yy->__pos)); return 1; @@ -1346,7 +1383,7 @@ YY_PARSE(yycontext *) YYRELEASE(yycontext *yyctx) } #endif -#line 160 "parse.peg" +#line 162 "parse.peg" void parseConfiguration(char const *file) diff --git a/parse.peg b/parse.peg index cae69b2..a418f10 100644 --- a/parse.peg +++ b/parse.peg @@ -139,11 +139,12 @@ invalid_syntax = < (!eol .)+ > eol } service = name -address = ipv4 | hostname # TODO: IPV6 +address = ipv4 | ipv6 | hostname # TODO: IPV6 pattern = [0-9*?]+ ('.' [0-9*?]+ ('.' [0-9*?]+ ('.' [0-9*?]+)?)?)? number = digit+ ipv4 = number '.' number '.' number '.' number | '0' +ipv6 = (hexdigit | ':')+ | '[' ipv6 ']' hostname = ([-0-9a-zA-Z_]+ '.')* [a-zA-Z][-0-9a-zA-Z_]* '.'? @@ -153,6 +154,7 @@ filename = '"' [^"]+ '"' - = [ \t]+ digit = [0-9] +hexdigit = [0-9a-fA-F] sol = { ++yy->currentLine; } eol = '\r'? '\n' | eof eof = '\0' diff --git a/rinetd.c b/rinetd.c index 3b0b66e..adb5f7e 100644 --- a/rinetd.c +++ b/rinetd.c @@ -858,14 +858,17 @@ static int checkConnectionAllowed(ConnectionInfo const *cnx) static int getAddress(char const *host, struct in_addr *iaddr) { /* If this is an IP address, use inet_addr() */ - int is_ipaddr = 1; + int is_ipv4 = 1, is_ipv6 = 0; for (char const *p = host; *p; ++p) { - if (!isdigit(*p) && *p != '.') { - is_ipaddr = 0; - break; - } + is_ipv6 |= (*p == ':' || *p == '[' || *p == ']'); + is_ipv4 &= (isdigit(*p) || *p == '.'); } - if (is_ipaddr) { + if (is_ipv6) { + fprintf(stderr, "IPv6 addresses are not supported yet: %s\n", host); + return -1; + } + + if (is_ipv4) { iaddr->s_addr = inet_addr(host); return 0; }