mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-17 14:37:02 +00:00
smtpsrv: Test too many recipients
This patch adds a test to make sure we don't allow too many recipients.
This commit is contained in:
@@ -270,6 +270,31 @@ func TestRelayForbidden(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestTooManyRecipients(t *testing.T) {
|
||||
c := mustDial(t, ModeSubmission, true)
|
||||
defer c.Close()
|
||||
|
||||
auth := smtp.PlainAuth("", "testuser@localhost", "testpasswd", "127.0.0.1")
|
||||
if err := c.Auth(auth); err != nil {
|
||||
t.Fatalf("Auth: %v", err)
|
||||
}
|
||||
|
||||
if err := c.Mail("testuser@localhost"); err != nil {
|
||||
t.Fatalf("Mail: %v", err)
|
||||
}
|
||||
|
||||
for i := 0; i < 101; i++ {
|
||||
if err := c.Rcpt(fmt.Sprintf("to%d@somewhere", i)); err != nil {
|
||||
t.Fatalf("Rcpt: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
err := c.Rcpt("to102@somewhere")
|
||||
if err == nil || err.Error() != "452 4.5.3 Too many recipients" {
|
||||
t.Errorf("Expected too many recipients, got: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
var str1MiB string
|
||||
|
||||
func sendLargeEmail(tb testing.TB, c *smtp.Client, sizeMiB int) error {
|
||||
|
||||
Reference in New Issue
Block a user