Testsuite: Update debian8 flavour for 5600
[users/jgh/exim.git] / test / scripts / 0000-Basic / 0002
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 munge dnssec
8
9 exim -be
10
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.
14
15 # Some fixed variables
16
17 exim_path: $exim_path
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 unknown: ${unknown}
27 h_subject: $h_subject:(should be empty)
28 h_subject:$h_subject (should be empty)
29 header in curlies: ${header_subject:} (should fail)
30
31 # \$message_headers should be empty
32 message_headers: >$message_headers<
33
34 # Continuation
35 x\
36 y
37 x\
38              y
39
40 # Overlong names and overbig numbers
41
42 +$aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
43 +${aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
44 +$11111111111111111111111111111111111
45 +${11111111111111111111111111111111111}
46
47 # List operations
48
49 filter: "${filter{a:b:c}{eq{1}{1}}}"
50 filter: ${filter{a:b:c}{!eq{$item}{b}}}
51 filter: ${filter{<' a'b'c}{!eq{$item}{b}}}
52 filter: ${filter{<' ''a'b' ''c}{!eq{$item}{b}}}
53 filter: "${filter{}{!eq{$item}{b}}}"
54
55 map: "${map{}{$item}}"
56 map: ${map{a:b:c}{$item}}
57 map: ${map{a:b:c}{:$item:}}
58 map: ${if eq{1}{0}{${map{a:b:c}{:$item:}}}{fail string}}
59 map: ${map{:b:c}{[$item]}}
60
61 reduce: "${reduce{}{+}{$value$item}}"
62 reduce: ${reduce{a:b:c}{+}{$value$item}}
63 reduce: ${reduce {<, 1,2,3}{0}{${eval:$value+$item}}}
64 reduce: ${reduce {3:0:9:4:6}{0}{${if >{$item}{$value}{$item}{$value}}}}
65
66 listnamed: ${listnamed:dlist}
67 listnamed: ${listnamed:+dlist}
68 listnamed: ${listnamed:hlist}
69 listnamed: ${listnamed:elist}
70 listnamed: ${listnamed:flist}
71 listnamed: ${listnamed:nolist}
72 listnamed: ${listnamed_d:dlist}
73 listnamed: ${listnamed_d:hlist}
74 listnamed: ${listnamed_z:dlist}
75
76 listcount: ${listcount:a:b:c}
77 listcount: ${listcount:}
78 listcount: ${listcount:<;a;b;c}
79 listcount: ${listcount:${listnamed:dlist}}
80
81 listextract: ${listextract{ 2}{a:b:c:d}}
82 listextract: ${listextract{-2}{<,a,b,c,d}{X${value}X}}
83 listextract: ${listextract{ 5}{a:b:c:d}}
84 listextract: ${listextract{-5}{a:b:c:d}}
85 listextract: ${listextract{ 5}{a:b:c:d}{}{fail}}
86 listextract: ${listextract{ 5}{a:b:c:d}{}fail}
87
88 sort: ${sort{3:2:1:4}{<}{$item}}
89 sort: ${sort {<, 3,2,1,4}{>}{$item}}
90 sort: ${sort{c:B:a:aa}{lti}{$item}}
91 sort: ${sort{666 r99.ex.com:10 smtp.ex.com:100 r2.ex.com}{<}{${sg {$item}{([0-9]*).*\$}{\$1}}}}
92 sort: ${sort{666,r99.ex.com:10,smtp.ex.com:100,r2.ex.com}{<}{${listextract{1}{<,$item}}}}
93 sort: "${sort{}{<}{$item}}"
94
95 # Tests with iscntrl() and illegal separators
96
97 map: ${map{<\n a\n\nb\nc}{'$item'}}
98
99 reduce: ${reduce {<n 1\n2\n3}{0}{${eval:$value+$item}}}
100 reduce: ${reduce {<\n 1\n2\n3}{0}{${eval:$value+$item}}}
101 reduce: ${reduce { <\n 1\n 2 \n 3 }{0}{${eval:$value+$item}}}
102 reduce: ${reduce {<\x7f 1\x7f2\177 3}{0}{${eval:$value+$item}}}
103
104 # Operators
105
106 acl: ${acl
107 acl: ${acl}
108 acl: ${acl {a_nosuch}}
109 acl: ${acl {a_ret}}
110 acl: ${acl {a_ret}{person@dom.ain}}
111 acl: ${acl {a_ret}{firstarg}{secondarg}}
112 acl: ${acl {a_ret}{arg with spaces}}
113 acl: ${acl {a_none}}
114 acl: ${acl {a_none}{person@dom.ain}}
115 acl: ${acl {a_deny}}
116 acl: ${acl {a_deny}{person@dom.ain}}
117 acl: ${acl {a_defer}}
118 acl: ${acl {a_sub}{top_arg_1}{top_arg_2}{top_arg_3}}
119 acl: ${reduce {1:2:3:4} {} {$value ${acl {a_ret}{$item}}}}
120
121 addrss: ${address:local-part@dom.ain}
122 addrss: ${address:Exim Person <local-part@dom.ain> (that's me)}
123 domain: ${domain:local-part@dom.ain}
124 domain: ${domain:Exim Person <local-part@dom.ain> (that's me)}
125
126 addresses: ${addresses:>' 'abc@xyz, 'pqr@xyz}
127 addresses: ${addresses:Exim Person <local-part@dom.ain> (that's me)}
128 addresses: ${addresses:>+ Exim Person <local-part@dom.ain> (that's me),\
129            xyz@abc}
130 addresses: ${addresses:Exim Person <local-part@dom.ain> (that's me), \
131            xyz@abc, nullgroupname:;, group: p@q, r@s; }
132 addresses: ${addresses:local-part@dom.ain <local-part@dom.ain>}
133
134 escape: ${escape:B7·F2ò}
135 eval:   ${eval:1+1}
136 eval:   ${eval:1+2*3}
137 eval:   ${eval:(1+2)*3}
138 eval:   ${eval:3/2*4}
139 eval:   ${eval:3*4/2}
140 eval:   ${eval:42}
141 eval:   ${eval:}
142 eval:   ${eval:-2}
143 eval:   ${eval:-2 - -3}
144 eval:   ${eval:-2 - (-3)}
145 eval:   ${eval:-2 - (-3}
146 eval:   ${eval:-2 - -3)}
147 eval:   ${eval:-2 --3}
148 eval:   ${eval:-2 -+3}
149 eval:   ${eval:-2 -+-3}
150 eval:   ${eval:(2*(1+1))/2 + 40K}
151 eval:   ${eval:077}
152 eval:   ${eval:08}
153 eval10: ${eval10:077}
154 eval10: ${eval10:08}
155 eval10: ${eval10:0x1234}
156 eval:   ${eval:2+42%5}
157 eval:   ${eval:0xc&5}
158 eval:   ${eval:0xc & 5 }
159 eval:   ${eval:0x0c|5}
160 eval:   ${eval:0xc^5}
161 eval:   ${eval:0xc>>1}
162 eval:   ${eval:0xc >> 2}
163 eval:   ${eval:0xc >> 4 }
164 eval:   ${eval:0xc<<1}
165 eval:   ${eval:~255&0x1234}
166 eval:   ${eval:~ 255&0x1234}
167 eval:   ${eval: -(~255&0x1234)}
168
169 expand: \$primary_hostname ${expand:\$primary_hostname}
170 hash:   ${hash_3:monty} ${hash_5:monty} ${hash_4_62:monty python}
171 hash:   ${hash_3:abc}X ${hash_3:ab}X ${hash_3:a}X ${hash_3:}X
172 hex2b64:${hex2b64:12345678}
173 hex2b64:${hex2b64:abcdef}
174 hex2b64:${hex2b64:ABCDEF}
175 hex2b64:${hex2b64:1a2b3c4d5e6f}
176 hex2b64:${hex2b64:1a2b3c4d5e6}
177 hex2b64:${hex2b64:1a2b3c4d5e6g}
178 hex2b64:${hex2b64:${md5:the quick brown fox}}
179 hex2b64:${hex2b64:${sha1:the quick brown fox}}
180
181 The base62 operator is actually a base36 operator in the Darwin and Cygwin
182 environments. Write cunning tests that produce the same output in both cases,
183 while doing a reasonable check.
184
185 base62:  ${if or {\
186                  {eq {${base62:12345}}{0003D7}}\
187                  {eq {${base62:12345}}{0009IX}}\
188                  }{OK}{NOT OK}}
189 base62d: ${if or {\
190                  {eq {${base62d:0003D7}}{12345}}\
191                  {eq {${base62d:0009IX}}{12345}}\
192                  }{OK}{NOT OK}}
193 base62d: ${if or {\
194                  {eq {${base62d:3D7}}{12345}}\
195                  {eq {${base62d:9IX}}{12345}}\
196                  }{OK}{NOT OK}}
197 base62 error: ${base62:12345x}
198 base62d error:${base62d:0003D7.}
199
200 hmac:   ${hmac{md5}{somesecret}{mail.example.com 2002-10-17 11:30:59}}
201 hmac:   ${hmac{sha1}{somesecret}{mail.example.com 2002-10-17 11:30:59}}
202 md5:    ${md5:the quick brown fox jumps over the lazy dog}
203 sha1:   ${sha1:}
204 sha1:   ${sha1:abc}
205 mask:   ${mask:192.168.10.206/28}
206 mask:   ${mask:192.168.10.206/32}
207 mask:   ${mask:192.168.10.206/33}
208 mask:   ${mask:192.168.10.206/0}
209 mask:   ${mask:192.168.10.206}
210 mask:   ${mask:a.b.c.d}
211 nhash:  ${nhash_24:monty} ${nhash_8_63:monty python}
212 lc/uc:  ${lc:The Quick} ${uc: Brown Fox}
213 length: ${length_10:The quick brown fox} ${l_10:abc}
214 lclpt:  ${local_part:local-part@dom.ain}
215 lclpt:  ${local_part:Exim Person <local-part@dom.ain> (that's me)}
216 quote:  ${quote:aZ09_.-Q} ${quote:ab*cd} ${quote:ab\cd"ef}
217 quote:  ${quote:nl(\n)}
218 quote:  ${quote:cr(\r)}
219 quote:  ${quote:tab(\t)}
220 quote:  ${quote:xff(\xff)}
221 quote:  Empty>${quote:}<
222 quote_local_part: ${quote_local_part:abcd}
223 quote_local_part: ${quote_local_part:O'Reilly}
224 quote_local_part: ${quote_local_part:a space}
225 quote_local_part: ${quote_local_part:.something}
226 quote_local_part: ${quote_local_part:something.}
227 quote_local_part: ${quote_local_part:joe.bloggs}
228 quote_local_part: ${quote_local_part:a!b}
229 quote_local_part: ${quote_local_part:x@y}
230 quote_local_part: ${quote_local_part:ab*cd}
231 quote_local_part: ${quote_local_part:x:y}
232 quote_local_part: ${quote_local_part:ab\cd"ef}
233 quote_local_part: ${quote_local_part:}
234 rxquote:${rxquote:aZ09_,-Q} ${rxquote:ab*cd} ${rxquote:ab\cd"ef}
235 hexquote: ${hexquote:\
236     \001\002\003\004\005\006\007 \010\011\012\013\014\015\016\017 \
237 \020\021\022\023\024\025\026\027 \030\031\032\033\034\035\036\037 \
238 \040\041\042\043\044\045\046\047 \050\051\052\053\054\055\056\057 \
239 \060\061\062\063\064\065\066\067 \070\071\072\073\074\075\076\077 \
240 \100\101\102\103\104\105\106\107 \110\111\112\113\114\115\116\117 \
241 \120\121\122\123\124\125\126\127 \130\131\132\133\134\135\136\137 \
242 \140\141\142\143\144\145\146\147 \150\151\152\153\154\155\156\157 \
243 \160\161\162\163\164\165\166\167 \170\171\172\173\174\175\176\177}
244 substr: ${substr_3_2:rhubarb} ${s_-5_2:1234567} ${s_-5_2:12} ${s_-3_2:12}
245 substr: ${s_3:rhubarb} ${s_-2:rhubarb}
246 substr: ${s_1:}
247 substr: ${substr_10:abc}
248 str2b64:${str2b64:abcd}
249 str2b64:${str2b64:The quick brown \n fox}
250 strlen: ${strlen:}
251 strlen: ${strlen:a}
252 strlen: ${strlen:abcdefgh}
253 time_eval:     ${time_eval:10s}
254 time_eval:     ${time_eval:2h}
255 time_eval:     ${time_eval:1d5m}
256 time_eval:     ${time_eval:1w2d3h4m5s}
257 time_eval:     ${time_eval:14}
258 time_eval:     ${time_eval:rhubarb}
259 time_interval: ${time_interval:0}
260 time_interval: ${time_interval:44}
261 time_interval: ${time_interval:999999}
262 time_interval: ${time_interval:-1}
263 time_interval: ${time_interval:rhubarb}
264
265 # stat is a bit tricky, but some of the fields of the aux-var directory
266 # should be the same on all systems
267
268 stat:   ${extract{mode}{${stat:DIR/aux-var}}}
269 stat:   ${extract{smode}{${stat:DIR/aux-var}}}
270 stat:   ${stat:/a/non/existent/file}
271
272 # "Operators" that have expanded arguments
273
274 hash:   ${hash{3}{monty}} ${hash{5}{monty}} ${hash{4}{62}{monty python}}
275 hash:   ${hash{3}{abc}}X ${hash{3}{ab}}X ${hash{3}{a}}X ${hash{3}{}}X
276 nhash:  ${nhash{24}{monty}} ${nhash{8}{63}{monty python}}
277 length: ${length{10}{The quick brown fox}} ${length{10}{abc}}
278 substr: ${substr{3}{2}{rhubarb}} ${substr{-5}{2}{1234567}} ${substr{-5}{2}{12}} ${substr{-3}{2}{12}}
279 substr: ${substr{${if eq{1}{1}{-8}}}{${if eq{1}{0}{25}{1}}}{abcde}}
280
281 # Error forms
282
283 ${hash{one}}
284 ${hash{nonnumber}{abcd}}
285 ${hash{3}{2}{4}{abcd}}
286 ${substr{-3}{-2}{abcd}}
287
288 # Skipped operators
289
290 addrss: ${if eq {1}{2}{${address:invalid}}{NO}}
291 domain: ${if eq {1}{2}{${domain:invalid}}{NO}}
292 escape: ${if eq {1}{2}{${escape:invalid}}{NO}}
293 expand: ${if eq {1}{2}{\$primary_hostname ${expand:\$invalid}}{NO}}
294 hash:   ${if eq {1}{2}{${hash_3:invalid}}{NO}}
295 md5:    ${if eq {1}{2}{${md5:invalid}}{NO}}
296 mask:   ${if eq {1}{2}{${mask:invalid}}{NO}}
297
298 # Number suffixes in conditions
299 1k: ${if >{1}{1k}{n}{y}}
300 1K: ${if >{1}{1K}{n}{y}}
301 1M: ${if >{1}{1M}{n}{y}}
302 1G: ${if >{1}{1G}{n}{y}}
303
304 # Numeric overflow
305 # >32b should work, >64b not
306
307 1 > 2047M                ${if >{1}{2047M}{y}{n}}
308 1 > 2048M                ${if >{1}{2048M}{y}{n}}
309 1 > 4096000000           ${if >{1}{4096000000}{y}{n}}
310 1 > 4096M                ${if >{1}{4096M}{y}{n}}
311 1 > 4611686018427387904  ${if >{1}{4611686018427387904} {y}{n}}
312 1 > 46116860184273879040 ${if >{1}{46116860184273879040}{y}{n}}
313
314 # Conditions
315
316 2=2:    ${if ={2}{2}{y}{n}}
317 2==2:   ${if =={2}{2}{y}{n}}
318 3=2:    ${if ={3}{2}{y}{n}}
319 2==3:   ${if =={2}{3}{y}{n}}
320 !2=2:   ${if !={2}{2}{y}{n}}
321 !2==2:  ${if !=={2}{2}{y}{n}}
322 !3=2:   ${if !={3}{2}{y}{n}}
323 !2==3:  ${if !=={2}{3}{y}{n}}
324 2>3:    ${if >{2}{3}{y}{n}}
325 3>3:    ${if >{3}{3}{y}{n}}
326 4>3:    ${if >{4}{3}{y}{n}}
327 1>-1:   ${if >{1}{-1}{y}{n}}
328 2>=3:   ${if >={2}{3}{y}{n}}
329 3>=3:   ${if >={3}{3}{y}{n}}
330 4>=3:   ${if >={4}{3}{y}{n}}
331 2<3:    ${if <{2}{3}{y}{n}}
332 3<3:    ${if <{3}{3}{y}{n}}
333 4<3:    ${if <{4}{3}{y}{n}}
334 2<=3:   ${if <={2}{3}{y}{n}}
335 3<=3:   ${if <={3}{3}{y}{n}}
336 4<=3:   ${if <={4}{3}{y}{n}}
337 5<=3:   ${if <={ 5 } { 3 } {y}{n}}
338 -3<=1:  ${if <={-3}{1}{y}{n}}
339
340 5>3k:   ${if >{5 } {3k }{y}{n}}
341 5>3m:   ${if >{5 } {3m }{y}{n}}
342 5>3z:   ${if >{5 } {3z }{y}{n}}
343 5>a:    ${if >{ 5 } {a}{y}{n}}
344 5>bad:  ${if >{5 } {${lookup{trick}lsearch{DIR/aux-fixed/0002.lsearch}}} {y}{n}}
345
346 >0:     ${if > {}{0}{y}{n}}
347 =:      ${if = {}{}{y}{n}}
348 -2<:    ${if < {-2}{}{y}{n}}
349 08>07:  ${if > {08}{07}{y}{n}}
350 011=11: ${if = {011}{11}{y}{n}}
351
352 def:y   ${if def:tod_log{y}{n}}
353 def:n   ${if def:host{y}{n}}
354 def:f   ${if def:post{y}{n}}
355 def:h_f ${if def:h_xxx {y}{n}}
356 def:h_f ${if def:h_xxx:{y}{n}}
357 def:d:  ${if def:tod_log:{y}{n}}
358
359 exists: ${if exists{/etc/passwd}{y}{n}}
360 exists: ${if exists{/doesnt}{y}{n}}
361
362 eq:     ${if eq{abc}{abc}{y}{n}}
363 eq:     ${if eq{abc}{xyz}{y}{n}}
364 !eq:    ${if !eq{abc}{abc}{y}{n}}
365 !eq:    ${if !eq{abc}{xyz}{y}{n}}
366
367 eqi:    ${if eqi{abc}{abc}{y}{n}}
368 eqi:    ${if eqi{abc}{ABC}{y}{n}}
369 eqi:    ${if eqi{abc}{xyz}{y}{n}}
370 !eqi:   ${if !eqi{abc}{abc}{y}{n}}
371 !eqi:   ${if !eqi{abc}{aBc}{y}{n}}
372 !eqi:   ${if !eqi{abc}{xyz}{y}{n}}
373
374 lt:     ${if lt{ABC}{abc}{y}{n}}
375 lti:    ${if lti{ABC}{abc}{y}{n}}
376 le:     ${if le{ABC}{abc}{y}{n}}
377 lei:    ${if lei{ABC}{abc}{y}{n}}
378 gt:     ${if gt{ABC}{abc}{y}{n}}
379 gti:    ${if gti{ABC}{abc}{y}{n}}
380 ge:     ${if ge{ABC}{abc}{y}{n}}
381 gei:    ${if gei{ABC}{abc}{y}{n}}
382
383 isip:   ${if isip {1.2.3.4}{y}{n}}  1.2.3.4
384 isip4:  ${if isip4{1.2.3.4}{y}{n}}  1.2.3.4
385 isip6:  ${if isip6{1.2.3.4}{y}{n}}  1.2.3.4
386 isip:   ${if isip {1:2:3:4}{y}{n}}  1:2:3:4
387 isip4:  ${if isip4{1:2:3:4}{y}{n}}  1:2:3:4
388 isip6:  ${if isip6{1:2:3:4}{y}{n}}  1:2:3:4
389 isip:   ${if isip {::1}{y}{n}}      ::1
390 isip4:  ${if isip4{::1}{y}{n}}      ::1
391 isip6:  ${if isip6{::1}{y}{n}}      ::1
392 isip:   ${if isip {fe80::a00:20ff:fe86:a061}{y}{n}}  fe80::a00:20ff:fe86:a061
393 isip4:  ${if isip4{fe80::a00:20ff:fe86:a061}{y}{n}}  fe80::a00:20ff:fe86:a061
394 isip6:  ${if isip6{fe80::a00:20ff:fe86:a061}{y}{n}}  fe80::a00:20ff:fe86:a061
395 isip:   ${if isip {rhubarb}{y}{n}}  rhubarb
396 isip4:  ${if isip4{rhubarb}{y}{n}}  rhubarb
397 isip6:  ${if isip6{rhubarb}{y}{n}}  rhubarb
398
399 match:  ${if match{abcd}{\N^([ab]+)(\w+)$\N}{$2$1}fail}
400 match:  ${if match{abcd}{^\N([ab]+)(\w+)$\N}{$2$1}fail}
401 match:  ${if match{abcd}{^([ab]+)(\\w+)\$}{$2$1}fail}
402 match:  ${if match{wxyz}{^([ab]+)(\\w+)\$}{$2$1}fail}
403 match:  ${if match{abcd}{^([ab]+)(\\w+)\$}{$2[${if match{xyz}{(.*)}{$1}fail}]$1}fail}
404
405 match_domain:    ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
406 match_domain:    ${if match_domain{a.b.c}{x.y.z:p.q.r}{yes}{no}}
407 match_domain:    ${if match_domain{5.aa.bb}{+dlist}{yes}{no}}
408 match_domain:    ${if match_domain{xxxyz}{+dlist}{yes}{no}}
409 match_domain:    ${if match_domain{xyz}{+dlist}{yes}{no}}
410
411 ${if match{x@zz.aa.bb}{^(.*)} \
412   { \
413   >$1< \
414   ${if match_domain{${domain:$1}}{+dlist}{[$1]}} \
415   >$1< \
416   } \
417   { CAN'T HAPPEN}}
418
419 ${if match{x@xxxabc}{^(.*)} \
420   { \
421   >$1< \
422   ${if match_domain{${domain:$1}}{^\Nxxx(.*)\N}{[$1]}} \
423   >$1< \
424   } \
425   { CAN'T HAPPEN}}
426
427 match_address:   ${if match_address{x@y.z}{p@q:*@y.z}{yes}{no}}
428 match_address:   ${if match_address{x@y.z}{p@q:x@*.z}{yes}{no}}
429
430 match_local_part:${if match_local_part{jo}{jack:jill:jo:john}{yes}{no}}
431 match_local_part:${if match_local_part{jo}{\N^\w\N}{yes}{no}}
432
433 match_ip:        01 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.4}}
434 match_ip:        02 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6}}
435 match_ip:        03 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6/24}}
436 match_ip:        04 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6:*}}
437 match_ip:        05 ${if match_ip{1.2.3.4}{4.5.6.7:1.2.3.6:name}}
438 match_ip:        06 ${if match_ip{1.2.3.4}{:4.5.6.7}}
439 match_ip:        07 ${if match_ip{}{:4.5.6.7}}
440 match_ip:        08 ${if match_ip{V4NET.11.12.13}{+hlist}}
441 match_ip:        09 ${if match_ip{V4NET.11.12.14}{+hlist}}
442 match_ip:        10 ${if match_ip{192.168.3.4}{+hlist}}
443 match_ip:        11 ${if match_ip{somename}{+hlist}}
444 match_ip:        12 ${if match_ip{1.2.3.4}{lsearch;DIR/aux-fixed/0002.matchip}}
445 match_ip:        13 ${if match_ip{1.2.3.4}{net-lsearch;DIR/aux-fixed/0002.matchip}}
446 match_ip:        14 ${if match_ip{5.6.7.8}{net24-lsearch;DIR/aux-fixed/0002.matchip}}
447 match_ip:        15 ${if match_ip{abcd::dcba}{net-iplsearch;DIR/aux-fixed/0002.matchip}}
448
449 queue_running:  ${if queue_running{y}{n}}
450 first_delivery: ${if first_delivery{y}{n}}
451
452 queue_running after or: ${if or{{eq {0}{0}}{queue_running}}{y}{n}}
453 first_delivery after or: ${if or{{eq {0}{0}}{first_delivery}}{y}{n}}
454
455 # acl expansion condition
456 acl if: ${if acl {{a_ret}}               {Y:$value}{N:$value}}
457 acl if: ${if acl {{a_ret}{argY}}         {Y:$value}{N:$value}}
458 acl if: ${if acl {{a_deny}{argN}{arg2}}  {Y:$value}{N:$value}}
459 acl if: ${if acl {{a_defer}{argN}{arg2}} {Y:$value}{N:$value}}
460
461 # Default values for both if strings
462
463 \${if eq{1}{1}}  >${if eq{1}{1}}<
464 \${if eq{1}{2}}  >${if eq{1}{2}}<
465
466 # Lookups: DIR is the testing directory. In this test we can only use the
467 # lookups that are required in all cases.
468
469 ${lookup{postmaster}lsearch{DIR/aux-fixed/0002.aliases}{$value}fail}
470
471 ${lookup{x@y}lsearch*@{DIR/aux-fixed/0002.starat}{$value}fail}
472 ${lookup{x@z}lsearch*{DIR/aux-fixed/0002.starat}{$value}fail}
473 ${lookup{x@z}lsearch*@{DIR/aux-fixed/0002.starat}{$value}fail}
474 ${lookup{x@w}lsearch*@{DIR/aux-fixed/0002.starat}{$value}fail}
475
476 ${lookup{a.b.c.d}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
477 ${lookup{x.y.z}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}{failed x.y.z}}
478 ${lookup{p.q}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
479 ${lookup{o.p.q}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
480 ${lookup{m.n.o.p.q}partial-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
481 ${lookup{x.y.z}partial1-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
482 ${lookup{x.y.z}partial0-lsearch{DIR/aux-fixed/0002.domains}{$value}fail}
483
484 q1:  ${lookup{abc}lsearch{DIR/aux-fixed/0002.quoted}}
485 q2:  ${lookup{xyz}lsearch{DIR/aux-fixed/0002.quoted}}
486 q3:  ${lookup{pqr}lsearch{DIR/aux-fixed/0002.quoted}}
487 q4:  ${lookup{a:b}lsearch{DIR/aux-fixed/0002.quoted}}
488 q5:  ${lookup{"quoted"}lsearch{DIR/aux-fixed/0002.quoted}}
489 q6:  ${lookup{white space}lsearch{DIR/aux-fixed/0002.quoted}}
490 q7:  ${lookup{b\\s}lsearch{DIR/aux-fixed/0002.quoted}}
491
492 abc:   ${lookup{abc}wildlsearch{DIR/aux-var/0002.wild}}
493 a.b.c: ${lookup{a.b.c}wildlsearch{DIR/aux-var/0002.wild}}
494 ab.c:  ${lookup{ab.c}wildlsearch{DIR/aux-var/0002.wild}}
495 xyz:   ${lookup{xyz}wildlsearch{DIR/aux-var/0002.wild}}
496 Xyz:   ${lookup{Xyz}wildlsearch{DIR/aux-var/0002.wild}}
497 Zyz:   ${lookup{Zyz}wildlsearch{DIR/aux-var/0002.wild}}
498 a b:   ${lookup{a b}wildlsearch{DIR/aux-var/0002.wild}}
499 a  b:  ${lookup{a  b}wildlsearch{DIR/aux-var/0002.wild}}
500 a:b:   ${lookup{a:b}wildlsearch{DIR/aux-var/0002.wild}}
501 a.b:   ${lookup{a.b}wildlsearch{DIR/aux-var/0002.wild}}
502 a..b:  ${lookup{a..b}wildlsearch{DIR/aux-var/0002.wild}}
503 a9b:   ${lookup{a9b}wildlsearch{DIR/aux-var/0002.wild}}
504 a99b:  ${lookup{a99b}wildlsearch{DIR/aux-var/0002.wild}}
505
506 # Should give the same results as above because expansion does nothing
507
508 abc:   ${lookup{abc}nwildlsearch{DIR/aux-var/0002.wild}}
509 a.b.c: ${lookup{a.b.c}nwildlsearch{DIR/aux-var/0002.wild}}
510 ab.c:  ${lookup{ab.c}nwildlsearch{DIR/aux-var/0002.wild}}
511 xyz:   ${lookup{xyz}nwildlsearch{DIR/aux-var/0002.wild}}
512 Xyz:   ${lookup{Xyz}nwildlsearch{DIR/aux-var/0002.wild}}
513 Zyz:   ${lookup{Zyz}nwildlsearch{DIR/aux-var/0002.wild}}
514 a b:   ${lookup{a b}nwildlsearch{DIR/aux-var/0002.wild}}
515 a  b:  ${lookup{a  b}nwildlsearch{DIR/aux-var/0002.wild}}
516 a:b:   ${lookup{a:b}nwildlsearch{DIR/aux-var/0002.wild}}
517
518 # Should fail because of no expansion
519
520 a.b:   ${lookup{a.b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}}
521 a..b:  ${lookup{a..b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}}
522 a9b:   ${lookup{a9b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}}
523 a99b:  ${lookup{a99b}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NO}}
524
525 # But these should succeed
526
527 a\\:b:  ${lookup{a\\:b}nwildlsearch{DIR/aux-var/0002.wild}}
528 a\\:Xb: ${lookup{a\\:Xb}nwildlsearch{DIR/aux-var/0002.wild}}
529
530 # Some tests of case-(in)dependence
531
532 MiXeD-CD:  ${lookup{MiXeD-CD}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NOT FOUND}}
533 MixeD-CD:  ${lookup{MixeD-CD}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NOT FOUND}}
534 MiXeD-Ncd: ${lookup{MiXeD-Ncd}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NOT FOUND}}
535 MixeD-Ncd: ${lookup{MixeD-Ncd}nwildlsearch{DIR/aux-var/0002.wild}{$value}{NOT FOUND}}
536
537 # IP address (CIDR) lookups
538
539 1.2.3.4:      ${lookup{1.2.3.4}iplsearch{DIR/aux-fixed/0002.iplsearch}}
540 1.2.3.5:      ${lookup{1.2.3.5}iplsearch{DIR/aux-fixed/0002.iplsearch}}
541 1.2.3.5:      ${lookup{1.2.3.5}iplsearch*{DIR/aux-fixed/0002.iplsearch}}
542 abcd::cdab:   ${lookup{abcd::cdab}iplsearch{DIR/aux-fixed/0002.iplsearch}}
543 192.168.1.2:  ${lookup{192.168.1.2}iplsearch{DIR/aux-fixed/0002.iplsearch}}
544 192.168.5.6:  ${lookup{192.168.5.6}iplsearch{DIR/aux-fixed/0002.iplsearch}}
545 abcd:abcd::   ${lookup{abcd:abcd::}iplsearch{DIR/aux-fixed/0002.iplsearch}}
546 abcd:abcd:1:: ${lookup{abcd:abcd:1::}iplsearch{DIR/aux-fixed/0002.iplsearch}}
547 abcd:abcd::3  ${lookup{abcd:abcd::3}iplsearch{DIR/aux-fixed/0002.iplsearch}}
548 rhubarb       ${lookup{rhubarb}iplsearch{DIR/aux-fixed/0002.iplsearch}}
549
550
551 # Nested Lookups - style 1
552
553 ${lookup{${lookup{key1}lsearch{DIR/aux-fixed/0002.rec}{$value}{key1f}}}lsearch{DIR/aux-fixed/0002.rec}{$value}fail}
554 ${lookup{${lookup{key3}lsearch{DIR/aux-fixed/0002.rec}{$value}{key1f}}}lsearch{DIR/aux-fixed/0002.rec}{$value}fail}
555
556 # Nested Lookups - style 2
557
558 ${lookup{key1}lsearch{DIR/aux-fixed/0002.rec}{${lookup{$value}lsearch{DIR/aux-fixed/0002.rec}{$value}{failed for $value}}}{failed for key1}}
559 ${lookup{key3}lsearch{DIR/aux-fixed/0002.rec}{${lookup{$value}lsearch{DIR/aux-fixed/0002.rec}{$value}{failed for $value}}}{failed for key1}}
560
561 # Other nesting tests
562
563 ${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}}}
564 ${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}}}
565 ${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}}}
566 ${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}}}
567
568 # Lookup quotes for standardly expected lookups
569
570 lsearch ${quote_lsearch: !@#\$%^&*()_-+=|\\~`1234567890\{[\}]qwertyuiop:;"'asdfghjkl<,>.?/zxcvbnm}
571 xxx     ${quote_xxx: !@#\$%^&*()_-+=|\\~`1234567890\{[\}]qwertyuiop:;"'asdfghjkl<,>.?/zxcvbnm}
572
573 # Extract
574
575 ${extract{B}{A=1 B=2 C=3}}
576 ${extract{ B }{A=1 B=2 C=3}{$value}{NOT FOUND}}
577 ${extract{2}{:}{1:2:3}}
578 ${extract{ 2 }{:}{1:2:3}{$value}{NOT FOUND}}
579 Empty:<${extract{D}{A=1 B=2 C=3}}>
580 Empty:<${extract{4}{:}{1:2:3}}>
581 ${extract{C}{A=1 B=2 C=3}{<$value>}}
582 ${extract{3}{:}{1:2:3}{<$value>}}
583 Empty:<${extract{Z}{A=1 B=2 C=3}{<$value>}}>
584 Empty:<${extract{4}{:}{1:2:3}{<$value>}}>
585 ${extract{Z}{A=1 B=2 C=3}{<$value>}{no Z}}
586 ${extract{4}{:}{1:2:3}{<$value>}{no 4}}
587 ${extract{Z}{A=1 B=2 C=3}{<$value>}fail}
588 ${extract{4}{:}{1:2:3}{<$value>}fail}
589 ${extract{K4}{${sg{1=A 4=D 3=C}{(\\d+)=}{K\$1=}}}}
590 ${extract{0}{:}{a:b:c:d:e}{$value}{FAIL}}
591 ${extract{1}{:}{a:b:c:d:e}{$value}{FAIL}}
592 ${extract{-1}{:}{a:b:c:d:e}{$value}{FAIL}}
593 ${extract{-5}{:}{a:b:c:d:e}{$value}{FAIL}}
594 ${extract{-6}{:}{a:b:c:d:e}{$value}{FAIL}}
595 ${extract{-3}{:,}{a,,b::c}}
596 ${extract{2}{:,}{a,,b::c}}
597 ${extract{3}{:,}{a,,b::c}}
598 ${extract{a-b}{X = "one two" a-b "three four" 5=99}}
599 ${extract{}{X=3}}
600 ${extract{ }{X=3}}
601 ${extract{ 2 }{ }{a b c}}
602
603 # Translation
604
605 abcdea aaa xyz ${tr{abcdea}{aaa}{xyz}}
606 abcdea a   z   ${tr{abcdea}{a}{z}}
607 abcdea a       ${tr{abcdea}{a}{}}
608 abcdea abc z   ${tr{abcdea}{abc}{z}}
609
610 # Boolean
611 "TrUe"                ${if bool{TrUe}{true}{false}}      EXPECT: true
612 "FALSE"               ${if bool{FALSE}{true}{false}}     EXPECT: false
613 " yes"                ${if bool{ yes}{true}{false}}      EXPECT: true
614 " no"                 ${if bool{ no}{true}{false}}     EXPECT: false
615 "yes "                ${if bool{yes }{true}{false}}      EXPECT: true
616 "-1"                  ${if bool{-1}{true}{false}}     EXPECT: true
617 "0"                   ${if bool{0}{true}{false}}     EXPECT: false
618 "1"                   ${if bool{1}{true}{false}}      EXPECT: true
619 " 0 "                 ${if bool{ 0 }{true}{false}}     EXPECT: false
620 " 1 "                 ${if bool{ 1 }{true}{false}}      EXPECT: true
621 "1111111111111111111" ${if bool{1111111111111111111}{true}{false}}      EXPECT: true
622 "9"                   ${if bool{9}{true}{false}}      EXPECT: true
623 " "                   ${if bool{ }{true}{false}}     EXPECT: false
624 "text"                ${if bool{text}{true}{false}}     EXPECT: error
625 " text"               ${if bool{ text}{true}{false}}     EXPECT: error
626 "-text"               ${if bool{-text}{true}{false}}     EXPECT: error
627 "text "               ${if bool{text }{true}{false}}     EXPECT: error
628 " text "              ${if bool{ text }{true}{false}}     EXPECT: error
629 "00"                  ${if bool{00}{true}{false}}     EXPECT: false
630 "!true"               ${if !bool{true}{true}{false}}     EXPECT: false
631 "!false"              ${if !bool{false}{true}{false}}      EXPECT: true
632
633 "TrUe"                ${if bool_lax{TrUe}{true}{false}}      EXPECT: true
634 "FALSE"               ${if bool_lax{FALSE}{true}{false}}     EXPECT: false
635 " yes"                ${if bool_lax{ yes}{true}{false}}      EXPECT: true
636 " no"                 ${if bool_lax{ no}{true}{false}}     EXPECT: false
637 "yes "                ${if bool_lax{yes }{true}{false}}      EXPECT: true
638 "-1"                  ${if bool_lax{-1}{true}{false}}      EXPECT: true
639 "0"                   ${if bool_lax{0}{true}{false}}     EXPECT: false
640 "1"                   ${if bool_lax{1}{true}{false}}      EXPECT: true
641 " 0 "                 ${if bool_lax{ 0 }{true}{false}}     EXPECT: false
642 " 1 "                 ${if bool_lax{ 1 }{true}{false}}      EXPECT: true
643 "1111111111111111111" ${if bool_lax{1111111111111111111}{true}{false}}      EXPECT: true
644 "9"                   ${if bool_lax{9}{true}{false}}      EXPECT: true
645 " "                   ${if bool_lax{ }{true}{false}}     EXPECT: false
646 "text"                ${if bool_lax{text}{true}{false}}      EXPECT: true
647 " text"               ${if bool_lax{ text}{true}{false}}      EXPECT: true
648 "text "               ${if bool_lax{text }{true}{false}}      EXPECT: true
649 " text "              ${if bool_lax{ text }{true}{false}}      EXPECT: true
650 "00"                  ${if bool_lax{00}{true}{false}}      EXPECT: true
651 "!true"               ${if !bool_lax{true}{true}{false}}     EXPECT: false
652 "!false"              ${if !bool_lax{false}{true}{false}}      EXPECT: true
653
654 # RFC 2047
655
656 abcd      ${rfc2047:abcd}
657 <:abcd:>  ${rfc2047:<:abcd:>}
658 <:ab cd:> ${rfc2047:<:ab cd:>}
659 Long:     ${rfc2047: here we go: a string that is going to be encoded: it will go over the 75-char limit}
660 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}
661
662 # RFC 2047 decode
663
664 ${rfc2047d:abcd      abcd}
665 ${rfc2047d:<:abcd:>  =?iso-8859-8?Q?=3C=3Aabcd=3A=3E?=}
666 ${rfc2047d:<:ab cd:> =?iso-8859-8?Q?=3C=3Aab_cd=3A=3E?=}
667 ${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?=}
668 ${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?=}
669
670 # UTF-8
671
672 abcd      ${from_utf8:abcd}
673 aÀÿd      ${from_utf8:aÃ\80ÿd}
674 toobig    ${from_utf8:aĀd}
675
676 # Substitution
677
678 \${sg{abcdefabcdef}{abc}{xyz}}          =${sg{abcdefabcdef}{abc}{xyz}}
679 \${sg{ab:xy::z}{:}{::}}                 =${sg{ab:xy::z}{:}{::}}
680 \${sg{abcdefabcdef}{(..)[^c]}{>\$1<}}    =${sg{abcdefabcdef}{(..)[^c]}{>$1<}}
681 \${sg{abcdefabcdef}{(..)[^c]}{>\\\$1<}}   =${sg{abcdefabcdef}{(..)[^c]}{>\$1<}}
682 \${sg{abcdefabcdef}{(..)[^c]}{>\\N\$1\\N<}}=${sg{abcdefabcdef}{(..)[^c]}{>\N$1\N<}}
683 \${sg{abbab}{a*}{+}}                    =${sg{abbab}{a*}{+}}
684
685 # File insertion
686
687 ${readfile}
688 ${readfile{DIR/aux-fixed/0002.readfile}}
689 ${readfile{DIR/aux-fixed/0002.readfile}{}}
690 ${readfile{DIR/aux-fixed/0002.readfile}{:}}
691 ${readfile{DIR/aux-fixed/0002.readfile}{ - }}
692 ${readfile{/non/exist/file}}
693 ${if exists{/non/exist/file}{${readfile{/non/exist/file}}}{non-exist}}
694 >${readfile{DIR/aux-fixed/0002.readfile}{!}}\
695     <
696
697 # Calling a command
698
699 ${run{DIR/aux-fixed/0002.runfile 0}}
700 RC=$runrc
701 ${run{DIR/aux-fixed/0002.runfile 0}{1}{2}}
702 RC=$runrc
703 ${run{DIR/aux-fixed/0002.runfile 0}{$value}{2}}
704 RC=$runrc
705 ${run{DIR/aux-fixed/0002.runfile 1}{$value}{2}}
706 RC=$runrc
707 ${run{DIR/aux-fixed/0002.runfile 1}{$value}{$value}}
708 RC=$runrc
709 ${run{DIR/test-nonexist}{Y}{N}}
710 RC=$runrc
711 >>${run{DIR/bin/iefbr14}}<<
712 RC=$runrc
713 ${if eq{1}{2}{${run{/non/exist}}}{1!=2}}
714 RC=$runrc
715
716 # PRVS
717
718 ${prvs{userx@test.ex}{secret}}
719 ${prvs{userx@test.ex}{secret}{1}}
720 ${prvs{userx@test.ex}{secret}{8}}
721
722 # Syntax errors
723
724 ${prvs{userx@test.ex}{secret}{12}}
725 ${prvs{userx@test.ex}{secret}{rhubarb}}
726 ${prvs{userx@test.ex}{secret}{}}
727
728 # Correct checks; can't put explicit addresses in the tests, because they
729 # will change over time.
730
731 ${prvscheck{${prvs{userx@test.ex}{secret}}}{secret}}
732 result=$prvscheck_result
733
734 ${prvscheck{${prvs{userx@test.ex}{secret}{1}}}{secret}\
735 {>$prvscheck_result< >$prvscheck_address< >$prvscheck_keynum<}}
736 result=$prvscheck_result
737
738 ${prvscheck{${prvs{userx@test.ex}{secret}{8}}}{secret}{}}
739 result=$prvscheck_result
740
741 # Incorrect secret
742
743 ${prvscheck{${prvs{userx@test.ex}{secret}}}{socrot}}
744 result=$prvscheck_result
745
746 ${prvscheck{${prvs{userx@test.ex}{secret}}}{socrot}{$prvscheck_keynum}}
747 result=$prvscheck_result
748
749 # Non-prvs address
750
751 >>${prvscheck{userx@test.ex}{secret}}<<
752 result=$prvscheck_result
753
754 # Syntax errors
755
756 ${tod_log
757 ${tod_log+6
758 ${expand:abcd
759 ${expand:abcd${tod_log}
760 ${hmac{xxx}{a}{b}}
761 ${if and {xyz}{a}{b}}
762 ${if and {{xya}}{a}{b}}
763 ${if and {{${lookup{x}lsearch{/a/b}}}}{a}{b}}
764 ${if eq {$h_xyz}{1}{y}{n}}
765 ${if eq {$h_xyz:}{1}{y}{n}
766 ${if def:h_xyz}{y}{n}}
767 ${if or {eq {}{}{yes}{no}}
768 ${if or {{eq {}{}{yes}{no}}
769 ${if or {{eq {}{}}{yes}{no}}
770 ${substr_1_:12345}
771 ${substr__3:12345}
772
773 # Iterations: forany and forall
774
775 ${if forany{a:b:c}{eq{$item}{a}}{yes}{no}}
776 ${if forany{a:b:c}{eq{$item}{b}}{yes}{no}}
777 ${if forany{a:b:c}{eq{$item}{c}}{yes}{no}}
778 ${if forany {a:b:c} {eq {$item} {z}} {yes} {no}}
779 ${if !forany{a:b:c}{eq{$item}{z}}{yes}{no}}
780 ${if !forany{a:b:c}{eq{$item}{a}}{yes}{no}}
781 ${if forany{}{eq{$item}{a}}{yes}{no}}
782 ${if !forany{}{eq{$item}{a}}{yes}{no}}
783 ${if forany{<, $primary_hostname,foo,bar}{eq{$item}{$primary_hostname}}{yes}{no}}
784
785 ${if forany{}{yes}{no}}
786 ${if forany{a:b:c}{gt{$item}{a}{yes}{no}}
787
788 ${if forall{a:b:c}{match{$item}{^[a-c]\$}}{yes}{no}}
789 ${if forall{q:b:c}{match{$item}{^[a-c]\$}}{yes}{no}}
790 ${if forall{a:b:z}{match{$item}{^[a-c]\$}}{yes}{no}}
791 ${if forall{}{match{$item}{^[a-c]\$}}{yes}{no}}
792
793 ${if !forall{a:b:c}{match{$item}{^[a-c]\$}}{yes}{no}}
794 ${if !forall{q:b:c}{match{$item}{^[a-c]\$}}{yes}{no}}
795 ${if !forall{a:b:z}{match{$item}{^[a-c]\$}}{yes}{no}}
796 ${if !forall{}{match{$item}{^[a-c]\$}}{yes}{no}}
797
798 # Expect yes
799 ${if forany{a:b:c}\
800   {\
801   eq\
802     {$item: ${if forall{x:y:z}{match{$item}{^[x-z]\$}}{true}{false}}}\
803     {$item: true}\
804   }\
805 {outer=yes}{outer=no}} item='$item' (unset)
806
807 # Expect no
808 ${if forany{a:b:c}\
809   {\
810   eq\
811     {$item: ${if !forall{x:y:z}{match{$item}{^[x-z]\$}}{true}{false}}}\
812     {$item: true}\
813   }\
814 {outer=yes}{outer=no}}
815
816 # Error inside nest - check message is helpful
817 ${if forany{a:b:c}\
818   {\
819   eq\
820     {$item: ${if forall{x:y:z}{match{$item}{^[x-z]\$}{true}{false}}}\
821     {$item: true}\
822   }\
823 {outer=yes}{outer=no}}
824
825
826 # Miscellaneous (for bug fixes, etc)
827
828 ${if ={1}{1} {true}{${if ={1}{1} {true}{${if ={1}{1}{true}fail}}}}}
829
830 # Environment access
831
832 ${env {USER}}
833 ${env {NO_SUCH_VARIABLE} {oops, success} {correct}}
834
835 ****
836 # Test "escape" with print_topbitchars
837 exim -be -DPTBC=print_topbitchars
838 escape: ${escape:B7·F2ò}
839 ****
840 # Checkout expansion debugging
841 exim -d-all+expand -be
842 primary_hostname: $primary_hostname
843 match:  ${if match{abcd}{\N^([ab]+)(\w+)$\N}{$2$1}fail}
844 match:  ${if match{wxyz}{\N^([ab]+)(\w+)$\N}{$2$1}fail}
845 ${if eq {1}{1}{yes}{${lookup{xx}lsearch{/non/exist}}}}
846 match_address:   ${if match_address{a.b.c}{a.b.c}{yes}{no}}
847 ****
848 # Sender host name and address etc, all unset
849 exim -be
850 -be Sender host name and address etc, all unset
851 -oMa  sender_host_address = $sender_host_address
852       sender_host_port = $sender_host_port
853 -oMaa sender_host_authenticated = $sender_host_authenticated
854 -oMai authenticated_id = $authenticated_id
855 -oMas authenticated_sender = $authenticated_sender
856 -oMi  interface_address = $interface_address
857       interface_port = $interface_port
858 -oMr  received_protocol = $received_protocol
859 -oMs  sender_host_name = $sender_host_name
860 -oMt  sender_ident = $sender_ident
861 ****
862 # Sender host name and address etc, all set except host name.
863 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
864 -be Sender host name and address etc, all set except host name.
865 -oMa  sender_host_address = $sender_host_address
866       sender_host_port = $sender_host_port
867 -oMaa sender_host_authenticated = $sender_host_authenticated
868 -oMai authenticated_id = $authenticated_id
869 -oMas authenticated_sender = $authenticated_sender
870 -oMi  interface_address = $interface_address
871       interface_port = $interface_port
872 -oMr  received_protocol = $received_protocol
873 -oMt  sender_ident = $sender_ident
874 ****
875 # Sender host name explicitly set
876 exim -be -oMa V4NET.0.0.1.1234 -oMs my.host.name
877 -be Sender host name explicitly set
878 -oMa  sender_host_address = $sender_host_address
879       sender_host_port = $sender_host_port
880 -oMs  sender_host_name = $sender_host_name
881 ****
882 # Sender host name lookup fails (V4NET.11.12.13 is not reverse registered)
883 exim -be -oMa V4NET.11.12.13
884 be Sender host name lookup fails (V4NET.11.12.13 is not reverse registered)
885 -oMs  sender_host_name = $sender_host_name
886       host_lookup_failed = $host_lookup_failed
887 ****
888 # Sender host name and protocol set by Sendmail-compatible option
889 exim -be -pspecial:host.name
890 -be Sender host name and protocol set by Sendmail-compatible option
891 -p  received_protocol = $received_protocol
892 -p  sender_host_name = $sender_host_name
893 ****
894 # Sender host name and address etc, all set except host name,
895 # which should therefore be looked up from the address, but not if
896 # we are skipping. The debug output for this test will show when
897 # the lookup occurs.
898 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
899 -be Sender host name and address etc, all set except host name
900 -oMa  sender_host_address = $sender_host_address
901       sender_host_port = $sender_host_port
902 -oMaa sender_host_authenticated = $sender_host_authenticated
903 -oMai authenticated_id = $authenticated_id
904 -oMas authenticated_sender = $authenticated_sender
905 -oMi  interface_address = $interface_address
906       interface_port = $interface_port
907 -oMr  received_protocol = $received_protocol
908 ----> No lookup yet: ${if eq{black}{white}{$sender_host_name}{No}}
909 -oMs  sender_host_name = $sender_host_name
910 -oMt  sender_ident = $sender_ident
911 ****
912 # Test no auto host name lookup for query-style lookups
913 exim -d -bh V4NET.0.0.1
914 ****
915 exim -d -bh V4NET.0.0.2
916 ****
917 # Test $reply_address
918 exim -bh V4NET.0.0.0
919 mail from:<>
920 rcpt to:<some@body>
921 data
922 .
923 mail from:<>
924 rcpt to:<some@body>
925 data
926 From: a@b
927 .
928 mail from:<>
929 rcpt to:<some@body>
930 data
931 From: a@b
932 Reply-to: c@d
933 .
934 mail from:<>
935 rcpt to:<some@body>
936 data
937 Reply-to:
938 .
939 mail from:<>
940 rcpt to:<some@body>
941 data
942 Reply-to:
943 From: x@y
944 .
945 quit
946 ****
947 # Check RFC 2047 decoding with (default) length check
948 exim -bh V4NET.0.0.0
949 mail from:<>
950 rcpt to:<some@body>
951 data
952 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?=
953 .
954 quit
955 ****
956 # Check RFC 2047 decoding with length check disabled
957 exim -DLENCHECK=check_rfc2047_length=false -bh V4NET.0.0.0
958 mail from:<>
959 rcpt to:<some@body>
960 data
961 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?=
962 .
963 quit
964 ****
965 # Certain kind of error
966 exim -d -be
967 match_ip:        15 ${if match_ip{1.2.3.4}{1.2.3}}
968 match_ip:        16 ${if match_ip{1.2.3.4}{1.2.3.4/abc}}
969 ****
970 # Operation of inlist and negated inlist
971 exim -be
972 ${if inlist{aa}{aa} {in list}{not in list}}
973 ${if !inlist{aa}{aa} {not in list}{in list}}
974 ****