author | Alberto Bertogli
<albertito@blitiri.com.ar> 2016-10-13 19:37:29 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2016-10-21 21:18:53 UTC |
parent | f5e466eac517a62416f09913dc536b552bfcf6c7 |
internal/smtpsrv/conn.go | +4 | -1 |
diff --git a/internal/smtpsrv/conn.go b/internal/smtpsrv/conn.go index 24ba3e2..456b42e 100644 --- a/internal/smtpsrv/conn.go +++ b/internal/smtpsrv/conn.go @@ -147,7 +147,6 @@ loop: break } - commandCount.Add(cmd, 1) if cmd == "AUTH" { c.tr.Debugf("-> AUTH <redacted>") } else { @@ -187,10 +186,14 @@ loop: c.writeResponse(221, "Be seeing you...") break loop default: + // Sanitize it a bit to avoid filling the logs and events with + // noisy data. Keep the first 6 bytes for debugging. + cmd = fmt.Sprintf("unknown<%.6s>", cmd) code = 500 msg = "unknown command" } + commandCount.Add(cmd, 1) if code > 0 { c.tr.Debugf("<- %d %s", code, msg)