Closed issuefiler closed 4 years ago
The ABNF has already been parsed in parse.go
TODO:
if s.allowsHost
line as suggested above. However, we should also modify the allowsHost
to match the evaluated value. (The case 4 above is a valid address <"po\ST\mAs\t\eR"> - no?)RCPT TO: <poSTmAsteR>
and <"po\ST\mAs\t\eR">
There's a question - what Address.host
should we default to? Should we fill any value there? Leave blank, or add a new config option, or just use 'localhost' ?
The RFC seems to be a bit unclear for "po\ST\mAs\t\eR"
and "po\ST\mAs\t\eR"@example.com
inputs, but what you’ve said would be the right path to go, I guess; edited.
And for the Address.Host
of <Postmaster>
: we could simply leave the Host
blank (as is) and modify the stringifying steps for use by processors (#199).
Hi @issuefiler, Please see PR #202 - it's ready for your acceptance test :-)
It works a little different from what was specified above (https://github.com/flashmob/go-guerrilla/issues/201#issuecomment-557957171)
It simply captures quoted local-parts without the escape characters, and then the String() function knows if it was quoted or not. So if the local-part is "test\" " then it will be stored as "test " ".
So, allowsHost
didn't need any modification after all.
When testing:
Note that if <postmaster>
is used in the RCPT TO (without a host), then new functionality was added to assume that the host is assumed to be the Hostname setting for the Server. Therefore, we must ensure that the Hostname setting also exists in the AllowedHosts config setting. (The server will log a warning if it detects this case)
RFC 5321
Test
Preset
Expectation
Case # 1
Case # 2
Case # 3
Case # 4
EDITED
Current
Case # 1 ✅
Case # 2 ✅
Case # 3 ❌
Case # 4 ❌ ~✅~ EDITED
~Fix (not tested)~
Host
is empty and theUser
is case-insensitivelyPostmaster
, sayOK
.~https://github.com/flashmob/go-guerrilla/blob/51f7dda326b1e9878e5f679ccb34a134127951b0/server.go#L492-L503
↓