From 8cd93abe4fbb9d6a6815beb703f527e78a6ff2aa Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Tue, 7 Nov 2017 14:30:34 -0500 Subject: [PATCH] fix sa hook --- contrib/backends/srndv2/src/srnd/spam.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/contrib/backends/srndv2/src/srnd/spam.go b/contrib/backends/srndv2/src/srnd/spam.go index 79be60e..30a6d5b 100644 --- a/contrib/backends/srndv2/src/srnd/spam.go +++ b/contrib/backends/srndv2/src/srnd/spam.go @@ -10,6 +10,7 @@ import ( ) var ErrSpamFilterNotEnabled = errors.New("spam filter access attempted when disabled") +var ErrSpamFilterFailed = errors.New("spam filter failed") type SpamFilter struct { addr string @@ -53,11 +54,11 @@ func (sp *SpamFilter) Rewrite(msg io.Reader, out io.WriteCloser) error { } if l == "\n" { r.ReadString(10) - break + _, err = io.CopyBuffer(out, r, buff[:]) + c.Close() + out.Close() + return err } } - _, err = io.CopyBuffer(out, r, buff[:]) - c.Close() - out.Close() - return err + return ErrSpamFilterFailed }