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