diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2024-07-15 13:43:27 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2024-07-15 13:43:27 +0100 |
commit | 2c5771d4d6a53b2e11516426295cff5aa70de26a (patch) | |
tree | a4da53d2189988174d5dcf8b7c204dc13fe752b6 | |
parent | 27b858776562a743a6036d5f6e1ee022d2006f79 (diff) | |
download | rspamd-2c5771d4d6a53b2e11516426295cff5aa70de26a.tar.gz rspamd-2c5771d4d6a53b2e11516426295cff5aa70de26a.zip |
[Project] Start support of MIME UTF8
-rw-r--r-- | src/ragel/content_disposition.rl | 2 | ||||
-rw-r--r-- | src/ragel/smtp_address.rl | 1 | ||||
-rw-r--r-- | src/ragel/smtp_base.rl | 21 |
3 files changed, 13 insertions, 11 deletions
diff --git a/src/ragel/content_disposition.rl b/src/ragel/content_disposition.rl index 862015ea1..93d3c9d3d 100644 --- a/src/ragel/content_disposition.rl +++ b/src/ragel/content_disposition.rl @@ -7,7 +7,7 @@ balanced_ccontent := ccontent* ')' @{ fret; }; comment = "(" (FWS? ccontent)* FWS? ")"; CFWS = ((FWS? comment)+ FWS?) | FWS; - qcontent = qtextSMTP | quoted_pairSMTP | textUTF8; + qcontent = qtextSMTP | quoted_pairSMTP; quoted_string = CFWS? (DQUOTE (((FWS? qcontent)* FWS?) >Quoted_Str_Start %Quoted_Str_End) diff --git a/src/ragel/smtp_address.rl b/src/ragel/smtp_address.rl index 0caf1a65e..eb0fc2d9d 100644 --- a/src/ragel/smtp_address.rl +++ b/src/ragel/smtp_address.rl @@ -24,6 +24,7 @@ # SMTP address spec # Obtained from: https://tools.ietf.org/html/rfc5321#section-4.1.2 + # Additions from rfc6532 (smtputf8): https://tools.ietf.org/html/rfc6532#section-3.2 QcontentSMTP = qtextSMTP | quoted_pairSMTP %User_has_backslash; Quoted_string = ( DQUOTE QcontentSMTP* >User_start %User_end DQUOTE ) %Quoted_addr; diff --git a/src/ragel/smtp_base.rl b/src/ragel/smtp_base.rl index cb4f066bc..26999eb51 100644 --- a/src/ragel/smtp_base.rl +++ b/src/ragel/smtp_base.rl @@ -9,26 +9,27 @@ CRLF = "\r\n" | ("\r" [^\n]) | ([^\r] "\n"); DQUOTE = '"'; + utf8_cont = 0x80..0xbf; + utf8_2c = 0xc0..0xdf utf8_cont; + utf8_3c = 0xe0..0xef utf8_cont utf8_cont; + utf8_4c = 0xf0..0xf7 utf8_cont utf8_cont utf8_cont; + UTF8_non_ascii = utf8_2c | utf8_3c | utf8_4c; + # Printable US-ASCII characters not including specials atext = alpha | digit | "!" | "#" | "$" | "%" | "&" | "'" | "*" | "+" | "_" | "/" | "=" | "?" | "^" | - "-" | "`" | "{" | "|" | "}" | "~"; + "-" | "`" | "{" | "|" | "}" | "~" | UTF8_non_ascii; # Printable US-ASCII characters not including "[", "]", or "\" - dtext = 33..90 | 94..126; + dtext = 33..90 | 94..126 | UTF8_non_ascii; # Printable US-ASCII characters not including "(", ")", or "\" - ctext = 33..39 | 42..91 | 93..126; + ctext = 33..39 | 42..91 | 93..126 | UTF8_non_ascii; - dcontent = 33..90 | 94..126; + dcontent = 33..90 | 94..126 | UTF8_non_ascii; Let_dig = alpha | digit; Ldh_str = ( alpha | digit | "_" | "-" )* Let_dig; quoted_pairSMTP = "\\" 32..126; - qtextSMTP = 32..33 | 35..91 | 93..126; - utf8_cont = 0x80..0xbf; - utf8_2c = 0xc0..0xdf utf8_cont; - utf8_3c = 0xe0..0xef utf8_cont utf8_cont; - utf8_4c = 0xf0..0xf7 utf8_cont utf8_cont utf8_cont; - textUTF8 = qtextSMTP | utf8_2c | utf8_3c | utf8_4c; + qtextSMTP = 32..33 | 35..91 | 93..126 | UTF8_non_ascii; Atom = atext+; Dot_string = Atom ("." Atom)*; dot_atom_text = atext+ ("." atext+)*; |