1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-17 17:47:03 +00:00

Allow AUTH=<> FROM parameter (#284)

* Use backtick on regex
* Accept AUTH=<> FROM parameter
* Update changelog
This commit is contained in:
James Hillyerd
2022-07-30 10:57:29 -07:00
committed by GitHub
parent 1650a5b375
commit 87018ed42d
3 changed files with 12 additions and 4 deletions

View File

@@ -6,6 +6,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased] ## [Unreleased]
### Fixed
- Support for `AUTH=<>` FROM parameter (#284)
## [v3.0.2] - 2022-07-04 ## [v3.0.2] - 2022-07-04
Note: We had to abandon the 3.0.1 release, see the blog post [What happened to Note: We had to abandon the 3.0.1 release, see the blog post [What happened to

View File

@@ -54,11 +54,11 @@ const (
QUIT QUIT
) )
// fromRegex captures the from address and optional BODY=8BITMIME clause. Matches FROM, while // fromRegex captures the from address and optional parameters. Matches FROM, while accepting '>'
// accepting '>' as quoted pair and in double quoted strings (?i) makes the regex case insensitive, // as quoted pair and in double quoted strings (?i) makes the regex case insensitive, (?:) is
// (?:) is non-grouping sub-match // non-grouping sub-match. Accepts empty angle bracket value in options for 'AUTH=<>'.
var fromRegex = regexp.MustCompile( var fromRegex = regexp.MustCompile(
"(?i)^FROM:\\s*<((?:(?:\\\\>|[^>])+|\"[^\"]+\"@[^>])+)?>( [\\w= ]+)?$") `(?i)^FROM:\s*<((?:(?:\\>|[^>])+|"[^"]+"@[^>])+)?>( [\w= ]+(?:=<>)?)?$`)
func (s State) String() string { func (s State) String() string {
switch s { switch s {

View File

@@ -193,6 +193,10 @@ func TestReadyState(t *testing.T) {
{"RSET", 250}, {"RSET", 250},
{"MAIL FROM:<john@gmail.com> SIZE=1024", 250}, {"MAIL FROM:<john@gmail.com> SIZE=1024", 250},
{"RSET", 250}, {"RSET", 250},
{"MAIL FROM:<john@gmail.com> SIZE=1024 BODY=8BITMIME", 250},
{"RSET", 250},
{"MAIL FROM:<bounces@onmicrosoft.com> SIZE=4096 AUTH=<>", 250},
{"RSET", 250},
{"MAIL FROM:<host!host!user/data@foo.com>", 250}, {"MAIL FROM:<host!host!user/data@foo.com>", 250},
{"RSET", 250}, {"RSET", 250},
{"MAIL FROM:<\"first last\"@space.com>", 250}, {"MAIL FROM:<\"first last\"@space.com>", 250},