summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2023-08-20 13:12:26 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2023-08-20 14:23:41 +0100
commit3586c3794ff2df6724c92f41311d0109ca2e632d (patch)
tree02643f55b3438366ed9688a20f24d94459242814
parent8a2fd4b22738aa6cceaf2ddd7755f376cb8460a3 (diff)
Testsuite: add with-dkim case to DMARC testcase
-rw-r--r--src/src/dmarc.c2
-rw-r--r--test/confs/46501
-rw-r--r--test/log/46507
-rw-r--r--test/scripts/4650-DMARC/465027
-rw-r--r--test/scripts/4650-DMARC/REQUIRES2
-rw-r--r--test/stdout/465048
6 files changed, 84 insertions, 3 deletions
diff --git a/src/src/dmarc.c b/src/src/dmarc.c
index 48a72541f..070885111 100644
--- a/src/src/dmarc.c
+++ b/src/src/dmarc.c
@@ -272,7 +272,7 @@ if (spf_response)
g = string_fmt_append(g, "spf %d\n", dmarc_spf_ares_result);
if (dkim_history_buffer)
- g = string_fmt_append(g, "%s\n", dkim_history_buffer);
+ g = string_cat(g, dkim_history_buffer);
g = string_fmt_append(g, "pdomain %s\npolicy %d\n",
dmarc_used_domain, dmarc_policy);
diff --git a/test/confs/4650 b/test/confs/4650
index 5ad7adbc8..d6a637adb 100644
--- a/test/confs/4650
+++ b/test/confs/4650
@@ -19,6 +19,7 @@ primary_hostname = myhost.test.ex
dmarc_tld_file = DIR/aux-fixed/TESTNUM.tldfile
dmarc_history_file = DIR/tmp/TESTNUM.hist.dmarc
+dkim_verify_hashes = sha256 : sha512 : sha1
acl_smtp_rcpt = accept
acl_smtp_data = check_data
diff --git a/test/log/4650 b/test/log/4650
index 900f36156..f9c6bd38f 100644
--- a/test/log/4650
+++ b/test/log/4650
@@ -8,3 +8,10 @@
1999-03-02 09:44:33 10HmaX-000000005vi-0000 dmarc_domain_policy <none>
1999-03-02 09:44:33 10HmaX-000000005vi-0000 Authentication-Results: myhost.test.ex;\n spf=none smtp.mailfrom=test.ex;\n dmarc=none header.from=test.ex
1999-03-02 09:44:33 10HmaX-000000005vi-0000 <= a@test.ex H=(testclient) [ip4.ip4.ip4.ip4] P=smtp S=sss
+1999-03-02 09:44:33 10HmaY-000000005vi-0000 DMARC results: spf_domain=bloggs.com dmarc_domain=test.ex spf_align=no dkim_align=yes enforcement='Accept'
+1999-03-02 09:44:33 10HmaY-000000005vi-0000 dmarc_status <accept>
+1999-03-02 09:44:33 10HmaY-000000005vi-0000 dmarc_status_text <Accept>
+1999-03-02 09:44:33 10HmaY-000000005vi-0000 dmarc_used_domain <test.ex>
+1999-03-02 09:44:33 10HmaY-000000005vi-0000 dmarc_domain_policy <none>
+1999-03-02 09:44:33 10HmaY-000000005vi-0000 Authentication-Results: myhost.test.ex;\n spf=none smtp.mailfrom=bloggs.com;\n dkim=pass header.d=test.ex header.s=sel header.a=rsa-sha1;\n dmarc=pass header.from=test.ex
+1999-03-02 09:44:33 10HmaY-000000005vi-0000 <= CALLER@bloggs.com H=(testclient) [ip4.ip4.ip4.ip4] P=smtp S=sss DKIM=test.ex id=qwerty1234@disco-zombie.net
diff --git a/test/scripts/4650-DMARC/4650 b/test/scripts/4650-DMARC/4650
index 40df619f3..04e5d0ae7 100644
--- a/test/scripts/4650-DMARC/4650
+++ b/test/scripts/4650-DMARC/4650
@@ -11,6 +11,9 @@ sudo chmod 777 DIR/tmp
#
exim -bd -DSERVER=server -oX PORT_D
****
+#
+#
+# Without a dkim signing, then with (copied from 4500)
client HOSTIPV4 PORT_D
??? 220
HELO testclient
@@ -20,13 +23,35 @@ MAIL FROM:<a@test.ex>
RCPT TO:<fred@test.ex>
??? 250
DATA
-??? 3
+??? 354
Subject: test
From: <z@test.ex>
body line
.
??? 250
+RSET
+??? 250
+MAIL FROM:<CALLER@bloggs.com>
+??? 250
+RCPT TO:<a@test.ex>
+??? 250
+DATA
+??? 354
+DKIM-Signature: v=1; a=rsa-sha1; c=simple/simple; d=test.ex; h=from:to
+ :date:message-id:subject; s=sel; bh=OB9dZVu7+5/ufs3TH9leIcEpXSo=; b=
+ CoaRNB2Z59hSnhTzT8bYbMIN3P57XAVcFeV5oGEl4aKmhm6Mtu2uIc7B2z9k5+A/
+ +KFIE9HRj7eg9kPzagoPIvI84WE5PN5yRehMjJI6WqhM3V+bQDHkb8ubSmiaYxY5
+ B2Pd/kEGgHUlMDB0Hug4FMMt7GcFxagKspthOT/Pso0=
+From: mrgus@test.ex
+To: bakawolf@yahoo.com
+Date: Thu, 19 Nov 2015 17:00:07 -0700
+Message-ID: <qwerty1234@disco-zombie.net>
+Subject: simple test
+
+This is a simple test.
+.
+??? 250
QUIT
****
#
diff --git a/test/scripts/4650-DMARC/REQUIRES b/test/scripts/4650-DMARC/REQUIRES
index fe9e7b342..bd50f8494 100644
--- a/test/scripts/4650-DMARC/REQUIRES
+++ b/test/scripts/4650-DMARC/REQUIRES
@@ -1 +1,3 @@
support DMARC
+support DKIM
+support SPF
diff --git a/test/stdout/4650 b/test/stdout/4650
index 3ee5a7782..fcdb257f2 100644
--- a/test/stdout/4650
+++ b/test/stdout/4650
@@ -11,7 +11,7 @@ Connecting to ip4.ip4.ip4.ip4 port 1225 ... connected
??? 250
<<< 250 Accepted
>>> DATA
-??? 3
+??? 354
<<< 354 Enter message, ending with "." on a line by itself
>>> Subject: test
>>> From: <z@test.ex>
@@ -20,6 +20,33 @@ Connecting to ip4.ip4.ip4.ip4 port 1225 ... connected
>>> .
??? 250
<<< 250 OK id=10HmaX-000000005vi-0000
+>>> RSET
+??? 250
+<<< 250 Reset OK
+>>> MAIL FROM:<CALLER@bloggs.com>
+??? 250
+<<< 250 OK
+>>> RCPT TO:<a@test.ex>
+??? 250
+<<< 250 Accepted
+>>> DATA
+??? 354
+<<< 354 Enter message, ending with "." on a line by itself
+>>> DKIM-Signature: v=1; a=rsa-sha1; c=simple/simple; d=test.ex; h=from:to
+>>> :date:message-id:subject; s=sel; bh=OB9dZVu7+5/ufs3TH9leIcEpXSo=; b=
+>>> CoaRNB2Z59hSnhTzT8bYbMIN3P57XAVcFeV5oGEl4aKmhm6Mtu2uIc7B2z9k5+A/
+>>> +KFIE9HRj7eg9kPzagoPIvI84WE5PN5yRehMjJI6WqhM3V+bQDHkb8ubSmiaYxY5
+>>> B2Pd/kEGgHUlMDB0Hug4FMMt7GcFxagKspthOT/Pso0=
+>>> From: mrgus@test.ex
+>>> To: bakawolf@yahoo.com
+>>> Date: Tue, 2 Mar 1999 09:44:33 +0000
+>>> Message-ID: <qwerty1234@disco-zombie.net>
+>>> Subject: simple test
+>>>
+>>> This is a simple test.
+>>> .
+??? 250
+<<< 250 OK id=10HmaY-000000005vi-0000
>>> QUIT
End of script
job 10HmaX-000000005vi-0000
@@ -40,3 +67,22 @@ sp 0
align_dkim 5
align_spf 5
action 2
+job 10HmaY-000000005vi-0000
+reporter myhost.test.ex
+received 1692480217
+ipaddr ip4.ip4.ip4.ip4
+from test.ex
+mfrom bloggs.com
+spf 6
+dkim test.ex 0
+pdomain test.ex
+policy 15
+rua -
+pct 100
+adkim 114
+aspf 114
+p 110
+sp 0
+align_dkim 4
+align_spf 5
+action 2