File tree Expand file tree Collapse file tree 4 files changed +87
-1
lines changed
Expand file tree Collapse file tree 4 files changed +87
-1
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,8 @@ echo "smtp_to_request_1: smtp_to_request_1" >> ${BUILDDIR}/untaint
146146echo " smtp_to_request_2: smtp_to_request_2" >> ${BUILDDIR} /untaint
147147echo " smtp_to_request_3: smtp_to_request_3" >> ${BUILDDIR} /untaint
148148echo " smtp_cc_request_1: smtp_cc_request_1" >> ${BUILDDIR} /untaint
149- echo " smtp_cc_request_2: smtp_cc_request_2" >> ${BUILDDIR} /untaint
149+ echo " xlat_recipient_1: xlat_recipient_1" >> ${BUILDDIR} /untaint
150+ echo " xlat_recipient_2: xlat_recipient_2" >> ${BUILDDIR} /untaint
150151
151152echo " Generating the file attachment"
152153# Generate a file for test email attachments
Original file line number Diff line number Diff line change @@ -48,5 +48,21 @@ smtp {
4848 set_date = no
4949}
5050
51+ smtp smtp_xlat {
52+ tls {
53+ require_cert = never
54+ }
55+
56+ username = "Bob"
57+ password = "Saget"
58+
59+ uri = "$ENV{SMTP_TEST_SERVER}:$ENV{SMTP_TEST_SERVER_PORT}"
60+ timeout = 200s
61+
62+ envelope_address = "postmaster@localhost"
63+
64+ set_date = no
65+ }
66+
5167delay {
5268}
Original file line number Diff line number Diff line change 1+ #
2+ # Input packet
3+ #
4+ Packet-Type = Access-Request
5+ User-Name = 'Bob'
6+ User-Password = 'Saget'
7+
8+ #
9+ # Expected answer
10+ #
11+ Packet-Type == Access-Accept
12+
Original file line number Diff line number Diff line change 1+ bool sent
2+
3+ #
4+ # Test xlat with all 3 arguments
5+ #
6+ sent = %smtp_xlat.send('xlat_recipient_1@localhost', 'Simple email', 'With body')
7+
8+ #
9+ # Xlat failure is likely a timeout
10+ # Avoid false negatives by aborting test
11+ #
12+ if (!sent) {
13+ if (Module-Failure-Message[*] == 'smtp: curl request failed: Timeout was reached (28)') {
14+ test_pass
15+ handled
16+ }
17+ test_fail
18+ }
19+
20+ #
21+ # Wait up to five seconds for exim to deliver the email
22+ # Then confirm it was delivered
23+ #
24+ foreach i (%range(50)) {
25+ if %file.exists('build/ci/exim4/mail/xlat_recipient_1') {
26+ break;
27+ }
28+ %delay(0.1)
29+ }
30+ if !%file.exists('build/ci/exim4/mail/xlat_recipient_1') {
31+ test_fail
32+ }
33+
34+ #
35+ # Test xlat with just recipient and subject
36+ #
37+ sent := %smtp_xlat.send('xlat_recipient_2@localhost', 'Simple email two')
38+
39+ if (!sent) {
40+ if (Module-Failure-Message[*] == 'smtp: curl request failed: Timeout was reached (28)') {
41+ test_pass
42+ handled
43+ }
44+ test_fail
45+ }
46+
47+ foreach i (%range(50)) {
48+ if %file.exists('build/ci/exim4/mail/xlat_recipient_2') {
49+ break;
50+ }
51+ %delay(0.1)
52+ }
53+ if !%file.exists('build/ci/exim4/mail/xlat_recipient_2') {
54+ test_fail
55+ }
56+
57+ test_pass
You can’t perform that action at this time.
0 commit comments