From 19b819d222a5424798a0a0570883512303cdf41e Mon Sep 17 00:00:00 2001 From: Mechiel Lukkien Date: Wed, 9 Aug 2023 08:12:59 +0200 Subject: [PATCH] in smtpserver, don't put unrecognized smtp commands in prometheus metrics can blow up prometheus storage. --- smtpserver/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smtpserver/server.go b/smtpserver/server.go index 743eebd..5bd94d2 100644 --- a/smtpserver/server.go +++ b/smtpserver/server.go @@ -719,6 +719,7 @@ func command(c *conn) { p := newParser(args, c.smtputf8, c) fn, ok := commands[cmdl] if !ok { + c.cmd = "(unknown)" if c.ncmds == 0 { // Other side is likely speaking something else than SMTP, send error message and // stop processing because there is a good chance whatever they sent has multiple @@ -726,7 +727,6 @@ func command(c *conn) { c.writecodeline(smtp.C500BadSyntax, smtp.SeProto5Syntax2, "please try again speaking smtp", nil) panic(errIO) } - c.cmd = "(unknown)" // note: not "command not implemented", see ../rfc/5321:2934 ../rfc/5321:2539 xsmtpUserErrorf(smtp.C500BadSyntax, smtp.SeProto5BadCmdOrSeq1, "unknown command") }