https://src.bluestatic.org
/
mailpopbox.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
974f0c1
)
In smtp/conn_test.go, testServer.verifyAddress should check a common domain.
author
Robert Sesek <rsesek@bluestatic.org>
Thu, 6 Sep 2018 00:56:27 +0000
(20:56 -0400)
committer
Robert Sesek <rsesek@bluestatic.org>
Thu, 6 Sep 2018 00:56:27 +0000
(20:56 -0400)
smtp/conn_test.go
patch
|
blob
|
history
diff --git
a/smtp/conn_test.go
b/smtp/conn_test.go
index d6275c9c15ed1f556779fb249d076bc063bb0d61..70839079e5379ba40bdf30f301b7c14b848b8578 100644
(file)
--- a/
smtp/conn_test.go
+++ b/
smtp/conn_test.go
@@
-63,6
+63,7
@@
type userAuth struct {
type testServer struct {
EmptyServerCallbacks
type testServer struct {
EmptyServerCallbacks
+ domain string
blockList []string
tlsConfig *tls.Config
*userAuth
blockList []string
tlsConfig *tls.Config
*userAuth
@@
-77,6
+78,9
@@
func (s *testServer) TLSConfig() *tls.Config {
}
func (s *testServer) VerifyAddress(addr mail.Address) ReplyLine {
}
func (s *testServer) VerifyAddress(addr mail.Address) ReplyLine {
+ if DomainForAddress(addr) != s.domain {
+ return ReplyBadMailbox
+ }
for _, block := range s.blockList {
if strings.ToLower(block) == addr.Address {
return ReplyBadMailbox
for _, block := range s.blockList {
if strings.ToLower(block) == addr.Address {
return ReplyBadMailbox
@@
-121,6
+125,7
@@
func runTableTest(t testing.TB, conn *textproto.Conn, seq []requestResponse) {
// RFC 5321 § D.1
func TestScenarioTypical(t *testing.T) {
s := testServer{
// RFC 5321 § D.1
func TestScenarioTypical(t *testing.T) {
s := testServer{
+ domain: "foo.com",
blockList: []string{"Green@foo.com"},
}
l := runServer(t, &s)
blockList: []string{"Green@foo.com"},
}
l := runServer(t, &s)
@@
-168,6
+173,7
@@
func TestScenarioTypical(t *testing.T) {
func TestVerifyAddress(t *testing.T) {
s := testServer{
func TestVerifyAddress(t *testing.T) {
s := testServer{
+ domain: "test.mail",
blockList: []string{"banned@test.mail"},
}
l := runServer(t, &s)
blockList: []string{"banned@test.mail"},
}
l := runServer(t, &s)
@@
-203,8
+209,10
@@
func TestBadAddress(t *testing.T) {
}
func TestCaseSensitivty(t *testing.T) {
}
func TestCaseSensitivty(t *testing.T) {
- s := &testServer{}
- s.blockList = []string{"reject@mail.com"}
+ s := &testServer{
+ domain: "mail.com",
+ blockList: []string{"reject@mail.com"},
+ }
l := runServer(t, s)
defer l.Close()
l := runServer(t, s)
defer l.Close()