audit 4: a deleted domain says so, the Outbound log filters by status and day
test / test (push) Canceled after 0s
test / test (push) Canceled after 0s
L17: past DeleteDomain both rebuilds run, their errors joined under domain.ErrDeletedIncomplete; the key is removed only when OpenDKIM's tables were rebuilt (they may still name it otherwise); the domain list says the domain is deleted and that Reload configuration finishes it, not "internal error". Tests in domain (the tables failing, the sender map failing) and handlers. The Outbound log's status and day filters (owner, 2026-10-13; the mockup first,80e3979): view.OutLogFilter carried by the poll, the pages, the rows' links and the message's way back; SendLogFilter.Status, Since, Until (whole UTC days, as the Inbound log's); rejected is the three refusals together; a status not in the list is no narrowing. Tests: the filters through the handler, the poll and the way back; the day boundaries in store. The plan's milter-socket step is ticked: done in 2.5.2 (98e09fe). Tested on the test server: go vet + go test of 25 packages, make e2e (all pass, 642 s) on this tree. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"io/fs"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"slices"
|
||||
"sort"
|
||||
"strconv"
|
||||
"time"
|
||||
@@ -301,7 +302,7 @@ func logLines(lines []string) []view.LogLine {
|
||||
func deliveriesBackURL(r *http.Request) string {
|
||||
q := r.URL.Query()
|
||||
back := url.Values{}
|
||||
for _, k := range []string{"domain", "app", "p"} {
|
||||
for _, k := range []string{"domain", "app", "status", "from", "to", "p"} {
|
||||
if v := q.Get(k); v != "" {
|
||||
back.Set(k, v)
|
||||
}
|
||||
@@ -364,6 +365,7 @@ func (h *Handlers) outLogPage(r *http.Request) (*view.OutLog, error) {
|
||||
filter := store.SendLogFilter{
|
||||
Domain: q.Get("domain"),
|
||||
AppLogin: q.Get("app"),
|
||||
Status: outLogStatus(q.Get("status")),
|
||||
// A global administrator reads the whole journal, including rows left
|
||||
// behind by a domain that has since been deleted; anyone else the rows
|
||||
// of the domains assigned to them, by id - not those an earlier domain
|
||||
@@ -379,6 +381,15 @@ func (h *Handlers) outLogPage(r *http.Request) (*view.OutLog, error) {
|
||||
filter.AppLogin = ""
|
||||
}
|
||||
}
|
||||
form := view.OutLogFilter{Domain: filter.Domain, App: filter.AppLogin, Status: filter.Status}
|
||||
// The days, as on the Inbound log: from the first's midnight to the end of
|
||||
// the last, UTC; a day that does not parse is no narrowing.
|
||||
if t, err := time.Parse(logDay, q.Get("from")); err == nil {
|
||||
form.From, filter.Since = t.Format(logDay), t
|
||||
}
|
||||
if t, err := time.Parse(logDay, q.Get("to")); err == nil {
|
||||
form.To, filter.Until = t.Format(logDay), t
|
||||
}
|
||||
|
||||
total, err := h.store.CountSendLog(filter)
|
||||
if err != nil {
|
||||
@@ -396,7 +407,7 @@ func (h *Handlers) outLogPage(r *http.Request) (*view.OutLog, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
out := view.NewOutLog(h.shellMeta(r), h.sendLogRetentionDays(), p.IsGlobal(), domainNames, logins, filter.Domain, filter.AppLogin)
|
||||
out := view.NewOutLog(h.shellMeta(r), h.sendLogRetentionDays(), p.IsGlobal(), domainNames, logins, form)
|
||||
table := make([]view.OutLogRow, len(rows))
|
||||
for i, row := range rows {
|
||||
table[i] = view.OutLogRow{
|
||||
@@ -408,6 +419,15 @@ func (h *Handlers) outLogPage(r *http.Request) (*view.OutLog, error) {
|
||||
return out.WithRows(table, page, lastPage), nil
|
||||
}
|
||||
|
||||
// outLogStatus is the status filter of the Outbound log: one of the statuses
|
||||
// a row has, or none.
|
||||
func outLogStatus(v string) string {
|
||||
if slices.Contains(view.OutLogStatuses, v) {
|
||||
return v
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// parsePage clamps the "p" query parameter to a valid page number, defaulting
|
||||
// to 1 for anything missing or malformed rather than rejecting the request.
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user