Hopefully the final lot of test files.
[exim.git] / test / scripts / 0000-Basic / 0002
CommitLineData
59371ea7
PH
1# Common string expansions
2#
3# This is the main string expansion test that tests those expansions that will
4# be present in the basic Exim binary which we require in order to run these
5# tests at all. Specialized expansion tests also exist for optional features
6# in other test scripts.
7
8exim -be
9
10# These expansions can test variables in the configuration, but as there
11# is no message being processed, there is no message-related data. But
12# that of course gets tested in plenty of other places.
13
14# Some fixed variables
15
16exim_path: $exim_path
17primary_hostname: $primary_hostname
18primary_hostname: ${primary_hostname}
19qualify_domain: $qualify_domain
20bounce_return_size_limit: ${bounce_return_size_limit}
21spool_directory: $spool_directory
22unknown: ${unknown}
23h_subject: $h_subject:(should be empty)
24h_subject:$h_subject (should be empty)
25header in curlies: ${header_subject:} (should fail)
26
27# \$message_headers should be empty
28message_headers: >$message_headers<
29
30# Continuation
31x\
32y
33x\
34 y
35
36# Overlong names and overbig numbers
37
38+$aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
39+${aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
40+$11111111111111111111111111111111111
41+${11111111111111111111111111111111111}
42
43# Operators
44
45addrss: ${address:local-part@dom.ain}
46addrss: ${address:Exim Person <local-part@dom.ain> (that's me)}
47domain: ${domain:local-part@dom.ain}
48domain: ${domain:Exim Person <local-part@dom.ain> (that's me)}
49escape: ${escape:B7F2}
50eval: ${eval:1+1}
51eval: ${eval:1+2*3}
52eval: ${eval:(1+2)*3}
53eval: ${eval:3/2*4}
54eval: ${eval:3*4/2}
55eval: ${eval:42}
56eval: ${eval:}
57eval: ${eval:-2}
58eval: ${eval:-2 - -3}
59eval: ${eval:-2 - (-3)}
60eval: ${eval:-2 - (-3}
61eval: ${eval:-2 - -3)}
62eval: ${eval:-2 --3}
63eval: ${eval:-2 -+3}
64eval: ${eval:-2 -+-3}
65eval: ${eval:(2*(1+1))/2 + 40K}
66eval: ${eval:077}
67eval: ${eval:08}
68eval10: ${eval10:077}
69eval10: ${eval10:08}
70expand: \$primary_hostname ${expand:\$primary_hostname}
71hash: ${hash_3:monty} ${hash_5:monty} ${hash_4_62:monty python}
72hash: ${hash_3:abc}X ${hash_3:ab}X ${hash_3:a}X ${hash_3:}X
73hex2b64:${hex2b64:12345678}
74hex2b64:${hex2b64:abcdef}
75hex2b64:${hex2b64:ABCDEF}
76hex2b64:${hex2b64:1a2b3c4d5e6f}
77hex2b64:${hex2b64:1a2b3c4d5e6}
78hex2b64:${hex2b64:1a2b3c4d5e6g}
79hex2b64:${hex2b64:${md5:the quick brown fox}}
80hex2b64:${hex2b64:${sha1:the quick brown fox}}
81
82The base62 operator is actually a base36 operator in the Darwin and Cygwin
83environments. Write cunning tests that produce the same output in both cases,
84while doing a reasonable check.
85
86base62: ${if or {\
87 {eq {${base62:12345}}{0003D7}}\
88 {eq {${base62:12345}}{0009IX}}\
89 }{OK}{NOT OK}}
90base62d: ${if or {\
91 {eq {${base62d:0003D7}}{12345}}\
92 {eq {${base62d:0009IX}}{12345}}\
93 }{OK}{NOT OK}}
94base62d: ${if or {\
95 {eq {${base62d:3D7}}{12345}}\
96 {eq {${base62d:9IX}}{12345}}\
97 }{OK}{NOT OK}}
98base62 error: ${base62:12345x}
99base62d error:${base62d:0003D7.}
100
101hmac: ${hmac{md5}{somesecret}{mail.example.com 2002-10-17 11:30:59}}
102hmac: ${hmac{sha1}{somesecret}{mail.example.com 2002-10-17 11:30:59}}
103md5: ${md5:the quick brown fox jumps over the lazy dog}
104sha1: ${sha1:}
105sha1: ${sha1:abc}
106mask: ${mask:192.168.10.206/28}
107mask: ${mask:192.168.10.206/32}
108mask: ${mask:192.168.10.206/33}
109mask: ${mask:192.168.10.206/0}
110mask: ${mask:192.168.10.206}
111mask: ${mask:a.b.c.d}
112nhash: ${nhash_24:monty} ${nhash_8_63:monty python}
113lc/uc: ${lc:The Quick} ${uc: Brown Fox}
114length: ${length_10:The quick brown fox} ${l_10:abc}
115lclpt: ${local_part:local-part@dom.ain}
116lclpt: ${local_part:Exim Person <local-part@dom.ain> (that's me)}
117quote: ${quote:aZ09_.-Q} ${quote:ab*cd} ${quote:ab\cd"ef}
118quote: ${quote:nl(\n)}
119quote: ${quote:cr(\r)}
120quote: ${quote:tab(\t)}
121quote: ${quote:xff(\xff)}
122quote: Empty>${quote:}<
123quote_local_part: ${quote_local_part:abcd}
124quote_local_part: ${quote_local_part:O'Reilly}
125quote_local_part: ${quote_local_part:a space}
126quote_local_part: ${quote_local_part:.something}
127quote_local_part: ${quote_local_part:something.}
128quote_local_part: ${quote_local_part:joe.bloggs}
129quote_local_part: ${quote_local_part:a!b}
130quote_local_part: ${quote_local_part:x@y}
131quote_local_part: ${quote_local_part:ab*cd}
132quote_local_part: ${quote_local_part:x:y}
133quote_local_part: ${quote_local_part:ab\cd"ef}
134quote_local_part: ${quote_local_part:}
135rxquote:${rxquote:aZ09_,-Q} ${rxquote:ab*cd} ${rxquote:ab\cd"ef}
136substr: ${substr_3_2:rhubarb} ${s_-5_2:1234567} ${s_-5_2:12} ${s_-3_2:12}
137substr: ${s_3:rhubarb} ${s_-2:rhubarb}
138substr: ${s_1:}
139substr: ${substr_10:abc}
140str2b64:${str2b64:abcd}
141str2b64:${str2b64:The quick brown \n fox}
142strlen: ${strlen:}
143strlen: ${strlen:a}
144strlen: ${strlen:abcdefgh}
145time_interval: ${time_interval:0}
146time_interval: ${time_interval:44}
147time_interval: ${time_interval:999999}
148time_interval: ${time_interval:-1}
149time_interval: ${time_interval:rhubarb}
150
151# stat is a bit tricky, but some of the fields of the aux-var directory
152# should be the same on all systems
153
154stat: ${extract{mode}{${stat:DIR/aux-var}}}
155stat: ${extract{smode}{${stat:DIR/aux-var}}}
156stat: ${stat:/a/non/existent/file}
157
158# "Operators" that have expanded arguments
159
160hash: ${hash{3}{monty}} ${hash{5}{monty}} ${hash{4}{62}{monty python}}
161hash: ${hash{3}{abc}}X ${hash{3}{ab}}X ${hash{3}{a}}X ${hash{3}{}}X
162nhash: ${nhash{24}{monty}} ${nhash{8}{63}{monty python}}
163length: ${length{10}{The quick brown fox}} ${length{10}{abc}}
164substr: ${substr{3}{2}{rhubarb}} ${substr{-5}{2}{1234567}} ${substr{-5}{2}{12}} ${substr{-3}{2}{12}}
165substr: ${substr{${if eq{1}{1}{-8}}}{${if eq{1}{0}{25}{1}}}{abcde}}
166
167# Error forms
168
169${hash{one}}
170${hash{nonnumber}{abcd}}
171${hash{3}{2}{4}{abcd}}
172${substr{-3}{-2}{abcd}}
173
174# Skipped operators
175
176addrss: ${if eq {1}{2}{${address:invalid}}{NO}}
177domain: ${if eq {1}{2}{${domain:invalid}}{NO}}
178escape: ${if eq {1}{2}{${escape:invalid}}{NO}}
179expand: ${if eq {1}{2}{\$primary_hostname ${expand:\$invalid}}{NO}}
180hash: ${if eq {1}{2}{${hash_3:invalid}}{NO}}
181md5: ${if eq {1}{2}{${md5:invalid}}{NO}}
182mask: ${if eq {1}{2}{${mask:invalid}}{NO}}
183
184# Conditions
185
1862=2: ${if ={2}{2}{y}{n}}
1872==2: ${if =={2}{2}{y}{n}}
1883=2: ${if ={3}{2}{y}{n}}
1892==3: ${if =={2}{3}{y}{n}}
190!2=2: ${if !={2}{2}{y}{n}}
191!2==2: ${if !=={2}{2}{y}{n}}
192!3=2: ${if !={3}{2}{y}{n}}
193!2==3: ${if !=={2}{3}{y}{n}}
1942>3: ${if >{2}{3}{y}{n}}
1953>3: ${if >{3}{3}{y}{n}}
1964>3: ${if >{4}{3}{y}{n}}
1972>=3: ${if >={2}{3}{y}{n}}
1983>=3: ${if >={3}{3}{y}{n}}
1994>=3: ${if >={4}{3}{y}{n}}
2002<3: ${if <{2}{3}{y}{n}}
2013<3: ${if <{3}{3}{y}{n}}
2024<3: ${if <{4}{3}{y}{n}}
2032<=3: ${if <={2}{3}{y}{n}}
2043<=3: ${if <={3}{3}{y}{n}}
2054<=3: ${if <={4}{3}{y}{n}}
2065<=3: ${if <={ 5 } { 3 } {y}{n}}
207
2085>3k: ${if >{5 } {3k }{y}{n}}
2095>3m: ${if >{5 } {3m }{y}{n}}
2105>3z: ${if >{5 } {3z }{y}{n}}
2115>a: ${if >{ 5 } {a}{y}{n}}
212
213def:y ${if def:tod_log{y}{n}}
214def:n ${if def:host{y}{n}}
215def:f ${if def:post{y}{n}}
216def:h_f ${if def:h_xxx {y}{n}}
217def:h_f ${if def:h_xxx:{y}{n}}
218def:d: ${if def:tod_log:{y}{n}}
219
220exists: ${if exists{/etc/passwd}{y}{n}}
221exists: ${if exists{/doesnt}{y}{n}}
222
223eq: ${if eq{abc}{abc}{y}{n}}
224eq: ${if eq{abc}{xyz}{y}{n}}
225!eq: ${if !eq{abc}{abc}{y}{n}}
226!eq: ${if !eq{abc}{xyz}{y}{n}}
227
228eqi: ${if eqi{abc}{abc}{y}{n}}
229eqi: ${if eqi{abc}{ABC}{y}{n}}
230eqi: ${if eqi{abc}{xyz}{y}{n}}
231!eqi: ${if !eqi{abc}{abc}{y}{n}}
232!eqi: ${if !eqi{abc}{aBc}{y}{n}}
233!eqi: ${if !eqi{abc}{xyz}{y}{n}}
234
235lt: ${if lt{ABC}{abc}{y}{n}}
236lti: ${if lti{ABC}{abc}{y}{n}}
237le: ${if le{ABC}{abc}{y}{n}}
238lei: ${if lei{ABC}{abc}{y}{n}}
239gt: ${if gt{ABC}{abc}{y}{n}}
240gti: ${if gti{ABC}{abc}{y}{n}}
241ge: ${if ge{ABC}{abc}{y}{n}}
242gei: ${if gei{ABC}{abc}{y}{n}}
243
244isip: ${if isip {1.2.3.4}{y}{n}} 1.2.3.4
245isip4: ${if isip4{1.2.3.4}{y}{n}} 1.2.3.4
246isip6: ${if isip6{1.2.3.4}{y}{n}} 1.2.3.4
247isip: ${if isip {1:2:3:4}{y}{n}} 1:2:3:4
248isip4: ${if isip4{1:2:3:4}{y}{n}} 1:2:3:4
249isip6: ${if isip6{1:2:3:4}{y}{n}} 1:2:3:4
250isip: ${if isip {::1}{y}{n}} ::1
251isip4: ${if isip4{::1}{y}{n}} ::1
252isip6: ${if isip6{::1}{y}{n}} ::1
253isip: ${if isip {fe80::a00:20ff:fe86:a061}{y}{n}} fe80::a00:20ff:fe86:a061
254isip4: ${if isip4{fe80::a00:20ff:fe86:a061}{y}{n}} fe80::a00:20ff:fe86:a061
255isip6: ${if isip6{fe80::a00:20ff:fe86:a061}{y}{n}} fe80::a00:20ff:fe86:a061
256isip: ${if isip {rhubarb}{y}{n}} rhubarb
257isip4: ${if isip4{rhubarb}{y}{n}} rhubarb
258isip6: ${if isip6{rhubarb}{y}{n}} rhubarb
259
260match: ${if match{abcd}{\N^([ab]+)(\w+)$\N}{$2$1}fail}
261match: ${if match{abcd}{^\N([ab]+)(\w+)$\N}{$2$1}fail}
262match: ${if match{abcd}{^([ab]+)(\\w+)\$}{$2$1}fail}
263match: ${if match{wxyz}{^([ab]+)(\\w+)\$}{$2$1}fail}
264match: ${if match{abcd}{^([ab]+)(\\w+)\$}{$2[${if match{xyz}{(.*)}{$1}fail}]$1}fail}
265
266match_domain: ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
267match_domain: ${if match_domain{a.b.c}{x.y.z:p.q.r}{yes}{no}}
268match_domain: ${if match_domain{5.aa.bb}{+dlist}{yes}{no}}
269match_domain: ${if match_domain{xxxyz}{+dlist}{yes}{no}}
270match_domain: ${if match_domain{xyz}{+dlist}{yes}{no}}
271
272match_address: ${if match_address{x@y.z}{p@q:*@y.z}{yes}{no}}
273match_address: ${if match_address{x@y.z}{p@q:x@*.z}{yes}{no}}
274
275match_local_part:${if match_local_part{jo}{jack:jill:jo:john}{yes}{no}}
276match_local_part:${if match_local_part{jo}{\N^\w\N}{yes}{no}}
277
278match_ip: 01 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.4}}
279match_ip: 02 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6}}
280match_ip: 03 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6/24}}
281match_ip: 04 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6:*}}
282match_ip: 05 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6:name}}
283match_ip: 06 ${if match_ip{1.2.3.4}{:4.5.6.7}}
284match_ip: 07 ${if match_ip{}{:4.5.6.7}}
285match_ip: 08 ${if match_ip{V4NET.11.12.13}{+hlist}}
286match_ip: 09 ${if match_ip{V4NET.11.12.14}{+hlist}}
287match_ip: 10 ${if match_ip{192.168.3.4}{+hlist}}
288match_ip: 11 ${if match_ip{somename}{+hlist}}
289match_ip: 12 ${if match_ip{1.2.3.4}{lsearch;DIR/aux-fixed/0002.matchip}}
290match_ip: 13 ${if match_ip{1.2.3.4}{net-lsearch;DIR/aux-fixed/0002.matchip}}
291match_ip: 14 ${if match_ip{5.6.7.8}{net24-lsearch;DIR/aux-fixed/0002.matchip}}
292
293queue_running: ${if queue_running{y}{n}}
294first_delivery: ${if first_delivery{y}{n}}
295
296queue_running after or: ${if or{{eq {0}{0}}{queue_running}}{y}{n}}
297first_delivery after or: ${if or{{eq {0}{0}}{first_delivery}}{y}{n}}
298
299# Default values for both if strings
300
301\${if eq{1}{1}} >${if eq{1}{1}}<
302\${if eq{1}{2}} >${if eq{1}{2}}<
303
304# Lookups: DIR is the testing directory. In this test we can only use the
305# lookups that are required in all cases.
306
307${lookup{postmaster}lsearch{DIR/aux-fixed/0002.aliases}{$value}fail}
308
309${lookup{x@y}lsearch*@{DIR/aux-fixed/0002.starat}{$value}fail}
310${lookup{x@z}lsearch*{DIR/aux-fixed/0002.starat}{$value}fail}
311${lookup{x@z}lsearch*@{DIR/aux-fixed/0002.starat}{$value}fail}
312${lookup{x@w}lsearch*@{DIR/aux-fixed/0002.starat}{$value}fail}
313
314${lookup{a.b.c.d}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
315${lookup{x.y.z}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}{failed x.y.z}}
316${lookup{p.q}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
317${lookup{o.p.q}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
318${lookup{m.n.o.p.q}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
319${lookup{x.y.z}partial1-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
320${lookup{x.y.z}partial0-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
321
322q1: ${lookup{abc}lsearch{DIR/aux-fixed/0002.quoted}}
323q2: ${lookup{xyz}lsearch{DIR/aux-fixed/0002.quoted}}
324q3: ${lookup{pqr}lsearch{DIR/aux-fixed/0002.quoted}}
325q4: ${lookup{a:b}lsearch{DIR/aux-fixed/0002.quoted}}
326q5: ${lookup{"quoted"}lsearch{DIR/aux-fixed/0002.quoted}}
327q6: ${lookup{white space}lsearch{DIR/aux-fixed/0002.quoted}}
328q7: ${lookup{b\\s}lsearch{DIR/aux-fixed/0002.quoted}}
329
330abc: ${lookup{abc}wildlsearch{DIR/aux-var/0002.wild}}
331a.b.c: ${lookup{a.b.c}wildlsearch{DIR/aux-var/0002.wild}}
332ab.c: ${lookup{ab.c}wildlsearch{DIR/aux-var/0002.wild}}
333xyz: ${lookup{xyz}wildlsearch{DIR/aux-var/0002.wild}}
334Xyz: ${lookup{Xyz}wildlsearch{DIR/aux-var/0002.wild}}
335Zyz: ${lookup{Zyz}wildlsearch{DIR/aux-var/0002.wild}}
336a b: ${lookup{a b}wildlsearch{DIR/aux-var/0002.wild}}
337a b: ${lookup{a b}wildlsearch{DIR/aux-var/0002.wild}}
338a:b: ${lookup{a:b}wildlsearch{DIR/aux-var/0002.wild}}
339a.b: ${lookup{a.b}wildlsearch{DIR/aux-var/0002.wild}}
340a..b: ${lookup{a..b}wildlsearch{DIR/aux-var/0002.wild}}
341a9b: ${lookup{a9b}wildlsearch{DIR/aux-var/0002.wild}}
342a99b: ${lookup{a99b}wildlsearch{DIR/aux-var/0002.wild}}
343
344# Should give the same results as above because expansion does nothing
345
346abc: ${lookup{abc}nwildlsearch{DIR/aux-var/0002.wild}}
347a.b.c: ${lookup{a.b.c}nwildlsearch{DIR/aux-var/0002.wild}}
348ab.c: ${lookup{ab.c}nwildlsearch{DIR/aux-var/0002.wild}}
349xyz: ${lookup{xyz}nwildlsearch{DIR/aux-var/0002.wild}}
350Xyz: ${lookup{Xyz}nwildlsearch{DIR/aux-var/0002.wild}}
351Zyz: ${lookup{Zyz}nwildlsearch{DIR/aux-var/0002.wild}}
352a b: ${lookup{a b}nwildlsearch{DIR/aux-var/0002.wild}}
353a b: ${lookup{a b}nwildlsearch{DIR/aux-var/0002.wild}}
354a:b: ${lookup{a:b}nwildlsearch{DIR/aux-var/0002.wild}}
355
356# Should fail because of no expansion
357
358a.b: ${lookup{a.b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}}
359a..b: ${lookup{a..b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}}
360a9b: ${lookup{a9b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}}
361a99b: ${lookup{a99b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}}
362
363# But these should succeed
364
365a\\:b: ${lookup{a\\:b}nwildlsearch{DIR/aux-var/0002.wild}}
366a\\:Xb: ${lookup{a\\:Xb}nwildlsearch{DIR/aux-var/0002.wild}}
367
368# IP address (CIDR) lookups
369
3701.2.3.4: ${lookup{1.2.3.4}iplsearch{DIR/aux-fixed/0002.iplsearch}}
3711.2.3.5: ${lookup{1.2.3.5}iplsearch{DIR/aux-fixed/0002.iplsearch}}
3721.2.3.5: ${lookup{1.2.3.5}iplsearch*{DIR/aux-fixed/0002.iplsearch}}
373abcd::cdab: ${lookup{abcd::cdab}iplsearch{DIR/aux-fixed/0002.iplsearch}}
374192.168.1.2: ${lookup{192.168.1.2}iplsearch{DIR/aux-fixed/0002.iplsearch}}
375192.168.5.6: ${lookup{192.168.5.6}iplsearch{DIR/aux-fixed/0002.iplsearch}}
376abcd:abcd:: ${lookup{abcd:abcd::}iplsearch{DIR/aux-fixed/0002.iplsearch}}
377abcd:abcd:1:: ${lookup{abcd:abcd:1::}iplsearch{DIR/aux-fixed/0002.iplsearch}}
378abcd:abcd::3 ${lookup{abcd:abcd::3}iplsearch{DIR/aux-fixed/0002.iplsearch}}
379rhubarb ${lookup{rhubarb}iplsearch{DIR/aux-fixed/0002.iplsearch}}
380
381
382# Nested Lookups - style 1
383
384${lookup{${lookup{key1}lsearch{DIR/aux-fixed/0002.rec}{$value}{key1f}}}lsearch{DIR/aux-fixed/0002.rec}{$value}fail}
385${lookup{${lookup{key3}lsearch{DIR/aux-fixed/0002.rec}{$value}{key1f}}}lsearch{DIR/aux-fixed/0002.rec}{$value}fail}
386
387# Nested Lookups - style 2
388
389${lookup{key1}lsearch{DIR/aux-fixed/0002.rec}{${lookup{$value}lsearch{DIR/aux-fixed/0002.rec}{$value}{failed for $value}}}{failed for key1}}
390${lookup{key3}lsearch{DIR/aux-fixed/0002.rec}{${lookup{$value}lsearch{DIR/aux-fixed/0002.rec}{$value}{failed for $value}}}{failed for key1}}
391
392# Other nesting tests
393
394${lookup{one}lsearch{DIR/aux-fixed/0002.alias1}{$value${lookup{one}lsearch{DIR/aux-fixed/0002.alias2}{,$value}}}{${lookup{one}lsearch{DIR/aux-fixed/0002.alias2}{$value}fail}}}
395${lookup{two}lsearch{DIR/aux-fixed/0002.alias1}{$value${lookup{two}lsearch{DIR/aux-fixed/0002.alias2}{,$value}}}{${lookup{two}lsearch{DIR/aux-fixed/0002.alias2}{$value}fail}}}
396${lookup{both}lsearch{DIR/aux-fixed/0002.alias1}{$value${lookup{both}lsearch{DIR/aux-fixed/0002.alias2}{,$value}}}{${lookup{both}lsearch{DIR/aux-fixed/0002.alias2}{$value}fail}}}
397${lookup{neither}lsearch{DIR/aux-fixed/0002.alias1}{$value${lookup{neither}lsearch{DIR/aux-fixed/0002.alias2}{,$value}}}{${lookup{neither}lsearch{DIR/aux-fixed/0002.alias2}{$value}fail}}}
398
399# Lookup quotes for standardly expected lookups
400
401lsearch ${quote_lsearch: !@#\$%^&*()_-+=|\\~`1234567890\{[\}]qwertyuiop:;"'asdfghjkl<,>.?/zxcvbnm}
402xxx ${quote_xxx: !@#\$%^&*()_-+=|\\~`1234567890\{[\}]qwertyuiop:;"'asdfghjkl<,>.?/zxcvbnm}
403
404# Extract
405
406${extract{B}{A=1 B=2 C=3}}
407${extract{ B }{A=1 B=2 C=3}{$value}{NOT FOUND}}
408${extract{2}{:}{1:2:3}}
409${extract{ 2 }{:}{1:2:3}{$value}{NOT FOUND}}
410Empty:<${extract{D}{A=1 B=2 C=3}}>
411Empty:<${extract{4}{:}{1:2:3}}>
412${extract{C}{A=1 B=2 C=3}{<$value>}}
413${extract{3}{:}{1:2:3}{<$value>}}
414Empty:<${extract{Z}{A=1 B=2 C=3}{<$value>}}>
415Empty:<${extract{4}{:}{1:2:3}{<$value>}}>
416${extract{Z}{A=1 B=2 C=3}{<$value>}{no Z}}
417${extract{4}{:}{1:2:3}{<$value>}{no 4}}
418${extract{Z}{A=1 B=2 C=3}{<$value>}fail}
419${extract{4}{:}{1:2:3}{<$value>}fail}
420${extract{K4}{${sg{1=A 4=D 3=C}{(\\d+)=}{K\$1=}}}}
421${extract{0}{:}{a:b:c:d:e}{$value}{FAIL}}
422${extract{1}{:}{a:b:c:d:e}{$value}{FAIL}}
423${extract{-1}{:}{a:b:c:d:e}{$value}{FAIL}}
424${extract{-5}{:}{a:b:c:d:e}{$value}{FAIL}}
425${extract{-6}{:}{a:b:c:d:e}{$value}{FAIL}}
426${extract{-3}{:,}{a,,b::c}}
427${extract{2}{:,}{a,,b::c}}
428${extract{3}{:,}{a,,b::c}}
429${extract{a-b}{X = "one two" a-b "three four" 5=99}}
430${extract{}{X=3}}
431${extract{ }{X=3}}
432${extract{ 2 }{ }{a b c}}
433
434# Translation
435
436abcdea aaa xyz ${tr{abcdea}{aaa}{xyz}}
437abcdea a z ${tr{abcdea}{a}{z}}
438abcdea a ${tr{abcdea}{a}{}}
439abcdea abc z ${tr{abcdea}{abc}{z}}
440
441# RFC 2047
442
443abcd ${rfc2047:abcd}
444<:abcd:> ${rfc2047:<:abcd:>}
445<:ab cd:> ${rfc2047:<:ab cd:>}
446Long: ${rfc2047: here we go: a string that is going to be encoded: it will go over the 75-char limit}
447Long: ${rfc2047: here we go: a string that is going to be encoded: it will go over the 75-char limit by a long way; in fact this one will go over the 150 character limit}
448
449
450# UTF-8
451
452abcd ${from_utf8:abcd}
453ad ${from_utf8:aÀÿd}
454toobig ${from_utf8:aĀd}
455
456# Substitution
457
458\${sg{abcdefabcdef}{abc}{xyz}} =${sg{abcdefabcdef}{abc}{xyz}}
459\${sg{ab:xy::z}{:}{::}} =${sg{ab:xy::z}{:}{::}}
460\${sg{abcdefabcdef}{(..)[^c]}{>\$1<}} =${sg{abcdefabcdef}{(..)[^c]}{>$1<}}
461\${sg{abcdefabcdef}{(..)[^c]}{>\\\$1<}} =${sg{abcdefabcdef}{(..)[^c]}{>\$1<}}
462\${sg{abcdefabcdef}{(..)[^c]}{>\\N\$1\\N<}}=${sg{abcdefabcdef}{(..)[^c]}{>\N$1\N<}}
463\${sg{abbab}{a*}{+}} =${sg{abbab}{a*}{+}}
464
465# File insertion
466
467${readfile}
468${readfile{DIR/aux-fixed/0002.readfile}}
469${readfile{DIR/aux-fixed/0002.readfile}{}}
470${readfile{DIR/aux-fixed/0002.readfile}{:}}
471${readfile{DIR/aux-fixed/0002.readfile}{ - }}
472${readfile{/non/exist/file}}
473${if exists{/non/exist/file}{${readfile{/non/exist/file}}}{non-exist}}
474>${readfile{DIR/aux-fixed/0002.readfile}{!}}\
475 <
476
477# Calling a command
478
479${run{DIR/aux-fixed/0002.runfile 0}}
480RC=$runrc
481${run{DIR/aux-fixed/0002.runfile 0}{1}{2}}
482RC=$runrc
483${run{DIR/aux-fixed/0002.runfile 0}{$value}{2}}
484RC=$runrc
485${run{DIR/aux-fixed/0002.runfile 1}{$value}{2}}
486RC=$runrc
487${run{DIR/aux-fixed/0002.runfile 1}{$value}{$value}}
488RC=$runrc
489${run{DIR/test-nonexist}{Y}{N}}
490RC=$runrc
491>>${run{DIR/bin/iefbr14}}<<
492RC=$runrc
493${if eq{1}{2}{${run{/non/exist}}}{1!=2}}
494RC=$runrc
495
496# PRVS
497
498${prvs{userx@test.ex}{secret}}
499${prvs{userx@test.ex}{secret}{1}}
500${prvs{userx@test.ex}{secret}{8}}
501
502# Syntax errors
503
504${prvs{userx@test.ex}{secret}{12}}
505${prvs{userx@test.ex}{secret}{rhubarb}}
506${prvs{userx@test.ex}{secret}{}}
507
508# Correct checks; can't put explicit addresses in the tests, because they
509# will change over time.
510
511${prvscheck{${prvs{userx@test.ex}{secret}}}{secret}}
512result=$prvscheck_result
513
514${prvscheck{${prvs{userx@test.ex}{secret}{1}}}{secret}\
515{>$prvscheck_result< >$prvscheck_address< >$prvscheck_keynum<}}
516result=$prvscheck_result
517
518${prvscheck{${prvs{userx@test.ex}{secret}{8}}}{secret}{}}
519result=$prvscheck_result
520
521# Incorrect secret
522
523${prvscheck{${prvs{userx@test.ex}{secret}}}{socrot}}
524result=$prvscheck_result
525
526${prvscheck{${prvs{userx@test.ex}{secret}}}{socrot}{$prvscheck_keynum}}
527result=$prvscheck_result
528
529# Non-prvs address
530
531>>${prvscheck{userx@test.ex}{secret}}<<
532result=$prvscheck_result
533
534# Syntax errors
535
536${tod_log
537${tod_log+6
538${expand:abcd
539${expand:abcd${tod_log}
540${hmac{xxx}{a}{b}}
541${if and {xyz}{a}{b}}
542${if and {{xya}}{a}{b}}
543${if and {{${lookup{x}lsearch{/a/b}}}}{a}{b}}
544${if eq {$h_xyz}{1}{y}{n}}
545${if or {eq {}{}{yes}{no}}
546${if or {{eq {}{}{yes}{no}}
547${if or {{eq {}{}}{yes}{no}}
548${substr_1_:12345}
549${substr__3:12345}
550
551# Miscellaneous (for bug fixes, etc)
552
553${if ={1}{1} {true}{${if ={1}{1} {true}{${if ={1}{1}{true}fail}}}}}
554
555****
556# Test "escape" with print_topbitchars
557exim -be -DPTBC=print_topbitchars
558escape: ${escape:B7F2}
559****
560# Checkout expansion debugging
561exim -d-all+expand -be
562primary_hostname: $primary_hostname
563match: ${if match{abcd}{\N^([ab]+)(\w+)$\N}{$2$1}fail}
564match: ${if match{wxyz}{\N^([ab]+)(\w+)$\N}{$2$1}fail}
565${if eq {1}{1}{yes}{${lookup{xx}lsearch{/non/exist}}}}
566match_address: ${if match_address{a.b.c}{a.b.c}{yes}{no}}
567****
568# Sender host name and address etc, all unset
569exim -be
570-oMa sender_host_address = $sender_host_address
571 sender_host_port = $sender_host_port
572-oMaa sender_host_authenticated = $sender_host_authenticated
573-oMai authenticated_id = $authenticated_id
574-oMas authenticated_sender = $authenticated_sender
575-oMi interface_address = $interface_address
576 interface_port = $interface_port
577-oMr received_protocol = $received_protocol
578-oMs sender_host_name = $sender_host_name
579-oMt sender_ident = $sender_ident
580****
581# Sender host name and address etc, all set except host name.
582exim -d-all+expand -be -oMa V4NET.0.0.1.1234 -oMaa AAA -oMai philip -oMas xx@yy.zz -oMi 1.1.1.1.99 -oMr special -oMt me
583-oMa sender_host_address = $sender_host_address
584 sender_host_port = $sender_host_port
585-oMaa sender_host_authenticated = $sender_host_authenticated
586-oMai authenticated_id = $authenticated_id
587-oMas authenticated_sender = $authenticated_sender
588-oMi interface_address = $interface_address
589 interface_port = $interface_port
590-oMr received_protocol = $received_protocol
591-oMt sender_ident = $sender_ident
592****
593# Sender host name explicitly set
594exim -be -oMa V4NET.0.0.1.1234 -oMs my.host.name
595-oMa sender_host_address = $sender_host_address
596 sender_host_port = $sender_host_port
597-oMs sender_host_name = $sender_host_name
598****
599# Sender host name lookup fails (V4NET.11.12.13 is not reverse registered)
600exim -be -oMa V4NET.11.12.13
601-oMs sender_host_name = $sender_host_name
602 host_lookup_failed = $host_lookup_failed
603****
604# Sender host name and protocol set by Sendmail-compatible option
605exim -be -pspecial:host.name
606-p received_protocol = $received_protocol
607-p sender_host_name = $sender_host_name
608****
609# Sender host name and address etc, all set except host name,
610# which should therefore be looked up from the address, but not if
611# we are skipping. The debug output for this test will show when
612# the lookup occurs.
613exim -d-all+host_lookup+expand -be -oMa V4NET.0.0.1.1234 -oMaa AAA -oMai philip -oMas xx@yy.zz -oMi 1.1.1.1.99 -oMr special -oMt me
614-oMa sender_host_address = $sender_host_address
615 sender_host_port = $sender_host_port
616-oMaa sender_host_authenticated = $sender_host_authenticated
617-oMai authenticated_id = $authenticated_id
618-oMas authenticated_sender = $authenticated_sender
619-oMi interface_address = $interface_address
620 interface_port = $interface_port
621-oMr received_protocol = $received_protocol
622----> No lookup yet: ${if eq{black}{white}{$sender_host_name}{No}}
623-oMs sender_host_name = $sender_host_name
624-oMt sender_ident = $sender_ident
625****
626# Test no auto host name lookup for query-style lookups
627exim -d -bh V4NET.0.0.1
628****
629exim -d -bh V4NET.0.0.2
630****
631# Test $reply_address
632exim -bh V4NET.0.0.0
633mail from:<>
634rcpt to:<some@body>
635data
636.
637mail from:<>
638rcpt to:<some@body>
639data
640From: a@b
641.
642mail from:<>
643rcpt to:<some@body>
644data
645From: a@b
646Reply-to: c@d
647.
648mail from:<>
649rcpt to:<some@body>
650data
651Reply-to:
652.
653mail from:<>
654rcpt to:<some@body>
655data
656Reply-to:
657From: x@y
658.
659quit
660****
661# Check RFC 2047 decoding with (default) length check
662exim -bh V4NET.0.0.0
663mail from:<>
664rcpt to:<some@body>
665data
666Subject: =?iso-8859-8?Q?_here_we_go=3A_a_string_that_is_going_to_be_encoded=3A_it_will_go_over_the_75-char_limit_by_a_long_way=3B_in_fact_this_one_will_go_over_the_150_character_limit?=
667.
668quit
669****
670# Check RFC 2047 decoding with length check disabled
671exim -DLENCHECK=check_rfc2047_length=false -bh V4NET.0.0.0
672mail from:<>
673rcpt to:<some@body>
674data
675Subject: =?iso-8859-8?Q?_here_we_go=3A_a_string_that_is_going_to_be_encoded=3A_it_will_go_over_the_75-char_limit_by_a_long_way=3B_in_fact_this_one_will_go_over_the_150_character_limit?=
676.
677quit
678****