From 071ad66035b50a41c021eaac9857dc095b51aa1a Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Fri, 24 May 2024 18:50:27 +0200 Subject: [PATCH] Sync with upstream This PR syncs our smtp package with the upstream `net/smtp` changes introduced via https://github.com/golang/go/commit/bf91eb3a8bb057a620f3823e4d6b74a529c0a44d --- smtp/smtp.go | 5 +++-- smtp/smtp_test.go | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/smtp/smtp.go b/smtp/smtp.go index f9c5285..d2a0e64 100644 --- a/smtp/smtp.go +++ b/smtp/smtp.go @@ -210,7 +210,8 @@ func (c *Client) Auth(a Auth) error { } resp64 := make([]byte, encoding.EncodedLen(len(resp))) encoding.Encode(resp64, resp) - code, msg64, err := c.cmd(0, strings.TrimSpace(fmt.Sprintf("AUTH %s %s", mech, resp64))) + code, msg64, err := c.cmd(0, "%s", strings.TrimSpace(fmt.Sprintf("AUTH %s %s", mech, + resp64))) for err == nil { var msg []byte switch code { @@ -238,7 +239,7 @@ func (c *Client) Auth(a Auth) error { } resp64 = make([]byte, encoding.EncodedLen(len(resp))) encoding.Encode(resp64, resp) - code, msg64, err = c.cmd(0, string(resp64)) + code, msg64, err = c.cmd(0, "%s", resp64) } return err } diff --git a/smtp/smtp_test.go b/smtp/smtp_test.go index 148ecf7..6df6eeb 100644 --- a/smtp/smtp_test.go +++ b/smtp/smtp_test.go @@ -1042,12 +1042,12 @@ func TestSendMail(t *testing.T) { tc := textproto.NewConn(conn) for i := 0; i < len(data) && data[i] != ""; i++ { - if err := tc.PrintfLine(data[i]); err != nil { + if err := tc.PrintfLine("%s", data[i]); err != nil { t.Errorf("printing to textproto failed: %s", err) } for len(data[i]) >= 4 && data[i][3] == '-' { i++ - if err := tc.PrintfLine(data[i]); err != nil { + if err := tc.PrintfLine("%s", data[i]); err != nil { t.Errorf("printing to textproto failed: %s", err) } }