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