mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-17 14:37:02 +00:00
chasquid: Don't enforce authentication at MAIL FROM
There are cases, like email bounces and forwarding, where a remote server may use an address within our domain as "MAIL FROM". The current test at MAIL FROM will block them, which can be quite an inconvenience as those cases are not that rare. It's a nice test but doesn't add much, as we don't really pass the validation along, and we still do relay and user checks on RCPT TO. So this patch removes that test.
This commit is contained in:
@@ -615,14 +615,6 @@ func (c *Conn) MAIL(params string) (code int, msg string) {
|
||||
// but that's not according to the RFC. We reset the envelope instead.
|
||||
c.resetEnvelope()
|
||||
|
||||
// If the source is local, check that it completed auth for that user.
|
||||
if e.Address != "<>" && envelope.DomainIn(e.Address, c.localDomains) {
|
||||
user, domain := envelope.Split(e.Address)
|
||||
if user != c.authUser || domain != c.authDomain {
|
||||
return 503, "user not authorized"
|
||||
}
|
||||
}
|
||||
|
||||
c.mailFrom = e.Address
|
||||
return 250, "You feel like you are being watched"
|
||||
}
|
||||
|
||||
@@ -201,15 +201,6 @@ func TestRcptBeforeMail(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestLocalHasAuthenticated(t *testing.T) {
|
||||
c := mustDial(t, ModeSubmission, false)
|
||||
defer c.Close()
|
||||
|
||||
if err := c.Mail("from@localhost"); err == nil {
|
||||
t.Errorf("Accepted non-authenticated local mail")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRelayForbidden(t *testing.T) {
|
||||
c := mustDial(t, ModeSMTP, false)
|
||||
defer c.Close()
|
||||
|
||||
Reference in New Issue
Block a user