1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-18 14:47:03 +00:00

smtpsrv: Quote unknown commands for debugging

When we receive unknown commands, we use the first 6 bytes for
troubleshooting (e.g. put them in traces and exported metrics).

While this is safe, since the different places know how to quote them
properly, it makes things more difficult to analyse, since it's not
uncommon to see be binary blobs.

This patch makes us use the ascii-quoted version instead, to make things
easier to analyze.
This commit is contained in:
Alberto Bertogli
2021-06-11 10:03:06 +01:00
parent 27f4356f67
commit 44eb0b903a

View File

@@ -278,7 +278,7 @@ loop:
default: default:
// Sanitize it a bit to avoid filling the logs and events with // Sanitize it a bit to avoid filling the logs and events with
// noisy data. Keep the first 6 bytes for debugging. // noisy data. Keep the first 6 bytes for debugging.
cmd = fmt.Sprintf("unknown<%.6s>", cmd) cmd = fmt.Sprintf("unknown<%.6q>", cmd)
code = 500 code = 500
msg = "5.5.1 Unknown command" msg = "5.5.1 Unknown command"
} }