1 # Common string expansions
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.
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.
14 # Some fixed variables
17 primary_hostname: $primary_hostname
18 primary_hostname: ${primary_hostname}
19 qualify_domain: $qualify_domain
20 bounce_return_size_limit: ${bounce_return_size_limit}
21 spool_directory: $spool_directory
23 h_subject: $h_subject:(should be empty)
24 h_subject:$h_subject (should be empty)
25 header in curlies: ${header_subject:} (should fail)
27 # \$message_headers should be empty
28 message_headers: >$message_headers<
36 # Overlong names and overbig numbers
38 +$aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
39 +${aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
40 +$11111111111111111111111111111111111
41 +${11111111111111111111111111111111111}
45 filter: "${filter{a:b:c}{eq{1}{1}}}"
46 filter: ${filter{a:b:c}{!eq{$item}{b}}}
47 filter: ${filter{<' a'b'c}{!eq{$item}{b}}}
48 filter: ${filter{<' ''a'b' ''c}{!eq{$item}{b}}}
49 filter: "${filter{}{!eq{$item}{b}}}"
51 map: "${map{}{$item}}"
52 map: ${map{a:b:c}{$item}}
53 map: ${map{a:b:c}{:$item:}}
54 map: ${if eq{1}{0}{${map{a:b:c}{:$item:}}}{fail string}}
55 map: ${map{:b:c}{[$item]}}
57 reduce: "${reduce{}{+}{$value$item}}"
58 reduce: ${reduce{a:b:c}{+}{$value$item}}
59 reduce: ${reduce {<, 1,2,3}{0}{${eval:$value+$item}}}
60 reduce: ${reduce {3:0:9:4:6}{0}{${if >{$item}{$value}{$item}{$value}}}}
64 addrss: ${address:local-part@dom.ain}
65 addrss: ${address:Exim Person <local-part@dom.ain> (that's me)}
66 domain: ${domain:local-part@dom.ain}
67 domain: ${domain:Exim Person <local-part@dom.ain> (that's me)}
69 addresses: ${addresses:>' 'abc@xyz, 'pqr@xyz}
70 addresses: ${addresses:Exim Person <local-part@dom.ain> (that's me)}
71 addresses: ${addresses:>+ Exim Person <local-part@dom.ain> (that's me),\
73 addresses: ${addresses:Exim Person <local-part@dom.ain> (that's me), \
74 xyz@abc, nullgroupname:;, group: p@q, r@s; }
75 addresses: ${addresses:local-part@dom.ain <local-part@dom.ain>}
77 escape: ${escape:B7·F2ò}
87 eval: ${eval:-2 - (-3)}
88 eval: ${eval:-2 - (-3}
89 eval: ${eval:-2 - -3)}
93 eval: ${eval:(2*(1+1))/2 + 40K}
98 eval10: ${eval10:0x1234}
101 eval: ${eval:0xc & 5 }
105 eval: ${eval:0xc >> 2}
106 eval: ${eval:0xc >> 4 }
108 eval: ${eval:~255&0x1234}
109 eval: ${eval:~ 255&0x1234}
110 eval: ${eval: -(~255&0x1234)}
112 expand: \$primary_hostname ${expand:\$primary_hostname}
113 hash: ${hash_3:monty} ${hash_5:monty} ${hash_4_62:monty python}
114 hash: ${hash_3:abc}X ${hash_3:ab}X ${hash_3:a}X ${hash_3:}X
115 hex2b64:${hex2b64:12345678}
116 hex2b64:${hex2b64:abcdef}
117 hex2b64:${hex2b64:ABCDEF}
118 hex2b64:${hex2b64:1a2b3c4d5e6f}
119 hex2b64:${hex2b64:1a2b3c4d5e6}
120 hex2b64:${hex2b64:1a2b3c4d5e6g}
121 hex2b64:${hex2b64:${md5:the quick brown fox}}
122 hex2b64:${hex2b64:${sha1:the quick brown fox}}
124 The base62 operator is actually a base36 operator in the Darwin and Cygwin
125 environments. Write cunning tests that produce the same output in both cases,
126 while doing a reasonable check.
129 {eq {${base62:12345}}{0003D7}}\
130 {eq {${base62:12345}}{0009IX}}\
133 {eq {${base62d:0003D7}}{12345}}\
134 {eq {${base62d:0009IX}}{12345}}\
137 {eq {${base62d:3D7}}{12345}}\
138 {eq {${base62d:9IX}}{12345}}\
140 base62 error: ${base62:12345x}
141 base62d error:${base62d:0003D7.}
143 hmac: ${hmac{md5}{somesecret}{mail.example.com 2002-10-17 11:30:59}}
144 hmac: ${hmac{sha1}{somesecret}{mail.example.com 2002-10-17 11:30:59}}
145 md5: ${md5:the quick brown fox jumps over the lazy dog}
148 mask: ${mask:192.168.10.206/28}
149 mask: ${mask:192.168.10.206/32}
150 mask: ${mask:192.168.10.206/33}
151 mask: ${mask:192.168.10.206/0}
152 mask: ${mask:192.168.10.206}
153 mask: ${mask:a.b.c.d}
154 nhash: ${nhash_24:monty} ${nhash_8_63:monty python}
155 lc/uc: ${lc:The Quick} ${uc: Brown Fox}
156 length: ${length_10:The quick brown fox} ${l_10:abc}
157 lclpt: ${local_part:local-part@dom.ain}
158 lclpt: ${local_part:Exim Person <local-part@dom.ain> (that's me)}
159 quote: ${quote:aZ09_.-Q} ${quote:ab*cd} ${quote:ab\cd"ef}
160 quote: ${quote:nl(\n)}
161 quote: ${quote:cr(\r)}
162 quote: ${quote:tab(\t)}
163 quote: ${quote:xff(\xff)}
164 quote: Empty>${quote:}<
165 quote_local_part: ${quote_local_part:abcd}
166 quote_local_part: ${quote_local_part:O'Reilly}
167 quote_local_part: ${quote_local_part:a space}
168 quote_local_part: ${quote_local_part:.something}
169 quote_local_part: ${quote_local_part:something.}
170 quote_local_part: ${quote_local_part:joe.bloggs}
171 quote_local_part: ${quote_local_part:a!b}
172 quote_local_part: ${quote_local_part:x@y}
173 quote_local_part: ${quote_local_part:ab*cd}
174 quote_local_part: ${quote_local_part:x:y}
175 quote_local_part: ${quote_local_part:ab\cd"ef}
176 quote_local_part: ${quote_local_part:}
177 rxquote:${rxquote:aZ09_,-Q} ${rxquote:ab*cd} ${rxquote:ab\cd"ef}
178 substr: ${substr_3_2:rhubarb} ${s_-5_2:1234567} ${s_-5_2:12} ${s_-3_2:12}
179 substr: ${s_3:rhubarb} ${s_-2:rhubarb}
181 substr: ${substr_10:abc}
182 str2b64:${str2b64:abcd}
183 str2b64:${str2b64:The quick brown \n fox}
186 strlen: ${strlen:abcdefgh}
187 time_eval: ${time_eval:10s}
188 time_eval: ${time_eval:2h}
189 time_eval: ${time_eval:1d5m}
190 time_eval: ${time_eval:1w2d3h4m5s}
191 time_eval: ${time_eval:14}
192 time_eval: ${time_eval:rhubarb}
193 time_interval: ${time_interval:0}
194 time_interval: ${time_interval:44}
195 time_interval: ${time_interval:999999}
196 time_interval: ${time_interval:-1}
197 time_interval: ${time_interval:rhubarb}
199 # stat is a bit tricky, but some of the fields of the aux-var directory
200 # should be the same on all systems
202 stat: ${extract{mode}{${stat:DIR/aux-var}}}
203 stat: ${extract{smode}{${stat:DIR/aux-var}}}
204 stat: ${stat:/a/non/existent/file}
206 # "Operators" that have expanded arguments
208 hash: ${hash{3}{monty}} ${hash{5}{monty}} ${hash{4}{62}{monty python}}
209 hash: ${hash{3}{abc}}X ${hash{3}{ab}}X ${hash{3}{a}}X ${hash{3}{}}X
210 nhash: ${nhash{24}{monty}} ${nhash{8}{63}{monty python}}
211 length: ${length{10}{The quick brown fox}} ${length{10}{abc}}
212 substr: ${substr{3}{2}{rhubarb}} ${substr{-5}{2}{1234567}} ${substr{-5}{2}{12}} ${substr{-3}{2}{12}}
213 substr: ${substr{${if eq{1}{1}{-8}}}{${if eq{1}{0}{25}{1}}}{abcde}}
218 ${hash{nonnumber}{abcd}}
219 ${hash{3}{2}{4}{abcd}}
220 ${substr{-3}{-2}{abcd}}
224 addrss: ${if eq {1}{2}{${address:invalid}}{NO}}
225 domain: ${if eq {1}{2}{${domain:invalid}}{NO}}
226 escape: ${if eq {1}{2}{${escape:invalid}}{NO}}
227 expand: ${if eq {1}{2}{\$primary_hostname ${expand:\$invalid}}{NO}}
228 hash: ${if eq {1}{2}{${hash_3:invalid}}{NO}}
229 md5: ${if eq {1}{2}{${md5:invalid}}{NO}}
230 mask: ${if eq {1}{2}{${mask:invalid}}{NO}}
234 4096M ${if >{1}{4096M}{y}{n}}
235 4096000000 ${if >{1}{4096000000}{y}{n}}
239 2=2: ${if ={2}{2}{y}{n}}
240 2==2: ${if =={2}{2}{y}{n}}
241 3=2: ${if ={3}{2}{y}{n}}
242 2==3: ${if =={2}{3}{y}{n}}
243 !2=2: ${if !={2}{2}{y}{n}}
244 !2==2: ${if !=={2}{2}{y}{n}}
245 !3=2: ${if !={3}{2}{y}{n}}
246 !2==3: ${if !=={2}{3}{y}{n}}
247 2>3: ${if >{2}{3}{y}{n}}
248 3>3: ${if >{3}{3}{y}{n}}
249 4>3: ${if >{4}{3}{y}{n}}
250 1>-1: ${if >{1}{-1}{y}{n}}
251 2>=3: ${if >={2}{3}{y}{n}}
252 3>=3: ${if >={3}{3}{y}{n}}
253 4>=3: ${if >={4}{3}{y}{n}}
254 2<3: ${if <{2}{3}{y}{n}}
255 3<3: ${if <{3}{3}{y}{n}}
256 4<3: ${if <{4}{3}{y}{n}}
257 2<=3: ${if <={2}{3}{y}{n}}
258 3<=3: ${if <={3}{3}{y}{n}}
259 4<=3: ${if <={4}{3}{y}{n}}
260 5<=3: ${if <={ 5 } { 3 } {y}{n}}
261 -3<=1: ${if <={-3}{1}{y}{n}}
263 5>3k: ${if >{5 } {3k }{y}{n}}
264 5>3m: ${if >{5 } {3m }{y}{n}}
265 5>3z: ${if >{5 } {3z }{y}{n}}
266 5>a: ${if >{ 5 } {a}{y}{n}}
268 >0: ${if > {}{0}{y}{n}}
269 =: ${if = {}{}{y}{n}}
270 -2<: ${if < {-2}{}{y}{n}}
271 08>07: ${if > {08}{07}{y}{n}}
272 011=11: ${if = {011}{11}{y}{n}}
274 def:y ${if def:tod_log{y}{n}}
275 def:n ${if def:host{y}{n}}
276 def:f ${if def:post{y}{n}}
277 def:h_f ${if def:h_xxx {y}{n}}
278 def:h_f ${if def:h_xxx:{y}{n}}
279 def:d: ${if def:tod_log:{y}{n}}
281 exists: ${if exists{/etc/passwd}{y}{n}}
282 exists: ${if exists{/doesnt}{y}{n}}
284 eq: ${if eq{abc}{abc}{y}{n}}
285 eq: ${if eq{abc}{xyz}{y}{n}}
286 !eq: ${if !eq{abc}{abc}{y}{n}}
287 !eq: ${if !eq{abc}{xyz}{y}{n}}
289 eqi: ${if eqi{abc}{abc}{y}{n}}
290 eqi: ${if eqi{abc}{ABC}{y}{n}}
291 eqi: ${if eqi{abc}{xyz}{y}{n}}
292 !eqi: ${if !eqi{abc}{abc}{y}{n}}
293 !eqi: ${if !eqi{abc}{aBc}{y}{n}}
294 !eqi: ${if !eqi{abc}{xyz}{y}{n}}
296 lt: ${if lt{ABC}{abc}{y}{n}}
297 lti: ${if lti{ABC}{abc}{y}{n}}
298 le: ${if le{ABC}{abc}{y}{n}}
299 lei: ${if lei{ABC}{abc}{y}{n}}
300 gt: ${if gt{ABC}{abc}{y}{n}}
301 gti: ${if gti{ABC}{abc}{y}{n}}
302 ge: ${if ge{ABC}{abc}{y}{n}}
303 gei: ${if gei{ABC}{abc}{y}{n}}
305 isip: ${if isip {1.2.3.4}{y}{n}} 1.2.3.4
306 isip4: ${if isip4{1.2.3.4}{y}{n}} 1.2.3.4
307 isip6: ${if isip6{1.2.3.4}{y}{n}} 1.2.3.4
308 isip: ${if isip {1:2:3:4}{y}{n}} 1:2:3:4
309 isip4: ${if isip4{1:2:3:4}{y}{n}} 1:2:3:4
310 isip6: ${if isip6{1:2:3:4}{y}{n}} 1:2:3:4
311 isip: ${if isip {::1}{y}{n}} ::1
312 isip4: ${if isip4{::1}{y}{n}} ::1
313 isip6: ${if isip6{::1}{y}{n}} ::1
314 isip: ${if isip {fe80::a00:20ff:fe86:a061}{y}{n}} fe80::a00:20ff:fe86:a061
315 isip4: ${if isip4{fe80::a00:20ff:fe86:a061}{y}{n}} fe80::a00:20ff:fe86:a061
316 isip6: ${if isip6{fe80::a00:20ff:fe86:a061}{y}{n}} fe80::a00:20ff:fe86:a061
317 isip: ${if isip {rhubarb}{y}{n}} rhubarb
318 isip4: ${if isip4{rhubarb}{y}{n}} rhubarb
319 isip6: ${if isip6{rhubarb}{y}{n}} rhubarb
321 match: ${if match{abcd}{\N^([ab]+)(\w+)$\N}{$2$1}fail}
322 match: ${if match{abcd}{^\N([ab]+)(\w+)$\N}{$2$1}fail}
323 match: ${if match{abcd}{^([ab]+)(\\w+)\$}{$2$1}fail}
324 match: ${if match{wxyz}{^([ab]+)(\\w+)\$}{$2$1}fail}
325 match: ${if match{abcd}{^([ab]+)(\\w+)\$}{$2[${if match{xyz}{(.*)}{$1}fail}]$1}fail}
327 match_domain: ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
328 match_domain: ${if match_domain{a.b.c}{x.y.z:p.q.r}{yes}{no}}
329 match_domain: ${if match_domain{5.aa.bb}{+dlist}{yes}{no}}
330 match_domain: ${if match_domain{xxxyz}{+dlist}{yes}{no}}
331 match_domain: ${if match_domain{xyz}{+dlist}{yes}{no}}
333 ${if match{x@zz.aa.bb}{^(.*)} \
336 ${if match_domain{${domain:$1}}{+dlist}{[$1]}} \
341 ${if match{x@xxxabc}{^(.*)} \
344 ${if match_domain{${domain:$1}}{^\Nxxx(.*)\N}{[$1]}} \
349 match_address: ${if match_address{x@y.z}{p@q:*@y.z}{yes}{no}}
350 match_address: ${if match_address{x@y.z}{p@q:x@*.z}{yes}{no}}
352 match_local_part:${if match_local_part{jo}{jack:jill:jo:john}{yes}{no}}
353 match_local_part:${if match_local_part{jo}{\N^\w\N}{yes}{no}}
355 match_ip: 01 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.4}}
356 match_ip: 02 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6}}
357 match_ip: 03 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6/24}}
358 match_ip: 04 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6:*}}
359 match_ip: 05 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6:name}}
360 match_ip: 06 ${if match_ip{1.2.3.4}{:4.5.6.7}}
361 match_ip: 07 ${if match_ip{}{:4.5.6.7}}
362 match_ip: 08 ${if match_ip{V4NET.11.12.13}{+hlist}}
363 match_ip: 09 ${if match_ip{V4NET.11.12.14}{+hlist}}
364 match_ip: 10 ${if match_ip{192.168.3.4}{+hlist}}
365 match_ip: 11 ${if match_ip{somename}{+hlist}}
366 match_ip: 12 ${if match_ip{1.2.3.4}{lsearch;DIR/aux-fixed/0002.matchip}}
367 match_ip: 13 ${if match_ip{1.2.3.4}{net-lsearch;DIR/aux-fixed/0002.matchip}}
368 match_ip: 14 ${if match_ip{5.6.7.8}{net24-lsearch;DIR/aux-fixed/0002.matchip}}
370 queue_running: ${if queue_running{y}{n}}
371 first_delivery: ${if first_delivery{y}{n}}
373 queue_running after or: ${if or{{eq {0}{0}}{queue_running}}{y}{n}}
374 first_delivery after or: ${if or{{eq {0}{0}}{first_delivery}}{y}{n}}
376 # Default values for both if strings
378 \${if eq{1}{1}} >${if eq{1}{1}}<
379 \${if eq{1}{2}} >${if eq{1}{2}}<
381 # Lookups: DIR is the testing directory. In this test we can only use the
382 # lookups that are required in all cases.
384 ${lookup{postmaster}lsearch{DIR/aux-fixed/0002.aliases}{$value}fail}
386 ${lookup{x@y}lsearch*@{DIR/aux-fixed/0002.starat}{$value}fail}
387 ${lookup{x@z}lsearch*{DIR/aux-fixed/0002.starat}{$value}fail}
388 ${lookup{x@z}lsearch*@{DIR/aux-fixed/0002.starat}{$value}fail}
389 ${lookup{x@w}lsearch*@{DIR/aux-fixed/0002.starat}{$value}fail}
391 ${lookup{a.b.c.d}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
392 ${lookup{x.y.z}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}{failed x.y.z}}
393 ${lookup{p.q}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
394 ${lookup{o.p.q}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
395 ${lookup{m.n.o.p.q}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
396 ${lookup{x.y.z}partial1-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
397 ${lookup{x.y.z}partial0-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
399 q1: ${lookup{abc}lsearch{DIR/aux-fixed/0002.quoted}}
400 q2: ${lookup{xyz}lsearch{DIR/aux-fixed/0002.quoted}}
401 q3: ${lookup{pqr}lsearch{DIR/aux-fixed/0002.quoted}}
402 q4: ${lookup{a:b}lsearch{DIR/aux-fixed/0002.quoted}}
403 q5: ${lookup{"quoted"}lsearch{DIR/aux-fixed/0002.quoted}}
404 q6: ${lookup{white space}lsearch{DIR/aux-fixed/0002.quoted}}
405 q7: ${lookup{b\\s}lsearch{DIR/aux-fixed/0002.quoted}}
407 abc: ${lookup{abc}wildlsearch{DIR/aux-var/0002.wild}}
408 a.b.c: ${lookup{a.b.c}wildlsearch{DIR/aux-var/0002.wild}}
409 ab.c: ${lookup{ab.c}wildlsearch{DIR/aux-var/0002.wild}}
410 xyz: ${lookup{xyz}wildlsearch{DIR/aux-var/0002.wild}}
411 Xyz: ${lookup{Xyz}wildlsearch{DIR/aux-var/0002.wild}}
412 Zyz: ${lookup{Zyz}wildlsearch{DIR/aux-var/0002.wild}}
413 a b: ${lookup{a b}wildlsearch{DIR/aux-var/0002.wild}}
414 a b: ${lookup{a b}wildlsearch{DIR/aux-var/0002.wild}}
415 a:b: ${lookup{a:b}wildlsearch{DIR/aux-var/0002.wild}}
416 a.b: ${lookup{a.b}wildlsearch{DIR/aux-var/0002.wild}}
417 a..b: ${lookup{a..b}wildlsearch{DIR/aux-var/0002.wild}}
418 a9b: ${lookup{a9b}wildlsearch{DIR/aux-var/0002.wild}}
419 a99b: ${lookup{a99b}wildlsearch{DIR/aux-var/0002.wild}}
421 # Should give the same results as above because expansion does nothing
423 abc: ${lookup{abc}nwildlsearch{DIR/aux-var/0002.wild}}
424 a.b.c: ${lookup{a.b.c}nwildlsearch{DIR/aux-var/0002.wild}}
425 ab.c: ${lookup{ab.c}nwildlsearch{DIR/aux-var/0002.wild}}
426 xyz: ${lookup{xyz}nwildlsearch{DIR/aux-var/0002.wild}}
427 Xyz: ${lookup{Xyz}nwildlsearch{DIR/aux-var/0002.wild}}
428 Zyz: ${lookup{Zyz}nwildlsearch{DIR/aux-var/0002.wild}}
429 a b: ${lookup{a b}nwildlsearch{DIR/aux-var/0002.wild}}
430 a b: ${lookup{a b}nwildlsearch{DIR/aux-var/0002.wild}}
431 a:b: ${lookup{a:b}nwildlsearch{DIR/aux-var/0002.wild}}
433 # Should fail because of no expansion
435 a.b: ${lookup{a.b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}}
436 a..b: ${lookup{a..b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}}
437 a9b: ${lookup{a9b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}}
438 a99b: ${lookup{a99b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}}
440 # But these should succeed
442 a\\:b: ${lookup{a\\:b}nwildlsearch{DIR/aux-var/0002.wild}}
443 a\\:Xb: ${lookup{a\\:Xb}nwildlsearch{DIR/aux-var/0002.wild}}
445 # Some tests of case-(in)dependence
447 MiXeD-CD: ${lookup{MiXeD-CD}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NOT FOUND}}
448 MixeD-CD: ${lookup{MixeD-CD}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NOT FOUND}}
449 MiXeD-Ncd: ${lookup{MiXeD-Ncd}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NOT FOUND}}
450 MixeD-Ncd: ${lookup{MixeD-Ncd}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NOT FOUND}}
452 # IP address (CIDR) lookups
454 1.2.3.4: ${lookup{1.2.3.4}iplsearch{DIR/aux-fixed/0002.iplsearch}}
455 1.2.3.5: ${lookup{1.2.3.5}iplsearch{DIR/aux-fixed/0002.iplsearch}}
456 1.2.3.5: ${lookup{1.2.3.5}iplsearch*{DIR/aux-fixed/0002.iplsearch}}
457 abcd::cdab: ${lookup{abcd::cdab}iplsearch{DIR/aux-fixed/0002.iplsearch}}
458 192.168.1.2: ${lookup{192.168.1.2}iplsearch{DIR/aux-fixed/0002.iplsearch}}
459 192.168.5.6: ${lookup{192.168.5.6}iplsearch{DIR/aux-fixed/0002.iplsearch}}
460 abcd:abcd:: ${lookup{abcd:abcd::}iplsearch{DIR/aux-fixed/0002.iplsearch}}
461 abcd:abcd:1:: ${lookup{abcd:abcd:1::}iplsearch{DIR/aux-fixed/0002.iplsearch}}
462 abcd:abcd::3 ${lookup{abcd:abcd::3}iplsearch{DIR/aux-fixed/0002.iplsearch}}
463 rhubarb ${lookup{rhubarb}iplsearch{DIR/aux-fixed/0002.iplsearch}}
466 # Nested Lookups - style 1
468 ${lookup{${lookup{key1}lsearch{DIR/aux-fixed/0002.rec}{$value}{key1f}}}lsearch{DIR/aux-fixed/0002.rec}{$value}fail}
469 ${lookup{${lookup{key3}lsearch{DIR/aux-fixed/0002.rec}{$value}{key1f}}}lsearch{DIR/aux-fixed/0002.rec}{$value}fail}
471 # Nested Lookups - style 2
473 ${lookup{key1}lsearch{DIR/aux-fixed/0002.rec}{${lookup{$value}lsearch{DIR/aux-fixed/0002.rec}{$value}{failed for $value}}}{failed for key1}}
474 ${lookup{key3}lsearch{DIR/aux-fixed/0002.rec}{${lookup{$value}lsearch{DIR/aux-fixed/0002.rec}{$value}{failed for $value}}}{failed for key1}}
476 # Other nesting tests
478 ${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}}}
479 ${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}}}
480 ${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}}}
481 ${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}}}
483 # Lookup quotes for standardly expected lookups
485 lsearch ${quote_lsearch: !@#\$%^&*()_-+=|\\~`1234567890\{[\}]qwertyuiop:;"'asdfghjkl<,>.?/zxcvbnm}
486 xxx ${quote_xxx: !@#\$%^&*()_-+=|\\~`1234567890\{[\}]qwertyuiop:;"'asdfghjkl<,>.?/zxcvbnm}
490 ${extract{B}{A=1 B=2 C=3}}
491 ${extract{ B }{A=1 B=2 C=3}{$value}{NOT FOUND}}
492 ${extract{2}{:}{1:2:3}}
493 ${extract{ 2 }{:}{1:2:3}{$value}{NOT FOUND}}
494 Empty:<${extract{D}{A=1 B=2 C=3}}>
495 Empty:<${extract{4}{:}{1:2:3}}>
496 ${extract{C}{A=1 B=2 C=3}{<$value>}}
497 ${extract{3}{:}{1:2:3}{<$value>}}
498 Empty:<${extract{Z}{A=1 B=2 C=3}{<$value>}}>
499 Empty:<${extract{4}{:}{1:2:3}{<$value>}}>
500 ${extract{Z}{A=1 B=2 C=3}{<$value>}{no Z}}
501 ${extract{4}{:}{1:2:3}{<$value>}{no 4}}
502 ${extract{Z}{A=1 B=2 C=3}{<$value>}fail}
503 ${extract{4}{:}{1:2:3}{<$value>}fail}
504 ${extract{K4}{${sg{1=A 4=D 3=C}{(\\d+)=}{K\$1=}}}}
505 ${extract{0}{:}{a:b:c:d:e}{$value}{FAIL}}
506 ${extract{1}{:}{a:b:c:d:e}{$value}{FAIL}}
507 ${extract{-1}{:}{a:b:c:d:e}{$value}{FAIL}}
508 ${extract{-5}{:}{a:b:c:d:e}{$value}{FAIL}}
509 ${extract{-6}{:}{a:b:c:d:e}{$value}{FAIL}}
510 ${extract{-3}{:,}{a,,b::c}}
511 ${extract{2}{:,}{a,,b::c}}
512 ${extract{3}{:,}{a,,b::c}}
513 ${extract{a-b}{X = "one two" a-b "three four" 5=99}}
516 ${extract{ 2 }{ }{a b c}}
520 abcdea aaa xyz ${tr{abcdea}{aaa}{xyz}}
521 abcdea a z ${tr{abcdea}{a}{z}}
522 abcdea a ${tr{abcdea}{a}{}}
523 abcdea abc z ${tr{abcdea}{abc}{z}}
528 <:abcd:> ${rfc2047:<:abcd:>}
529 <:ab cd:> ${rfc2047:<:ab cd:>}
530 Long: ${rfc2047: here we go: a string that is going to be encoded: it will go over the 75-char limit}
531 Long: ${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}
535 ${rfc2047d:abcd abcd}
536 ${rfc2047d:<:abcd:> =?iso-8859-8?Q?=3C=3Aabcd=3A=3E?=}
537 ${rfc2047d:<:ab cd:> =?iso-8859-8?Q?=3C=3Aab_cd=3A=3E?=}
538 ${rfc2047d:Long: =?iso-8859-8?Q?_here_we_go=3A_a_string_that_is_going_to_be_encoded=3A_i?= =?iso-8859-8?Q?t_will_go_over_the_75-char_limit?=}
539 ${rfc2047d:Long: =?iso-8859-8?Q?_here_we_go=3A_a_string_that_is_going_to_be_encoded=3A_i?= =?iso-8859-8?Q?t_will_go_over_the_75-char_limit_by_a_long_way=3B_in_fac?= =?iso-8859-8?Q?t_this_one_will_go_over_the_150_character_limit?=}
543 abcd ${from_utf8:abcd}
544 aÀÿd ${from_utf8:aÃ
\80ÿd}
545 toobig ${from_utf8:aĀd}
549 \${sg{abcdefabcdef}{abc}{xyz}} =${sg{abcdefabcdef}{abc}{xyz}}
550 \${sg{ab:xy::z}{:}{::}} =${sg{ab:xy::z}{:}{::}}
551 \${sg{abcdefabcdef}{(..)[^c]}{>\$1<}} =${sg{abcdefabcdef}{(..)[^c]}{>$1<}}
552 \${sg{abcdefabcdef}{(..)[^c]}{>\\\$1<}} =${sg{abcdefabcdef}{(..)[^c]}{>\$1<}}
553 \${sg{abcdefabcdef}{(..)[^c]}{>\\N\$1\\N<}}=${sg{abcdefabcdef}{(..)[^c]}{>\N$1\N<}}
554 \${sg{abbab}{a*}{+}} =${sg{abbab}{a*}{+}}
559 ${readfile{DIR/aux-fixed/0002.readfile}}
560 ${readfile{DIR/aux-fixed/0002.readfile}{}}
561 ${readfile{DIR/aux-fixed/0002.readfile}{:}}
562 ${readfile{DIR/aux-fixed/0002.readfile}{ - }}
563 ${readfile{/non/exist/file}}
564 ${if exists{/non/exist/file}{${readfile{/non/exist/file}}}{non-exist}}
565 >${readfile{DIR/aux-fixed/0002.readfile}{!}}\
570 ${run{DIR/aux-fixed/0002.runfile 0}}
572 ${run{DIR/aux-fixed/0002.runfile 0}{1}{2}}
574 ${run{DIR/aux-fixed/0002.runfile 0}{$value}{2}}
576 ${run{DIR/aux-fixed/0002.runfile 1}{$value}{2}}
578 ${run{DIR/aux-fixed/0002.runfile 1}{$value}{$value}}
580 ${run{DIR/test-nonexist}{Y}{N}}
582 >>${run{DIR/bin/iefbr14}}<<
584 ${if eq{1}{2}{${run{/non/exist}}}{1!=2}}
589 ${prvs{userx@test.ex}{secret}}
590 ${prvs{userx@test.ex}{secret}{1}}
591 ${prvs{userx@test.ex}{secret}{8}}
595 ${prvs{userx@test.ex}{secret}{12}}
596 ${prvs{userx@test.ex}{secret}{rhubarb}}
597 ${prvs{userx@test.ex}{secret}{}}
599 # Correct checks; can't put explicit addresses in the tests, because they
600 # will change over time.
602 ${prvscheck{${prvs{userx@test.ex}{secret}}}{secret}}
603 result=$prvscheck_result
605 ${prvscheck{${prvs{userx@test.ex}{secret}{1}}}{secret}\
606 {>$prvscheck_result< >$prvscheck_address< >$prvscheck_keynum<}}
607 result=$prvscheck_result
609 ${prvscheck{${prvs{userx@test.ex}{secret}{8}}}{secret}{}}
610 result=$prvscheck_result
614 ${prvscheck{${prvs{userx@test.ex}{secret}}}{socrot}}
615 result=$prvscheck_result
617 ${prvscheck{${prvs{userx@test.ex}{secret}}}{socrot}{$prvscheck_keynum}}
618 result=$prvscheck_result
622 >>${prvscheck{userx@test.ex}{secret}}<<
623 result=$prvscheck_result
630 ${expand:abcd${tod_log}
632 ${if and {xyz}{a}{b}}
633 ${if and {{xya}}{a}{b}}
634 ${if and {{${lookup{x}lsearch{/a/b}}}}{a}{b}}
635 ${if eq {$h_xyz}{1}{y}{n}}
636 ${if eq {$h_xyz:}{1}{y}{n}
637 ${if def:h_xyz}{y}{n}}
638 ${if or {eq {}{}{yes}{no}}
639 ${if or {{eq {}{}{yes}{no}}
640 ${if or {{eq {}{}}{yes}{no}}
644 # Iterations: forany and forall
646 ${if forany{a:b:c}{eq{$item}{a}}{yes}{no}}
647 ${if forany{a:b:c}{eq{$item}{b}}{yes}{no}}
648 ${if forany{a:b:c}{eq{$item}{c}}{yes}{no}}
649 ${if forany {a:b:c} {eq {$item} {z}} {yes} {no}}
650 ${if !forany{a:b:c}{eq{$item}{z}}{yes}{no}}
651 ${if !forany{a:b:c}{eq{$item}{a}}{yes}{no}}
652 ${if forany{}{eq{$item}{a}}{yes}{no}}
653 ${if !forany{}{eq{$item}{a}}{yes}{no}}
654 ${if forany{<, $primary_hostname,foo,bar}{eq{$item}{$primary_hostname}}{yes}{no}}
656 ${if forany{}{yes}{no}}
657 ${if forany{a:b:c}{gt{$item}{a}{yes}{no}}
659 ${if forall{a:b:c}{match{$item}{^[a-c]\$}}{yes}{no}}
660 ${if forall{q:b:c}{match{$item}{^[a-c]\$}}{yes}{no}}
661 ${if forall{a:b:z}{match{$item}{^[a-c]\$}}{yes}{no}}
662 ${if forall{}{match{$item}{^[a-c]\$}}{yes}{no}}
664 ${if !forall{a:b:c}{match{$item}{^[a-c]\$}}{yes}{no}}
665 ${if !forall{q:b:c}{match{$item}{^[a-c]\$}}{yes}{no}}
666 ${if !forall{a:b:z}{match{$item}{^[a-c]\$}}{yes}{no}}
667 ${if !forall{}{match{$item}{^[a-c]\$}}{yes}{no}}
673 {$item: ${if forall{x:y:z}{match{$item}{^[x-z]\$}}{true}{false}}}\
676 {outer=yes}{outer=no}} item='$item' (unset)
682 {$item: ${if !forall{x:y:z}{match{$item}{^[x-z]\$}}{true}{false}}}\
685 {outer=yes}{outer=no}}
687 # Error inside nest - check message is helpful
691 {$item: ${if forall{x:y:z}{match{$item}{^[x-z]\$}{true}{false}}}\
694 {outer=yes}{outer=no}}
697 # Miscellaneous (for bug fixes, etc)
699 ${if ={1}{1} {true}{${if ={1}{1} {true}{${if ={1}{1}{true}fail}}}}}
702 # Test "escape" with print_topbitchars
703 exim -be -DPTBC=print_topbitchars
704 escape: ${escape:B7·F2ò}
706 # Checkout expansion debugging
707 exim -d-all+expand -be
708 primary_hostname: $primary_hostname
709 match: ${if match{abcd}{\N^([ab]+)(\w+)$\N}{$2$1}fail}
710 match: ${if match{wxyz}{\N^([ab]+)(\w+)$\N}{$2$1}fail}
711 ${if eq {1}{1}{yes}{${lookup{xx}lsearch{/non/exist}}}}
712 match_address: ${if match_address{a.b.c}{a.b.c}{yes}{no}}
714 # Sender host name and address etc, all unset
716 -oMa sender_host_address = $sender_host_address
717 sender_host_port = $sender_host_port
718 -oMaa sender_host_authenticated = $sender_host_authenticated
719 -oMai authenticated_id = $authenticated_id
720 -oMas authenticated_sender = $authenticated_sender
721 -oMi interface_address = $interface_address
722 interface_port = $interface_port
723 -oMr received_protocol = $received_protocol
724 -oMs sender_host_name = $sender_host_name
725 -oMt sender_ident = $sender_ident
727 # Sender host name and address etc, all set except host name.
728 exim -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
729 -oMa sender_host_address = $sender_host_address
730 sender_host_port = $sender_host_port
731 -oMaa sender_host_authenticated = $sender_host_authenticated
732 -oMai authenticated_id = $authenticated_id
733 -oMas authenticated_sender = $authenticated_sender
734 -oMi interface_address = $interface_address
735 interface_port = $interface_port
736 -oMr received_protocol = $received_protocol
737 -oMt sender_ident = $sender_ident
739 # Sender host name explicitly set
740 exim -be -oMa V4NET.0.0.1.1234 -oMs my.host.name
741 -oMa sender_host_address = $sender_host_address
742 sender_host_port = $sender_host_port
743 -oMs sender_host_name = $sender_host_name
745 # Sender host name lookup fails (V4NET.11.12.13 is not reverse registered)
746 exim -be -oMa V4NET.11.12.13
747 -oMs sender_host_name = $sender_host_name
748 host_lookup_failed = $host_lookup_failed
750 # Sender host name and protocol set by Sendmail-compatible option
751 exim -be -pspecial:host.name
752 -p received_protocol = $received_protocol
753 -p sender_host_name = $sender_host_name
755 # Sender host name and address etc, all set except host name,
756 # which should therefore be looked up from the address, but not if
757 # we are skipping. The debug output for this test will show when
759 exim -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
760 -oMa sender_host_address = $sender_host_address
761 sender_host_port = $sender_host_port
762 -oMaa sender_host_authenticated = $sender_host_authenticated
763 -oMai authenticated_id = $authenticated_id
764 -oMas authenticated_sender = $authenticated_sender
765 -oMi interface_address = $interface_address
766 interface_port = $interface_port
767 -oMr received_protocol = $received_protocol
768 ----> No lookup yet: ${if eq{black}{white}{$sender_host_name}{No}}
769 -oMs sender_host_name = $sender_host_name
770 -oMt sender_ident = $sender_ident
772 # Test no auto host name lookup for query-style lookups
773 exim -d -bh V4NET.0.0.1
775 exim -d -bh V4NET.0.0.2
777 # Test $reply_address
807 # Check RFC 2047 decoding with (default) length check
812 Subject: =?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?=
816 # Check RFC 2047 decoding with length check disabled
817 exim -DLENCHECK=check_rfc2047_length=false -bh V4NET.0.0.0
821 Subject: =?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?=
825 # Certain kind of error
827 match_ip: 15 ${if match_ip{1.2.3.4}{1.2.3}}
828 match_ip: 16 ${if match_ip{1.2.3.4}{1.2.3.4/abc}}