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