MCPcopy Index your code
hub / github.com/foxcpp/maddy / CheckBody

Method CheckBody

internal/check/command/command.go:368–396  ·  view source on GitHub ↗
(ctx context.Context, hdr textproto.Header, body buffer.Buffer)

Source from the content-addressed store, hash-verified

366}
367
368func (s *state) CheckBody(ctx context.Context, hdr textproto.Header, body buffer.Buffer) module.CheckResult {
369 if s.c.stage != StageBody {
370 return module.CheckResult{}
371 }
372
373 defer trace.StartRegion(ctx, "command/CheckBody"+s.c.cmd).End()
374
375 cmdName, cmdArgs := s.expandCommand("")
376
377 var buf bytes.Buffer
378 _ = textproto.WriteHeader(&buf, hdr)
379 bR, err := body.Open()
380 if err != nil {
381 return module.CheckResult{
382 Reason: &exterrors.SMTPError{
383 Code: 450,
384 Message: "Internal server error",
385 CheckName: "command",
386 Err: err,
387 Misc: map[string]interface{}{
388 "cmd": cmdName + " " + strings.Join(cmdArgs, " "),
389 },
390 },
391 Reject: true,
392 }
393 }
394
395 return s.run(cmdName, cmdArgs, io.MultiReader(bytes.NewReader(buf.Bytes()), bR))
396}
397
398func (s *state) Close() error {
399 return nil

Callers

nothing calls this directly

Calls 4

expandCommandMethod · 0.95
runMethod · 0.95
BytesMethod · 0.80
OpenMethod · 0.65

Tested by

no test coverage detected