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