mirror of
https://github.com/mjl-/mox.git
synced 2024-12-26 16:33:47 +03:00
ensure senderaccount is always set for messages in queue
before, the smtpserver that queued a dsn would set an empty senderaccount, which was interpreted in a few places as the globally configured postmaster cacount. the empty senderaccount would be used by the smtpserver that queued a dsn with null return path. we now set the postmaster account when we add a message to the queue. more code in the queue pretty much needs a non-empty senderaccount, such as the filters when listing, and the suppression list.
This commit is contained in:
parent
6e7f15e0e4
commit
e2924af8d2
3 changed files with 21 additions and 25 deletions
|
@ -204,12 +204,10 @@ func cleanupHookRetiredSingle(log mlog.Log) {
|
||||||
|
|
||||||
func hookRetiredKeep(account string) time.Duration {
|
func hookRetiredKeep(account string) time.Duration {
|
||||||
keep := 24 * 7 * time.Hour
|
keep := 24 * 7 * time.Hour
|
||||||
if account != "" {
|
|
||||||
accConf, ok := mox.Conf.Account(account)
|
accConf, ok := mox.Conf.Account(account)
|
||||||
if ok {
|
if ok {
|
||||||
keep = accConf.KeepRetiredWebhookPeriod
|
keep = accConf.KeepRetiredWebhookPeriod
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return keep
|
return keep
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1366,7 +1366,6 @@ func deliver(log mlog.Log, resolver dns.Resolver, m0 Msg) {
|
||||||
var remoteMTA dsn.NameIP // Zero value, will not be included in DSN. ../rfc/3464:1027
|
var remoteMTA dsn.NameIP // Zero value, will not be included in DSN. ../rfc/3464:1027
|
||||||
|
|
||||||
// Check if recipient is on suppression list. If so, fail delivery.
|
// Check if recipient is on suppression list. If so, fail delivery.
|
||||||
if m0.SenderAccount != "" {
|
|
||||||
path := smtp.Path{Localpart: m0.RecipientLocalpart, IPDomain: m0.RecipientDomain}
|
path := smtp.Path{Localpart: m0.RecipientLocalpart, IPDomain: m0.RecipientDomain}
|
||||||
baseAddr := baseAddress(path).XString(true)
|
baseAddr := baseAddress(path).XString(true)
|
||||||
qsup := bstore.QueryTx[webapi.Suppression](xtx)
|
qsup := bstore.QueryTx[webapi.Suppression](xtx)
|
||||||
|
@ -1386,7 +1385,6 @@ func deliver(log mlog.Log, resolver dns.Resolver, m0 Msg) {
|
||||||
kick()
|
kick()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
resolveTransport := func(mm Msg) (string, config.Transport, bool) {
|
resolveTransport := func(mm Msg) (string, config.Transport, bool) {
|
||||||
if mm.Transport != "" {
|
if mm.Transport != "" {
|
||||||
|
|
|
@ -56,7 +56,7 @@ func queueDSN(ctx context.Context, log mlog.Log, c *conn, rcptTo smtp.Path, m ds
|
||||||
}
|
}
|
||||||
qm := queue.MakeMsg(smtp.Path{}, rcptTo, has8bit, smtputf8, int64(len(buf)), m.MessageID, nil, reqTLS, time.Now(), m.Subject)
|
qm := queue.MakeMsg(smtp.Path{}, rcptTo, has8bit, smtputf8, int64(len(buf)), m.MessageID, nil, reqTLS, time.Now(), m.Subject)
|
||||||
qm.DSNUTF8 = bufUTF8
|
qm.DSNUTF8 = bufUTF8
|
||||||
if err := queue.Add(ctx, c.log, "", f, qm); err != nil {
|
if err := queue.Add(ctx, c.log, mox.Conf.Static.Postmaster.Account, f, qm); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue