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.
11 # These expansions can test variables in the configuration, but as there
12 # is no message being processed, there is no message-related data. But
13 # that of course gets tested in plenty of other places.
15 # Some fixed variables
18 exim_version: $exim_version
19 config_dir: $config_dir
20 config_file: $config_file
21 primary_hostname: $primary_hostname
22 primary_hostname: ${primary_hostname}
23 qualify_domain: $qualify_domain
24 bounce_return_size_limit: ${bounce_return_size_limit}
25 spool_directory: $spool_directory
26 queue_name: $queue_name
28 h_subject: $h_subject:(should be empty)
29 h_subject:$h_subject (should be empty)
30 header in curlies: ${header_subject:} (should fail)
32 # \$message_headers should be empty
33 message_headers: >$message_headers<
41 # Overlong names and overbig numbers
43 +$aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
44 +${aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
45 +$11111111111111111111111111111111111
46 +${11111111111111111111111111111111111}
50 filter: "${filter{a:b:c}{eq{1}{1}}}"
51 filter: ${filter{a:b:c}{!eq{$item}{b}}}
52 filter: ${filter{<' a'b'c}{!eq{$item}{b}}}
53 filter: ${filter{<' ''a'b' ''c}{!eq{$item}{b}}}
54 filter: "${filter{}{!eq{$item}{b}}}"
56 map: "${map{}{$item}}"
57 map: ${map{a:b:c}{$item}}
58 map: ${map{a:b:c}{:$item:}}
59 map: ${if eq{1}{0}{${map{a:b:c}{:$item:}}}{fail string}}
60 map: ${map{:b:c}{[$item]}}
62 reduce: "${reduce{}{+}{$value$item}}"
63 reduce: ${reduce{a:b:c}{+}{$value$item}}
64 reduce: ${reduce {<, 1,2,3}{0}{${eval:$value+$item}}}
65 reduce: ${reduce {3:0:9:4:6}{0}{${if >{$item}{$value}{$item}{$value}}}}
66 # Check for extract corrupting reduce's $value
67 reduce: ${reduce {b}{a aaa}{${extract{1}{ }{$value}} , $item}}
69 listnamed: ${listnamed:dlist}
70 listnamed: ${listnamed:+dlist}
71 listnamed: ${listnamed:hlist}
72 listnamed: ${listnamed:elist}
73 listnamed: ${listnamed:flist}
74 listnamed: ${listnamed:nolist}
75 listnamed: ${listnamed_d:dlist}
76 listnamed: ${listnamed_d:hlist}
77 listnamed: ${listnamed_z:dlist}
79 listcount: ${listcount:a:b:c}
80 listcount: ${listcount:}
81 listcount: ${listcount:<;a;b;c}
82 listcount: ${listcount:${listnamed:dlist}}
84 listextract: ${listextract{ 2}{a:b:c:d}}
85 listextract: ${listextract{-2}{<,a,b,c,d}{X${value}X}}
86 listextract: ${listextract{ 5}{a:b:c:d}}
87 listextract: ${listextract{-5}{a:b:c:d}}
88 listextract: ${listextract{ 5}{a:b:c:d}{}{fail}}
89 listextract: ${listextract{ 5}{a:b:c:d}{}fail}
91 sort: ${sort{3:2:1:4}{<}{$item}}
92 sort: ${sort {<, 3,2,1,4}{>}{$item}}
93 sort: ${sort{c:B:a:aa}{lti}{$item}}
94 sort: ${sort{666 r99.ex.com:10 smtp.ex.com:100 r2.ex.com}{<}{${sg {$item}{([0-9]*).*\$}{\$1}}}}
95 sort: ${sort{666,r99.ex.com:10,smtp.ex.com:100,r2.ex.com}{<}{${listextract{1}{<,$item}}}}
96 sort: "${sort{}{<}{$item}}"
98 # Tests with iscntrl() and illegal separators
100 map: ${map{<\n a\n\nb\nc}{'$item'}}
102 reduce: ${reduce {<n 1\n2\n3}{0}{${eval:$value+$item}}}
103 reduce: ${reduce {<\n 1\n2\n3}{0}{${eval:$value+$item}}}
104 reduce: ${reduce { <\n 1\n 2 \n 3 }{0}{${eval:$value+$item}}}
105 reduce: ${reduce {<\x7f 1\x7f2\177 3}{0}{${eval:$value+$item}}}
111 acl: ${acl {a_nosuch}}
113 acl: ${acl {a_ret}{person@dom.ain}}
114 acl: ${acl {a_ret}{firstarg}{secondarg}}
115 acl: ${acl {a_ret}{arg with spaces}}
117 acl: ${acl {a_none}{person@dom.ain}}
119 acl: ${acl {a_deny}{person@dom.ain}}
120 acl: ${acl {a_defer}}
121 acl: ${acl {a_sub}{top_arg_1}{top_arg_2}{top_arg_3}}
122 acl: ${reduce {1:2:3:4} {} {$value ${acl {a_ret}{$item}}}}
124 addrss: ${address:local-part@dom.ain}
125 addrss: ${address:Exim Person <local-part@dom.ain> (that's me)}
126 addrss: ${address:Exim Person <local-part(comment)@dom.ain> (that's me)}
127 addrss: ${address:Exim Person <local-part@dom.ain(comment)> (that's me)}
128 addrss: ${address:Exim Person <local-part(comment)@dom.ain(comment2)> (that's me)}
129 addrss: ${address:Exim Person <local-part.(comment)dot-atom@dom.ain(comment2)> (that's me)}
130 addrss: ${address:Exim Person <(comment)local-part@dom.ain(comment2)> (that's me)}
131 domain: ${domain:local-part@dom.ain}
132 domain: ${domain:Exim Person <local-part@dom.ain> (that's me)}
133 domain: ${domain:Exim Person <local-part(foo)@(bar)dom.ain> (that's me)}
135 addresses: ${addresses:>' 'abc@xyz, 'pqr@xyz}
136 addresses: ${addresses:Exim Person <local-part@dom.ain> (that's me)}
137 addresses: ${addresses:>+ Exim Person <local-part@dom.ain> (that's me),\
139 addresses: ${addresses:Exim Person <local-part@dom.ain> (that's me), \
140 xyz@abc, nullgroupname:;, group: p@q, r@s; }
141 addresses: ${addresses:local-part@dom.ain <local-part@dom.ain>}
142 addresses: ${addresses:>}
144 escape: ${escape:B7·F2ò}
145 excape8bit: ${escape8bit:undisturbed text\ttab\nnewline\ttab\\backslash \176tilde\177DEL\200\x81.}
149 eval: ${eval:(1+2)*3}
155 eval: ${eval:-2 - -3}
156 eval: ${eval:-2 - (-3)}
157 eval: ${eval:-2 - (-3}
158 eval: ${eval:-2 - -3)}
161 eval: ${eval:-2 -+-3}
162 eval: ${eval:(2*(1+1))/2 + 40K}
165 eval10: ${eval10:077}
167 eval10: ${eval10:0x1234}
170 eval: ${eval:0xc & 5 }
174 eval: ${eval:0xc >> 2}
175 eval: ${eval:0xc >> 4 }
177 eval: ${eval:~255&0x1234}
178 eval: ${eval:~ 255&0x1234}
179 eval: ${eval: -(~255&0x1234)}
181 expand: \$primary_hostname ${expand:\$primary_hostname}
182 hash: ${hash_3:monty} ${hash_5:monty} ${hash_4_62:monty python}
183 hash: ${hash_3:abc}X ${hash_3:ab}X ${hash_3:a}X ${hash_3:}X
184 hex2b64:${hex2b64:12345678}
185 hex2b64:${hex2b64:abcdef}
186 hex2b64:${hex2b64:ABCDEF}
187 hex2b64:${hex2b64:1a2b3c4d5e6f}
188 hex2b64:${hex2b64:1a2b3c4d5e6}
189 hex2b64:${hex2b64:1a2b3c4d5e6g}
190 hex2b64:${hex2b64:${md5:the quick brown fox}}
191 hex2b64:${hex2b64:${sha1:the quick brown fox}}
193 base32: 0 <${base32:0}>
194 base32: 1 <${base32:1}>
195 base32: 31 <${base32:31}>
196 base32: 32 <${base32:32}>
197 base32: 42 <${base32:42}>
198 base32 error: 0x1 ${base32:0x1}
200 base32d: 0 ${base32d:${base32:0}}
201 base32d: 1 ${base32d:${base32:1}}
202 base32d: 31 ${base32d:${base32:31}}
203 base32d: 32 ${base32d:${base32:32}}
204 base32d: 42 ${base32d:${base32:42}}
205 base32d error: ABC ${base32d:ABC}
207 the base62 operator is actually a base36 operator in the Darwin and Cygwin
208 environments. Write cunning tests that produce the same output in both cases,
209 while doing a reasonable check.
212 {eq {${base62:12345}}{0003D7}}\
213 {eq {${base62:12345}}{0009IX}}\
216 {eq {${base62d:0003D7}}{12345}}\
217 {eq {${base62d:0009IX}}{12345}}\
220 {eq {${base62d:3D7}}{12345}}\
221 {eq {${base62d:9IX}}{12345}}\
223 base62 error: ${base62:12345x}
224 base62d error:${base62d:0003D7.}
226 hmac: ${hmac{md5}{somesecret}{mail.example.com 2002-10-17 11:30:59}}
227 hmac: ${hmac{sha1}{somesecret}{mail.example.com 2002-10-17 11:30:59}}
228 md5: ${md5:the quick brown fox jumps over the lazy dog}
231 mask: ${mask:192.168.10.206/28}
232 mask: ${mask:192.168.10.206/32}
233 mask: ${mask:192.168.10.206/33}
234 mask: ${mask:192.168.10.206/0}
235 mask: ${mask:192.168.10.206}
236 mask: ${mask:a.b.c.d}
237 ipv6denorm: ${ipv6denorm:::1}
238 ipv6denorm: ${ipv6denorm:fe00::1}
239 ipv6denorm: ${ipv6denorm:192.168.0.1}
240 ipv6denorm: ${ipv6denorm:fe80::192.168.0.1}
241 ipv6norm: ${ipv6norm:0:0:0::1}
242 ipv6norm: ${ipv6norm:2a00::0}
243 ipv6norm: ${ipv6norm:2a00::1}
244 ipv6norm: ${ipv6norm:2a00:eadf:0000:0000:0000:0000:0001:0000}
245 ipv6norm: ${ipv6norm:2a00:eadf:0000:0001:0000:0000:0000:0000}
246 ipv6norm: ${ipv6norm:2a00:0:0:0::}
247 ipv6norm: ${ipv6norm:2a00:2:3:4:5:6:7:8}
248 nhash: ${nhash_24:monty} ${nhash_8_63:monty python}
249 lc/uc: ${lc:The Quick} ${uc: Brown Fox}
250 length: ${length_10:The quick brown fox} ${l_10:abc}
251 lclpt: ${local_part:local-part@dom.ain}
252 lclpt: ${local_part:Exim Person <local-part@dom.ain> (that's me)}
253 lclpt: ${local_part:Exim Person <local(comment).part@dom.(comment2)ain> (that's me)}
254 quote: ${quote:aZ09_.-Q} ${quote:ab*cd} ${quote:ab\cd"ef}
255 quote: ${quote:nl(\n)}
256 quote: ${quote:cr(\r)}
257 quote: ${quote:tab(\t)}
258 quote: ${quote:xff(\xff)}
259 quote: Empty>${quote:}<
260 quote_local_part: ${quote_local_part:abcd}
261 quote_local_part: ${quote_local_part:O'Reilly}
262 quote_local_part: ${quote_local_part:a space}
263 quote_local_part: ${quote_local_part:.something}
264 quote_local_part: ${quote_local_part:something.}
265 quote_local_part: ${quote_local_part:joe.bloggs}
266 quote_local_part: ${quote_local_part:a!b}
267 quote_local_part: ${quote_local_part:x@y}
268 quote_local_part: ${quote_local_part:ab*cd}
269 quote_local_part: ${quote_local_part:x:y}
270 quote_local_part: ${quote_local_part:ab\cd"ef}
271 quote_local_part: ${quote_local_part:}
272 rxquote:${rxquote:aZ09_,-Q} ${rxquote:ab*cd} ${rxquote:ab\cd"ef}
273 hexquote: ${hexquote:\
274 \001\002\003\004\005\006\007 \010\011\012\013\014\015\016\017 \
275 \020\021\022\023\024\025\026\027 \030\031\032\033\034\035\036\037 \
276 \040\041\042\043\044\045\046\047 \050\051\052\053\054\055\056\057 \
277 \060\061\062\063\064\065\066\067 \070\071\072\073\074\075\076\077 \
278 \100\101\102\103\104\105\106\107 \110\111\112\113\114\115\116\117 \
279 \120\121\122\123\124\125\126\127 \130\131\132\133\134\135\136\137 \
280 \140\141\142\143\144\145\146\147 \150\151\152\153\154\155\156\157 \
281 \160\161\162\163\164\165\166\167 \170\171\172\173\174\175\176\177}
282 substr: ${substr_3_2:rhubarb} ${s_-5_2:1234567} ${s_-5_2:12} ${s_-3_2:12}
283 substr: ${s_3:rhubarb} ${s_-2:rhubarb}
285 substr: ${substr_10:abc}
286 str2b64:${str2b64:abcd}
287 str2b64:${str2b64:The quick brown \n fox}
288 base64: ${base64:abcd}
289 base64: ${base64:The quick brown \n fox}
290 base64d:${base64d:YWJjZA==}
291 base64d:${base64d:VGhlIHF1aWNrIGJyb3duIAogZm94}
294 strlen: ${strlen:abcdefgh}
295 time_eval: ${time_eval:10s}
296 time_eval: ${time_eval:2h}
297 time_eval: ${time_eval:1d5m}
298 time_eval: ${time_eval:1w2d3h4m5s}
299 time_eval: ${time_eval:14}
300 time_eval: ${time_eval:rhubarb}
301 time_interval: ${time_interval:0}
302 time_interval: ${time_interval:44}
303 time_interval: ${time_interval:999999}
304 time_interval: ${time_interval:-1}
305 time_interval: ${time_interval:rhubarb}
307 # stat is a bit tricky, but some of the fields of the aux-var directory
308 # should be the same on all systems
310 stat: ${extract{mode}{${stat:DIR/aux-var}}}
311 stat: ${extract{smode}{${stat:DIR/aux-var}}}
312 stat: ${stat:/a/non/existent/file}
314 # "Operators" that have expanded arguments
316 hash: ${hash{3}{monty}} ${hash{5}{monty}} ${hash{4}{62}{monty python}}
317 hash: ${hash{3}{abc}}X ${hash{3}{ab}}X ${hash{3}{a}}X ${hash{3}{}}X
318 nhash: ${nhash{24}{monty}} ${nhash{8}{63}{monty python}}
319 length: ${length{10}{The quick brown fox}} ${length{10}{abc}}
320 substr: ${substr{3}{2}{rhubarb}} ${substr{-5}{2}{1234567}} ${substr{-5}{2}{12}} ${substr{-3}{2}{12}}
321 substr: ${substr{${if eq{1}{1}{-8}}}{${if eq{1}{0}{25}{1}}}{abcde}}
326 ${hash{nonnumber}{abcd}}
327 ${hash{3}{2}{4}{abcd}}
328 ${substr{-3}{-2}{abcd}}
332 addrss: ${if eq {1}{2}{${address:invalid}}{NO}}
333 domain: ${if eq {1}{2}{${domain:invalid}}{NO}}
334 escape: ${if eq {1}{2}{${escape:invalid}}{NO}}
335 expand: ${if eq {1}{2}{\$primary_hostname ${expand:\$invalid}}{NO}}
336 hash: ${if eq {1}{2}{${hash_3:invalid}}{NO}}
337 md5: ${if eq {1}{2}{${md5:invalid}}{NO}}
338 mask: ${if eq {1}{2}{${mask:invalid}}{NO}}
340 # Number suffixes in conditions
341 1k: ${if >{1}{1k}{n}{y}}
342 1K: ${if >{1}{1K}{n}{y}}
343 1M: ${if >{1}{1M}{n}{y}}
344 1G: ${if >{1}{1G}{n}{y}}
347 # >32b should work, >64b not
349 1 > 2047M ${if >{1}{2047M}{y}{n}}
350 1 > 2048M ${if >{1}{2048M}{y}{n}}
351 1 > 4096000000 ${if >{1}{4096000000}{y}{n}}
352 1 > 4096M ${if >{1}{4096M}{y}{n}}
353 1 > 4611686018427387904 ${if >{1}{4611686018427387904} {y}{n}}
354 1 > 46116860184273879040 ${if >{1}{46116860184273879040}{y}{n}}
358 2=2: ${if ={2}{2}{y}{n}}
359 2==2: ${if =={2}{2}{y}{n}}
360 3=2: ${if ={3}{2}{y}{n}}
361 2==3: ${if =={2}{3}{y}{n}}
362 !2=2: ${if !={2}{2}{y}{n}}
363 !2==2: ${if !=={2}{2}{y}{n}}
364 !3=2: ${if !={3}{2}{y}{n}}
365 !2==3: ${if !=={2}{3}{y}{n}}
366 2>3: ${if >{2}{3}{y}{n}}
367 3>3: ${if >{3}{3}{y}{n}}
368 4>3: ${if >{4}{3}{y}{n}}
369 1>-1: ${if >{1}{-1}{y}{n}}
370 2>=3: ${if >={2}{3}{y}{n}}
371 3>=3: ${if >={3}{3}{y}{n}}
372 4>=3: ${if >={4}{3}{y}{n}}
373 2<3: ${if <{2}{3}{y}{n}}
374 3<3: ${if <{3}{3}{y}{n}}
375 4<3: ${if <{4}{3}{y}{n}}
376 2<=3: ${if <={2}{3}{y}{n}}
377 3<=3: ${if <={3}{3}{y}{n}}
378 4<=3: ${if <={4}{3}{y}{n}}
379 5<=3: ${if <={ 5 } { 3 } {y}{n}}
380 -3<=1: ${if <={-3}{1}{y}{n}}
382 5>3k: ${if >{5 } {3k }{y}{n}}
383 5>3m: ${if >{5 } {3m }{y}{n}}
384 5>3z: ${if >{5 } {3z }{y}{n}}
385 5>a: ${if >{ 5 } {a}{y}{n}}
386 5>bad: ${if >{5 } {${lookup{trick}lsearch{DIR/aux-fixed/0002.lsearch}}} {y}{n}}
388 >0: ${if > {}{0}{y}{n}}
389 =: ${if = {}{}{y}{n}}
390 -2<: ${if < {-2}{}{y}{n}}
391 08>07: ${if > {08}{07}{y}{n}}
392 011=11: ${if = {011}{11}{y}{n}}
394 def:y ${if def:tod_log{y}{n}}
395 def:n ${if def:host{y}{n}}
396 def:f ${if def:post{y}{n}}
397 def:h_f ${if def:h_xxx {y}{n}}
398 def:h_f ${if def:h_xxx:{y}{n}}
399 def:d: ${if def:tod_log:{y}{n}}
401 exists: ${if exists{/etc/passwd}{y}{n}}
402 exists: ${if exists{/doesnt}{y}{n}}
404 eq: ${if eq{abc}{abc}{y}{n}}
405 eq: ${if eq{abc}{xyz}{y}{n}}
406 !eq: ${if !eq{abc}{abc}{y}{n}}
407 !eq: ${if !eq{abc}{xyz}{y}{n}}
409 eqi: ${if eqi{abc}{abc}{y}{n}}
410 eqi: ${if eqi{abc}{ABC}{y}{n}}
411 eqi: ${if eqi{abc}{xyz}{y}{n}}
412 !eqi: ${if !eqi{abc}{abc}{y}{n}}
413 !eqi: ${if !eqi{abc}{aBc}{y}{n}}
414 !eqi: ${if !eqi{abc}{xyz}{y}{n}}
416 lt: ${if lt{ABC}{abc}{y}{n}}
417 lti: ${if lti{ABC}{abc}{y}{n}}
418 le: ${if le{ABC}{abc}{y}{n}}
419 lei: ${if lei{ABC}{abc}{y}{n}}
420 gt: ${if gt{ABC}{abc}{y}{n}}
421 gti: ${if gti{ABC}{abc}{y}{n}}
422 ge: ${if ge{ABC}{abc}{y}{n}}
423 gei: ${if gei{ABC}{abc}{y}{n}}
425 isip: ${if isip {1.2.3.4}{y}{n}} 1.2.3.4
426 isip4: ${if isip4{1.2.3.4}{y}{n}} 1.2.3.4
427 isip6: ${if isip6{1.2.3.4}{y}{n}} 1.2.3.4
428 isip: ${if isip {::1.2.3.256}{y}{n}} ::1.2.3.256
429 isip4: ${if isip4{1.2.3.256}{y}{n}} 1.2.3.256
430 isip: ${if isip {1:2:3:4}{y}{n}} 1:2:3:4
431 isip4: ${if isip4{1:2:3:4}{y}{n}} 1:2:3:4
432 isip6: ${if isip6{1:2:3:4}{y}{n}} 1:2:3:4
433 isip: ${if isip {::1}{y}{n}} ::1
434 isip4: ${if isip4{::1}{y}{n}} ::1
435 isip6: ${if isip6{::1}{y}{n}} ::1
436 isip: ${if isip {fe80::a00:20ff:fe86:a061}{y}{n}} fe80::a00:20ff:fe86:a061
437 isip4: ${if isip4{fe80::a00:20ff:fe86:a061}{y}{n}} fe80::a00:20ff:fe86:a061
438 isip6: ${if isip6{fe80::a00:20ff:fe86:a061}{y}{n}} fe80::a00:20ff:fe86:a061
439 isip: ${if isip {fe80::1.2.3.4}{y}{n}} fe80::1.2.3.4
440 isip: ${if isip {rhubarb}{y}{n}} rhubarb
441 isip4: ${if isip4{rhubarb}{y}{n}} rhubarb
442 isip6: ${if isip6{rhubarb}{y}{n}} rhubarb
444 match: ${if match{abcd}{\N^([ab]+)(\w+)$\N}{$2$1}fail}
445 match: ${if match{abcd}{^\N([ab]+)(\w+)$\N}{$2$1}fail}
446 match: ${if match{abcd}{^([ab]+)(\\w+)\$}{$2$1}fail}
447 match: ${if match{wxyz}{^([ab]+)(\\w+)\$}{$2$1}fail}
448 match: ${if match{abcd}{^([ab]+)(\\w+)\$}{$2[${if match{xyz}{(.*)}{$1}fail}]$1}fail}
450 match_domain: ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
451 match_domain: ${if match_domain{a.b.c}{x.y.z:p.q.r}{yes}{no}}
452 match_domain: ${if match_domain{5.aa.bb}{+dlist}{yes}{no}}
453 match_domain: ${if match_domain{xxxyz}{+dlist}{yes}{no}}
454 match_domain: ${if match_domain{xyz}{+dlist}{yes}{no}}
456 ${if match{x@zz.aa.bb}{^(.*)} \
459 ${if match_domain{${domain:$1}}{+dlist}{[$1]}} \
464 ${if match{x@xxxabc}{^(.*)} \
467 ${if match_domain{${domain:$1}}{^\Nxxx(.*)\N}{[$1]}} \
472 match_address: ${if match_address{x@y.z}{p@q:*@y.z}{yes}{no}}
473 match_address: ${if match_address{x@y.z}{p@q:x@*.z}{yes}{no}}
475 match_local_part:${if match_local_part{jo}{jack:jill:jo:john}{yes}{no}}
476 match_local_part:${if match_local_part{jo}{\N^\w\N}{yes}{no}}
478 match_ip: 01 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.4}}
479 match_ip: 02 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6}}
480 match_ip: 03 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6/24}}
481 match_ip: 04 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6:*}}
482 match_ip: 05 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6:name}}
483 match_ip: 06 ${if match_ip{1.2.3.4}{:4.5.6.7}}
484 match_ip: 07 ${if match_ip{}{:4.5.6.7}}
485 match_ip: 08 ${if match_ip{V4NET.11.12.13}{+hlist}}
486 match_ip: 09 ${if match_ip{V4NET.11.12.14}{+hlist}}
487 match_ip: 10 ${if match_ip{192.168.3.4}{+hlist}}
488 match_ip: 11 ${if match_ip{somename}{+hlist}}
489 match_ip: 12 ${if match_ip{1.2.3.4}{lsearch;DIR/aux-fixed/0002.matchip}}
490 match_ip: 13 ${if match_ip{1.2.3.4}{net-lsearch;DIR/aux-fixed/0002.matchip}}
491 match_ip: 14 ${if match_ip{5.6.7.8}{net24-lsearch;DIR/aux-fixed/0002.matchip}}
492 match_ip: 15 ${if match_ip{abcd::dcba}{net-iplsearch;DIR/aux-fixed/0002.matchip}}
494 queue_running: ${if queue_running{y}{n}}
495 first_delivery: ${if first_delivery{y}{n}}
497 queue_running after or: ${if or{{eq {0}{0}}{queue_running}}{y}{n}}
498 first_delivery after or: ${if or{{eq {0}{0}}{first_delivery}}{y}{n}}
500 # acl expansion condition
501 acl if: ${if acl {{a_ret}} {Y:$value}{N:$value}}
502 acl if: ${if acl {{a_ret}{argY}} {Y:$value}{N:$value}}
503 acl if: ${if acl {{a_deny}{argN}{arg2}} {Y:$value}{N:$value}}
504 acl if: ${if acl {{a_defer}{argN}{arg2}} {Y:$value}{N:$value}}
506 # Default values for both if strings
508 \${if eq{1}{1}} >${if eq{1}{1}}<
509 \${if eq{1}{2}} >${if eq{1}{2}}<
511 # Lookups: DIR is the testing directory. In this test we can only use the
512 # lookups that are required in all cases.
514 ${lookup{postmaster}lsearch{DIR/aux-fixed/0002.aliases}{$value}fail}
516 ${lookup{x@y}lsearch*@{DIR/aux-fixed/0002.starat}{$value}fail}
517 ${lookup{x@z}lsearch*{DIR/aux-fixed/0002.starat}{$value}fail}
518 ${lookup{x@z}lsearch*@{DIR/aux-fixed/0002.starat}{$value}fail}
519 ${lookup{x@w}lsearch*@{DIR/aux-fixed/0002.starat}{$value}fail}
521 ${lookup{a.b.c.d}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
522 ${lookup{x.y.z}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}{failed x.y.z}}
523 ${lookup{p.q}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
524 ${lookup{o.p.q}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
525 ${lookup{m.n.o.p.q}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
526 ${lookup{x.y.z}partial1-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
527 ${lookup{x.y.z}partial0-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
529 q1: ${lookup{abc}lsearch{DIR/aux-fixed/0002.quoted}}
530 q2: ${lookup{xyz}lsearch{DIR/aux-fixed/0002.quoted}}
531 q3: ${lookup{pqr}lsearch{DIR/aux-fixed/0002.quoted}}
532 q4: ${lookup{a:b}lsearch{DIR/aux-fixed/0002.quoted}}
533 q5: ${lookup{"quoted"}lsearch{DIR/aux-fixed/0002.quoted}}
534 q6: ${lookup{white space}lsearch{DIR/aux-fixed/0002.quoted}}
535 q7: ${lookup{b\\s}lsearch{DIR/aux-fixed/0002.quoted}}
537 abc: ${lookup{abc}wildlsearch{DIR/aux-var/0002.wild}}
538 a.b.c: ${lookup{a.b.c}wildlsearch{DIR/aux-var/0002.wild}}
539 ab.c: ${lookup{ab.c}wildlsearch{DIR/aux-var/0002.wild}}
540 xyz: ${lookup{xyz}wildlsearch{DIR/aux-var/0002.wild}}
541 .Xyz: ${lookup{Xyz}wildlsearch{DIR/aux-var/0002.wild}}
542 .Zyz: ${lookup{Zyz}wildlsearch{DIR/aux-var/0002.wild}}
543 a b: ${lookup{a b}wildlsearch{DIR/aux-var/0002.wild}}
544 a b: ${lookup{a b}wildlsearch{DIR/aux-var/0002.wild}}
545 a:b: ${lookup{a:b}wildlsearch{DIR/aux-var/0002.wild}}
546 a.b: ${lookup{a.b}wildlsearch{DIR/aux-var/0002.wild}}
547 a..b: ${lookup{a..b}wildlsearch{DIR/aux-var/0002.wild}}
548 a9b: ${lookup{a9b}wildlsearch{DIR/aux-var/0002.wild}}
549 a99b: ${lookup{a99b}wildlsearch{DIR/aux-var/0002.wild}}
551 # Should give the same results as above because expansion does nothing
553 abc: ${lookup{abc}nwildlsearch{DIR/aux-var/0002.wild}}
554 a.b.c: ${lookup{a.b.c}nwildlsearch{DIR/aux-var/0002.wild}}
555 ab.c: ${lookup{ab.c}nwildlsearch{DIR/aux-var/0002.wild}}
556 xyz: ${lookup{xyz}nwildlsearch{DIR/aux-var/0002.wild}}
557 .Xyz: ${lookup{Xyz}nwildlsearch{DIR/aux-var/0002.wild}}
558 .Zyz: ${lookup{Zyz}nwildlsearch{DIR/aux-var/0002.wild}}
559 a b: ${lookup{a b}nwildlsearch{DIR/aux-var/0002.wild}}
560 a b: ${lookup{a b}nwildlsearch{DIR/aux-var/0002.wild}}
561 a:b: ${lookup{a:b}nwildlsearch{DIR/aux-var/0002.wild}}
563 # Should fail because of no expansion
565 a.b: ${lookup{a.b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}}
566 a..b: ${lookup{a..b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}}
567 a9b: ${lookup{a9b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}}
568 a99b: ${lookup{a99b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}}
570 # But these should succeed
572 a\\:b: ${lookup{a\\:b}nwildlsearch{DIR/aux-var/0002.wild}}
573 a\\:Xb: ${lookup{a\\:Xb}nwildlsearch{DIR/aux-var/0002.wild}}
575 # Some tests of case-(in)dependence
577 .MiXeD-CD: ${lookup{MiXeD-CD}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NOT FOUND}}
578 .MixeD-CD: ${lookup{MixeD-CD}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NOT FOUND}}
579 .MiXeD-Ncd: ${lookup{MiXeD-Ncd}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NOT FOUND}}
580 .MixeD-Ncd: ${lookup{MixeD-Ncd}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NOT FOUND}}
582 # IP address (CIDR) lookups
584 1.2.3.4: ${lookup{1.2.3.4}iplsearch{DIR/aux-fixed/0002.iplsearch}}
585 1.2.3.5: ${lookup{1.2.3.5}iplsearch{DIR/aux-fixed/0002.iplsearch}}
586 1.2.3.5: ${lookup{1.2.3.5}iplsearch*{DIR/aux-fixed/0002.iplsearch}}
587 abcd::cdab: ${lookup{abcd::cdab}iplsearch{DIR/aux-fixed/0002.iplsearch}}
588 192.168.1.2: ${lookup{192.168.1.2}iplsearch{DIR/aux-fixed/0002.iplsearch}}
589 192.168.5.6: ${lookup{192.168.5.6}iplsearch{DIR/aux-fixed/0002.iplsearch}}
590 abcd:abcd:: ${lookup{abcd:abcd::}iplsearch{DIR/aux-fixed/0002.iplsearch}}
591 abcd:abcd:1:: ${lookup{abcd:abcd:1::}iplsearch{DIR/aux-fixed/0002.iplsearch}}
592 abcd:abcd::3 ${lookup{abcd:abcd::3}iplsearch{DIR/aux-fixed/0002.iplsearch}}
593 rhubarb ${lookup{rhubarb}iplsearch{DIR/aux-fixed/0002.iplsearch}}
596 # Nested Lookups - style 1
598 ${lookup{${lookup{key1}lsearch{DIR/aux-fixed/0002.rec}{$value}{key1f}}}lsearch{DIR/aux-fixed/0002.rec}{$value}fail}
599 ${lookup{${lookup{key3}lsearch{DIR/aux-fixed/0002.rec}{$value}{key1f}}}lsearch{DIR/aux-fixed/0002.rec}{$value}fail}
601 # Nested Lookups - style 2
603 ${lookup{key1}lsearch{DIR/aux-fixed/0002.rec}{${lookup{$value}lsearch{DIR/aux-fixed/0002.rec}{$value}{failed for $value}}}{failed for key1}}
604 ${lookup{key3}lsearch{DIR/aux-fixed/0002.rec}{${lookup{$value}lsearch{DIR/aux-fixed/0002.rec}{$value}{failed for $value}}}{failed for key1}}
606 # Other nesting tests
608 ${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}}}
609 ${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}}}
610 ${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}}}
611 ${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}}}
613 # Lookup quotes for standardly expected lookups
615 lsearch ${quote_lsearch: !@#\$%^&*()_-+=|\\~`1234567890\{[\}]qwertyuiop:;"'asdfghjkl<,>.?/zxcvbnm}
616 xxx ${quote_xxx: !@#\$%^&*()_-+=|\\~`1234567890\{[\}]qwertyuiop:;"'asdfghjkl<,>.?/zxcvbnm}
620 ${extract{B}{A=1 B=2 C=3}}
621 ${extract{ B }{A=1 B=2 C=3}{$value}{NOT FOUND}}
622 ${extract{2}{:}{1:2:3}}
623 ${extract{ 2 }{:}{1:2:3}{$value}{NOT FOUND}}
624 empty:<${extract{D}{A=1 B=2 C=3}}>
625 empty:<${extract{4}{:}{1:2:3}}>
626 ${extract{C}{A=1 B=2 C=3}{<$value>}}
627 ${extract{3}{:}{1:2:3}{<$value>}}
628 empty:<${extract{Z}{A=1 B=2 C=3}{<$value>}}>
629 empty:<${extract{4}{:}{1:2:3}{<$value>}}>
630 ${extract{Z}{A=1 B=2 C=3}{<$value>}{no Z}}
631 ${extract{4}{:}{1:2:3}{<$value>}{no 4}}
632 ${extract{Z}{A=1 B=2 C=3}{<$value>}fail}
633 ${extract{4}{:}{1:2:3}{<$value>}fail}
634 ${extract{K4}{${sg{1=A 4=D 3=C}{(\\d+)=}{K\$1=}}}}
635 ${extract{0}{:}{a:b:c:d:e}{$value}{FAIL}}
636 ${extract{1}{:}{a:b:c:d:e}{$value}{FAIL}}
637 ${extract{-1}{:}{a:b:c:d:e}{$value}{FAIL}}
638 ${extract{-5}{:}{a:b:c:d:e}{$value}{FAIL}}
639 ${extract{-6}{:}{a:b:c:d:e}{$value}{FAIL}}
640 ${extract{-3}{:,}{a,,b::c}}
641 ${extract{2}{:,}{a,,b::c}}
642 ${extract{3}{:,}{a,,b::c}}
643 ${extract{a-b}{X = "one two" a-b "three four" 5=99}}
646 ${extract{ 2 }{ }{a b c}}
648 ${map{a,1:b,2:c,3}{${extract{1}{,}{$item}{$value}{}}}}
649 ${map{a,1:b,2:c,3}{${extract{1}{,}{$item}{$value}{failcase}{bogus_argument}}}}
650 ${map{a,1:b,2:c,3}{${extract{1}{,}{$item}{$value}fail}}}
654 abcdea aaa xyz ${tr{abcdea}{aaa}{xyz}}
655 abcdea a z ${tr{abcdea}{a}{z}}
656 abcdea a ${tr{abcdea}{a}{}}
657 abcdea abc z ${tr{abcdea}{abc}{z}}
660 "TrUe" ${if bool{TrUe}{true}{false}} EXPECT: true
661 "FALSE" ${if bool{FALSE}{true}{false}} EXPECT: false
662 " yes" ${if bool{ yes}{true}{false}} EXPECT: true
663 " no" ${if bool{ no}{true}{false}} EXPECT: false
664 "yes " ${if bool{yes }{true}{false}} EXPECT: true
665 "-1" ${if bool{-1}{true}{false}} EXPECT: true
666 "0" ${if bool{0}{true}{false}} EXPECT: false
667 "1" ${if bool{1}{true}{false}} EXPECT: true
668 " 0 " ${if bool{ 0 }{true}{false}} EXPECT: false
669 " 1 " ${if bool{ 1 }{true}{false}} EXPECT: true
670 "1111111111111111111" ${if bool{1111111111111111111}{true}{false}} EXPECT: true
671 "9" ${if bool{9}{true}{false}} EXPECT: true
672 " " ${if bool{ }{true}{false}} EXPECT: false
673 "text" ${if bool{text}{true}{false}} EXPECT: error
674 " text" ${if bool{ text}{true}{false}} EXPECT: error
675 "-text" ${if bool{-text}{true}{false}} EXPECT: error
676 "text " ${if bool{text }{true}{false}} EXPECT: error
677 " text " ${if bool{ text }{true}{false}} EXPECT: error
678 "00" ${if bool{00}{true}{false}} EXPECT: false
679 "!true" ${if !bool{true}{true}{false}} EXPECT: false
680 "!false" ${if !bool{false}{true}{false}} EXPECT: true
682 "TrUe" ${if bool_lax{TrUe}{true}{false}} EXPECT: true
683 "FALSE" ${if bool_lax{FALSE}{true}{false}} EXPECT: false
684 " yes" ${if bool_lax{ yes}{true}{false}} EXPECT: true
685 " no" ${if bool_lax{ no}{true}{false}} EXPECT: false
686 "yes " ${if bool_lax{yes }{true}{false}} EXPECT: true
687 "-1" ${if bool_lax{-1}{true}{false}} EXPECT: true
688 "0" ${if bool_lax{0}{true}{false}} EXPECT: false
689 "1" ${if bool_lax{1}{true}{false}} EXPECT: true
690 " 0 " ${if bool_lax{ 0 }{true}{false}} EXPECT: false
691 " 1 " ${if bool_lax{ 1 }{true}{false}} EXPECT: true
692 "1111111111111111111" ${if bool_lax{1111111111111111111}{true}{false}} EXPECT: true
693 "9" ${if bool_lax{9}{true}{false}} EXPECT: true
694 " " ${if bool_lax{ }{true}{false}} EXPECT: false
695 "text" ${if bool_lax{text}{true}{false}} EXPECT: true
696 " text" ${if bool_lax{ text}{true}{false}} EXPECT: true
697 "text " ${if bool_lax{text }{true}{false}} EXPECT: true
698 " text " ${if bool_lax{ text }{true}{false}} EXPECT: true
699 "00" ${if bool_lax{00}{true}{false}} EXPECT: true
700 "!true" ${if !bool_lax{true}{true}{false}} EXPECT: false
701 "!false" ${if !bool_lax{false}{true}{false}} EXPECT: true
706 <:abcd:> ${rfc2047:<:abcd:>}
707 <:ab cd:> ${rfc2047:<:ab cd:>}
708 long: ${rfc2047: here we go: a string that is going to be encoded: it will go over the 75-char limit}
709 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}
713 ${rfc2047d:abcd abcd}
714 ${rfc2047d:<:abcd:> =?iso-8859-8?Q?=3C=3Aabcd=3A=3E?=}
715 ${rfc2047d:<:ab cd:> =?iso-8859-8?Q?=3C=3Aab_cd=3A=3E?=}
716 ${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?=}
717 ${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?=}
721 abcd ${from_utf8:abcd}
722 aÀÿd ${from_utf8:aÃ
\80ÿd}
723 toobig ${from_utf8:aĀd}
727 \${sg{abcdefabcdef}{abc}{xyz}} =${sg{abcdefabcdef}{abc}{xyz}}
728 \${sg{ab:xy::z}{:}{::}} =${sg{ab:xy::z}{:}{::}}
729 \${sg{abcdefabcdef}{(..)[^c]}{>\$1<}} =${sg{abcdefabcdef}{(..)[^c]}{>$1<}}
730 \${sg{abcdefabcdef}{(..)[^c]}{>\\\$1<}} =${sg{abcdefabcdef}{(..)[^c]}{>\$1<}}
731 \${sg{abcdefabcdef}{(..)[^c]}{>\\N\$1\\N<}}=${sg{abcdefabcdef}{(..)[^c]}{>\N$1\N<}}
732 \${sg{abbab}{a*}{+}} =${sg{abbab}{a*}{+}}
737 ${readfile{DIR/aux-fixed/0002.readfile}}
738 ${readfile{DIR/aux-fixed/0002.readfile}{}}
739 ${readfile{DIR/aux-fixed/0002.readfile}{:}}
740 ${readfile{DIR/aux-fixed/0002.readfile}{ - }}
741 ${readfile{/non/exist/file}}
742 ${if exists{/non/exist/file}{${readfile{/non/exist/file}}}{non-exist}}
743 >${readfile{DIR/aux-fixed/0002.readfile}{!}}\
748 ${run{DIR/aux-fixed/0002.runfile 0}}
750 ${run{DIR/aux-fixed/0002.runfile 0}{1}{2}}
752 ${run{DIR/aux-fixed/0002.runfile 0}{$value}{2}}
754 ${run{DIR/aux-fixed/0002.runfile 1}{$value}{2}}
756 ${run{DIR/aux-fixed/0002.runfile 1}{$value}{$value}}
758 ${run{DIR/test-nonexist}{Y}{N}}
760 >>${run{DIR/bin/iefbr14}}<<
762 ${if eq{1}{2}{${run{/non/exist}}}{1!=2}}
767 ${prvs{userx@test.ex}{secret}}
768 ${prvs{userx@test.ex}{secret}{1}}
769 ${prvs{userx@test.ex}{secret}{8}}
773 ${prvs{userx@test.ex}{secret}{12}}
774 ${prvs{userx@test.ex}{secret}{rhubarb}}
775 ${prvs{userx@test.ex}{secret}{}}
777 # Correct checks; can't put explicit addresses in the tests, because they
778 # will change over time.
780 ${prvscheck{${prvs{userx@test.ex}{secret}}}{secret}}
781 result=$prvscheck_result
783 ${prvscheck{${prvs{userx@test.ex}{secret}{1}}}{secret}\
784 {>$prvscheck_result< >$prvscheck_address< >$prvscheck_keynum<}}
785 result=$prvscheck_result
787 ${prvscheck{${prvs{userx@test.ex}{secret}{8}}}{secret}{}}
788 result=$prvscheck_result
792 ${prvscheck{${prvs{userx@test.ex}{secret}}}{socrot}}
793 result=$prvscheck_result
795 ${prvscheck{${prvs{userx@test.ex}{secret}}}{socrot}{$prvscheck_keynum}}
796 result=$prvscheck_result
800 >>${prvscheck{userx@test.ex}{secret}}<<
801 result=$prvscheck_result
808 ${expand:abcd${tod_log}
810 ${if and {xyz}{a}{b}}
811 ${if and {{xya}}{a}{b}}
812 ${if and {{${lookup{x}lsearch{/a/b}}}}{a}{b}}
813 ${if eq {$h_xyz}{1}{y}{n}}
814 ${if eq {$h_xyz:}{1}{y}{n}
815 ${if def:h_xyz}{y}{n}}
816 ${if or {eq {}{}{yes}{no}}
817 ${if or {{eq {}{}{yes}{no}}
818 ${if or {{eq {}{}}{yes}{no}}
822 # Iterations: forany and forall
824 ${if forany{a:b:c}{eq{$item}{a}}{yes}{no}}
825 ${if forany{a:b:c}{eq{$item}{b}}{yes}{no}}
826 ${if forany{a:b:c}{eq{$item}{c}}{yes}{no}}
827 ${if forany {a:b:c} {eq {$item} {z}} {yes} {no}}
828 ${if !forany{a:b:c}{eq{$item}{z}}{yes}{no}}
829 ${if !forany{a:b:c}{eq{$item}{a}}{yes}{no}}
830 ${if forany{}{eq{$item}{a}}{yes}{no}}
831 ${if !forany{}{eq{$item}{a}}{yes}{no}}
832 ${if forany{<, $primary_hostname,foo,bar}{eq{$item}{$primary_hostname}}{yes}{no}}
834 ${if forany{}{yes}{no}}
835 ${if forany{a:b:c}{gt{$item}{a}{yes}{no}}
837 ${if forall{a:b:c}{match{$item}{^[a-c]\$}}{yes}{no}}
838 ${if forall{q:b:c}{match{$item}{^[a-c]\$}}{yes}{no}}
839 ${if forall{a:b:z}{match{$item}{^[a-c]\$}}{yes}{no}}
840 ${if forall{}{match{$item}{^[a-c]\$}}{yes}{no}}
842 ${if !forall{a:b:c}{match{$item}{^[a-c]\$}}{yes}{no}}
843 ${if !forall{q:b:c}{match{$item}{^[a-c]\$}}{yes}{no}}
844 ${if !forall{a:b:z}{match{$item}{^[a-c]\$}}{yes}{no}}
845 ${if !forall{}{match{$item}{^[a-c]\$}}{yes}{no}}
851 {$item: ${if forall{x:y:z}{match{$item}{^[x-z]\$}}{true}{false}}}\
854 {outer=yes}{outer=no}} item='$item' (unset)
860 {$item: ${if !forall{x:y:z}{match{$item}{^[x-z]\$}}{true}{false}}}\
863 {outer=yes}{outer=no}}
865 # Error inside nest - check message is helpful
869 {$item: ${if forall{x:y:z}{match{$item}{^[x-z]\$}{true}{false}}}\
872 {outer=yes}{outer=no}}
875 # Miscellaneous (for bug fixes, etc)
877 ${if ={1}{1} {true}{${if ={1}{1} {true}{${if ={1}{1}{true}fail}}}}}
882 ${env {NO_SUCH_VARIABLE} {oops, success} {correct}}
886 ${extract json {Url} \
887 { \{ \"Url\": \"http://www.example.com/image/481989943\",\
893 ${extract json {Width} \
894 { \{ \"Url\": \"http://www.example.com/image/481989943\",\
900 ${extract json {2} {[116, 943, 234, 38793]} }
901 ${extract json {2} {${extract json{IDs} {\{"other":"foo", "IDs": [116, 943, 234]\} }}} }
903 ${extract json {2} {["red", "green", "blue", "black"]} }
904 ${extract jsons{2} {["red", "green", "blue", "black"]} }
905 <${extract jsons{5} {["red", "green", "blue", "black"]} }>
908 ${extract json {seconds} { \{"hours":0, "mins":0, "seconds":59\} }}
909 ${extract json {seconds} {${extract json {2} { ["irrelevant", \{"hours":0, "mins":0, "seconds":59\}] }}}}
911 ${extract json{IDs}{ \{"IDs": \{"1":116, "2":943, "3":234\}\} }}
912 expect: {"1":116, "2":943, "3":234}
914 ${extract json{IDs}{ \{"id": \{"a":101, "b":102\}, "IDs": \{"1":116, "2":943, "3":234\}\} }}
915 expect: {"1":116, "2":943, "3":234}
917 <${extract json{nonexistent}{ \{"id": \{"a":101, "b":102\}, "IDs": \{"1":116, "2":943, "3":234\}\} }}>
919 <${extract jsons{nonexistent}{ \{"id": \{"a":101, "b":102\}, "IDs": \{"1":116, "2":943, "3":234\}\} }}>
922 ${if forany_json {[1, 2, 3]}{={$item}{1}}{yes}{no}}
923 ${if forany_jsons{["A", "B", "C"]}{eq{$item}{B}}{yes}{no}}
926 # Test "escape" with print_topbitchars
927 exim -be -DPTBC=print_topbitchars
928 escape: ${escape:B7·F2ò}
930 # Checkout expansion debugging
931 exim -d-all+expand -be
932 primary_hostname: $primary_hostname
933 match: ${if match{abcd}{\N^([ab]+)(\w+)$\N}{$2$1}fail}
934 match: ${if match{wxyz}{\N^([ab]+)(\w+)$\N}{$2$1}fail}
935 ${if eq {1}{1}{yes}{${lookup{xx}lsearch{/non/exist}}}}
936 match_address: ${if match_address{a.b.c}{a.b.c}{yes}{no}}
938 exim -d-all+expand+noutf8 -be
939 primary_hostname: $primary_hostname
940 match: ${if match{abcd}{\N^([ab]+)(\w+)$\N}{$2$1}fail}
941 match: ${if match{wxyz}{\N^([ab]+)(\w+)$\N}{$2$1}fail}
942 ${if eq {1}{1}{yes}{${lookup{xx}lsearch{/non/exist}}}}
943 match_address: ${if match_address{a.b.c}{a.b.c}{yes}{no}}
945 # Sender host name and address etc, all unset
947 -be Sender host name and address etc, all unset
948 -oMa sender_host_address = $sender_host_address
949 sender_host_port = $sender_host_port
950 -oMaa sender_host_authenticated = $sender_host_authenticated
951 -oMai authenticated_id = $authenticated_id
952 -oMas authenticated_sender = $authenticated_sender
953 -oMi interface_address = $interface_address
954 interface_port = $interface_port
955 -oMr received_protocol = $received_protocol
956 -oMs sender_host_name = $sender_host_name
957 -oMt sender_ident = $sender_ident
959 # Sender host name and address etc, all set except host name.
960 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
961 -be Sender host name and address etc, all set except host name.
962 -oMa sender_host_address = $sender_host_address
963 sender_host_port = $sender_host_port
964 -oMaa sender_host_authenticated = $sender_host_authenticated
965 -oMai authenticated_id = $authenticated_id
966 -oMas authenticated_sender = $authenticated_sender
967 -oMi interface_address = $interface_address
968 interface_port = $interface_port
969 -oMr received_protocol = $received_protocol
970 -oMt sender_ident = $sender_ident
972 # Sender host name explicitly set
973 exim -be -oMa V4NET.0.0.1.1234 -oMs my.host.name
974 -be Sender host name explicitly set
975 -oMa sender_host_address = $sender_host_address
976 sender_host_port = $sender_host_port
977 -oMs sender_host_name = $sender_host_name
979 # Sender host name lookup fails (V4NET.11.12.13 is not reverse registered)
980 exim -be -oMa V4NET.11.12.13
981 be Sender host name lookup fails (V4NET.11.12.13 is not reverse registered)
982 -oMs sender_host_name = $sender_host_name
983 host_lookup_failed = $host_lookup_failed
985 # Sender host name and protocol set by Sendmail-compatible option
986 exim -be -pspecial:host.name
987 -be Sender host name and protocol set by Sendmail-compatible option
988 -p received_protocol = $received_protocol
989 -p sender_host_name = $sender_host_name
991 # Sender host name and address etc, all set except host name,
992 # which should therefore be looked up from the address, but not if
993 # we are skipping. The debug output for this test will show when
995 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
996 -be Sender host name and address etc, all set except host name
997 -oMa sender_host_address = $sender_host_address
998 sender_host_port = $sender_host_port
999 -oMaa sender_host_authenticated = $sender_host_authenticated
1000 -oMai authenticated_id = $authenticated_id
1001 -oMas authenticated_sender = $authenticated_sender
1002 -oMi interface_address = $interface_address
1003 interface_port = $interface_port
1004 -oMr received_protocol = $received_protocol
1005 ----> No lookup yet: ${if eq{black}{white}{$sender_host_name}{No}}
1006 -oMs sender_host_name = $sender_host_name
1007 -oMt sender_ident = $sender_ident
1009 # Test no auto host name lookup for query-style lookups
1010 exim -d -bh V4NET.0.0.1
1012 exim -d -bh V4NET.0.0.2
1014 # Test $reply_address
1015 exim -bh V4NET.0.0.0
1044 # Check RFC 2047 decoding with (default) length check
1045 exim -bh V4NET.0.0.0
1049 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?=
1053 # Check RFC 2047 decoding with length check disabled
1054 exim -DLENCHECK=check_rfc2047_length=false -bh V4NET.0.0.0
1058 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?=
1062 # Certain kind of error
1064 match_ip: 15 ${if match_ip{1.2.3.4}{1.2.3}}
1065 match_ip: 16 ${if match_ip{1.2.3.4}{1.2.3.4/abc}}
1067 # Operation of inlist and negated inlist
1069 ${if inlist{aa}{aa} {in list}{not in list}}
1070 ${if !inlist{aa}{aa} {not in list}{in list}}