Skip to content

Commit

Permalink
accept empty from-address in SPF fixes #603
Browse files Browse the repository at this point in the history
(cherry picked from commit 691ba53)
  • Loading branch information
Beutlin committed Dec 2, 2023
1 parent 351c44e commit e34b383
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions internal/check/spf/spf.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,12 @@ func (s *state) CheckConnection(ctx context.Context) module.CheckResult {
return module.CheckResult{}
}

if s.msgMeta.OriginalFrom == "" {
s.skip = true
s.log.Println("sender address is empty")
return module.CheckResult{}
}

mailFrom, err := prepareMailFrom(s.msgMeta.OriginalFrom)
if err != nil {
s.skip = true
Expand Down
5 changes: 4 additions & 1 deletion tests/smtp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ func TestCheckSPF(tt *testing.T) {
conn.Writeln("RSET")
conn.ExpectPattern("250 *")

conn.Writeln("MAIL FROM:<>")
conn.ExpectPattern("250 *")

conn.Writeln("MAIL FROM:<[email protected]>")
conn.ExpectPattern("551 5.7.0 *")

Expand Down Expand Up @@ -453,7 +456,7 @@ func TestCheckAuthorizeSender(tt *testing.T) {
auth_normalize precis_casefold
user_to_email static {
entry "test-user1" "[email protected]"
entry "test-user2" "é@example1.org"
entry "test-user2" "é@example1.org"
}
}
}
Expand Down

0 comments on commit e34b383

Please sign in to comment.