From d345a27f9f45c05cd4c9699660a74a52e39b3d89 Mon Sep 17 00:00:00 2001 From: Bernhard Froehlich Date: Mon, 11 May 2020 13:12:24 +0000 Subject: [PATCH] Verify that user is properly authenticated before sending mail if AUTH is required --- protocol.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/protocol.go b/protocol.go index d8a3297..a047f02 100644 --- a/protocol.go +++ b/protocol.go @@ -202,6 +202,11 @@ func (session *session) handleMAIL(cmd command) { return } + if session.server.Authenticator != nil && session.peer.Username == "" { + session.reply(530, "Authentication Required.") + return + } + if !session.tls && session.server.ForceTLS { session.reply(502, "Please turn on TLS by issuing a STARTTLS command.") return