diff --git a/contrib/backends/srndv2/src/srnd/nntp.go b/contrib/backends/srndv2/src/srnd/nntp.go index 8ec01a2..78ff54b 100644 --- a/contrib/backends/srndv2/src/srnd/nntp.go +++ b/contrib/backends/srndv2/src/srnd/nntp.go @@ -864,7 +864,7 @@ func (self *nntpConnection) handleLine(daemon *NNTPDaemon, code int, line string //lo, hi, err := daemon.database.GetLastAndFirstForGroup(group) //if err == nil { if ValidNewsgroup(group) { - _, _ = io.WriteString(dw, fmt.Sprintf("%s 0 0 y\n", group)) + fmt.Fprintf(dw, "%s 0 0 y\n", group) } //} else { // log.Println(self.name, "could not get low/high water mark for", group, err) @@ -996,7 +996,9 @@ func (self *nntpConnection) handleLine(daemon *NNTPDaemon, code int, line string conn.PrintfLine("215 list of newsgroups follows") dw := conn.DotWriter() for _, entry := range list { - io.WriteString(dw, fmt.Sprintf("%s %s %s y\r\n", entry[0], entry[1], entry[2])) + if ValidNewsgroup(entry[0]) { + io.WriteString(dw, fmt.Sprintf("%s %s %s y\r\n", entry[0], entry[1], entry[2])) + } } dw.Close() } else { @@ -1148,7 +1150,9 @@ func (self *nntpConnection) handleLine(daemon *NNTPDaemon, code int, line string conn.PrintfLine("215 list of newsgroups follows") dw := conn.DotWriter() for _, entry := range list { - io.WriteString(dw, fmt.Sprintf("%s %s %s y\r\n", entry[0], entry[1], entry[2])) + if ValidNewsgroup(entry[0]) { + io.WriteString(dw, fmt.Sprintf("%s %s %s y\r\n", entry[0], entry[1], entry[2])) + } } dw.Close() } else { diff --git a/contrib/backends/srndv2/src/srnd/util.go b/contrib/backends/srndv2/src/srnd/util.go index 5ee1ddd..0c2de14 100644 --- a/contrib/backends/srndv2/src/srnd/util.go +++ b/contrib/backends/srndv2/src/srnd/util.go @@ -297,6 +297,9 @@ func decAddr(encaddr, key string) string { var exp_valid_newsgroup = regexp.MustCompilePOSIX(`^[a-zA-Z0-9.]{1,128}$`) func newsgroupValidFormat(newsgroup string) bool { + newsgroup = strings.TrimFunc(newsgroup, func(r rune) bool { + return r == ' ' + }) return exp_valid_newsgroup.MatchString(newsgroup) && len(newsgroup) > 0 }