Fix fuzzing for imapserver

Broken since introducing LoginAttempts. The fuzzing functions didn't get the
store.Init() call, and would hang on trying to send to the loginattemptwriter.
This commit is contained in:
Mechiel Lukkien
2025-03-05 19:47:29 +01:00
parent edfc24a701
commit 06b7c8bba0
2 changed files with 11 additions and 0 deletions

View File

@ -35,8 +35,14 @@ func FuzzServer(f *testing.F) {
mox.Context = ctxbg
mox.ConfigStaticPath = filepath.FromSlash("../testdata/smtpserverfuzz/mox.conf")
mox.MustLoadConfig(true, false)
store.Close() // May not be open, we ignore error.
dataDir := mox.ConfigDirPath(mox.Conf.Static.DataDir)
os.RemoveAll(dataDir)
err := store.Init(ctxbg)
if err != nil {
f.Fatalf("store init: %v", err)
}
acc, err := store.OpenAccount(log, "mjl", false)
if err != nil {
f.Fatalf("open account: %v", err)