commit which fixes invalid line shit
This commit is contained in:
parent
aadb4ae230
commit
2752676013
@ -864,7 +864,7 @@ func (self *nntpConnection) handleLine(daemon *NNTPDaemon, code int, line string
|
|||||||
//lo, hi, err := daemon.database.GetLastAndFirstForGroup(group)
|
//lo, hi, err := daemon.database.GetLastAndFirstForGroup(group)
|
||||||
//if err == nil {
|
//if err == nil {
|
||||||
if ValidNewsgroup(group) {
|
if ValidNewsgroup(group) {
|
||||||
_, _ = io.WriteString(dw, fmt.Sprintf("%s 0 0 y\n", group))
|
fmt.Fprintf(dw, "%s 0 0 y\n", group)
|
||||||
}
|
}
|
||||||
//} else {
|
//} else {
|
||||||
// log.Println(self.name, "could not get low/high water mark for", group, err)
|
// 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")
|
conn.PrintfLine("215 list of newsgroups follows")
|
||||||
dw := conn.DotWriter()
|
dw := conn.DotWriter()
|
||||||
for _, entry := range list {
|
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()
|
dw.Close()
|
||||||
} else {
|
} else {
|
||||||
@ -1148,7 +1150,9 @@ func (self *nntpConnection) handleLine(daemon *NNTPDaemon, code int, line string
|
|||||||
conn.PrintfLine("215 list of newsgroups follows")
|
conn.PrintfLine("215 list of newsgroups follows")
|
||||||
dw := conn.DotWriter()
|
dw := conn.DotWriter()
|
||||||
for _, entry := range list {
|
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()
|
dw.Close()
|
||||||
} else {
|
} else {
|
||||||
|
@ -297,6 +297,9 @@ func decAddr(encaddr, key string) string {
|
|||||||
var exp_valid_newsgroup = regexp.MustCompilePOSIX(`^[a-zA-Z0-9.]{1,128}$`)
|
var exp_valid_newsgroup = regexp.MustCompilePOSIX(`^[a-zA-Z0-9.]{1,128}$`)
|
||||||
|
|
||||||
func newsgroupValidFormat(newsgroup string) bool {
|
func newsgroupValidFormat(newsgroup string) bool {
|
||||||
|
newsgroup = strings.TrimFunc(newsgroup, func(r rune) bool {
|
||||||
|
return r == ' '
|
||||||
|
})
|
||||||
return exp_valid_newsgroup.MatchString(newsgroup) && len(newsgroup) > 0
|
return exp_valid_newsgroup.MatchString(newsgroup) && len(newsgroup) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user