From: Robert Sesek Date: Tue, 17 Jan 2017 02:21:25 +0000 (-0500) Subject: Lower-case the addresses in smtp.conn.parsePath. X-Git-Tag: v1.1.1 X-Git-Url: https://src.bluestatic.org/?a=commitdiff_plain;h=1e462588041aca4c222943b4259802ca8410fce1;p=mailpopbox.git Lower-case the addresses in smtp.conn.parsePath. --- diff --git a/smtp/conn.go b/smtp/conn.go index 1837027..f8ef4c1 100644 --- a/smtp/conn.go +++ b/smtp/conn.go @@ -145,7 +145,7 @@ func (conn *connection) parsePath(command string) (string, ReplyLine) { if idx == -1 { return "", ReplyBadSyntax } - return params[:idx+1], ReplyOK + return strings.ToLower(params[:idx+1]), ReplyOK } func (conn *connection) doEHLO() { diff --git a/smtp/conn_test.go b/smtp/conn_test.go index 9eefd65..4a93101 100644 --- a/smtp/conn_test.go +++ b/smtp/conn_test.go @@ -66,7 +66,7 @@ func (s *testServer) Name() string { func (s *testServer) VerifyAddress(addr mail.Address) ReplyLine { for _, block := range s.blockList { - if block == addr.Address { + if strings.ToLower(block) == addr.Address { return ReplyBadMailbox } } @@ -186,6 +186,7 @@ func TestBadAddress(t *testing.T) { func TestCaseSensitivty(t *testing.T) { s := &testServer{} + s.blockList = []string{"reject@mail.com"} l := runServer(t, s) defer l.Close() @@ -197,6 +198,8 @@ func TestCaseSensitivty(t *testing.T) { {"ehLO test.TEST", 0, func(t testing.TB, conn *textproto.Conn) { conn.ReadResponse(250) }}, {"mail FROM:", 250, nil}, {"RcPT tO:", 250, nil}, + {"RCPT TO:", 550, nil}, + {"RCPT TO:", 550, nil}, {"DATa", 0, func(t testing.TB, conn *textproto.Conn) { readCodeLine(t, conn, 354)