From 96a931de3ee2fde2aa2c62f269a2382390e57faa Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Tue, 7 Nov 2017 14:13:17 -0500 Subject: [PATCH] fix sa hook --- contrib/backends/srndv2/src/srnd/spam.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/contrib/backends/srndv2/src/srnd/spam.go b/contrib/backends/srndv2/src/srnd/spam.go index f557163..3281045 100644 --- a/contrib/backends/srndv2/src/srnd/spam.go +++ b/contrib/backends/srndv2/src/srnd/spam.go @@ -3,8 +3,10 @@ package srnd import ( "bufio" "errors" + "fmt" "io" "net" + "os/user" ) var ErrSpamFilterNotEnabled = errors.New("spam filter access attempted when disabled") @@ -36,7 +38,11 @@ func (sp *SpamFilter) Rewrite(msg io.Reader, out io.WriteCloser) error { if err != nil { return err } - io.WriteString(c, "PROCESS SPAMC/1.5\r\nUser: nntpchan\r\n\r\n") + u, err := user.Current() + if err != nil { + return err + } + fmt.Fprintf(c, "PROCESS SPAMC/1.5\r\nUser: %s\r\n\r\n", u.Username) io.CopyBuffer(c, msg, buff[:]) c.CloseWrite() r := bufio.NewReader(c)