[exim-cvs] Testsuite: add with-dkim case to DMARC testcase

Góra strony
Delete this message
Reply to this message
Autor: Exim Git Commits Mailing List
Data:  
Dla: exim-cvs
Temat: [exim-cvs] Testsuite: add with-dkim case to DMARC testcase
Gitweb: https://git.exim.org/exim.git/commitdiff/3586c3794ff2df6724c92f41311d0109ca2e632d
Commit:     3586c3794ff2df6724c92f41311d0109ca2e632d
Parent:     8a2fd4b22738aa6cceaf2ddd7755f376cb8460a3
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Sun Aug 20 13:12:26 2023 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Sun Aug 20 14:23:41 2023 +0100


        Testsuite: add with-dkim case to DMARC testcase
---
 src/src/dmarc.c                  |  2 +-
 test/confs/4650                  |  1 +
 test/log/4650                    |  7 ++++++
 test/scripts/4650-DMARC/4650     | 27 +++++++++++++++++++++-
 test/scripts/4650-DMARC/REQUIRES |  2 ++
 test/stdout/4650                 | 48 +++++++++++++++++++++++++++++++++++++++-
 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@??? 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@??? H=(testclient) [ip4.ip4.ip4.ip4] P=smtp S=sss DKIM=test.ex id=qwerty1234@???
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@???>
 RCPT TO:<fred@???>
 ??? 250
 DATA
-??? 3
+??? 354
 Subject: test
 From: <z@???>


 body line
 .
 ??? 250
+RSET
+??? 250
+MAIL FROM:<CALLER@???>
+??? 250
+RCPT TO:<a@???>
+??? 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@???
+To: bakawolf@???
+Date: Thu, 19 Nov 2015 17:00:07 -0700
+Message-ID: <qwerty1234@???>
+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@???>

@@ -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@???>
+??? 250
+<<< 250 OK
+>>> RCPT TO:<a@???>
+??? 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@???
+>>> To: bakawolf@???
+>>> Date: Tue, 2 Mar 1999 09:44:33 +0000
+>>> Message-ID: <qwerty1234@???>
+>>> 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

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-cvs.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-cvs-unsubscribe@???
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/