From dcc051e1498a432e73b400564f0d1778a80e76f9 Mon Sep 17 00:00:00 2001 From: Mechiel Lukkien Date: Mon, 22 May 2023 15:37:03 +0200 Subject: [PATCH] for fuzzing the imapserver and smtpserver use different config files than regular tests otherwise they cannot be running at the same time, they could overwrite each other's files. --- .gitignore | 2 ++ imapserver/fuzz_test.go | 2 +- smtpserver/fuzz_test.go | 2 +- testdata/imapserverfuzz/domains.conf | 15 +++++++++++++++ testdata/imapserverfuzz/mox.conf | 15 +++++++++++++++ testdata/smtpserverfuzz/domains.conf | 17 +++++++++++++++++ testdata/smtpserverfuzz/mox.conf | 9 +++++++++ 7 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 testdata/imapserverfuzz/domains.conf create mode 100644 testdata/imapserverfuzz/mox.conf create mode 100644 testdata/smtpserverfuzz/domains.conf create mode 100644 testdata/smtpserverfuzz/mox.conf diff --git a/.gitignore b/.gitignore index c0a3d9c..4d2d059 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ /testdata/exportmbox/ /testdata/httpaccount/data/ /testdata/imap/data/ +/testdata/imapserverfuzz/data/ /testdata/imaptest/data/ /testdata/integration/data/ /testdata/junk/*.bloom @@ -18,6 +19,7 @@ /testdata/smtp/sendlimit/data/ /testdata/smtp/catchall/data/ /testdata/smtp/postmaster/ +/testdata/smtpserverfuzz/data/ /testdata/store/data/ /testdata/train/ /cover.out diff --git a/imapserver/fuzz_test.go b/imapserver/fuzz_test.go index 54c9411..7f79bf9 100644 --- a/imapserver/fuzz_test.go +++ b/imapserver/fuzz_test.go @@ -59,7 +59,7 @@ func FuzzServer(f *testing.F) { } mox.Context = context.Background() - mox.ConfigStaticPath = "../testdata/imap/mox.conf" + mox.ConfigStaticPath = "../testdata/imapserverfuzz/mox.conf" mox.MustLoadConfig(false) dataDir := mox.ConfigDirPath(mox.Conf.Static.DataDir) os.RemoveAll(dataDir) diff --git a/smtpserver/fuzz_test.go b/smtpserver/fuzz_test.go index 5c360c3..c26c12d 100644 --- a/smtpserver/fuzz_test.go +++ b/smtpserver/fuzz_test.go @@ -30,7 +30,7 @@ func FuzzServer(f *testing.F) { f.Add("QUIT") mox.Context = ctxbg - mox.ConfigStaticPath = "../testdata/smtp/mox.conf" + mox.ConfigStaticPath = "../testdata/smtpserverfuzz/mox.conf" mox.MustLoadConfig(false) dataDir := mox.ConfigDirPath(mox.Conf.Static.DataDir) os.RemoveAll(dataDir) diff --git a/testdata/imapserverfuzz/domains.conf b/testdata/imapserverfuzz/domains.conf new file mode 100644 index 0000000..3ba0f08 --- /dev/null +++ b/testdata/imapserverfuzz/domains.conf @@ -0,0 +1,15 @@ +Domains: + mox.example: + LocalpartCaseSensitive: false +Accounts: + mjl: + Domain: mox.example + Destinations: + mjl@mox.example: nil + JunkFilter: + Threshold: 0.95 + Params: + Twograms: true + MaxPower: 0.1 + TopWords: 10 + IgnoreWords: 0.1 diff --git a/testdata/imapserverfuzz/mox.conf b/testdata/imapserverfuzz/mox.conf new file mode 100644 index 0000000..3ed95b9 --- /dev/null +++ b/testdata/imapserverfuzz/mox.conf @@ -0,0 +1,15 @@ +DataDir: data +User: 1000 +LogLevel: trace +Hostname: mox.example +Listeners: + local: + IPs: + - 0.0.0.0 + IMAP: + Enabled: true + Port: 1143 + NoRequireSTARTTLS: true +Postmaster: + Account: mjl + Mailbox: postmaster diff --git a/testdata/smtpserverfuzz/domains.conf b/testdata/smtpserverfuzz/domains.conf new file mode 100644 index 0000000..e74182d --- /dev/null +++ b/testdata/smtpserverfuzz/domains.conf @@ -0,0 +1,17 @@ +Domains: + mox.example: nil + mox2.example: nil +Accounts: + mjl: + Domain: mox.example + Destinations: + mjl@mox.example: nil + mjl@mox2.example: nil + JunkFilter: + Threshold: 0.9 + Params: + Onegrams: true + MaxPower: 0.01 + TopWords: 10 + IgnoreWords: 0.1 + RareWords: 2 diff --git a/testdata/smtpserverfuzz/mox.conf b/testdata/smtpserverfuzz/mox.conf new file mode 100644 index 0000000..e1286db --- /dev/null +++ b/testdata/smtpserverfuzz/mox.conf @@ -0,0 +1,9 @@ +DataDir: data +User: 1000 +LogLevel: trace +Hostname: mox.example +Postmaster: + Account: mjl + Mailbox: postmaster +Listeners: + local: nil