#line 1 "/home/hanzlik/rpmbuild/BUILD/rspamd-3.1/src/ragel/rfc2047_parser.rl" #line 53 "/home/hanzlik/rpmbuild/BUILD/rspamd-3.1/src/ragel/rfc2047_parser.rl" #include "smtp_parsers.h" #include "mime_headers.h" #line 11 "/home/hanzlik/rpmbuild/BUILD/rspamd-3.1/src/rfc2047.rl.c" static const int rfc2047_parser_start = 1; static const int rfc2047_parser_first_final = 17; static const int rfc2047_parser_error = 0; static const int rfc2047_parser_en_main = 1; #line 58 "/home/hanzlik/rpmbuild/BUILD/rspamd-3.1/src/ragel/rfc2047_parser.rl" gboolean rspamd_rfc2047_parser (const gchar *in, gsize len, gint *pencoding, const gchar **charset, gsize *charset_len, const gchar **encoded, gsize *encoded_len) { const char *p = in, *pe = in + len, *encoded_start = NULL, *encoded_end = NULL, *charset_start = NULL, *charset_end = NULL, *eof = in + len; gint encoding = RSPAMD_RFC2047_QP, cs = 0; #line 34 "/home/hanzlik/rpmbuild/BUILD/rspamd-3.1/src/rfc2047.rl.c" { cs = (int)rfc2047_parser_start; } #line 71 "/home/hanzlik/rpmbuild/BUILD/rspamd-3.1/src/ragel/rfc2047_parser.rl" #line 42 "/home/hanzlik/rpmbuild/BUILD/rspamd-3.1/src/rfc2047.rl.c" { if ( p == pe ) goto _test_eof; switch ( cs ) { case 1: goto st_case_1; case 0: goto st_case_0; case 2: goto st_case_2; case 3: goto st_case_3; case 4: goto st_case_4; case 5: goto st_case_5; case 6: goto st_case_6; case 7: goto st_case_7; case 8: goto st_case_8; case 9: goto st_case_9; case 17: goto st_case_17; case 18: goto st_case_18; case 19: goto st_case_19; case 20: goto st_case_20; case 10: goto st_case_10; case 11: goto st_case_11; case 12: goto st_case_12; case 13: goto st_case_13; case 14: goto st_case_14; case 15: goto st_case_15; case 16: goto st_case_16; } goto st_out; _st1: if ( p == eof ) { if ( cs >= 17 ) goto _out; else goto _pop; } p+= 1; if ( p == pe ) goto _test_eof1; st_case_1: if ( ( (*( p))) == 61 ) { goto _st2; } { goto _st0; } st_case_0: _st0: cs = 0; goto _pop; _st2: if ( p == eof ) { if ( cs >= 17 ) goto _out; else goto _pop; } p+= 1; if ( p == pe ) goto _test_eof2; st_case_2: if ( ( (*( p))) == 63 ) { goto _st3; } { goto _st0; } _st3: if ( p == eof ) { if ( cs >= 17 ) goto _out; else goto _pop; } p+= 1; if ( p == pe ) goto _test_eof3; st_case_3: switch( ( (*( p))) ) { case 33: { goto _ctr4; } case 43: { goto _ctr4; } case 45: { goto _ctr4; } case 92: { goto _ctr4; } } if ( ( (*( p))) < 48 ) { if ( 35 <= ( (*( p))) && ( (*( p))) <= 39 ) { goto _ctr4; } } else if ( ( (*( p))) > 57 ) { if ( ( (*( p))) > 90 ) { if ( 94 <= ( (*( p))) && ( (*( p))) <= 126 ) { goto _ctr4; } } else if ( ( (*( p))) >= 65 ) { goto _ctr4; } } else { goto _ctr4; } { goto _st0; } _ctr4: { #line 5 "/home/hanzlik/rpmbuild/BUILD/rspamd-3.1/src/ragel/rfc2047_parser.rl" charset_start = p; } #line 179 "/home/hanzlik/rpmbuild/BUILD/rspamd-3.1/src/rfc2047.rl.c" goto _st4; _st4: if ( p == eof ) { if ( cs >= 17 ) goto _out; else goto _pop; } p+= 1; if ( p == pe ) goto _test_eof4; st_case_4: switch( ( (*( p))) ) { case 33: { goto _st4; } case 42: { goto _ctr6; } case 43: { goto _st4; } case 45: { goto _st4; } case 63: { goto _ctr7; } case 92: { goto _st4; } } if ( ( (*( p))) < 48 ) { if ( 35 <= ( (*( p))) && ( (*( p))) <= 39 ) { goto _st4; } } else if ( ( (*( p))) > 57 ) { if ( ( (*( p))) > 90 ) { if ( 94 <= ( (*( p))) && ( (*( p))) <= 126 ) { goto _st4; } } else if ( ( (*( p))) >= 65 ) { goto _st4; } } else { goto _st4; } { goto _st0; } _ctr6: { #line 9 "/home/hanzlik/rpmbuild/BUILD/rspamd-3.1/src/ragel/rfc2047_parser.rl" if (charset_start && p > charset_start) { charset_end = p; } } #line 240 "/home/hanzlik/rpmbuild/BUILD/rspamd-3.1/src/rfc2047.rl.c" goto _st5; _st5: if ( p == eof ) { if ( cs >= 17 ) goto _out; else goto _pop; } p+= 1; if ( p == pe ) goto _test_eof5; st_case_5: if ( ( (*( p))) > 90 ) { if ( 97 <= ( (*( p))) && ( (*( p))) <= 122 ) { goto _st6; } } else if ( ( (*( p))) >= 65 ) { goto _st6; } { goto _st0; } _st6: if ( p == eof ) { if ( cs >= 17 ) goto _out; else goto _pop; } p+= 1; if ( p == pe ) goto _test_eof6; st_case_6: switch( ( (*( p))) ) { case 45: { goto _st5; } case 63: { goto _st7; } } if ( ( (*( p))) > 90 ) { if ( 97 <= ( (*( p))) && ( (*( p))) <= 122 ) { goto _st10; } } else if ( ( (*( p))) >= 65 ) { goto _st10; } { goto _st0; } _ctr7: { #line 9 "/home/hanzlik/rpmbuild/BUILD/rspamd-3.1/src/ragel/rfc2047_parser.rl" if (charset_start && p > charset_start) { charset_end = p; } } #line 302 "/home/hanzlik/rpmbuild/BUILD/rspamd-3.1/src/rfc2047.rl.c" goto _st7; _st7: if ( p == eof ) { if ( cs >= 17 ) goto _out; else goto _pop; } p+= 1; if ( p == pe ) goto _test_eof7; st_case_7: switch( ( (*( p))) ) { case 66: { goto _st8; } case 81: { goto _st8; } case 98: { goto _st8; } case 113: { goto _st8; } } { goto _st0; } _st8: if ( p == eof ) { if ( cs >= 17 ) goto _out; else goto _pop; } p+= 1; if ( p == pe ) goto _test_eof8; st_case_8: if ( ( (*( p))) == 63 ) { goto _ctr13; } { goto _st0; } _ctr13: { #line 15 "/home/hanzlik/rpmbuild/BUILD/rspamd-3.1/src/ragel/rfc2047_parser.rl" if (p > in) { switch (*(p - 1)) { case 'B': case 'b': encoding = RSPAMD_RFC2047_BASE64; break; default: encoding = RSPAMD_RFC2047_QP; break; } } } #line 367 "/home/hanzlik/rpmbuild/BUILD/rspamd-3.1/src/rfc2047.rl.c" goto _st9; _st9: if ( p == eof ) { if ( cs >= 17 ) goto _out; else goto _pop; } p+= 1; if ( p == pe ) goto _test_eof9; st_case_9: if ( ( (*( p))) == 63 ) { goto _ctr16; } if ( 32 <= ( (*( p))) && ( (*( p))) <= 126 ) { goto _ctr15; } { goto _st0; } _ctr15: { #line 29 "/home/hanzlik/rpmbuild/BUILD/rspamd-3.1/src/ragel/rfc2047_parser.rl" encoded_start = p; } #line 397 "/home/hanzlik/rpmbuild/BUILD/rspamd-3.1/src/rfc2047.rl.c" goto _st17; _ctr23: { #line 33 "/home/hanzlik/rpmbuild/BUILD/rspamd-3.1/src/ragel/rfc2047_parser.rl" if (encoded_start && p > encoded_start) { encoded_end = p; } } #line 409 "/home/hanzlik/rpmbuild/BUILD/rspamd-3.1/src/rfc2047.rl.c" goto _st17; _st17: if ( p == eof ) { if ( cs >= 17 ) goto _out; else goto _pop; } p+= 1; if ( p == pe ) goto _test_eof17; st_case_17: if ( ( (*( p))) == 63 ) { goto _ctr25; } if ( 32 <= ( (*( p))) && ( (*( p))) <= 126 ) { goto _st17; } { goto _st0; } _ctr25: { #line 33 "/home/hanzlik/rpmbuild/BUILD/rspamd-3.1/src/ragel/rfc2047_parser.rl" if (encoded_start && p > encoded_start) { encoded_end = p; } } #line 441 "/home/hanzlik/rpmbuild/BUILD/rspamd-3.1/src/rfc2047.rl.c" goto _st18; _st18: if ( p == eof ) { if ( cs >= 17 ) goto _out; else goto _pop; } p+= 1; if ( p == pe ) goto _test_eof18; st_case_18: switch( ( (*( p))) ) { case 61: { goto _st19; } case 63: { goto _ctr25; } } if ( 32 <= ( (*( p))) && ( (*( p))) <= 126 ) { goto _st17; } { goto _st0; } _st19: if ( p == eof ) { if ( cs >= 17 ) goto _out; else goto _pop; } p+= 1; if ( p == pe ) goto _test_eof19; st_case_19: { goto _st0; } _ctr16: { #line 29 "/home/hanzlik/rpmbuild/BUILD/rspamd-3.1/src/ragel/rfc2047_parser.rl" encoded_start = p; } #line 490 "/home/hanzlik/rpmbuild/BUILD/rspamd-3.1/src/rfc2047.rl.c" goto _st20; _ctr27: { #line 33 "/home/hanzlik/rpmbuild/BUILD/rspamd-3.1/src/ragel/rfc2047_parser.rl" if (encoded_start && p > encoded_start) { encoded_end = p; } } #line 502 "/home/hanzlik/rpmbuild/BUILD/rspamd-3.1/src/rfc2047.rl.c" goto _st20; _st20: if ( p == eof ) { if ( cs >= 17 ) goto _out; else goto _pop; } p+= 1; if ( p == pe ) goto _test_eof20; st_case_20: if ( ( (*( p))) == 63 ) { goto _ctr25; } if ( ( (*( p))) > 60 ) { if ( 62 <= ( (*( p))) && ( (*( p))) <= 126 ) { goto _st17; } } else if ( ( (*( p))) >= 32 ) { goto _st17; } { goto _st0; } _st10: if ( p == eof ) { if ( cs >= 17 ) goto _out; else goto _pop; } p+= 1; if ( p == pe ) goto _test_eof10; st_case_10: switch( ( (*( p))) ) { case 45: { goto _st5; } case 63: { goto _st7; } } if ( ( (*( p))) > 90 ) { if ( 97 <= ( (*( p))) && ( (*( p))) <= 122 ) { goto _st11; } } else if ( ( (*( p))) >= 65 ) { goto _st11; } { goto _st0; } _st11: if ( p == eof ) { if ( cs >= 17 ) goto _out; else goto _pop; } p+= 1; if ( p == pe ) goto _test_eof11; st_case_11: switch( ( (*( p))) ) { case 45: { goto _st5; } case 63: { goto _st7; } } if ( ( (*( p))) > 90 ) { if ( 97 <= ( (*( p))) && ( (*( p))) <= 122 ) { goto _st12; } } else if ( ( (*( p))) >= 65 ) { goto _st12; } { goto _st0; } _st12: if ( p == eof ) { if ( cs >= 17 ) goto _out; else goto _pop; } p+= 1; if ( p == pe ) goto _test_eof12; st_case_12: switch( ( (*( p))) ) { case 45: { goto _st5; } case 63: { goto _st7; } } if ( ( (*( p))) > 90 ) { if ( 97 <= ( (*( p))) && ( (*( p))) <= 122 ) { goto _st13; } } else if ( ( (*( p))) >= 65 ) { goto _st13; } { goto _st0; } _st13: if ( p == eof ) { if ( cs >= 17 ) goto _out; else goto _pop; } p+= 1; if ( p == pe ) goto _test_eof13; st_case_13: switch( ( (*( p))) ) { case 45: { goto _st5; } case 63: { goto _st7; } } if ( ( (*( p))) > 90 ) { if ( 97 <= ( (*( p))) && ( (*( p))) <= 122 ) { goto _st14; } } else if ( ( (*( p))) >= 65 ) { goto _st14; } { goto _st0; } _st14: if ( p == eof ) { if ( cs >= 17 ) goto _out; else goto _pop; } p+= 1; if ( p == pe ) goto _test_eof14; st_case_14: switch( ( (*( p))) ) { case 45: { goto _st5; } case 63: { goto _st7; } } if ( ( (*( p))) > 90 ) { if ( 97 <= ( (*( p))) && ( (*( p))) <= 122 ) { goto _st15; } } else if ( ( (*( p))) >= 65 ) { goto _st15; } { goto _st0; } _st15: if ( p == eof ) { if ( cs >= 17 ) goto _out; else goto _pop; } p+= 1; if ( p == pe ) goto _test_eof15; st_case_15: switch( ( (*( p))) ) { case 45: { goto _st5; } case 63: { goto _st7; } } if ( ( (*( p))) > 90 ) { if ( 97 <= ( (*( p))) && ( (*( p))) <= 122 ) { goto _st16; } } else if ( ( (*( p))) >= 65 ) { goto _st16; } { goto _st0; } _st16: if ( p == eof ) { if ( cs >= 17 ) goto _out; else goto _pop; } p+= 1; if ( p == pe ) goto _test_eof16; st_case_16: switch( ( (*( p))) ) { case 45: { goto _st5; } case 63: { goto _st7; } } { goto _st0; } st_out: _test_eof1: cs = 1; goto _test_eof; _test_eof2: cs = 2; goto _test_eof; _test_eof3: cs = 3; goto _test_eof; _test_eof4: cs = 4; goto _test_eof; _test_eof5: cs = 5; goto _test_eof; _test_eof6: cs = 6; goto _test_eof; _test_eof7: cs = 7; goto _test_eof; _test_eof8: cs = 8; goto _test_eof; _test_eof9: cs = 9; goto _test_eof; _test_eof17: cs = 17; goto _test_eof; _test_eof18: cs = 18; goto _test_eof; _test_eof19: cs = 19; goto _test_eof; _test_eof20: cs = 20; goto _test_eof; _test_eof10: cs = 10; goto _test_eof; _test_eof11: cs = 11; goto _test_eof; _test_eof12: cs = 12; goto _test_eof; _test_eof13: cs = 13; goto _test_eof; _test_eof14: cs = 14; goto _test_eof; _test_eof15: cs = 15; goto _test_eof; _test_eof16: cs = 16; goto _test_eof; _test_eof: {} if ( p == eof ) { switch ( cs ) { case 1: { break; } case 0: { break; } case 2: { break; } case 3: { break; } case 4: { break; } case 5: { break; } case 6: { break; } case 7: { break; } case 8: { break; } case 9: { break; } case 17: { break; } case 18: { break; } case 19: { break; } case 20: { break; } case 10: { break; } case 11: { break; } case 12: { break; } case 13: { break; } case 14: { break; } case 15: { break; } case 16: { break; } } switch ( cs ) { } switch ( cs ) { case 1: goto _st1;case 0: goto _st0;case 2: goto _st2;case 3: goto _st3;case 4: goto _st4;case 5: goto _st5;case 6: goto _st6;case 7: goto _st7;case 8: goto _st8;case 9: goto _st9;case 17: goto _ctr23;case 18: goto _ctr25;case 19: goto _st19;case 20: goto _ctr27;case 10: goto _st10;case 11: goto _st11;case 12: goto _st12;case 13: goto _st13;case 14: goto _st14;case 15: goto _st15;case 16: goto _st16; } } if ( cs >= 17 ) goto _out; _pop: {} _out: {} } #line 72 "/home/hanzlik/rpmbuild/BUILD/rspamd-3.1/src/ragel/rfc2047_parser.rl" if (encoded_end) { *pencoding = encoding; *charset = charset_start; *charset_len = charset_end - charset_start; *encoded = encoded_start; *encoded_len = encoded_end - encoded_start; return TRUE; } return FALSE; }