git » chasquid » commit 013af62

maillog: Fix empty lines in the authentication log entries

author xrstf
2026-04-06 15:39:51 UTC
committer Alberto Bertogli
2026-04-06 18:14:59 UTC
parent af7b1d895cb50597aecadb520bbf340e989e808d

maillog: Fix empty lines in the authentication log entries

In maillog.Auth, we currently have a newline in the log entry args.

The blitiri.com.ar/go/log package handles trailing newlines, but only in
the format parameter, not in the args.

Because of this, the authentication log entries in the maillog currently
end with an extra newline.

This patch fixes the problem by removing the unnecessary newline from
the message.

https://github.com/albertito/chasquid/pull/82

Amended-by: Alberto Bertogli <albertito@blitiri.com.ar>
  Adjusted commit message.

internal/maillog/maillog.go +1 -1

diff --git a/internal/maillog/maillog.go b/internal/maillog/maillog.go
index b117ff2..6e2b8f3 100644
--- a/internal/maillog/maillog.go
+++ b/internal/maillog/maillog.go
@@ -96,7 +96,7 @@ func (l *Logger) Auth(netAddr net.Addr, user string, successful bool) {
 	if !successful {
 		res = "failed"
 	}
-	msg := fmt.Sprintf("%s auth %s for %s\n", netAddr, res, user)
+	msg := fmt.Sprintf("%s auth %s for %s", netAddr, res, user)
 	l.printf("%s", msg)
 	authLog.Debugf("%s", msg)
 }