mirror of
https://github.com/mjl-/mox.git
synced 2025-01-14 01:06:27 +03:00
fix fuzzing imapserver by not triggering the rate limiter
This commit is contained in:
parent
08eb1a5472
commit
6eff832d09
2 changed files with 5 additions and 1 deletions
|
@ -82,7 +82,7 @@ func FuzzServer(f *testing.F) {
|
||||||
|
|
||||||
var fl *os.File
|
var fl *os.File
|
||||||
if false {
|
if false {
|
||||||
fl, err = os.Create("fuzz.log")
|
fl, err = os.OpenFile("fuzz.log", os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
f.Fatalf("fuzz log")
|
f.Fatalf("fuzz log")
|
||||||
}
|
}
|
||||||
|
@ -96,6 +96,7 @@ func FuzzServer(f *testing.F) {
|
||||||
|
|
||||||
f.Fuzz(func(t *testing.T, s string) {
|
f.Fuzz(func(t *testing.T, s string) {
|
||||||
run := func(cmds []string) {
|
run := func(cmds []string) {
|
||||||
|
limitersInit() // Reset rate limiters.
|
||||||
serverConn, clientConn := net.Pipe()
|
serverConn, clientConn := net.Pipe()
|
||||||
defer serverConn.Close()
|
defer serverConn.Close()
|
||||||
|
|
||||||
|
@ -132,6 +133,8 @@ func FuzzServer(f *testing.F) {
|
||||||
cid++
|
cid++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Each command brings the connection state one step further. We try the fuzzing
|
||||||
|
// input for each state.
|
||||||
run([]string{})
|
run([]string{})
|
||||||
run([]string{"login mjl@mox.example testtest"})
|
run([]string{"login mjl@mox.example testtest"})
|
||||||
run([]string{"login mjl@mox.example testtest", "select inbox"})
|
run([]string{"login mjl@mox.example testtest", "select inbox"})
|
||||||
|
|
|
@ -73,6 +73,7 @@ func FuzzServer(f *testing.F) {
|
||||||
|
|
||||||
f.Fuzz(func(t *testing.T, s string) {
|
f.Fuzz(func(t *testing.T, s string) {
|
||||||
run := func(cmds []string) {
|
run := func(cmds []string) {
|
||||||
|
limitersInit() // Reset rate limiters.
|
||||||
serverConn, clientConn := net.Pipe()
|
serverConn, clientConn := net.Pipe()
|
||||||
defer serverConn.Close()
|
defer serverConn.Close()
|
||||||
defer clientConn.Close()
|
defer clientConn.Close()
|
||||||
|
|
Loading…
Reference in a new issue