MCPcopy Create free account
hub / github.com/foxcpp/maddy / CheckBody

Method CheckBody

internal/check/spf/spf.go:379–414  ·  view source on GitHub ↗
(ctx context.Context, header textproto.Header, body buffer.Buffer)

Source from the content-addressed store, hash-verified

377}
378
379func (s *state) CheckBody(ctx context.Context, header textproto.Header, body buffer.Buffer) module.CheckResult {
380 if s.c.enforceEarly || s.skip {
381 // Already applied in CheckConnection.
382 return module.CheckResult{}
383 }
384
385 defer trace.StartRegion(ctx, "check.spf/CheckBody").End()
386
387 res, ok := <-s.spfFetch
388 if !ok {
389 return module.CheckResult{
390 Reject: true,
391 Reason: exterrors.WithTemporary(
392 exterrors.WithFields(errors.New("panic recovered"), map[string]interface{}{
393 "check": "spf",
394 "smtp_msg": "Internal error during policy check",
395 }),
396 true,
397 ),
398 }
399 }
400 if s.relyOnDMARC(ctx, header) {
401 if res.res != spf.Pass {
402 s.log.Msg("deferring action due to a DMARC policy", "result", res.res, "err", res.err)
403 } else {
404 s.log.DebugMsg("deferring action due to a DMARC policy", "result", res.res, "err", res.err)
405 }
406
407 checkRes := s.spfResult(res.res, res.err)
408 checkRes.Quarantine = false
409 checkRes.Reject = false
410 return checkRes
411 }
412
413 return s.spfResult(res.res, res.err)
414}
415
416func (s *state) Close() error {
417 return nil

Callers

nothing calls this directly

Calls 6

relyOnDMARCMethod · 0.95
spfResultMethod · 0.95
WithTemporaryFunction · 0.92
WithFieldsFunction · 0.92
MsgMethod · 0.80
DebugMsgMethod · 0.80

Tested by

no test coverage detected