Update vendor/
This commit is contained in:
27
vendor/github.com/emersion/go-smtp/conn.go
generated
vendored
27
vendor/github.com/emersion/go-smtp/conn.go
generated
vendored
@@ -8,7 +8,6 @@ import (
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/textproto"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
@@ -38,7 +37,7 @@ type Conn struct {
|
||||
}
|
||||
|
||||
var (
|
||||
AuthRequiredErr = fmt.Errorf("Please authenticate first.")
|
||||
ErrAuthRequired = fmt.Errorf("Please authenticate first.")
|
||||
)
|
||||
|
||||
func newConn(c net.Conn, s *Server) *Conn {
|
||||
@@ -217,21 +216,27 @@ func (c *Conn) handleMail(arg string) {
|
||||
c.SetUser(user)
|
||||
}
|
||||
|
||||
// Match FROM, while accepting '>' as quoted pair and in double quoted strings
|
||||
// (?i) makes the regex case insensitive, (?:) is non-grouping sub-match
|
||||
re := regexp.MustCompile("(?i)^FROM:\\s*<((?:\\\\>|[^>])+|\"[^\"]+\"@[^>]+)>( [\\w= ]+)?$")
|
||||
m := re.FindStringSubmatch(arg)
|
||||
if m == nil {
|
||||
if len(arg) < 6 || strings.ToUpper(arg[0:5]) != "FROM:" {
|
||||
c.WriteResponse(501, "Was expecting MAIL arg syntax of FROM:<address>")
|
||||
return
|
||||
}
|
||||
fromArgs := strings.Split(strings.Trim(arg[5:], " "), " ")
|
||||
if c.server.Strict {
|
||||
if !strings.HasPrefix(fromArgs[0], "<") || !strings.HasSuffix(fromArgs[0], ">") {
|
||||
c.WriteResponse(501, "Was expecting MAIL arg syntax of FROM:<address>")
|
||||
return
|
||||
}
|
||||
}
|
||||
from := strings.Trim(fromArgs[0], "<> ")
|
||||
if from == "" {
|
||||
c.WriteResponse(501, "Was expecting MAIL arg syntax of FROM:<address>")
|
||||
return
|
||||
}
|
||||
|
||||
from := m[1]
|
||||
|
||||
// This is where the Conn may put BODY=8BITMIME, but we already
|
||||
// read the DATA as bytes, so it does not effect our processing.
|
||||
if m[2] != "" {
|
||||
args, err := parseArgs(m[2])
|
||||
if len(fromArgs) > 1 {
|
||||
args, err := parseArgs(fromArgs[1:])
|
||||
if err != nil {
|
||||
c.WriteResponse(501, "Unable to parse MAIL ESMTP parameters")
|
||||
return
|
||||
|
Reference in New Issue
Block a user