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