mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-17 14:37:02 +00:00
Do not allow repeated STARTTLS commands
Clients should only be able to do STARTTLS once.
This commit is contained in:
@@ -198,6 +198,21 @@ func TestReset(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRepeatedStartTLS(t *testing.T) {
|
||||
c, err := smtp.Dial(srvAddr)
|
||||
if err != nil {
|
||||
t.Fatalf("smtp.Dial: %v", err)
|
||||
}
|
||||
|
||||
if err = c.StartTLS(tlsConfig); err != nil {
|
||||
t.Fatalf("StartTLS: %v", err)
|
||||
}
|
||||
|
||||
if err = c.StartTLS(tlsConfig); err == nil {
|
||||
t.Errorf("Second STARTTLS did not fail as expected")
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// === Benchmarks ===
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user