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